Saravanan666/pypi-org huggingface dataset:
Package: prefetch-generator
Based onhttp://stackoverflow.com/questions/7323664/python-generator-pre-fetchThis is a single-function package that makes it possible to transform any generator into aBackgroundGeneratorwhich computes any number of elements from the generator ahead, in a background thread.It is quite lightweight, but not entirely weightless.TheBackgroundGeneratoris most useful when you have a GIL releasing task which might take a long time to complete (e.g. Disk I/O, Web Requests, pure C functions, GPU processing, …), and another task which takes a similar amount of time, but is dependent on the results of the first task (e.g. Computationally intensive processing of data loaded from disk).Normally these two tasks will constantly wait for one another to finish. If you make one of these tasks aBackgroundGenerator(see examples below), they will work in parallel, potentially saving up to 50% of execution time (definitely less in practice).We personally use theBackgroundGeneratorwhen iterating over minibatches of data for deep learning with tensorflow and theano ( lasagne, blocks, raw, etc.).Quick usage example (ipython notebook) -https://github.com/justheuristic/prefetch_generator/blob/master/example.ipynbThis package contains two objects:The ClassBackgroundGenerator(generator [,max_prefetch=1])The decorator@prefetch([max_prefetch=1])the usage is either#for item in BackgroundGenerator(my_generator):
#    do_stuff(item)or#@prefetch()
#def my_generator(some_param):
#    while True:
#        X = read_heavy_file()
#        y = wget_from_cornhub()
#        do_pretty_much_anything(some_param)
#        yield X, yMore details are written in theBackgroundGeneratordoc:
Seehelp(BackgroundGenerator)
Package: prefetch-parser
prefetch-parserA parser of Windows prefetch file.This repo is strongly inspired fromprefetch2es, I kept only the part that interest me.Usagedacru:~/git/prefetch-parser/$pythonprefetch_parser.py-h
usage:prefetch_parser.py[-h][-fPREFETCHFILE][-oJSONFILE]optionalarguments:-h,--helpshowthishelpmessageandexit-fPREFETCHFILE,--prefetchfilePREFETCHFILEWindowsPrefetchfile.-oJSONFILE,--jsonfileJSONFILEOutputjsonfilepath.'-'willprintcommandoutputonterminal.
Package: prefill-haalcentraalhr
Version:0.1.0Source:https://github.com/open-formulieren/open-forms-ext-haalcentraal-hrKeywords:Open Forms Extension, Haal Centraal HRPythonVersion:3.10Open Forms extension to prefill form fields with data coming from theHaal Centraal HR API.Contents1Features2Installation3Usage4Configuration1FeaturesConfiguration in the admin for the Haal Centraal serviceThe Haal Centraal client performs the token exchange with KeycloakRetrieve prefill data from theMaatschappelijkeActiviteitRaadplegenAPI endpoint based on KvK number.NoteThe Haal Centraal HR API is a Den Haag specific API and not a national Dutch standard.2InstallationRequirementsPython 3.8 or abovesetuptools 30.3.0 or aboveDjango 3.2 or newer3UsageFor an explanation of this how this extension works, look at the Open Formsdeveloper documentation.To see how to build and distribute an image with this extension, look at the Open Forms documentation aboutbuilding and distributing extensions.4ConfigurationIn the Open Forms Admin:Go toConfiguration>Servicesand create a service for Haal Centraal HR.Go toMiscellaneous>Token exchange plugin configurations.
Click onAdd Token exchange plugin configurationand fill in the details:Select the service for which you want the token authorisation to be performed.Add the Keycloak audience.Save the configuration.The prefill will be available in the form designer in the same way as other prefill plugins.
Package: prefix-codes
Python package implementing a number of prefix codes as strings for educational purposes alongside some utilities.How do I install this package?As usual, just download it using pip:pipinstallprefix_codesTests CoverageSince some software handling coverages sometime get slightly different results, here’s three of them:Available codesThe following codes are available as submodules (they are also installable by themselves) or imported.It should be noted that some of the following codes are not prefix codes, but are still important codes.Unary coding.Reduced binary encoding.Minimal binary encoding.Gamma coding.Delta coding.Omega coding.Interpolative coding.Nibble e Byte coding.Truncated binary encoding.Golomb coding.Levenshtein coding.Usage examplesThe following codes are available and readily importable into your project:fromprefix_codesimportunary,inverted_unaryfromprefix_codesimportgamma_codingfromprefix_codesimportdelta_codingfromprefix_codesimportomega_coding,decode_omega_codingfromprefix_codesimportlevenshtein_coding,decode_levenshtein_codingfromprefix_codesimporttruncated_binary_encodingfromprefix_codesimportreduced_binary_codingfromprefix_codesimportminimal_binary_codingfromprefix_codesimportinterpolative_codingfromprefix_codesimportnibble_coding,byte_codingfromprefix_codesimportgolomb_coding,optimal_golomb_coding,bernoulli_golomb_codingAvailable utilitiesTwo utilities are available, one to determine if a given code is a prefix code and a second one, based on theKraft-McMillan inequality, to determine if a given code is complete.It should be noted that the second utility fails when the code’s words are quite long for float errors.Usage examplesfromprefix_codesimportis_prefix_code,is_complete_prefix_codefromprefix_codesimportunary,interpolative_codingnumbers=list(range(100))unary_code=unary(numbers)interpolative_code=interpolative_coding(numbers,0,100)is_prefix_code(unary_code)# Trueis_prefix_code(interpolative_code)# Falseis_complete_prefix_code(unary_code)# Trueis_complete_prefix_code(interpolative_code)# FalseElias-Fano semi-succint data structureAn educational version ofElias-Fano semi-succint data structureimplemented using the codes above is also available.
Package: prefixcommons
prefixcommonsA python API for working with ID prefixes in the context ofprefixcommonsCurrent functionality: Uses JSON-LD contexts to expand and contract
CURIEs to URIsE.g.GO:0008150<=>http://purl.obolibrary.org/obo/GO_0008150Example>>> from prefixcommons import contract_uri
>>> print(contract_uri('http://purl.obolibrary.org/obo/GO_0008150'))
['GO:0008150']

>>> from prefixcommons import expand_uri
>>> print(expand_uri('GO:000850'))
http://purl.obolibrary.org/obo/GO_0008150The above uses standard JSON-LD context files fromprefixcommons/biocontextYou can pass your own>>> cmaps = [{'GO': 'http://purl.obolibrary.org/obo/GO_'}]
>>> print(contract_uri('http://purl.obolibrary.org/obo/GO_0008150'), cmaps)
['GO:0008150']
Package: prefixdate
Prefix date parserThis is a helper class to parse dates with varied degrees of precision. For
example, a data source might state a date as2001,2001-4or2001-04-02,
with the implication that only the year, month or day is known. This library
will process such partial dates into a structured format and allow their
validation and re-formatting (e.g. turning2001-4into2001-04above).The library does not support the complexities of the ISO 8601 and RFC 3339
standards including date ranges and calendar-week/day-of-year notations.InstallationInstallprefixdateusing PyPI:$pipinstallprefixdateUsageThe library provides a variety of helper functions to parse and format
partial dates:fromprefixdateimportparse,normalize_date,Precision# Parse returns a `DatePrefix` object:date=parse('2001-3')assertdate.text=='2001-03'date=parse(2001)assertdate.text=='2001'assertdate.precision==Precision.YEARdate=parse(None)assertdate.textisNoneassertdate.precision==Precision.EMPTY# This will also be the outcome for invalid dates!# Normalize to a standard string:assertnormalize_date('2001-1')=='2001-01'assertnormalize_date('2001-00-00')=='2001'assertnormalize_date('Boo!')isNone# This also works for datetimes:fromdatetimeimportdatetimenow=datetime.utcnow().isoformat()minute=normalize_date(now,precision=Precision.MINUTE)# You can also feed in None, date and datetime:normalize_date(datetime.utcnow())normalize_date(datetime.date())normalize_date(None)You can also use theparse_partshelper, which is similar to the constructor
for adatetime:fromprefixdateimportparse_parts,Precisiondate=parse_parts(2001,'3',None)assertdate.precision==Precision.MONTHassertdate.text=='2001-03'Format stringsFor dates which are not already stored in an ISO 8601-like string format, you
can supply one or many format strings fordatetime.strptime. The format strings
will be analysed to determine how precise the resulting dates are expected to be.fromprefixdateimportparse_format,parse_formats,Precisiondate=parse_format('YEAR 2021','YEAR %Y')assertdate.precision==Precision.YEARassertdate.text=='2021'# You can try out multiple formats in sequence. The first non-empty prefix# will be returned:date=parse_formats('2021',['%Y-%m-%d','%Y-%m','%Y'])assertdate.precision==Precision.YEARassertdate.text=='2021'CaveatsDatetimes are always converted to UTC and made naive (tzinfo stripped)Does not process milliseconds yet.Does not process invalid dates, like Feb 31st.
Package: prefixed
OverviewPrefixed provides an alternative implementation of the built-infloatwhich supports
formatted output withSI (decimal)andIEC (binary)prefixes.>>>fromprefixedimportFloat>>>f'{Float(3250):.2h}''3.25k'>>>'{:.2h}s'.format(Float(.00001534))'15.34μs'>>>'{:.2k}B'.format(Float(42467328))'40.50MiB'>>>f'{Float(2048):.2m}B''2.00KB'Becauseprefixed.Floatinherits from the built-infloat, it behaves
exactly the same in most cases.When a math operation is performed with another real number type
(float,int), the result will be aprefixed.Floatinstance.Presentation TypesAdditional presentation types'h','H','k','K','m', and'M'are supported for f-strings andformat().TypeMeaning'h'SI format. Outputs the number with closest divisible SI prefix.
(k, M, G, …)'H'Same as'h'with precision indicating significant digits.'k'IEC Format. Outputs the number with closest divisible IEC prefix.
(Ki, Mi, Gi, …)'K'Same as'k'with precision indicating significant digits.'m'Short IEC Format. Same as'k'but only a single character.
(K, M, G, …)'M'Same as'm'with precision indicating significant digits.'j'Alias for'k'- DEPRECATED'J'Alias for'm'- DEPRECATEDString InitializationWhen initializing from strings, SI and IEC prefixes are honored>>>Float('2k')Float(2000.0)>>>Float('2Ki')Float(2048.0)Additional FlagsAn additional format flag ‘!’ is available which adds a space before the prefix>>>f'{Float(3250):!.2h}''3.25 k'Significant DigitsWhen the'H','K, or'M'presentation types are used, precision is treated as
the number ofsignificant digitsto include. Standard rounding will occur for the final digit.>>>f'{Float(1246):.3h}''1.246k'>>>f'{Float(1246):.3H}''1.25k'By default, trailing zeros are removed.>>>f'{Float(1000):.3H}''1k'To preserve trailing zeros, include the'#'flag.>>>f'{Float(1000):#.3H}''1.00k'Adjustable ThresholdsAn additional field, margin, can be specified which lowers or raises the threshold for
for each prefix by the given percentage.
Margin is specified before precision with the syntax%[-]digit+.>>>f'{Float(950):.2h}''950.00'>>>f'{Float(950):%-5.2h}''0.95k'>>>f'{Float(1000):%5.2h}''1000.00'>>>f'{Float(1050):%5.2h}''1.05k'Supported PrefixesSI (Decimal) PrefixesPrefixNameBaseQQuetta1030RRonna1027YYotta1024ZZetta1021EExa1018PPeta1015TTera1012GGiga109MMega106kKilo103mMilli10-3μMicro10-6nNano10-9pPico10-12fFemto10-15aAtto10-18zZepto10-21yYocto10-24rRonto10-27qQuecto10-30IEC (Binary) PrefixesPrefixNameBaseYYobi280ZZebi270EExbi260PPedi250TTebi240GGibi230MMebi220KKibi210
Package: prefixtree
This package providesPrefixDict, a dictionary like object, andPrefixSet, set like object, that are implemented using usingprefix
trees, or tries. Using tries provides the following unique features when
compared to the builtin dict and set objects.Keys are returned in sorted order.Slice operations for getting, setting and deleting values.Trie based collections are useful when ordered access to key and values is a
requirement.UsagePrefixDictandPrefixSetbehave like the builtin dict and set objects.
They are implementations of theMutableMappingandMutableSetabstract
base classes. They also support the same constructors as the builtins.>>> from prefixtree import PrefixDict
>>> pd = PrefixDict(a=0, b=1)
>>> pd['c'] = 2
>>> 'a' in pd
True
>>> 'd' in pd
FalseThe only incompatible API difference betweenprefixtreecollections and the
builtins is thatPrefixDictandPrefixSetonly support strings as keys.
Unicode strings will be encoded to byte strings before and after use.Unlike the bultins, it’s possible to use slices when getting, setting and
deleting values fromprefixtreecollecionts.>>> list(pd['a':'c'])
[0, 1, 2]
>>> pd[:'b'] = [4, 3]
>>> list(pd['a':'c':-1])
[2, 3, 4]PrefixDictalso has additional methods not present on builtindicts.commonprefix(key), to find the longest comment prefix with current keys.startswith(prefix), iterates over current keys with matching prefix.Refer to the fullprefixtreedocumentation onRead The Docsfor details.Compatabilityprefixtreeis implemented to be compatible with Python 2.x and Python 3.x.
It has been tested against the following Python implementations:CPython 2.6CPython 2.7CPython 3.2PyPy 1.9.0Continuous integration testing is provided byTravis CI.IssuesSource code forprefixtreeis hosted onGitHub. Any bug reports or
feature requests can be made using GitHub’sissues system.Further ReadingFull documentation forprefixtreeis hosted byRead The Docs.
Package: preflet
# Preflet - Python SDKUse this SDK to communicate with Preflet’s services to make your ML apps cloud native.## Sample Codefrom preflet import Model
from preflet import generate_auth_token
from preflet import list_all_models
from preflet import get_model# train_type defaults to “Classification” and can be “Multi-Class” or
# “Regression” as well
my_model = Model(“your_model_name”, trained_clf, train_type=”Multi-Class”)my_model.calculate_metrics(y_test, predictions)my_model.extract_metadata(x_train, y_train)token = generate_auth_token(api_key=’your_api_key’)# host can be ‘beta.preflet.com’ if you want to host it on the cloud, or
# ‘localhost’
my_model.upload(token, host=’beta.preflet.com’)# to get a list of all your models
data = list_all_models(token, host=’beta.preflet.com’)# get a specific model for normal use/batch-prediction
downloaded_clf, details = get_model(“your_model_name”, token, host=’beta.preflet.com’)# make predictions out of the box
downloaded_clf.predict([…])
Package: preflibtools
PreflibtoolsOverviewThe PrefLib-Tools is a set of Python tools developed to work with preference data from thePrefLib.org website.This package provides input and output operations on PrefLib instances, together with some additional functionalities
on the instances: Testing whether a Condorcet winner exists, whether the instance is single-peaked, etc...We developed this package in the hope of making the use of PrefLib instances easy. This has been done in the same
spirit as PrefLib: Providing tools for the community with the help of the community. If you want to contribute, feel
free to create pull requests. If you have a question, a remark, or encounter a problem, please open an issue, create a
pull request etc...The full documentation of the package can be found there:https://preflib.github.io/preflibtools/.If, for some reasons, you are looking for the older version of the PrefLib-Tools, it is still available in the GitHub
repositoryPreflib-Tools-Old.InstallationThe installation is as easy as:pip3installpreflibtoolsDocumentationThe complete documentation is availablehere.
Package: prefpicker
PrefPickerManage & generate prefs.js files for use when testing Firefox. This tool is intended to simplify the use and tracking of prefs used by
our fuzzing tools. The template files can be modified to allow the creation of custom prefs.js files without
the need to maintain a separate mostly duplicate version of a prefs file.YAML Template StructureThe template document is made up of variants, prefs and values.prefis the name of the preference that will be added to the prefs.js file. This is an unquoted string.
Valid prefs can be found inall.jsor inStaticPrefList.yml.review_on_closeis optional. It is a list of relevant Bugzilla IDs used to help avoid obsolete entries. When all bugs in the list are closed the entry will be reviewed and removed if appropriate.valuecan be abool,int,stringornull. Adding multiple potential values is possible.
When multiple values are present one is chosen at random when generating the output.
Using a value ofnullwill skip adding the pref to the output prefs.js file (acts as browser default).variantis a subset of values to be used in place of the default values.
The default variant is used unless a variant is specified.There are a few mechanisms in place to help keep the file in order:All prefs must have a default variantAll variants must be defined in the variant listAll variants in the variant list must be usedAll variants must be a list and contain values# example.yml
variant:              # list of extra variants, default is implied
- alt                 # name of variant
pref:
  pref.name:          # unquoted name of the pref used in prefs.js
    review_on_close:  # optional
    - 123456
    variants:
      default:        # variant definition, default is required
      - 0             # potential value
      alt:            # extra optional variant
      - 1             # if multiple values are defined one is chosen randomly
      - null          # null is a special case meaning do not add the prefQuick SetupUse pip to install prefpicker.pipinstallprefpickerExamplesUse a built-intemplateto generate an up-to-dateprefs.jsfile.prefpickerbrowser-fuzzing.ymlprefs.jsOr generate aprefs.jsfile from a custom template using thewebrendervariant:user@machine:~/prefpicker$prefpickercustom/template.yml~/Desktop/prefs.js--variantwebrender
Loading'template.yml'...
Loaded255prefsand5variants
Generating'prefs.js'usingvariant'webrender'...
Done.The resultingprefs.jsfile is ready to be used with Firefox. It will look something like this:// Generated with PrefPicker @ 2020-02-08 00:50:29 UTC// Variant 'webrender'/// ... snipuser_pref("fuzzing.enabled",true);/// ... snip// 'gfx.webrender.all' defined by variant 'webrender'user_pref("gfx.webrender.all",true);/// ... snip// Fingerprint '13370ddba11'Updating TemplatesWhen adding a pref to a template it is encouraged to add a comment that provides justification and points to a bug in Bugzilla for additional context. If a pref does not already exist and is only used with non-default variants a 'null' entry must be added for the default variant.
Package: prefpy
PrefPyRank aggregation algorithms in the computer science field of
computational social choiceWhat’s NewExperiments and tests have been factored out of the repository (now
located athttps://github.com/pdpiech/prefpy-experiments)Generalized method of moments algorithm for mixtures of Plackett-Luce
modelsImplementation of EMM algorithm for mixtures of Plackett-Luce by
Gormley & MurphyWork In ProgressThis is an initial version of the Python package form, further
structural changes will be comingModule naming conventions will be changed; currently the algorithm
files take the initials of the names of the papers from which they
originate (e.g. “gmmra” for Generalized Method of Moments for Rank
Aggregation)Mixture Model for Plackett-Luce EMM algorithm by Gormley & Murphy is
forthcoming pending verification and testing of the methodRandom utility model algorithms (verification of the implentation
needs to be completed)InstallationUse of MATLAB optimization in this package requires Python 3.4 due to
lack of support yet for Python 3.5 by the MATLAB EngineInstall by running setup.py with Python 3.4 (or greater) with the
commandpython3 setup.py installSymlink install while developing to keep changes in the code instead
with the commandpython3 setup.py develop
Package: prefpy-experiments
PrefPy-experimentsScripts for experiments using PrefPy (found athttps://github.com/xialirong/prefpy)This code has been split off of the original PrefPy package/repository
in an effort to organize and remove code not part of the implementations
of the algorithms in PrefPy. All tests and experiments are now located
here.Work In ProgressThe code in this repository is research code, so it is constantly in
a state of changeThe imports must all be changed as these files were originally part
of the PrefPy package itself and now rely on it being installed
separatelyInstallationUse of MATLAB optimization in this package requires Python 3.4 due to
lack of support yet for Python 3.5 by the MATLAB EngineInstall by running setup.py with Python 3.4 (or greater) with the
commandpython3 setup.py installSymlink install while developing to keep changes in the code instead
with the commandpython3 setup.py develop
Package: prefref
PrefRefConfig init in __main__Subsectionexample codeBoolean ArgumentsThere are two types of boolean arguments supported as a Config_Option, the property 'is_flag' will determine how the boolean is handled.If 'is_flag' is true, the option can only be set by environment variable or console argument and cannot be stored in a config file. Passing the argument or having the environment variable existing, with or without explicitly setting it to a true/false value, will set the Config_Option value to True. Otherwise, the value will be set to the default value of the Config_Option.If 'is_flag' is false, the option can also be stored in a config file. You can either pass the console argument or have the environment variable set without an explicit statement of true/false to set it to True OR set it explicitly by passing/setting the value to true or false.
Package: prefs
PREFSStore and manage preferences easily.PREFSis Python library that stores preferences in a text file with a dictionary-like structure.InstallationOnWindows:pip install PREFSOnMacOSandLinux:pip3 install PREFSGetting startedTo initialize your preferences you will need to instance thePrefsclass with the first argument as the default preferences (the ones used the first time the program runs or whenever the file gets deleted).importprefsdefault_prefs={"lang":"en","theme":{"background":"#ffffff","font":"UbuntuMono",},}my_prefs=prefs.Prefs(default_prefs)The above code will create a file calledprefs.prefsthat looks like:#PREFSlang='en'theme=>background='#ffffff'font='UbuntuMono'Then you can change values as if it were a dictionary.my_prefs["lang"]="es"And nowprefs.prefswill look like:#PREFSlang='es'theme=>background='#ffffff'font='UbuntuMono'You can write your ownPREFSfiles manually as well, to manage your application's color scheme or the translations.AboutDocs:https://patitotective.github.io/PREFS/docs/start.GitHub:https://github.com/Patitotective/PREFS.Pypi:https://pypi.org/project/PREFS/.Discord:https://discord.gg/as85Q4GnR6.Contact me:Discord:Patitotective#0127.Tiwtter:@patitotective.Email:cristobalriaga@gmail.com.v1.0.0