Saravanan666/pypi-org huggingface dataset:
Package: purgatory-circuitbreaker
Purgatory is an implementation of the circuit breaker pattern.NoteIt is used to detect failures and encapsulates the logic of preventing
a failure from constantly recurring, during maintenance, temporary
external system failure or unexpected system difficulties.Source:https://en.wikipedia.org/wiki/Circuit_breaker_design_patternWhy another Circuit Breaker implementation ?The Purgatory library has been develop to be used inblacksmithwhere
the library aiobreaker was used but I encountered limitation so, I decide
to build my own implementation that feet well withblacksmith.FeaturesPurgatory supports the creation of many circuit breakers easily, that
can be used as context manager or decorator.
Circuit breaker can be asynchronous or synchronous.Example with a context manager for an async APIfrom purgatory import AsyncCircuitBreakerFactory

circuitbreaker = AsyncCircuitBreakerFactory()
async with await circuitbreaker.get_breaker("my_circuit"):
   ...Example with a decoratorfrom purgatory import AsyncCircuitBreakerFactory

circuitbreaker = AsyncCircuitBreakerFactory()

@circuitbreaker("another circuit")
async def function_that_may_fail():
   ...Example with a context manager for an synchronous APIfrom purgatory import SyncCircuitBreakerFactory

circuitbreaker = SyncCircuitBreakerFactory()
with circuitbreaker.get_breaker("my_circuit"):
   ...Circuit breakers states and monitoringThe state of every circuits can be stored in memory, shared in redis, or
be completly customized.It also support monitoring, using event hook.Purgatory is fully typed and fully tested.Read MoreYou can read thefull documentation of this library here.AlternativesHere is a list of alternatives, which may or may not support coroutines.aiobreaker -https://pypi.org/project/aiobreaker/circuitbreaker -https://pypi.org/project/circuitbreaker/pycircuitbreaker -https://pypi.org/project/pycircuitbreaker/pybreaker -https://pypi.org/project/pybreaker/lasier -https://pypi.org/project/lasier/breakers -https://pypi.org/project/breakers/pybreaker -https://pypi.org/project/pybreaker/python-circuit -https://pypi.org/project/python-circuit/
Package: purge-old-files
Simple tool to delete old files using a set of contraints.If--includeif used,
only files matching the provided glob pattern are considered.
This option can be used multiple times.
By default, all files are considered.Usage$purge-old-files-husage: purge-old-files [-h] [--debug | --quiet] [--syslog] [--dry-run]
                       [--include PATTERN] [--exclude PATTERN]
                       MIN_AGE [DIRECTORY [DIRECTORY ...]]

positional arguments:
  MIN_AGE               Minimum age of files
  DIRECTORY             Directory or glob pattern to be scanned (multiple
                        directories can be provided)

optional arguments:
  -h, --help            show this help message and exit
  --debug, -D           Show debug messages
  --quiet, -q           Only show warning messages
  --syslog, -s          Send log messages to /dev/log instead of stdout
  --dry-run, -d         Show which files should be deleted
  --include PATTERN, -i PATTERN
                        Include only files matching pattern
  --exclude PATTERN, -e PATTERN
                        Exclude files matching pattern#Purge*.logfilesin/logswhentheyareolderthan3days$purge-old-files--include'*.log'3d/logs#Deletefilesfrom/backupwhentheyareolderthan1week$purge-old-files1w/backup#Showwhichfilesfrom/backupareolderthan3months$purge-old-files--dry-run3M/backupFile minimum ageSupported units:s: secondsm: minutesh: hoursd: daysw: weeksM: months (30 days)y: years (365 days)Installation$pipinstallpurge-old-filesRequirementsPython 3.xFAQDo you know you can do this with a simple shell script usingfind?Yep. I wrote those for years. They are also painful to maintain.
And error prone. Feel free to use a shell script. :)
Package: purgeraw
OverviewFor photographers keeping every raw file captured can use a lot of space.This utility allows a photographer to purge any unused raw files leaving
only the processed files with their associated raws.The app trawls the input directory for raw and processed images.
Where it finds a raw image with a numeric index that can't be
found in the processed images it is marked for removal.Any sequence of 3 to 6 (inc) numbers in the image filename is deemed as its index which is used
to associate processed and raw images.Processed images may also have a filename format with a range of indexes, e.g. IMG_01234-1236.jpg
This processed file would be associated with IMG_01234.cr3, IMG_01235.cr3 and IMG_01236.cr3 raw images
thus ensuring they are not deleted. This is useful for HDR or panoramic processed images.For example, given the folder1 below:folder1/
  IMG_1000.cr3
  IMG_1001.cr3
  IMG_1002.cr3
  IMG_1003.cr3
  IMG_1004.cr3
  Processed/
    IMG_1000.jpg
    IMG_1002-1003.jpgRunningpraw folder1 -dwould remove the IMG_1001.cr3 and
IMG_1004.cr3 raw images as they don't have associated processed images.The resulting directory would be left as:folder1/
  IMG_1000.cr3
  IMG_1002.cr3
  IMG_1003.cr3
  Processed/
    IMG_1000.jpg
    IMG_1002-1003.jpgTo install runpip install purgeraw
Package: purge-static
purge-staticpurge-staticis a tool to find changed static files, show their URLs,
and optionally purge them for you on your CDN, such as Cloudflare.Withpurge-static, you can enable aggressive caching for your static
site on your CDN, caching the entire site on the CDN edge. When you update
your site, you simply need to usepurge-staticto purge only the changed
files.purge-staticuses the SHA256 hash of files to determine if they changed.Installationpip install purge-staticExample Invocationpurge-static-d/path/to/my/webroot-uhttps://example.comIf your webroot is not writable, you can select a different path to write
the hash store with--store /path/to/a/file/to/store/hashes.This example ignores all.gzfiles, since they are only used fornginx'sgzip_staticmodule, as well as all files with hash already in the name:purge-static-d/path/to/my/webroot-uhttps://example.com\-i'.*\.gz$|.*-[0-9a-f]{64}\.'For more detailed description of the arguments, runpurge-static --help.CloudflareTo use Cloudflare, you will need to create a credentials file:{"api_token":"myverysecretapitoken"}For legacy API keys, use this instead:{"email":"you@example.com","api_key":"myverysecretapikey"}Then, you can invokepurge-static:purge-static-d/path/to/my/webroot-uhttps://example.com\--cloudflare-c/path/to/my/credentiails-zmycloudflarezoneidNote that-ztakes the Cloudflare zone ID as 32 hex digits.
Package: purifier
PurifierA simple scraping library.It allows you to easily create simple and concise scrapers, even when the input
is quite messy.Example usageExtract titles and URLs of articles from Hacker News:frompurifierimportrequest,html,xpath,maps,fields,onescraper=(request()|html()|xpath('//a[@class="titlelink"]')|maps(fields(title=xpath("text()")|one(),url=xpath("@href")|one(),)))result=scraper.scrape("https://news.ycombinator.com")result==[{"title":"Why Is the Web So Monotonous? Google","url":"https://reasonablypolymorphic.com/blog/monotonous-web/index.html",},{"title":"Old jokes","url":"https://dynomight.net/old-jokes/",},...]Installationpip install purifierDocsTutorialAvailable scrapers— API reference.
Package: puristaa
puristaaPuristaa (Finnish for compress)License: MITProvide a memory neutral and fast implementation that is clear to understand and works for the use case of extracting a common prefix of a sequence of strings and yielding that prefix and a generator for the compressed strings of the original sequence.The latter is not yet clear. One simple implementation path is to receive a reference to a sequence, determine min-max, compare min to max by character and break with first index of enumaeration not matching. Finally yield first the prefix, subsequently all strings of the sequence each shortened by the prefix.Another still open question is, if a composition of functions can be construed, such that the prefix finding algorithm respects a caller provided policy representing the inner structure of the strings.
An example for an inner structure is a sequence of paths as strings. A path policy would provide a separator that modifies the prefix finding algorithm to backtrack to the previous such separator token.why? well, imagine the sequence'bar/baz', 'bar/bazaar'and a path policy providing the boolean predicatelambda x: x == '/'should not yield'bar/baz', '', 'aar'but instead'bar/', 'baz', 'bazaar'.DocumentationUser and developerdocumentation of puristaa.Bug TrackerFeature requests and bug reports are bested entered in thetodos of puristaa.Primary Source repositoryThe primary source repository ofpuristaa is at sourcehuta collection of tools useful for software development.StatusExperimentalNote: The default branch isdefault.UseCommandline API
Package: purkinje-messages
purkinje-messagesMessage definitions for the purkinje test runner.
Seepurkinje test runner.DevelopmentClone other relevantpurkinje-*packages, then:mkvirtualenv purkinje
workon purkinje
pip install -e .HistoryMar 02, 2015: Release of version 0.1.3Mar 01, 2015: Release of version 0.1.2Mar 01, 2015: Release of version 0.1.1Mar 01, 2015: Release of version 0.1.0Dec 11, 2014: Start of Development
Package: p.url
P.url is a simple url parsing library for python. Currently, you can
modify querystrings for given urls by adding or deleting. Chaining is
supported!UsageAdd/update queryfrompurlimportPurlurl=Purl('https://github.com/search?q=cat')str(url.add_query('q','dog'))# => 'https://github.com/search?q=dog'url=Purl('https://github.com/search')str(url.add_query({'q':'cat','l':'JavaScript','type':'Issues'}))# orurl=Purl('https://github.com/search')str(url.add_query('q','cat').add_query('l','JavaScript').add_query('type','Issues'))# => 'https://github.com/search?l=JavaScript&q=cat&type=Issues'Delete queryfrompurlimportPurlurl=Purl('https://github.com/search?q=cat')str(url.delete_query('q'))# => 'https://github.com/search'url=Purl('https://github.com/search?l=JavaScript&q=cat&type=Issues')str(url.delete_query(['q','type']))# => https://github.com/search?l=JavaScript# orurl=Purl('https://github.com/search?l=JavaScript&q=cat&type=Issues')str(url.delete_query('q').delete_query('type'))# => 'https://github.com/search?l=JavaScript'Paramsurl=(Purl('https://some.public.api.com').path('/:resource/:id/:action').param('resource','user').param('id',12).param('action','favorites'))str(url)# orurl=(Purl('https://some.public.api.com').path('/:resource/:id/:action').param({'resource':'user','id':12,'action':'favorites'}))str(url)# => 'https://some.public.api.com/user/12/favorites'Running the testsmake sure you have py test installedpip install pytestThen run:py.test
Package: purls
purls.pyPersonal URL Shortener.Today, we can use bit.ly or goo.gl or any of the other publicly available URL
shorteners out there, but doing so limits us in the shortURLs we can choose,
because the namespace is crowded with every other user.With the abundance of new TLDs, it is once again possible for an individual to
register a short personal domain relatively cheaply.  With that domain in hand,
purls.py allows one to quickly and easily host one’s own URL shortener with
minimal dependencies and almost no setup.Usagepurls.py runs on port 8880 by default, so if one is running Apache primarily,
the following two lines of configuration in the Apache configuration file are
sufficient to redirect the prefix /u/ to purls.py:ProxyPass /u/ http://localhost:8880/
ProxyPassReverse /u/ http://localhost:8880/The simplest invocation of purls.py requires only the domain prefix of the
shortened URL’s to be passed. For example, if my domain prefix ishttps://hq6.me/u/, I can invoke purls as follows:python purls.py https://hq6.me/u/InstallationThis software is only compatible with Python 2, so installation must be done
with one of the following commands:pip2 install purls
pip2.7 install purls
Package: purpleair-api
purple_air_api (PAA)This is a python3 wrapper for the new PurpleAirAPI (PAA). Details of the API can be found using this link:https://api.purpleair.com/#api-welcomeTo use the PurpleAirAPI (PAA) api keys are required. You can get API keys by sending an email tocontact@purpleair.comwith a first and last name to assign them to.How to Support This ProjectPurposeThis package is designed to be used for making tools around the PurpleAir API.For example, PAA data loggers -https://github.com/carlkidcrypto/purpleair_data_loggerInstallationYou can install the PurpleAir API via pip.python3-mpipinstallpurple_air_apiYou can install PurpleAir API by cloning down this repo.gitclonehttps://github.com/carlkidcrypto/purple_air_api.gitcdpurple_air_api
python3setup.pyinstallPurpleAirAPI Usage ExampleFirst we need to import the PurpleAir API (PAA)frompurpleair_api.PurpleAirAPIimportPurpleAirAPINext we need to make an instance of PAA.my_paa=PurpleAirAPI(your_api_read_key,your_api_write_key,your_ipv4_address)Now you can use that PAA instance to do things like...retval=my_paa.request_sensor_data(1234)Note: PurpleAirAPI is the main entry point. It will load read, write, and local submodules
based on the parameters that are passed in upon construction. If you wish to only use a
small piece of PurpleAirAPI then see the examples below.PurpleAirReadAPI Usage ExampleFirst we need to import the PurpleAirReadAPI.from purpleair_api.PurpleAirReadAPI import PurpleAirReadAPINow we need to make an instance if it.my_paa=PurpleAirReadAPI(api_read_key)Now we can use that instance to do things like...retval=my_paa.request_multiple_sensors_data("name")PurpleAirWriteAPI Usage ExampleFirst we need to import the PurpleAirWriteAPI.from purpleair_api.PurpleAirWriteAPI import PurpleAirWriteAPINow we need to make an instance if it.my_paa=PurpleAirWriteAPI(api_write_key)Now we can use that instance to do things like...retval=my_paa.post_create_member(1234)PurpleAirLocalAPI Usage ExampleFirst we need to import the PurpleAirLocalAPI.from purpleair_api.PurpleAirLocalAPI import PurpleAirLocalAPINow we need to make an instance if it.my_paa=PurpleAirLocalAPI(["ipv4_address"])Now we can use that instance to do things like...retval=my_paa.request_local_sensor_data()TestsRefer to the testreadme
Package: purple-auth-client
Purple Auth ClientAn async python client for my "Purple Auth" microservice.Routes Coveredinitializationfrompurple_auth_clientimportAuthClientauth_client=AuthClient(host="https://purpleauth.com",app_id="37f9a26d-03c8-4b7c-86ad-132bb82e8e38",api_key="[Key provided by purple auth portal]")/otp/request/Start otp authentication flow with server.result=awaitauth_client.authenticate("test@example.com",flow="otp")/otp/confirm/Complete authentication with email and generated code.result=awaitauth_client.submit_code("test@example.com","12345678")/token/verify/Send idToken to server for verification.result=awaitauth_client.verify_token_remote(token_submitted_by_client)/token/refresh/Request a new ID Token from the server using a refresh tokennew_token=awaitauth_client.refresh(refresh_token_from_client)/app/Get more info about this app from the server.info=awaitauth_client.app_info()/magic/request/Start authentication using magic link flow.result=awaitauth_client.authenticate("test@example.com",flow="magic")Local VerificationVerify and decode an ID Token on directly in the app without having to
call out every timeresult=awaitauth_client.verify(id_token_from_client)# {"headers": {"alg": "ES256", "type": "JWT"}, "claims": {"sub": "user@email.com", "exp": "test@example.com"}# etc.
Package: purplecaffeine
PurpleCaffeine: tracking of quantum programs and experimentsTracking experiments and programs is known problem in scientific community.
This project is aimed to create simple general interface to track quantum experiments, store and search them in an easy way.Table of ContentsFor UsersQuickstartSource Code InstallationDocumentationGuidesHow to Give FeedbackContribution GuidelinesReferences and AcknowledgementsLicenseQuickstartpipinstallpurplecaffeinefromqiskit.circuit.randomimportrandom_circuitfromqiskit.quantum_info.randomimportrandom_paulifromqiskit.primitivesimportEstimatorfrompurplecaffeine.coreimportTrial,LocalStoragefrompurplecaffeine.widgetimportWidgetn_qubits=4depth=3shots=2000circuit=random_circuit(n_qubits,depth)obs=random_pauli(n_qubits)local_storage=LocalStorage("./")withTrial("Example trial",storage=local_storage)astrial:# track some parameterstrial.add_parameter("estimator","qiskit.primitives.Estimator")trial.add_parameter("depth",depth)trial.add_parameter("n_qubits",n_qubits)trial.add_parameter("shots",shots)# track objects of interesttrial.add_circuit("circuit",circuit)trial.add_operator("obs",obs)# runexp_value=Estimator().run(circuit,obs,shots=shots).result().values.item()# track results of runtrial.add_metric("exp_value",exp_value)Widget(local_storage).show()Source Code InstallationIf you want to install from source code, execute while in the root folder of the project:cdclient
pipinstall.DocumentationDocumentation for project is hosted athttps://icekhan13.github.io/purplecaffeine/How to Give FeedbackWe encourage your feedback! You can share your thoughts with us by:Opening an issuein the repositoryContribution GuidelinesFor information on how to contribute to this project, please take a look at ourcontribution guidelines.References and Acknowledgements[1] Qiskit is an open-source SDK for working with quantum computers at the level of circuits, algorithms, and application modules.https://github.com/Qiskit/qiskitLicenseApache License 2.0
Package: purple-framework
Purple has two main parts:parsertree makerParserPurple parser is dynamic as he can parse any non-left-recursive grammar.
Grammar is part defined by the user and part which is necessary
to create ParseText obj. Grammar is represented in form of a dict, eg:grammar =  {"baseexpr" : [["mathop"]],
            "mathop": [["number","operator","mathop"],["number"]],
            "operator":[["plus"],["minus"]]}2nd argument which is required to create ParseText obj is grammar’s start symbol.
In this case “baseexpr” would be the one.After creating ParseText objparser = ParserText(grammar, "baseexpr")to check if some list of tokens (list of token type to be more precise) can be generated
from specified grammar just call parse method (which returns True or False)
with token list as its argument:parser.parse(token_list)During parsing process, parser is making trace which indicates how to build
something that very much resembles to AST.ASTEvery symbol in a grammar should be represented with a class of its own.
Depending if symbol is a “leaf” or a “node” (it’s a leaf if it doesn’t have production rule
otherwise it’s a node) corresponding class should inherit from LeafNode or Node class.Some “leaf” symbols obviously don’t have any semantic meaning likeandso for them there is
no need to be represented with a class.Semantic meaning of each symbol is defined by overriding Node’sdooperation()method.
For ‘leaf’ symbols if not overriden dooperation will return value of token associated with that
particular symbol.
So in our example for symbols mathop, operator and plus we would have:import operator

class MathOpNode(Node):
        def dooperation(self):
        if len(self.childrens) == 3:
            op_func = self.childrens[1].dooperation()
            arg_1 = self.childrens[0].dooperation()
            arg_2 = self.childrens[2].dooperation()
            return op_func(arg_1,arg_2)
        else:
            return self.childrens[0].dooperation()

class OperatorNode(Node):
        def dooperation(self):
                return self.childrens[0].dooperation()

class PlusNode(LeafNode):
        dooperation():
                return operator.addFinal stage is to create dict with symbols as keys and theirs corresponding classes as values.:nodes={
        "mathopnode" : MathOpNode,
        "operator" : OperatorNode,
        "plus" : PlusNode,
        .
        .
        .
}To build AST(SDT) first create AST obj with token list, start node (object corresponding to start symbol),
grammar and nodes as argumentsast = AST(token_list, start_node, grammar, nodes)and then call create_tree method with start symbol and trace (from parser) as argumentsast.create_tree(start_symbol, trace).
After that tree is created and its root istree_nodes’s first element.Assuming you have defined semantics (with overridingdooperation()) for every symbol, to execute your source code
you can just callast.execute(), which callsdooperation()on the root of the ast.
Package: purple-grove
Purple Grove Python LibraryA Python library for interacting with the Purple Grove platform.Installationpipinstallpurple-groveGetting startedHow to access the Purple Grove platform with this library.frompurple-groveimportPurpleGrovepg=PurpleGrove()Copyright 2024 Purple Monkey CollectivePermission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the “Software”), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject
to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Package: purpler
What and WhyPurpler is the beginning of a suite of tools that manage content to
apply purple numbers, starting with a logging IRC bot that enables
transclusion. See ablog postingfor more details.There are further plans. IRC logging is just the first part.UsePurpler consists of two services:A WSGI application that presents logs of content:purpler.wsgi.An IRC bot script that listens on configured channels:purpler-bot.The WSGI application requires a database url to run. Provide this by
create a filepurpler.db_urlin the working directory of the
WSGI application containing something like:mysql+pymysql://localhost/purpler?charset=utf8mb4The IRC bot takes a complex set of configuration on the command
line (runpurpler-bot--help). To avoid this complexity it is
possible to read configuration from a file. Here’s one way to
start it:nohup purpler-bot @purplerbot.conf --db-url=`cat purpler.db_url` &purplerbot.confcontains entries like:--no-log=#someprivatechannel
-c #openstack-nova
-c #openstack-sdks
-c #openstack-telemetry
-c #openstack-dev
-c #someprivatechannelInstallInstall purpler in the usual pip way:pip install -U purplerAlso install a database driver that will work with sqlalchemy.Web AppConfigure a WSGI server to run the wsgi application. Here’s an
example using mod_wsgi (you should modify this for your own
requirements with regard to logging, auth, etc.):<VirtualHost *:80>
ServerName p.anticdent.org
AllowEncodedSlashes On

WSGIDaemonProcess purpler user=cdent processes=2 threads=20 stack-size=524288 display-name=%{GROUP} maximum-requests=500
WSGIProcessGroup purpler

WSGIScriptAlias / /some/path/to/purpler/wsgi.py
</VirtualHost>The templates used for presenting the logs exist within the purpler
package. If you want custom templates set thePURPLER_TEMPLATE_PATHenvironment variable to a path to find overrides. CSS is inlined from a
style.css template.The BotSee above for an example of how to start uppurpler-bot. That’s
just one of many ways. Other options include systemd service,
supervisord or an initscript.CodeOnGitHub.CaveatsThis could charitably be described as a weekend hack so there
has been limited testing of the code with proper testing.LicenseApache License, Version 2.0