Saravanan666/pypi-org huggingface dataset:
Package: pgDont
PgDontPgDont help to quickly check a database against the"Don't Do This". It's more of an audit tool than a linter, but it alse can be use this way.Usagepgdont--dsn"host=localhost dbname=mydb user=john password=pass"Implemented rulesPgDont will check for the followings bad practices :Upper case table nameUpper case column nameUse of 'SQL_ASCII' encodingUse of Postgres RulesUse of inherited tables...TodoImplement missing rulesAdd config fileManage multi-schemaCleaner output summary
Package: pgdtools
Presolar grain database tools (pgdTools)Currently under development.This folder contains a very rough draft /
development version /
idea gathering file(s)
forpgdtools.
Use at your own risk!The idea behind this folder is to have a place
to share (really) early versions ofpgdtoolswith colleagues for testing
and feedback.
Thinks might change at any time!
There's no guarantee for consistency,
or anything, you've been warned.
That being said,
there should also be example files.
Have a look at the latest dates, etc.,
in order to find one that might work.Feedback extremely welcome!InstallationJupyterlab server (e.g., WENDI, ...)In the first cell of your jupyter notebook,
run the following code:%pip install git+https://github.com/galactic-forensics/pgdtools.gitThis should pull the latest version
ofpgdtoolsfrom GitHub and install it.
To test, follow steps below.LocalTo use this module,
clone this repository
and enter it:gitclonehttps://github.com/galactic-forensics/pgdtools.gitcdpgdtoolsIt is recommended that you use
a virtual python environment for the following steps.
Also: these steps have been tested with python 3.9.First, install the python requirements,
then the package itself.
You can skip the jupyter and ipython line if you
do not want to use these tools.pip install .Give it a spinNow you should be ready to usepgdtoolsfrom your session. Try the following:importpgdtoolspg=pgdtools.PresolarGrains()If this does not throw an error,
you should be fine and the
presolar grain database was found.ExamplesTheexamplesfolder contains some examples for you to read through.
There are some pure python exampmles,
as well as an ipython notebook for your consideration.
Please let me know if things are unclear, etc.Presolar grain databaseThe presolar grain database
can be found athttps://presolar.physics.wustl.edu/presolar-grain-database/.
Note that only the SiC database
is currently thought of being error free.
The current version ofpgdtoolsincludes the 2021-01-10 version
of the presolar SiC grain database,
which is the current version as of this writing (Nov 2021).DevelopmentTo make a development installation,
type:pipinstall-e.[dev]This will install all required packages.More to come on this...
Package: pgdumplib
Python3 library for reading and writing pg_dump files using the custom format.InstallationpipinstallpgdumplibExample UsageThe following example shows how to create a dump and then read it in, and
iterate through the data of one of the tables.pg_dump-dpgbench-Fc-fpgbench.dumpimportpgdumplibdump=pgdumplib.load('pgbench.dump')print('Database:{}'.format(dump.toc.dbname))print('Archive Timestamp:{}'.format(dump.toc.timestamp))print('Server Version:{}'.format(dump.toc.server_version))print('Dump Version:{}'.format(dump.toc.dump_version))forlineindump.table_data('public','pgbench_accounts'):print(line)
Package: p-gen
AboutPassword Generatoris a console utility that allows you to generate passwords based on code phrases and a secret key (seed).Requirements:Python 3+InstallationInstallpassword-generatorvia pip:$pipinstallp-genSet default values to generator:Seed(Default: MySecretSeed):exportPGEN_SEED=MyNotDefaultSecretSeed# Linux / OSXsetxPGEN_SEEDMyNotDefaultSecretSeed# WindowsPassword Length(Default: 18):exportPGEN_LENGTH=18# Linux / OSXsetxPGEN_LENGTH18# WindowsUsage of Special Symbols (0 or 1)(Default: 1):exportPGEN_USE_SPECIAL_SYMBOLS=1# Linux / OSXsetxPGEN_USE_SPECIAL_SYMBOLS1# WindowsThat's it!UsageAvailable keywords:pgen p-gen pass-genExamplespgen -h

>>>
usage: pgen [-h] [-length LENGTH] [-seed SEED] [-special_symbols {0,1}] CodePhrases [CodePhrases ...]

Generate the passwords.

positional arguments:
  CodePhrases

optional arguments:
  -h, --help            show this help message and exit
  -length LENGTH, -len LENGTH, -l LENGTH
                        length of password
  -seed SEED, -s SEED   secret key to generate unique passwords
  -special_symbols {0,1}, -ss {0,1}
                        use special symbols like "!#$./:;" etc.pgen phrase1 phrase2

>>> Your password: {Oj>[n8kQZX}lvYF2Ypgen phrase1 phrase2 -ss 0

>>> Your password: Jp9YEGbR4aqutZKafupgen phrase1 phrase2 -l 12

>>> Your password: {Oj>[n8kQZX}
Package: pgeng
pgengUseful functions and classes for pygameInstallationpip3 install pgeng -UDocumentationRunhelp(pgeng.<Function>)to get the documentation of the function (or possibly class)Or runhelp(pgeng.<Package Content>)to get the documentation of the functions or classes in a fileimportpgenghelp(pgeng)CreditsThanks totank-kingfor theflame(tutorial)Thanks toDaFluffyPotatofor all histutorialsLicenseThis project is licensed under the terms of the MIT license.For reference, seeLICENSE
Package: pgeon
Pgeon 🐦Apache ArrowPostgreSQLconnectorpgeonprovides a C++ library and (very) simple python bindings. Almost all
PostgreSQL native types are supported (seebelow).This project is similar topg2arrowand is heavily inspired by it. The main differences are the use ofCOPYinstead ofFETCHand that our implementation uses the Arrow C++ API.The goal ofpgeonis to provide fast bulk data download from a PostgreSQL database into Apache Arrow tables. If you're looking to upload data, you might want to have a look atArrow ADBC.Usagefrompgeonimportcopy_querydb="postgresql://postgres@localhost:5432/postgres"query="SELECT TIMESTAMP '2001-01-01 14:00:00'"tbl=copy_query(db,query)The actual query performed isCOPY ({query}) TO STDOUT (FORMAT binary), seethis pagefor more information.InstallationBuilding and runningpgeonrequireslibpqto be available on your system.PythonInstall from source using pip withgitclonehttps://github.com/0x0L/pgeon.gitcdpgeon
pipinstall.On linux, ifpyarrowis already installed as a conda package, you may want to useCONDA_BUILD=1 pip install .[optional] C++ library and toolsThis requirescmakeandninja. In addition you'll need to installlibpqand the Arrow C++ libraries (e.g.arrow-cppin conda)mkdirbuildcdbuild
cmake-GNinja..
ninjaPerformanceElapsed time distributions of a query fetching 7 columns (1 timestamp, 2 ints, 4 reals) and around 4.5 million rows. The result is returned as apandas.DataFramein all cases.NotesQueries usingROW(e.g.SELECT ROW('a', 1)) do not work (anonymous structs)SQL arrays are mapped topyarrow.list_(...). Only 1D arrays are fully supported. Higher dimensional arrays will be flattened.BitString types output format is not really helpfultsvector types with letter weights are not supportedPostgreSQL range and domain types are not supported.
Package: pgeon-xai
pgeon / pgeon-xaiTormos, A., Abalos, V., Gnatyshak, D., & Alvarez-Napagao, S. (2023, October).Policy graphs in action: explaining single- and multi-agent behaviour using predicates. InXAI in Action: Past, Present, and Future Applications.pgeon(pgeon-xai) is a Python package that produces explanations for opaque agents usingPolicy Graphs(PGs).A Policy Graph is a means to obtain a representation of the behavior of an opaque agent, in the form of a directed graph. Discrete states are mapped to nodes and actions to edges.Getting startedInstallpgeonwith pip:pip install pgeon-xaior:Download thepgeon/folder and move it into the root directory of your project.Installpgeon's requirements withpip install -r PATH_TO_PGEON_REQUIREMENTS.Example usageGenerating a Policy GraphGiven a Gymnasiumenvironmentand adiscretizer, you can generate a PG to describe an opaque agent's behavior withfit().frompgeonimportPolicyGraphpg=PolicyGraph(environment,discretizer)pg=pg.fit(agent,num_episodes=1000)Creating and using a PG-based policyThere exist two PG-based policies. You can select one or the other withPGBasedPolicyMode.frompgeonimportPGBasedPolicy,PGBasedPolicyModegreedy_policy=PGBasedPolicy(pg,mode=PGBasedPolicyMode.GREEDY)stochastic_policy=PGBasedPolicy(pg,mode=PGBasedPolicyMode.STOCHASTIC)# Passing the policy an observation to get an actionobs,_=environment.reset()action=greedy_policy.act(obs)More examplesYou can checkexamples/cartpole/demo.ipynbfor a complete breakdown ofpgeon's features.To run the notebook yourself:Download the entire repository.Installpgeon's requirements withpip install -r requirements.txt.Install an extra dependency, rllib, withpip install "ray[rllib]".Open and executeexamples/cartpole/demo.ipynb.CitationIf you use thepgeonlibrary, please cite:@inproceedings{tormos2023policy,
  title={Policy graphs in action: explaining single-and multi-agent behaviour using predicates},
  author={Tormos, Adrian and Abalos, Victor and Gnatyshak, Dmitry and Alvarez-Napagao, Sergio},
  booktitle={XAI in Action: Past, Present, and Future Applications},
  year={2023},
  url={https://openreview.net/forum?id=QPqL9xsYOf}
}
Package: pger
pgerpython package generatorhttps://packaging.python.org/en/latest/tutorials/packaging-projectshttps://setuptools.pypa.io/en/latestpger 可以做什么新建一个 github python 项目，并集成 github action使能够在推送 tag 时，自动创建 release，并推送 build 的文件到 release assets自动发布到 python package index(https://pypi.org/)安装pipinstall-Upger# 或pipinstallgit+https://github.com/foyoux/pger.git用法# 获取帮助pger-h/--help# 基本用法pgerfoyoux/pger
pgerfoyoux-rpger
pgerfoyoux--repofoyou-wilk# 默认 repo 当做主包名，替换 "-" 为 "_" -> src/<repo>/__init__.py，但 repo 允许以非字母开头，但包名不可以# 此时可指定 -p/--package 选项手动指定主包名pger-pticketfoyoux/12306在 Pycharm 中设置 src 为源代码根目录 （右键 src 目录 -> 将目标标记为 -> 源代码根目录）github configThe example above uses the newAPI tokenfeature of PyPI, which is recommended to
restrict the access the action has.The secret used in ${{ secrets.PYPI_API_TOKEN }} needs to be created on the settings page of your project on GitHub.
SeeCreating & using secrets
Package: pgesmd-self-access
PG&E Share My Data API for Self AccessThis python module is a helper for the Share My Data API which allows the utility customer to download their meter data using the Energy Services Provider Interface (ESPI), part of the Green Button standard.Click here to register with PG&E as a Self Access userInstallpippip install pgesmd_self_accesssourcegit clone https://github.com/JPHutchins/pgesmd_self_accesscd pgesmd_self_accessVirtual environment is optional but suggested if you are fiddling around:python3 -m venv venvsource venv/bin/activateInstall the dependencies:pip install -r requirements.txtAccess Your DataIn order to listen for messages from the PGE server you will need to provide the path to the SSL certificate (or symlink) that you provided to PGE. For example, the files (or symlinks) could be in~/pgesmd_self_access/cert/cert.crtand~/pgesmd_self_access/cert/private.key.Create a file~/pgesmd_self_access/auth/auth.json:{
  "third_party_id" : string, from PGE - use "" if unknown
  "client_id" : string, from PGE after completing registration
  "client_secret" : string, from PGE after completing registration
  "cert_crt_path" : string, like above
  "cert_key_path" : string, like above
}You may test some commands in the REPL to verify that everything is set up correctly:from pgesmd_self_access.api import SelfAccessApi
pge_api = SelfAccessApi.auth( < full path to the auth.json > ) # for example, /home/jp/pgesmd_self_access/auth/auth.json
pge_api.get_service_status()Complete the testing as required by PG&E:from pgesmd_self_access.api import PgeRegister
pge_reg = PgeRegister() # this will look for your auth.json at ./auth/auth.json
pge_reg.complete_testing() # hopefully this succeeds - if not check the SMD Portal and authPGE SMD will send data to the notification URI that you specified when you registered. Login to the PGE SMD portal to change it if needed.
In order to listen for the messages from PGE you will need to forward port 443 to the server that this module runs at (default) port 7999.
Once it is open you can start the server:from pgesmd_self_access.api import SelfAccessApi
from pgesmd_self_access.server import SelfAccessServer
from pgesmd_self_access.helpers import save_espi_xml
pge_api = SelfAccessApi.auth( < full path to the auth.json > )
SelfAccessServer(pge_api, save_file=save_espi_xml)The PGE server usually takes between 10-40 seconds to package and send the message. The helper function will save the response XML in your current working directory. You may like to see helpers.parse_espi_xml for more possibilities.
Package: pgevents
pgeventsPython event framework using PostgreSQL listen/notifyExample UsagefrompgeventsimportAppdsn="dbname=test user=test password=test host=localhost"channel="foo"# Postgres channel to listen for notifications ontopic="bar"# Event topic for handler to respond toapp=App(dsn,channel)@app.register(topic)defhandler(context):print("Handling event")app.run()Create an event entryINSERTINTOevents(topic)VALUES('bar');Then send a notification by running the following SQL:NOTIFYfoo;
Package: pgex
pgexA Python PyGame package extension.DesriptionPgex is a package that will help you to create games with PyGame easier and more convenient. There is no longer any need to register the functionality of text fields, buttons and other widgets each time. Everything has already been done for you!InstallationPackage is uploaded on PyPI and can be downloaded throughpipinstallpgexLinksLink on PyPI:https://pypi.org/project/pgex/GitHub Repository:https://github.com/IvanFoke/pgexUsage1. Text creationBefore you start creating any project on PyGame, you must initialize it. Use standard commands like screen creation and title setting.All widgets in pgex are stored inpgex.widgets. For example, let's import Text widget.
Pgex also describes a large number of different colors. They can be found inpgex.parameters.importpygameaspgfrompgex.widgetsimportTextfrompgex.parametersimportcolorspg.init()screen=pg.display.set_mode((800,600))pg.display.set_caption("Pgex Example")clock=pg.time.Clock()txt=Text("SomeText",r'Crushez.ttf',100,font_color=colors["dark_gray"],bg_color=colors["white"],border_width=1)game=Truewhilegame:foreventinpg.event.get():ifevent.type==pg.QUIT:game=Falsebreakscreen.fill(colors["light_blue"])txt.draw(screen,(100,300))pg.display.update()clock.tick(30)As you can see in the example, text widget is created with Text class. First 3 arguments are the text, the path to a font and the font size. Result of the work of this program:2. A Button that gets a value of an Entry fieldButton and Entry are another widgets from pgex. They also can be imported frompgex.widgets.A distinctive feature of the Button is the passing of a function into it through theactionargument, which will be called when the user clicks on it.The Entry requires the passing of PyGame events. This allows widget to intercept the data entered in the field. Field supports backspace key. To stop entering the text in field, you can press escape, enter, or simply click the left mouse button outside the field.frompgex.widgetsimportButtonfrompgex.widgetsimportEntrydefget_entry_value():globalentryprint(f"Got text:{entry.text}")entry=Entry(200,50,r'Crushez.ttf',20,centralized=True)btn=Button(200,100,"Btn",r'Crushez.ttf',40,r'button.wav',action=get_entry_value,centralized=True)defhandle_events(events):foreventinevents:ifevent.type==pg.QUIT:returnFalsereturnTrue# ... in game cyclewhileTrue:# ...events=pg.event.get()ifnothandle_events(events):breakbtn.draw(screen,(500,100))entry.draw(screen,(100,200),events)Result:Full example can be seen in examples folder.All other possibilities will be described soon.
Package: pg-explain-locks
PostgreSQL Query Lock ExplainerUtility to show what locks will be acquired by a given query.Query is executed but not committed.Installation instructionspip install pg_explain_locksExample UsageExamples shown againstdvdrental sample databasepg_explain_locks \
  --user DB_USER \
  --password DB_PASSWORD \
  --database DATABASE \
  --host HOST \
  --query "DROP table actor CASCADE"

+-------------+----------------------------+---------------------+
| Relation ID | Relation Name              | Lock Type           |
+-------------+----------------------------+---------------------+
| 16422       | actor                      | AccessExclusiveLock |
| 16448       | film_actor                 | AccessExclusiveLock |
| 16456       | actor_info                 | AccessExclusiveLock |
| 16487       | film_list                  | AccessExclusiveLock |
| 16506       | nicer_but_slower_film_list | AccessExclusiveLock |
| 16557       | actor_pkey                 | AccessExclusiveLock |
| 16588       | idx_actor_last_name        | AccessExclusiveLock |
+-------------+----------------------------+---------------------+pg_explain_locks \
  --user DB_USER \
  --password DB_PASSWORD \
  --database DATABASE \
  --host HOST \
  --query "SELECT * FROM film_actor fa JOIN actor a on a.actor_id=fa.actor_id FOR UPDATE"

+-------------+---------------------+-----------------+
| Relation ID | Relation Name       | Lock Type       |
+-------------+---------------------+-----------------+
| 16422       | actor               | RowShareLock    |
| 16448       | film_actor          | RowShareLock    |
| 16557       | actor_pkey          | AccessShareLock |
| 16569       | film_actor_pkey     | AccessShareLock |
| 16588       | idx_actor_last_name | AccessShareLock |
| 16593       | idx_fk_film_id      | AccessShareLock |
+-------------+---------------------+-----------------+pg_explain_locks \
  --user DB_USER \
  --password DB_PASSWORD \
  --database DATABASE \
  --host HOST \
  --query "ALTER TABLE customer ADD COLUMN deleted BOOLEAN"

+-------------+---------------+---------------------+
| Relation ID | Relation Name | Lock Type           |
+-------------+---------------+---------------------+
| 16411       | customer      | AccessExclusiveLock |
+-------------+---------------+---------------------+Example usage with settings fileCreate a settings file at~/.pg_explain_locks_settingsin order to use the same DB settings every time.Settings file contents :USER=your_user
PASSWORD=your_password
DATABASE=your_database
HOST=your_host
PORT=your_postUsage:pg_explain_locks "ALTER TABLE customer ADD COLUMN deleted BOOLEAN"

+-------------+---------------+---------------------+
| Relation ID | Relation Name | Lock Type           |
+-------------+---------------+---------------------+
| 16411       | customer      | AccessExclusiveLock |
+-------------+---------------+---------------------+
Package: pgexplode
pgexplodeA utility for exploding a PostgreSQL table (and any related data) into separate schemas.ExampleImagine the following table structure and data in a database namedexploder_test:CREATETABLEtenant(idserialPRIMARYKEY,slugvarchar);CREATETABLErelated(idserialPRIMARYKEY,tenant_idintegerNOTNULLREFERENCEStenant(id),valuevarchar);INSERTINTOtenant(id,slug)VALUES(1,'alpha'),(2,'beta');INSERTINTOrelated(tenant_id,value)VALUES(1,'alpha-value-1'),(1,'alpha-value-2'),(1,'alpha-value-3'),(2,'beta-value-1'),(2,'beta-value-2'),(2,'beta-value-3'),(2,'beta-value-4'),(2,'beta-value-5');Running the following command:python -m pgexplode -d exploder_test -t tenant -s slugWould create two schemas,alphaandbetaand copy the table data as follows:+ alpha
  ~ tenant: 1
  ~ related: 3
+ beta
  ~ tenant: 1
  ~ related: 5Outputting/Debugging SQLAdding an--sqlflag to the command above will output the SQL being run, which can be helpful when tweaking or
debugging:-- alphaDROPSCHEMAIFEXISTS"alpha"CASCADE;CREATESCHEMA"alpha";CREATETABLE"alpha".tenant(LIKEpublic.tenantINCLUDINGALL);INSERTINTO"alpha".tenant(SELECT*FROMtenantWHEREid=1);CREATETABLE"alpha".related(LIKEpublic.relatedINCLUDINGALL);INSERTINTO"alpha".related(SELECTrelated.*FROMrelatedJOINtenantONrelated.tenant_id=tenant.idWHEREtenant.id=1);CREATESEQUENCE"alpha".related_id_seq;ALTERSEQUENCE"alpha".related_id_seqOWNEDBY"alpha".related.id;ALTERTABLE"alpha".relatedALTERidSETDEFAULTnextval('alpha.related_id_seq'::regclass);CREATESEQUENCE"alpha".tenant_id_seq;ALTERSEQUENCE"alpha".tenant_id_seqOWNEDBY"alpha".tenant.id;ALTERTABLE"alpha".tenantALTERidSETDEFAULTnextval('alpha.tenant_id_seq'::regclass);ALTERTABLE"alpha".relatedADDCONSTRAINTrelated_tenant_id_fkeyFOREIGNKEY(tenant_id)REFERENCES"alpha".tenant(id);-- betaDROPSCHEMAIFEXISTS"beta"CASCADE;CREATESCHEMA"beta";CREATETABLE"beta".tenant(LIKEpublic.tenantINCLUDINGALL);INSERTINTO"beta".tenant(SELECT*FROMtenantWHEREid=2);CREATETABLE"beta".related(LIKEpublic.relatedINCLUDINGALL);INSERTINTO"beta".related(SELECTrelated.*FROMrelatedJOINtenantONrelated.tenant_id=tenant.idWHEREtenant.id=2);CREATESEQUENCE"beta".related_id_seq;ALTERSEQUENCE"beta".related_id_seqOWNEDBY"beta".related.id;ALTERTABLE"beta".relatedALTERidSETDEFAULTnextval('beta.related_id_seq'::regclass);CREATESEQUENCE"beta".tenant_id_seq;ALTERSEQUENCE"beta".tenant_id_seqOWNEDBY"beta".tenant.id;ALTERTABLE"beta".tenantALTERidSETDEFAULTnextval('beta.tenant_id_seq'::regclass);ALTERTABLE"beta".relatedADDCONSTRAINTrelated_tenant_id_fkeyFOREIGNKEY(tenant_id)REFERENCES"beta".tenant(id);You can see in addition to simply creating copies of each table,pgexplodeis also making sure the new tables have
their own sequences for serial columns, and tables are properly re-keyed within the new schema.
Package: pgext
PyGame EXTension=========Small python extension (written in C) for pygame.Surface manipulation.Created by Josef Vanžura <gindar@zamraky.cz>http://zamraky.cz/projects/pgext/## Dependecies* Python 2.5.4+* pygame 1.8+* SDL 1.2+, SDL_image## Installation (Fedora)1. Install dependencies (as root):```yum install pygame-devel python-devel SDL-devel```2. Download and extract pgext source package from pypi:```http://pypi.python.org/pypi/pgext```3. Install pgext (as root):```python setup.py install```## Installation (Ubuntu)1. Add pygame development PPA```sudo add-apt-repository ppa:pygame/pygame-dev```2. Install header files and dependencies:```sudo apt-get install python-dev pygame-dev libsdl-dev libsdl-image1.2-dev```3. Download and extract pgext source package from pypi:```http://pypi.python.org/pypi/pgext```4. Install pgext:```sudo python setup.py install```## Installation (Windows)1. Download and install python 2.7 32bit:```http://python.org/ftp/python/2.7.3/python-2.7.3.msi```2. Download and install pygame 1.9:```http://pygame.org/ftp/pygame-1.9.1.win32-py2.7.msi```3. Download and install pgext:```http://zamraky.cz/projects/pgext/```## Build from git repository (Fedora linux example)yum install pygame-devel python-devel SDL-develgit clone https://bitbucket.org/gindar/pgext.gitcd pgextsu -c python setup.py install## Links* Project homepage: http://zamraky.cz/projects/pgext/* Python homepage: http://python.org* Pygame homepage: http://pygame.org