Saravanan666/pypi-org huggingface dataset:
Package: pypgen
Pypgen provides various utilities for estimating standard genetic
diversity measures including Gst, G’st, G’’st, and Jost’s D from large
genomic datasets (Hedrick, 2005; Jost, 2008; Masatoshi Nei, 1973; Nei &
Chesser, 1983). Pypgen operates both on individual SNPs as
well as on user defined regions (e.g., five kilobase windows tiled
across each chromosome). For the windowed analyses pypgen estimates the
multi-locus versions of each estimator.Features:Handles multiallelic SNP callsAllows a single VCF file to contain multiple populationsOperates on standardVCF (Variant Call
Format)formatted SNP callsUsesbgzipedinput
for fast random accessTakes advantage of multiple processor coresCalculates additional metrics:snp count per windowmean read depth (+/- STDEV) per windowpopulations with fixed alleles per SNPmore as I think of themImportant Note:PYPGEN IS STILL IN ACTIVE DEVELOPMENT AND ALMOST CERTAINLY CONTAINS
BUGS. If you find a bug please file a report in theissues sectionof
the github repository and I’ll address it as soon as I can.Enclosed Scripts:Sliding window analysis (vcf_sliding_window.py)Per SNP analysis (vcf_snpwise_fstats.py)Dependancies:OSX or LinuxPython 2.7NumpypysamandsamtoolsInstallation:First installsamtools. On OS X I recommend usinghomebrewto do this. Once you have samtools installed and available in terminal you can use either pip or setuptools to install the current release of pypgen:pip install pypgenor,easy_install pypgenAlternately, if you like to live on the edge, you can clone and install the current development version from github.pip install -e git+https://github.com/ngcrawford/pypgen.gitDocumentation:More detailed documentation will be forthcoming, but in the meantime information about each script can be obtained by running:python [script name].py --helpOutput:Note: this will probably change.vcf_sliding_window.py:chrm= Name of chromosomestart= Starting position of windowstop= Ending position of windowsnp_count= Total Number of SNPs in windowtotal_depth_mean= Mean read depth across windowtotal_depth_stdev= Standard deviation of read depth across
windowPop1.sample_count.mean= Mean number of samples per snp for ‘Pop1’Pop1.sample_count.stdev= Standard deviation of samples per snp
for - ‘Pop1’Pop2.sample_count.mean= Mean number of samples per snp for ‘Pop2’Pop2.sample_count.stdev= Standard deviation of samples per snp
for ‘Pop2’Pop2.Pop1.D_est= Multilocus Dest (Jost 2008)Pop2.Pop1.G_double_prime_st_est= (Meirmans & Hedrick 2011)Pop2.Pop1.G_prime_st_est= Standardized Gst (Hedrick 2005)Pop2.Pop1.Gst_est= Fst corrected for sample size and allowing for
multiallelic loci (Nei & Chesser 1983)cont…vcf_snpwise_fstats.py:chrm= Name of chromosomepos= Position of SNPoutgroups= Number of samplesPop1= Population IDPop1.Pop2.D_est= Multilocus Dest (Jost 2008)Pop1.Pop2.G_double_prime_st_est= (Meirmans & Hedrick
2011)Pop1.Pop2.G_prime_st_est= Standardized Gst (Hedrick 2005)Pop1.Pop2.Gst_est= Fst corrected for sample size and
allowing for multiallelic loci (Nei & Chesser 1983)Pop1.Pop2.Hs_estPop1.Pop2.Ht_estcont…,Pop1_fixed= If a sample is fixed at a particular allele this
flag is set to 1 (= “True” in binary).cont…
Package: pypglab
pypglabAboutAn asynchronous Python library to communicate with PG LAB Electronics devices over MQTT.This library was created for Home Assistant integrations of PG LAB Electronics.FeaturesDiscover devicesControll relays (turn on/off)Monitor relays status (on/off)Controll shutters (open/close/pause)Monitor shutters status (open/opening/closed/closing)Receiving device internal sensor updateDevices supportedE-BoardComming soonE-SwitchInstallationpipinstallpypglabUsageA client interface in pypglab/mqtt.py is used for the comunication with MQTT broker.
The interface exposes callback for: publish, subscribe and unsusbribe.
Who is using pypglab library must manage the MQTT connection and define the MQTT client callback.The following is a pseudo example that turn on all relays.frompypglab.deviceimportDevicefrompypglab.mqttimportClientasyncdefsetup_pglab_device(config:dict):asyncdefmqtt_publish(topic:str,payload:str,qos:int|None=0,retain:bool|None=False)->None:print("TODO... call the client MQTT publish")pglab_mqtt_client=Client(mqtt_publish,None,None)pglab_device=Device()awaitpglab_device.config(pglab_mqtt_client,config)forrelayinpglab_device.relays:awaitrelay.turn_on()For working example and proper setup of the MQTT connection and callback,
see the example.py and the unittest of pypglab python library.FeedbackPlease give us feedback onpglab.electronics@gmail.comFounderThis plugin is created by PG Lab Electronics.LicenseCode is released under [MIT license]
Package: pypglib
PyPGLibPyPGLib: A Python Package for Easy Access to Power Grid Lib BenchmarkInstallationpipinstallpypglibUsageCombined withmatpower-pip:frommatpowerimportstart_instancefrompypglibimportpglib_opf_case14_ieeem=start_instance()m.runpf(pglib_opf_case14_ieee)
Package: pypgn
PyPGNA pure Python 3 library to simplify parsing and manipulation ofPGN(Portable Game Notation) format files, which are often used for serializing games such as chess.PrerequisitesPython version3.x>=3.6andPiPInstallInstall or upgrade withPiP$pipinstallpypgnYou can also install from source:gitclonehttps://github.com/DaniruKun/pypgn.gitcdpypgn
pythonsetup.pyinstallExamplesfrompypgn.gameimportGame# Importing game from file on diskchess_game=Game('test.pgn')# Import game from Lichesschess_game.pgn('dGm3ND39')print(chess_game.tag('Event'))print(chess_game.result())# Print opening ply for whiteprint(chess_game.ply(1,'w'))Output:$RatedBlitzgame
$0-1
$e4Read the docsIntroductionContributingLocal setupSetup a virtual environment withvirtualenv$virtualenvvenv
$sourcevenv/bin/activateInstall requirements$makeinstallRun unit tests locally withpytest$maketestRunflake8lint with$makelintDockerYou can also build and run tests in a Docker container:$makedocker-build
$makedocker-runAuthors@DaniruKunaka Daniils PetrovsLicenseMozilla Public License 2.0seeLICENSEfor more details.
Package: pypgoptimizator
ContentsMakina Corpus sponsored softwareREADMEBASIC USAGEHELPParametersMakina Corpus sponsored softwarePlanet Makina CorpusContact usREADMEThis script some optimized parameters in a postgresql configuration file according
to the current machine possibilities and parameters given on the command
line.BASIC USAGEpypgoptimizator -i pg.conf -o new.pg.confHELPpypgoptimizator –helpParameters-b: The shared buffer size. It’s 8192 by default, and it can be changed at
compilation time, pgsql side.-l: The output logs filename scheme (log_filename paramater)-o: The output file to write into-i: The input postgresql configuration file to read info from-m: max connections parameter for postgres (default 100)-p: The availaible Memory in KBytes, defaults to all available memory
Package: py-pgorm
PgormPgorm is a simple orm for postgre in pythoninstallpip install py-pgorm==0.0.8Usageimport pgorm 
def getCursor():
    dbconf={
        "database":"<dbname>",
        "user":"<user>", 
        "password": "<password>"
    }
    cursor = pgorm.getDbCursor(dbconf)
    return cursor

def test_create_table():

    cursor = getCursor()
    sql = '''
        drop table t;
        create table if not exists t(
            code varchar(10) not null, 
            label real not null
        );'''

    try:
        cursor.execute(sql) 
    except Exception as e:
        passExamplesRefer toexamples
Package: pypgrep
PyPgRep PackageThis is the PyPGREP package, this is a utility application which aims to simplify PostgreSQL database replication, it builds on top of logical replication enabled with the pg_create_logical_replication_slots function and currently uses the data extracted with the test plugin which is experimental and as such this projects also experimental and one should use it with caution and thorough testing. the utility only supports number, varchar, date and timestamp datatypes and does not support bytea data.PrePreqsPsycopg2SetupCreate the replication slot in the master databaseCreate a directory for the extracted change files, this location has to be specified in the parfiles.Setup parameter file for extractionStart the pypgrep with nohup (as a daemon) with the extract parfileSetup parameter for apply of extracted changesStart the pypgrep with nohup (as a daemon) with the apply parfileGithub-flavored Markdownto write your content.
Package: pypgrest
PypgrestA Python client for interacting with PostgREST APIs.Installation$ pip install pypgrestQuick start>>>frompypgrestimportPostgrest>>>client=Postgrest("https://api.tacos.com",token="secretsalsa")# See postgrest docs for supported query params>>>params={"select":"name,tortilla,cost","tortilla":"is.corn","limit":100,"order":"name"}# Supported methods are select, insert, update, upsert, and delete>>>client.select(resource="menu",params=params,pagination=True,headers=None)# [{ "name" : "al pastor", "tortilla" : "corn", "cost" : "2.01" }, ... ]>>>payload=[{"id":23,"cost":"2.25"},{"id":26,"cost":"1.25"}]>>>pgrest.upsert(payload)# [{ "id" : 23, "cost" : "2.25", "name" : "al pastor", ... }, ... ]# You can inspect the response object at `self.res`:>>>client.res.status_code# 201HeadersThe client is initialized withContent-Type=application/jsonand (if you supply a token)Authorizationheaders. You can supply additional headers on construction, or per request.>>>client=Postgrest("https://api.tacos.com",token="secretsalsa",headers={"Prefer":"return=representation"})>>>client.headers# {"Content-Type": 'application/json', 'Authorization': 'Bearer secretsalsa', 'Prefer': 'return=representation'}>>>client.insert(resource="menu",data={"id":5,"name":"barbacoa"},headers={"Prefer":"return=headers-only"})Limits and paginationBy default, the client will paginate requests until all records have been retrieved. You can supply alimitparam to limit the number of results returned byselect.You can disable pagination withpagination=False, in which case the record limit will be capped by your API'smax-rowssetting.DevelopmentWe use Github Actions to publish to PyPI. The workflows are defined in .github/workflows.Any commit/merge to the dev branch will trigger a PyPI publication to the knackpy-dev package. Anyreleaseon the master branch will trigger publication to the knackpy package on PyPI. Note that PyPI publications will fail if don’t bump the version number in setup.py.LicenseAs a work of the City of Austin, this project is in the public domain within the United States.Additionally, we waive copyright and related rights of the work worldwide through theCC0 1.0 Universal public domain dedication.
Package: pypgrest-dev
PypgrestA Python client for interacting with PostgREST APIs.Installation$ pip install pypgrestQuick start>>>frompypgrestimportPostgrest>>>client=Postgrest("https://api.tacos.com",token="secretsalsa")# See postgrest docs for supported query params>>>params={"select":"name,tortilla,cost","tortilla":"is.corn","limit":100,"order":"name"}# Supported methods are select, insert, update, upsert, and delete>>>client.select(resource="menu",params=params,pagination=True,headers=None)# [{ "name" : "al pastor", "tortilla" : "corn", "cost" : "2.01" }, ... ]>>>payload=[{"id":23,"cost":"2.25"},{"id":26,"cost":"1.25"}]>>>pgrest.upsert(payload)# [{ "id" : 23, "cost" : "2.25", "name" : "al pastor", ... }, ... ]# You can inspect the response object at `self.res`:>>>client.res.status_code# 201HeadersThe client is initialized withContent-Type=application/jsonand (if you supply a token)Authorizationheaders. You can supply additional headers on construction, or per request.>>>client=Postgrest("https://api.tacos.com",token="secretsalsa",headers={"Prefer":"return=representation"})>>>client.headers# {"Content-Type": 'application/json', 'Authorization': 'Bearer secretsalsa', 'Prefer': 'return=representation'}>>>client.insert(resource="menu",data={"id":5,"name":"barbacoa"},headers={"Prefer":"return=headers-only"})Limits and paginationBy default, the client will paginate requests until all records have been retrieved. You can supply alimitparam to limit the number of results returned byselect.You can disable pagination withpagination=False, in which case the record limit will be capped by your API'smax-rowssetting.DevelopmentWe use Github Actions to publish to PyPI. The workflows are defined in .github/workflows.Any commit/merge to the dev branch will trigger a PyPI publication to the knackpy-dev package. Anyreleaseon the master branch will trigger publication to the knackpy package on PyPI. Note that PyPI publications will fail if don’t bump the version number in setup.py.LicenseAs a work of the City of Austin, this project is in the public domain within the United States.Additionally, we waive copyright and related rights of the work worldwide through theCC0 1.0 Universal public domain dedication.
Package: pypgsync
pypgsyncPython utility to sync two postgresql databasesInstallationpipinstallpypgsyncUsageGiven two databases, pypgsync can determine which records differ. In theprimarykeyuse case,
records are identified by their primary key.importpsycopgfrompypgsync.mode.primarykeyimportdelta_by_primary_key,apply_delta_by_primary_keycon_source=psycopg.connect(host="host_source",dbname="db_source",user="user_source",password="secret_source")con_destination=psycopg.connect(host="host_destination",dbname="db_destination",user="user_destination",password="secret_destination")cur_source=con_source.cursor()cur_destination=con_destination.cursor()delta=delta_by_primary_key(cur_source=cur_source,cur_destination=cur_destination,table_name="products",primary_key="id",columns=["name","count","price"],pk_values=[1,2,3,4,5],)deltaprovides an overview of the differences between the two database tables, in terms of which
database operations (delete,insert,update) have to be applied to the destination database
in order to match the source database. The primary key identifies the rows that have to be modified.{"table_name": "products","primary_key": "id","intersection": set([1, 2]),"delete": set([3, ]),"insert": [{"id": 5, "name": "bread", "count": 5, "price": 3.2}],"update": [{"id": 2, "count": 20}, ]}deltacan then be used to apply the necessary changes to the destination database.frompypgsync.mode.primarykeyimportapply_delta_by_primary_keyapply_delta_by_primary_key(con_destination,delta)After which the two database tables are identical within the column and primary key range specified.To accomplish the sync in one step, use thesync_by_primary_keyfunction.frompypgsync.mode.primarykeyimportsync_by_primary_keysync_by_primary_key(cur_source,con_destination,table_name="products",primary_key="id")
Package: pyphantomapi
pyphantomapiA python api wrapper for the Splunk Phantom platformGetting StartedThis project is written for python 3+Installingpip install pyphantomapiRunning the teststox -e localIntegration tests are built withbetamaxBuilt Withrequests- Python HTTP LibraryVersioningWe useSemVerfor versioning. For the versions available, see thetags on this repository.AuthorsRyan Plas-@ryanplasmaSee also the list ofcontributorswho participated in this project.LicenseThis project is licensed under the MIT License - see theLICENSE.mdfile for detailsAcknowledgmentsInspirationgithub3.pypraw
Package: pyphase
pyPhaseis an open-source Python package for phase retrieval from phase contrast images in the Fresnel regime. For an overview, check out the pyPhase manuscript:https://arxiv.org/abs/2012.07942FeaturesPhase retrieval algorithmsWave propagation.Handling of different image sources and formatsTools for pre-processing such as registration of phase contrast images and motion estimationInstallationInstallation is currently through PyPI. Create a virtual environment using your favourite virtual environment manager, verify that pip is installed, then:pip install pyphasePyPhase currently requires Elastix 4.9 installed for registration.
To manually install elastix 4.9 go tohttps://elastix.lumc.nl/download.phpUnzip the archive.Add the path for elastix/bin to your .bashrc: add YOUR_PATH_TO_elastix/bin to your environment variable PATH.Add the path for elastix/lib to your .bashrc: add YOUR_PATH_TO_elastix/lib to your environment variable LD_LIBRARY_PATH.Test your installation:python3 import pyphase
Package: pyPhasesML
Machine Learning Extension for pyPhasesThis Extension adds:an Exporter forPyTorchandTensorFlowModels.an Modelmanager that can handlePyTorchandTensorFlowModelsSetupadd pyPhasesML to your dependencies or runpip install -U pyPhasesMLaddpyPhasesMLto your plugins in the main project config f.e: in yourproject.yamlname:bumpDetectornamespace:ibmt.tud# load machine learning pluginplugins:-pyPhasesMLyou do not need to add the ModelExporter manuallyGetting startetMinimal ExampleFor a complete minimal example see, with loading data, training and evaluation see:https://gitlab.com/tud.ibmt.public/pyphases/pyphasesml-example-bumpdetectorAdding required config valuesThese values can be changed in your config. The default values are shown here:modelPath:models/mymodels# the name of the model (also defines the path: models/MyCnn/MyCnn.py)modelName:CNNPytorch# the model config for a specific modelmodel:kernelSize:3alwaysIgnoreClassIndex:nullinputShape:[16,50]oneHotDecoded:FalsetrainingParameter:useEventScorer:falsestopAfterNotImproving:falsemaxEpochs:falsebatchSize:32validationEvery:falseoptimizer:falsebatchSizeValidation:32learningRate:0.001learningRateDecay:0.001validationMetrics:["acc","kappa"]classification:type:classificationclassNames:[A,B]classWeights:[0.6,0.4]Adding a PyTorch ModelCNNPytorchCreate a class that is compatible with yourmodelPathandmodelname. So in this example, we need a classCNNPytorchin the pathmodels/mymodels/CNNPytorch.pyrelative to your root.This class is required to:inherit fromModelTorchAdapter:populate theself.modelwith a valid PyTorch-Model, in thedefinemethodreturn a valid loss function in the methodgetLossFunctionimporttorch.nnasnnfrompyPhasesML.adapter.ModelTorchAdapterimportModelTorchAdapterclassCNNPytorch(ModelTorchAdapter):defdefine(self):length,channelCount=self.inputShapenumClasses=self.config.numClassesself.model=nn.Conv1d(in_channels=channelCount,out_channels=self.config.numClasses,kernel_size=self.getOption("kernelSize"),)defgetLossFunction(self):returntorch.nn.MultiLabelSoftMarginLoss(reduction="mean",weight=self.weightTensors)Load the modelIn a phase you can simply use theModelManagerto get the Model andregisterDatato save the state. There is no dependency onpyTorchorTensorFlowin this example, so you swap your models dynamicly depending on your environment:import numpy as npfrom pathlib import Pathfrom pyPhases import Phasefrom pyPhasesML import DatasetWrapXY, ModelManager, TrainingSetclass TestModel(Phase):def main(self):# loads the model depending on modelPath and modelNamemodel = ModelManager.getModel()input = np.randn(20, 16, 50)output = model(input)# save the model stateself.project.registerData("modelState", model)
Package: pyPhasesRecordloader
RecordLoader Extension for pyPhasesThis package extends pyPhases with the ability to load generic records from a dataset. This package properly requires another more specific plugin to load the data.This Extension adds:a normalized interface for a Signal (wraps a raw signal like numpy array):pyPhasesRecordloader/Signal.pya normalized interface for RecordSignals:pyPhasesRecordloader/RecordSignal.pycontaining a list of Signalsan inerface to load data from datasets:pyPhasesRecordloader/RecordLoader.pyloadRecord(recordName: str) -> RecordSignal- check if a record existsexist(recordName: str) -> bool- check if a record existsdelete(recordName)- delete a recordsome default Recordloader to load data itself or inherit from:EDFRecordLoaderH5RecordLoaderMatRecordLoaderWFDBRecordLoaderXMLAnnotationLoadersome possible ways to download data:Folderdownloader: From a FolderListDownloader: From a RecordlistS3Downloader: From a S3 compatible bucket storage
Package: pyPhasesRecordloaderMESA
Extension for pyPhasesRecordloaderExtension to load data records from the Multi-Ethnic Study of Atherosclerosis (MESA) database.The extensions requires a downloaded version of the MESA dataset. The location can be set through the config valuemesa-path.UsageIn a phase you can acess the data through theRecordLoader:Add the plugins and config values to yourproject.yaml:name:MesaProjectplugins:-pyPhasesML-pyPhasesRecordloaderMESA-pyPhasesRecordloaderphases:-name:MyPhaseconfig:mesa-path:C:/datasets/mesaIn a phase (phases/MyPhase.py) you can acess the records through theRecordLoader:frompyPhasesRecordloaderimportRecordLoaderfrompyPhasesimportPhaseclassMyPhase(Phase):defrun(self):recordIds=recordLoader.getRecordList()forrecordIdinrecordIds:record=recordLoader.getRecord(recordId)Run Your project withpython -m phases run MyPhase
Package: pyPhasesRecordloaderMrOS
Extension for pyPhasesRecordloaderExtension to load data records from the MrOS Sleep Study (MrOS) database.The extensions requires a downloaded version of the mros dataset. The location can be set through the config valuemros-path.UsageIn a phase you can acess the data through theRecordLoader:Add the plugins and config values to yourproject.yaml:name:MrOSProjectplugins:-pyPhasesML-pyPhasesRecordloaderMrOS-pyPhasesRecordloaderphases:-name:MyPhaseconfig:mros-path:C:/datasets/mrosIn a phase (phases/MyPhase.py) you can acess the records through theRecordLoader:frompyPhasesRecordloaderimportRecordLoaderfrompyPhasesimportPhaseclassMyPhase(Phase):defrun(self):recordIds=recordLoader.getRecordList()forrecordIdinrecordIds:record=recordLoader.getRecord(recordId)Run Your project withpython -m phases run MyPhase
Package: pyPhasesRecordloaderSHHS
Extension for pyPhasesRecordloaderExtension to load data records from the Sleep Heart Health Study (SHHS) database. Inlcuding both parts (shhs1 and shhs2).The extensions requires a downloaded version of the shhs dataset. The location can be set through the config valueshhs-path.UsageIn a phase you can acess the data through theRecordLoader:Add the plugins and config values to yourproject.yaml:name:SHHSProjectplugins:-pyPhasesML-pyPhasesRecordloaderSHHS-pyPhasesRecordloaderphases:-name:MyPhaseconfig:shhs-path:C:/datasets/shhsIn a phase (phases/MyPhase.py) you can acess the records through theRecordLoader:frompyPhasesRecordloaderimportRecordLoaderfrompyPhasesimportPhaseclassMyPhase(Phase):defrun(self):recordIds=recordLoader.getRecordList()forrecordIdinrecordIds:record=recordLoader.getRecord(recordId)Run Your project withpython -m phases run MyPhase
Package: pyphash
pyphash is a Python extension module that wraps the C library functioncrypt, which performs passphrase hashing, in the simplest possible
fashion.  It exposes one function, namedcrypt, which works just
like the Ccryptexcept that it is thread safe:>>> pyphash.crypt("swordfish", "$5e$z4x3Zlhs")
'$5$z4x3Zlhs$g7JP4M7HZw5L25Xwklbd2nQ2rfjzVGFB1SJutFnmvK4'You have to create settings strings yourself.This module is not intended to be used by programs that actually need
to hash passphrases—if it were, it would at least also provide access
tocrypt_gensalt.  Rather, its purpose is to be a test case for the
packaging toolchain for C extension modules.  Linux distributions are
changing how they provide the shared library that implementscrypt,
and Python packaging must adapt.  Seemanylinux bug
#305for the gory details.For thread safety, the module actually uses the reentrant variant ofcryptcalledcrypt_r, and looks for it incrypt.hrather thanunistd.h.  It will fail to compile if this function or this header
is not available.