Saravanan666/pypi-org huggingface dataset:
Package: pyngleton
Thread-safe and process-safe singleton class.
The singleton is shared between all threads.
For every process, a new instance is initialized and shared between all threads of the process.ExamplesBasic usage:frompyngletonimportsingleton@singletonclassMyClass:def__init__(self,x,y,z):self.x=xself.y=yself.z=zif__name__=='__main__':a=MyClass(1,2,3)b=MyClass(4,5,6)assertaisbassertb.x==1andb.y==2andb.z==3Multithreading:fromconcurrent.futuresimportThreadPoolExecutorfrompyngletonimportsingleton@singletonclassMyClass:passif__name__=='__main__':n=2withThreadPoolExecutor(max_workers=n)asexc:tasks=[exc.submit(MyClass)for_inrange(n)]results=set(task.result()fortaskintasks)assertlen(results)==1# all threads share the same instanceMultiprocessing:importmultiprocessingfromconcurrent.futuresimportProcessPoolExecutorfrompyngletonimportsingleton@singletonclassMyClass:def__init__(self,x:int,y:int,z:int,queue:multiprocessing.Queue):self.x=xself.y=yself.z=zqueue.put((x,y,z))defworker(x:int,y:int,z:int,queue:multiprocessing.Queue):MyClass(x,y,z,queue)if__name__=='__main__':n=2queue=multiprocessing.Manager().Queue()withProcessPoolExecutor(max_workers=n)asexc:tasks=[exc.submit(worker,i,i,i,queue)foriinrange(n)]fortaskintasks:task.result()results=[]whilenotqueue.empty():results.append(queue.get())assertresults==[(0,0,0),(1,1,1)]# each process has its own instanceThe classes decorated with@singletoncan't be pickled. If you want to be able to do that,
you can inherit fromSingletonorSingletonMetainstead of using the decorator.Inherting:frompyngletonimportSingleton,SingletonMetaclassMyClassA(metaclass=SingletonMeta):passclassMyClassB(Singleton):passif__name__=='__main__':assertMyClassA()isMyClassA()assertMyClassB()isMyClassB()assertMyClassA()isnotMyClassB()
Package: pyngram
# A simple Python n-gram calculator.## Given an arbitrary string, and the value of n as the size of the# n-gram (int), this module will show you the results, sorted from# most to least frequently occuring n-gram.## The 'sort by value' operation for the dict follows the# PEP 265 recommendation.## Installation:## user@host:~$ sudo pip install pyngram## Quick start:## >>> from pyngram import calc_ngram## method expects inputstring as 1st arg, size of n-gram as 2nd arg## >>> calc_ngram('bubble bobble, bubble bobble, bubble bobble', 3)## or straight from your *nix shell prompt## user@host:~$ ./pyngram.py## Enjoy!## Jay Liew# @jaysern#
Package: pyngramgen
Overview========This lib generate a ngram iteratorUsage=====```import pyngramgenif __name__ == '__main__':if len(sys.argv) != 2:print "python %s n" % (sys.argv[0])quit()while True:iput = raw_input()obj = pyngramgen.PyNgramGen(int(sys.argv[1]), 'abcdefghijklmnopqrstuvwxyz')for i in obj.generator(iput):print i```
Package: pyngrok
pyngrokis a Python wrapper forngrokthat manages its own binary, makingngrokavailable via a convenient Python
API.ngrokis a reverse proxy tool that opens secure tunnels from public URLs to localhost, perfect
for exposing local web servers, building webhook integrations, enabling SSH access, testing chatbots, demoing from
your own machine, and more, and its made even more powerful with native Python integration throughpyngrok.Installationpyngrokis available onPyPIand can be installed
usingpip:pipinstallpyngrokorconda:condainstall-cconda-forgepyngrokThat's it!pyngrokis now available as a package to our Python projects, andngrokis now available from
the command line.Basic UsageTo open a tunnel, use theconnectmethod,
which returns aNgrokTunnel, and this returned object has a reference to the public URL generated byngrokin itspublic_urlattribute.frompyngrokimportngrok# Open a HTTP tunnel on the default port 80# <NgrokTunnel: "https://<public_sub>.ngrok.io" -> "http://localhost:80">http_tunnel=ngrok.connect()# Open a SSH tunnel# <NgrokTunnel: "tcp://0.tcp.ngrok.io:12345" -> "localhost:22">ssh_tunnel=ngrok.connect("22","tcp")# Open a named tunnel from the config filenamed_tunnel=ngrok.connect(name="my_tunnel_name")Theconnectmethod takeskwargsas
well, which allows us to pass additional properties that aresupported byngrok.This package puts the defaultngrokbinary on our path, so all features ofngrokare
available on the command line.ngrokhttp80For details on how to fully leveragengrokfrom the command line, seengrok's official documentation.DocumentationFor more advanced usage,pyngrok's official documentation is available athttp://pyngrok.readthedocs.io.ngrokVersion Compatibilitypyngrokis compatible withngrokv2 and v3, but by default it will install v3. To install v2 instead,setngrok_versionto "v2" inPyngrokConfig.Python 2.7The last version ofpyngrokthat supports Python 2.7 is 4.1.x, so we need to pinpyngrok>=4.1,<4.2if we still want
to usepyngrokwith this version of Python. Its legacy documentation can be foundhere.ContributingIf you would like to get involved, be sure to review theContribution Guide.Want to contribute financially? If you've foundpyngrokuseful,sponsorshipwould
also be greatly appreciated!
Package: pynhanes
NHANES parserPython parser and scraper for NHANES accelerometry and questionnairehttps://wwwn.cdc.gov/nchs/nhanes/default.aspxFeaturesScrape .DOC files to Pandas DataFrameParse .XPT and mortality .DAT files and convert to Pandas DataFrameParse accelerometry .XPT files for 2003-2006 and 2011-2014 surveys to NumPy arraysInstallationpip install pynhanesIntroductionNHANES website has hierarchical organization of data:Surveys (e.g. "2011-2012") ->Components (e.g. "Questionnaire") ->Categories (e.g. "Occupation") ->Data variables (.DOC and .XPT files)For data analysis it is, however, more conveninet to have all data in Pandas DataFrame of NumPy arrays. This repo is here to help you make it.NOTE: Please, keep in mind, that some NHANES data fields have been recoded since 1999. Make sure you have reviewed the NHANES website and understand how the code processed and changed the data. Especially pay attention to categorical data. This may have effect on data analysis results.Quick startNHANES Parser lib offers tool to get data in Pandas and NumPy:Create a working folder, e.g.~/work/NHANES/, copy notebooks from repository foldersriptsto the working folder and create subfoldersXPT,CSV,NPZparse_codebook.ipynbscrapes hierarchical structure of NHANES website to Pandas DataFrame (default: save data inCSVsubfolder)pywgetxptcan download .XPT category files for all survey years (default: save data inXPTsubfolder)parse_userdata.ipynbgets a list of selected data variable fields and converts .XPT and mortality .DAT files to Pandas DataFrame (default: save data inCSVsubfolder)parse_activity.ipynbconverts 2003-2006 and 2011-2014 accelerometry data to NumPy arrays (default: save data inNPZsubfolder)load_and_plot.ipynbshows an example how to load and hadle parsed data*parse_codebook.ipynbproduces a codebook DataFrame which a handy tool to convert numerically-encoded values to human-readable labels**parse_userdata.ipynbcan combine several variables into a sinle variable. Normally you would like to do that if:a) Same data field has alternative names in diffrenet survey years (but be careful since the range of values may have changed -see the codebook):SMD090,SMD650- Avg # cigarettes/day during past 30 daysb) It is more reasonable to treat data fields together:SMQ020,SMQ120,SMQ150- Smoked at least 100 cigarettes in life / a pipe / cigars at least 20 times in life
Package: pynibs
pyNIBSPreprocessing, postprocessing, and analyses routines for non-invasive brain stimulation experiments.pyNIBSprovides the functions to allowcortical mappingswith transcranial magnetic stimulation (TMS) viafunctional analysis.pyNIBSis developed to work withSimNIBS, i.e. SimNIBS' meshes and FEM results can directly be used.
Currently,SimNIBS 3.2.6andSimNIBS 4.0.1is supported.See thedocumentationfor package details and ourprotocolpublication for a extensive usage examples. Free view only version of the paper:https://t.co/uv7CmVw6tp.InstallationVia PiP:pipinstallpynibsOr clone the source repository and install viasetup.py:gitclonehttps://gitlab.gwdg.de/tms-localization/pynibscdpynibs
pythonsetup.pydevelopTo import CED Signal EMG data use theexport to .matfeature of Signal.
To read.cfsfiles exported with CED Signal you might need tomanuallycompile the libbiosig package.BugsFor sure. Please open anissueor feel free to file a PR.CitationPlease citeNumssen, O., Zier, A. L., Thielscher, A., Hartwigsen, G., Knösche, T. R., & Weise, K. (2021). Efficient high-resolution TMS mapping of the human motor cortex by nonlinear regression. NeuroImage, 245, 118654. doi:10.1016/j.neuroimage.2021.118654when using this toolbox in your research.ReferencesWeise*, K., Numssen*, O., Thielscher, A., Hartwigsen, G., & Knösche, T. R. (2020). A novel approach to localize cortical TMS effects.NeuroImage, 209, 116486. doi:10.1016/j.neuroimage.2019.116486Numssen, O., Zier, A. L., Thielscher, A., Hartwigsen, G., Knösche, T. R., & Weise, K. (2021). Efficient high-resolution TMS mapping of the human motor cortex by nonlinear regression.NeuroImage, 245, 118654. doi:10.1016/j.neuroimage.2021.118654Weise*, K., Numssen*, O., Kalloch, B., Zier, A. L., Thielscher, A., Hartwigsen°, G., Knösche°, T. R. (2023). Precise transcranial magnetic stimulation motor-mapping.Nature Protocols. doi:10.1038/s41596-022-00776-6Jing, Y., Numssen, O., Weise, K., Kalloch, B., Buchberger, L., Haueisen, J., Hartwigsen, G., Knösche, T. (2023). Modeling the Effects of Transcranial Magnetic Stimulation on Spatial Attention.bioRxiv. doi:10.1101/2023.01.11.523548
Package: pynic
pyNICThis project is an interface written using C Python API to provide information
about Network Interface Cards.DocumentationCurrently, all documentation can be accessed in project’s GitHub page.DependenciesYou must install the Python headers.On Debian and Ubuntu:$ sudo apt-get install python-devInstallationsudo python setup.py installSupportThis project should support Python 2.x and 3.x in every Linux. However,
it was tested only on Python 2.7 and 3.4.What’s newSupport Python 3.xAdded repr e str functionsFixed some bugsIncreased reliabilityAdded functions to change addressesWhat’s new 0.5Removed set functionsAdded getter and setter as class propertiesAdded constantsWhat’s new 0.6Added setter for nameAdded hardware address validation for both length formatAdded setter for hardware address, but it is working just for 17 length format
Package: pynicehash
pynicehashfeatureFor now pynicehash support only rig management, get and set mining rig state.usagenh = pynicehash.NiceHash(api_url, organisation_id, api_key, api_secret)

rigs = nh.get_rigs()

for rig in rigs:
  print (rig.name)
  for device in rig.devices:
    print (device.name)When creating the NiceHash object you have to pass your connection credential.api_url you have two choice:https://api-test.nicehash.comfor testing, in testing you probably will not have any mining rig.https://api2.nicehash.comfor productionorganisation_id
The organisation_id is the the id you can find in you page where you create you api key.api_keyapi_secret
Package: pynida
pynidaThis software allows one to perform a full cycle ofin-situnanoindentation data analysis, including the video processingCurrent limitations:Onlyavifiles for videoDark-field images are expected for the particle shape evolution analysisMagnification should not be shanged during the experimentInstallationRequirementsmatplotlibnumpyopencv-pythonpandasPyQt5scipy>=scikit-image-0.18Currently, to install the software one should install all the prerequisites, and to execute in the folder for choise the following commands:$git init$git pullhttps://github.com/LebedevV/pynidaAfterwards, to run it:$python pynidaFeature requests and planned workKnown bugsfonts in GUI might be corruptedre-measuring of the rotation angle happens during the comparison stage. Might results in the wrong rotation angle in output(not related to the software itself) scales measured by the scalebar and by metadata may be different(to check) button "q" for exit from plt windows is not working on Ubuntu(to check) test imgs are saving nearby the opened file, not in the output dirPlanned work, long-termadd dm3/dm3 importscale down preview (need in a lineEdit for that?)add "save video" optionfully automatic scale detection. Will allow one to deal with the variable magnificationfor rotation: GUI with grid and drag&drop(?) Graphical scheme of indentation to GUIPlanned work, short-termcheckfpsvalues in output filesproper logs should be configuredallow shape analysis for the BF-TEM(partially done) preview of areas/contours, in pix/frFix column names in output files(partially done) Add descriptions to output files(partially done) file format checksupdatepnmby units recallmake code more readable, especially in the areas analysis(done) probe the write access to the output dirreduce number of global variables(almost done) move errors to qmesgsame checks on different buttons - to unifyvideo is probing every time in update_crop. To replace with the affine transformcreate a list of failed frames for areas/contoursadd unit tests!
Package: pynidus
pynidusA handful of utilities predominantly made to develop basic Cloud Run services that connect to
the same databases. Any configuration variable should be passed as an environment variable from Cloud Run.UsageTraining a ML model usually require multiple databases access. Although it is doable to instantiate a connection toPostgresqlorElasticsearcheverytime one needs to, it can actually become quickly cumbersome to do it for a certain number or models. To make everything a tiny bit more DRY,pyniduswraps very small chunks of code to deal with config files and clients instantiation.frompynidus.baseimportMultiClientconfig={"pg_dev":{"host":"host","user":"user","password":"password","database":"database","port":5432},"pg_logs":{"host":"host","user":"user","password":"password""database":"database"},"es_dev":{"host":"host","user":"user","password":"password"}}mc=MultiClient(config)mc.pg_client["logs"].query("SELECT * FROM some_table")mc.pg_client["dev"].query("SELECT * FROM another_table")Or if you want to use it inside a custom Class:classCustomClass(MultiClient):def__init__(self,**kwargs):super().__init__(**kwargs)cc.pg_client["logs"].query("SELECT * FROM some_table")cc.pg_client["dev"].query("SELECT * FROM another_table")TODOAdd a dev branch
Package: pynie
nieGeneric object storage services and distributed file system read and write solutions 💯The following storage services are supported:minio✅oss❌gcs❌s3❌cos❌obs❌The following distributed file systems are supported:Local Hard Drive ❌hdfs❌fastdfs❌Other Features:python3.10+Getting StartedCheck out the documentation.examplesfromnie.ss.minioimportMinioClientfromloguruimportloggerclient=MinioClient(end_point='192.168.31.1:9000',access_key='ak',secret_key='sk',bucket_name='nie',)withclient.open('tweets/en32tge57626gh372eb.txt','r',encoding='utf-8')asfile:logger.debug(file.read())has_obj:bool=client.os.path.exists('tweets/en32tge57626gh372eb.txt'')logger.debug(has_obj)
Package: py-nifcloud
Descriptionpython から NifCloud の REST API を実行するための sdk ですRequirementsこのプロジェクトを実行するには以下が必要です:python3.4.+Installpip install py-nifcloudPreparationconfig fileACCESS_KEY_ID と SECRET_ACCESS_KEY を含んだconfigファイルを準備してください (デフォルト:  ~/.nifcloud.yml)ACCESS_KEY_ID: 'your access key'
SECRET_ACCESS_KEY: 'your secret access key'environmentACCESS_KEY_ID と SECRET_ACCESS_KEY を環境変数に設定して準備することもできます
config file より優先されますexport ACCESS_KEY_ID="your access key"
export SECRET_ACCESS_KEY="your secret access key"UsageNifCloudClientfrom py_nifcloud.nifcloud_client import NifCloudClient

client = NifCloudClient(service_name="computing", region_name="jp-east-1", base_path="api",)
params = {
    'Action': 'DescribeRegions',
}

response = client.request(method="GET", query=params)ComputingClientfrom py_nifcloud.computing_client import ComputingClient

client = ComputingClient(region_name="jp-east-1")
params = {
    'Action': 'DescribeRegions',
}

response = client.request(method="GET", query=params)ContributingPR歓迎Support and Migration特に無しLicenseMIT License
Package: pynih
pynih - a Python interface for the NIH's Reporter APIspynih is a Python library that provides easy access to the NIH'sReporter APIs.Installationpip install pynihExample usageThis example can be executed inthis example notebook.from pynih import apis

# illustration of project api usage
search_criteria = {'appl_id':'9795459'}
include_fields = ['ApplId', 'ProjectTitle']
project_data = apis.query_project_api(include_fields=include_fields, search_criteria=search_criteria)

# illustration of publication api usage
search_criteria = {'pmid':'26657764'}
publication_data = apis.query_publication_api(search_criteria=search_criteria)query_project_apiinput parametersThe project APIquery_project_apihas the following input parameters:search_criteria- query search criteria.  Example:{"use_relevance": True, "fiscal_years": [2023],"include_active_projects": True}include_fields- fields to include in return payload.   Example: The output result payload would have only ten fields/columns: "include_fields":[ "ApplId","SubprojectId","FiscalYear","OrgName","OrgCity", "OrgState","OrgStateName","DeptType", "ProjectNum","OrgCountry" ].  Default value: all.limit- number of entries to return (maximum 500 per query).  Default value: 1.offset- Starting counter for return items (projects). Default value: 0.  Maximum allowable value: 14,999 or length of records.Seeofficial documentationfor further information on these inputs.
Package: pynimate
PynimatePython package for statistical data animations.Installationwith pipPynimate is avaialbe atpypipipinstallpynimateHow to usePynimate expects pandas dataframe formatted in this manner:Where the time column is set to index.time,col1,col2,col320121212013112201421.5320152.523.5Bar Chart Exampleimportpandasaspdfrommatplotlibimportpyplotaspltimportpynimateasnimdf=pd.DataFrame({"time":["1960-01-01","1961-01-01","1962-01-01"],"Afghanistan":[1,2,3],"Angola":[2,3,4],"Albania":[1,2,5],"USA":[5,3,4],"Argentina":[1,4,5],}).set_index("time")cnv=nim.Canvas()bar=nim.Barhplot.from_df(df,"%Y-%m-%d","2d")bar.set_time(callback=lambdai,datafier:datafier.data.index[i].year)cnv.add_plot(bar)cnv.animate()plt.show()DocumentationThe official documentation :https://julkaar9.github.io/pynimate/LicenseMIT License (MIT)
Package: pynimbar
pynimbarpynimbaris a Python package that provides a simple and customizable loading animation for console-based applications. The package allows you to create loading animations with custom text, as well as adjust the animation speed and style.InstallationYou can installpynimbarusing pip:pipinstallpynimbarUsagepynimbarprovides a context manager that allows you to use the loading animation as a context manager. This can be useful if you want to ensure that the loading animation is automatically stopped when an error occurs or when your code finishes executing. For example:frompynimbarimportloading_animationfromtimeimportsleepwithloading_animation('Processing data...'):sleep(5)CustomizationYou can customize the appearance and behavior of the loading animation using the following parameters:text(str): The text to display during the animation.success_msg(str, optional): The text to display when the animation is done. Defaults to'ok'.animation_frequency(float, optional): The frequency of the animation. Defaults to0.1.break_on_error(bool, optional): Whether to break on error. Defaults toFalse.verbose_errors(bool, optional): Whether to print the error traceback. Defaults toFalse.frames(str, optional): The frames of the animation. Defaults to'|/-\\'.ContributingIf you have any suggestions or improvements for pynimbar, feel free to submit a pull request or open an issue on theGitHub repository. We appreciate any feedback or contributions!
Package: pynimcodec
pynimcodecA set of message codecs for use with satellite IoT products implemented
in Python.nimoThe NIMO message codec was designed by ORBCOMM and represents an efficient
binary data packing for various data types at a bit-level.This module also provides facilities to build a XML file compliant with the
ORBCOMM and/or ViasatMessage Definition Fileconcept to apply to messages
sent over the IsatData Pro service.The principles of the NIMOCommon Message Formatare:First byte of payload isService Identification Number(SIN)
representing a microservice running on an IoT device.
Each<Service>consists of<ForwardMessages>(e.g. commands) and/or<ReturnMessages>(e.g. reports or responses from the IoT device).
SIN must be in a range 16..255.[!WARNING]
SIN range 16..127 mayconflictwith certain ORBCOMM-reserved messages
when using the ORBCOMM IDP service.Second byte of payload isMessage Identification Number(MIN)
representing a remote operation such as a data report or a command.
The combination ofSINandMINand direction (Forward/Return) enables
decoding of subsequent<Fields>containing data.Subsequent bytes of data are defined by<Fields>where each<Field>has
a data type such as<SignedIntField>,<EnumField>, etc.
These fields can be defined on individual bitwise boundaries, for example a
5-bit unsigned integer with maximum value 31, or a boolean single bit.
Package: pyning
PyningA quick and extensible configuration management libraryhttps://pypi.org/project/pyning/Pyning lets you take configuration entries in key/value pairs,
and query by key. For example, you might just use a dict (or any
Mapping type):args={'stop-on-error':True}registry=pyning.config.Registry()config=registry.add(args).resolve()print(config['stop-on-error'])# TrueKeys are used as attributes on the resolved object, and can be
used in the usual way:args={'stop_on_error':True}registry=pyning.config.Registry()config=registry.add(args).resolve()print(config.stop_on_error)# TrueNB: keys with spaces, or other python syntax elements (like '-')
will cause this syntax to fail, but such keys can still be found
with the dictionary-key lookup.Multiple levels of handler are possible, with later handlers
override same-key settings in earlier handlers.args={'stop_on_error':True}overrides={'stop_on_error':False}registry=pyning.config.Registry()config=registry.add(args).add(overrides).resolve()print(config.stop_on_error)# FalseYou might use this to have some configuration in a file, and
override with the argparse.ArgumentParser values.args={'stop_on_error':True}parser=argparse.ArgumentParser()parser.add_argument('--stop_on_error')cmdline=parser.parse_args()registry=pyning.config.Registry()config=registry.add(args).add(vars(cmdline)).resolve()print(config.stop_on_error)# FalseValues can use a limited variable substitution to swap in
values from different keys. This is especially useful when
using the overrides feature. At present, it only works for strings.public_args={'password':'${private_password}'}overrides={'private_password':'a good strong password'}registry=pyning.config.Registry()config=registry.add(public_args).add(overrides).resolve()print(config.password)# a good strong passwordThe syntax used to match a variable substitution can be changed by
passing in a different regular expression pattern to the Registry
constructor. The default is '${variable name}', matched againstr'(\$\{(.*?)\})'Values don't have to be single items: they can be sequences or
even nested Mapping objects. A convenient short-hand can be used
to refer to nested keys, and works with variable substitution,
too.importjsonargs={'url':'${remotes.endpoint}'}overrides=json.loads('''{ "remotes": {"endpoint": "http://nowhere"} } ''')cfg=Registry().add(args).add(overrides).resolve()print(cfg.url)Also, nested mapping objects can still use a nested attribute
lookup, too:importjsonargs={'url':'${remotes.endpoint}'}overrides=json.loads('''{ "remotes": {"endpoint": "http://nowhere"} } ''')cfg=Registry().add(args).add(overrides).resolve()print(cfg.remotes.endpoint)