Saravanan666/pypi-org huggingface dataset:
Package: aioburst
aioburstA library to optimize the speed of rate limited async calls, by alternating between bursts and sleeps.UsageInstall the package using pip:pip install aioburstImport the limiter:from aioburst import aioburstInstantiate the limiter using thecreatemethod, setting thelimit(number of calls) andperiod(period over
which the number of calls are restricted):limiter = AIOBurst.create(limit=10, period=1.0)

async with limiter:
    ...The code above would allow 10 asynchronous entries (into the context manager) without any limit. Then it adds
"sleepers" for the next calls. The sleeper tells the next entry when it can start. The 11th call gets the sleeper
set by the 1st call that returned and waits until theperiodhas elapsed. This approach ensures that there are
never more thanlimitsimultaneous calls but that the next call can start as soon as possible. The result is that
in a sliding window ofperiodyou should see exactlylimitcalls as active, regardless of how fast or slow any
individual call returns.You can also stack limiters:limiter1 = AIOBurst.create(limit=10, period=1.0)
limiter2 = AIOBurst.create(limit=100, period=60.0)

async with limiter1:
	async with limiter2:
    ...Use this for cases where an API has a two-level rate limit like 10 calls per second or 100 calls per minute---both
limits will be respected. The stack is also idempotent, meaning that whichever way you stack the limiters, both
limits will be respected:limiter1 = AIOBurst.create(limit=10, period=1.0)
limiter2 = AIOBurst.create(limit=100, period=60.0)


async with limiter1:
	async with limiter2:
    ...
    
# The limit above will do the exact same thing as the limit below
async with limiter2:
	async with limiter1:
    ...
Package: aiobus
An event-bus application layer, support redisSimplyASYNCframework to integrateDISTRIBUTEDmessage bus to your application:utilize redis pub/sub features in backendfast to start and simply configurethread-safe and python async-friendly thanks to coroutines contextsfault tolerance if some redis instances down for a little timescalable thanks to consistent hashing for mappingtopictoinstancewithout cluster setupInstallpip install aiobusUsageimportjsonimportasyncioimportdatetimefromaiobus.redisimportRedisBus...bus=RedisBus(servers=['192.168.100.1','192.168.100.2:6380'],max_pool_size=1000)...# Publisher Coroutineasyncdefpublisher():whileTrue:awaitbus.publish('my-topic',{'stamp':str(datetime.datetime.now())})awaitasyncio.sleep(0.1)...# Subscriber Coroutineasyncdefsubscriber():awaitbus.subscribe('my-topic')asyncformsginawaitbus.listen():print(json.dumps(msg,indent=2,sort_keys=True))...DemoSetup redis instances on localhostdocker-compose up -dfor demo purposesRun/DebugDemo scriptRunning testsBefore to run tests you shouldinstall dependencies:pip install -r requirements.txtstart the dependent services with command:docker-compose up -d
Package: aioca
aioca is an asynchronous EPICS Channel Access client for asyncio and Python
using libca via ctypes.PyPIpip install aiocaSource codehttps://github.com/dls-controls/aiocaDocumentationhttps://dls-controls.github.io/aiocaChangeloghttps://github.com/dls-controls/aioca/blob/master/CHANGELOG.rstIt exposes a high level interface similar to the commandline tools:caget(pvs, ...)
    Returns a single snapshot of the current value of each PV.

caput(pvs, values, ...)
    Writes values to one or more PVs.

camonitor(pvs, callback, ...)
    Receive notification each time any of the listed PVs changes.

connect(pvs, ...)
    Optionally can be used to establish PV connection before using the PV.Seehttps://dls-controls.github.io/aiocafor more detailed documentation.
Package: aiocached
aiocachedaioachedis a simple package with decoratorcachedto cache results of
ordinary and coroutine functions with configurable TTL andNonevalue supportI wrote a simple helper to cache results in one service because I found it easy
to do. As soon as I needed the helper in another project, I realized that it
should be in a separate package published on PyPI. Having foundaiocacheproject I was disappointed because it wasn't able to cacheNonevalues.
So I had a reason to createaiocached.Table of contentsUsage examplesInstallationUsage examplesIn this examplefoo(1)will be run just once:importasynciofromaiocachedimportcached@cachedasyncdeffoo(n):awaitasyncio.sleep(n)asyncdefmain():awaitasyncio.gather(*[foo(1)for_inrange(1000)])asyncio.run(main())In this examplebar(1)will be run twice because of TTL:importasynciofromaiocachedimportcached@cached(ttl=2)asyncdefbar(n):awaitasyncio.sleep(n)asyncdefmain():awaitbar(1)awaitasyncio.sleep(2)awaitbar(1)asyncio.run(main())If you want to cache an ordinary function, you can do it as well. In this
examplefoobar(1)will be run twice for the same reason as above:importtimefromaiocachedimportcached@cached(ttl=2)deffoobar(n):time.sleep(n)defmain():foobar(1)time.sleep(2)foobar(1)main()InstallationUse pip to install:$pipinstallaiocached
Package: aiocaldav
aiocaldavaiocaldav is a fork of the caldav project since v0.5.0It uses aiohttp client library instead of synchronous request lib.
It also targets only python 3.6+ (remove six and older python support)Drawbacks:no DigestAuth Support for nowBug corrections since caldav v0.5.0:Todo list without completed query syntax was wrongIt was possible to completed an already completed task. Now complete() an already
completed task does nothing (perhaps should we raise an error instead ?)changed datetime output in cdav to match rfc 5545 (for timezones)Evolutions since caldav v0.5.0 (incompatible change in top of 'asyncification')package name changed from caldav to aiocaldavPrincipal.calendar_home_set is no longer a property, it's now a async method
To set the prop, now use Principal._calendar_home_setter(url)
To retrieve is use await Principal.calendar_home_set()TestsTests uses pytest and pytest_asyncio and need (by default) docker and docker-compose.
Just run:# pytest .to launch the tests.
Package: aiocall
The missing call methods for pythonasyncio.I found that python asyncio is lacking some basic methods to invoke calls:call_soon_periodic(interval,callback,*args)call_later_periodic(delay,interval,callback,*args)This module provides these methods.Example:importasyncioimportaiocalldefdo_something(what):print('doing',what)timer=aiocall.call_later_periodic(0.5,1.0,do_something,'stuff')loop=asyncio.get_event_loop()loop.call_later(4.0,timer.cancel)loop.call_later(5.0,loop.stop)loop.run_forever()loop.close()Output:doing stuff
doing stuff
doing stuff
doing stuff
Package: aiocapsolver
Capsolver.com API for PythonCapSolverPython is an elegant API implementation of Capsolver.com for pythonFeatures:Async/Sync supportAll endpoints/inputs (soon)Error handlingInstallationpip install aiofiles(https://pypi.org/project/aiocapsolver/)Usagefromaiocapsolver.capsolverimportAsyncCapSolversolver=AsyncCapSolver(MyCapSolverApiKey)asyncdefmyasyncfunction():result=awaitsolver.solve_image_to_text(images/myimage.png)WIPCurrently only supports:asyncImage captcha solvingWatch this space for future additions
Package: aiocapsule
aiocapsuleA minimal package containing an AIOHTTP wrapper functionDesigned for asynchronous HTTP requests toa large, unknown number of
different serversSupport for HTTP proxy and basic authenticationInstallpipinstallaiocapsuleHow to usefromaiocapsule.coreimportrequestA simple call returning JSON as a dict:awaitrequest('GET','https://api.coingecko.com/api/v3/ping'){'gecko_says': '(V3) To the Moon!'}Or a string of HTML:awaitrequest('GET','https://example.com/',text=True)'<!doctype html>\n<html>\n<head>\n    <title>Example Domain</title>\n\n    <meta charset="utf-8" />\n    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n    <meta name="viewport" content="width=device-width, initial-scale=1" />\n    <style type="text/css">\n    body {\n        background-color: #f0f0f2;\n        margin: 0;\n        padding: 0;\n        font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;\n        \n    }\n    div {\n        width: 600px;\n        margin: 5em auto;\n        padding: 2em;\n        background-color: #fdfdff;\n        border-radius: 0.5em;\n        box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);\n    }\n    a:link, a:visited {\n        color: #38488f;\n        text-decoration: none;\n    }\n    @media (max-width: 700px) {\n        div {\n            margin: 0 auto;\n            width: auto;\n        }\n    }\n    </style>    \n</head>\n\n<body>\n<div>\n    <h1>Example Domain</h1>\n    <p>This domain is for use in illustrative examples in documents. You may use this\n    domain in literature without prior coordination or asking for permission.</p>\n    <p><a href="https://www.iana.org/domains/example">More information...</a></p>\n</div>\n</body>\n</html>\n'
Package: aiocarbon
Client for feeding data to graphite.ExampleCounter example:importasyncioimportaiocarbonasyncdefmain(loop):aiocarbon.setup(host="127.0.0.1",port=2003,client_class=aiocarbon.TCPClient)for_inrange(1000):withaiocarbon.Counter("foo"):awaitasyncio.sleep(0.1)if__name__=="__main__":loop=asyncio.get_event_loop()loop.run_until_complete(main(loop))loop.close()
Package: aiocasambi
Python library for controlling Casambi lightsaio Python library for controlling Casambi via Cloud APISupported modesThese modes are implemented:on/offbrightnesscolor temperaturergbrgbwGetting StartedRequest developer api key from Casambi:https://developer.casambi.com/Setup a site in Casambi app:http://support.casambi.com/support/solutions/articles/12000041325-how-to-create-a-siteInstallatingInstall this library through pip:pip install aiocasambiAuthorsOlof Hellqvist-Initial workLicenseThis project is licensed under the MIT License - see theLICENSE.mdfile for detailsTest scriptAdd the credentials tocasambi.yaml.exampleand rename the file tocasambi.yamlBuild localy in envpython3 -m venv aiocasambi
source ./aiocasambi/bin/activate
./aiocasambi/bin/pip3 install -r ./aiocasambi/requirements.txtDisclaimerThis library is neither affiliated with nor endorsed by Casambi.
Package: aiocassandra
info:Simple threaded cassandra wrapper for asyncioInstallationpipinstallaiocassandraUsageimportasynciofromaiocassandraimportaiosessionfromcassandra.clusterimportClusterfromcassandra.queryimportSimpleStatement# connection is blocking callcluster=Cluster()# aiocassandra uses executor_threads to talk to cassndra driver# https://datastax.github.io/python-driver/api/cassandra/cluster.html?highlight=executor_threadssession=cluster.connect()asyncdefmain():# patches and adds `execute_future`, `execute_futures` and `prepare_future`# to `cassandra.cluster.Session`aiosession(session)# best way is to use cassandra prepared statements# https://cassandra-zone.com/prepared-statements/# https://datastax.github.io/python-driver/api/cassandra/cluster.html#cassandra.cluster.Session.prepare# try to create them once on application initquery=session.prepare('SELECT now() FROM system.local;')# if non-blocking prepared statements is really needed:query=awaitsession.prepare_future('SELECT now() FROM system.local;')print(awaitsession.execute_future(query))# pagination is also supportedquery='SELECT * FROM system.size_estimates;'statement=SimpleStatement(query,fetch_size=100)# don't miss *s* (execute_futureS)asyncwithsession.execute_futures(statement)aspaginator:asyncforrowinpaginator:print(row)loop=asyncio.get_event_loop()loop.run_until_complete(main())cluster.shutdown()loop.close()Python 3.5+ is requiredThanksThe library was donated byOcean S.A.Thanks to the company for contribution.
Package: aiocast
aiocastCast videos to chromecast devices from the terminal.Install$ pip install aiocastUsage$ aiocast play video.mp4$ aiocast list-devices$ aiocast device-info "Home"$ aiocast play --help                                                                                                                                                                                                                ✔  19:31 
usage: aiocast play [-h] [-d DEVICE_NAME] [-p PORT] [-t TIMEOUT] [-i IDLE]
                    [--local-ip LOCAL_IP] [--mimetype MIMETYPE]
                    media

Cast a video

positional arguments:
  media                 Path to the video to cast.

optional arguments:
  -h, --help            show this help message and exit
  -d DEVICE_NAME, --device-name DEVICE_NAME
                        The target cast device name (default: None)
  -p PORT, --port PORT  Port of the local cast server (default: None)
  -t TIMEOUT, --timeout TIMEOUT
                        Timeout after which the program will close if stuck on
                        buffering. (default: 60)
  -i IDLE, --idle IDLE  Time to stay idle after a stop or media ends (default:
                        2.5)
  --local-ip LOCAL_IP   Local ip to use, otherwise get the first private ip
                        available. (default: None)
  --mimetype MIMETYPE   Set the mimetype of the media, otherwise will guess.
                        (default: None)
Package: aiocdp
AIOCDPThis library provides an async wrapper around the Chrome DevTools Protocol.AboutTo be the underlying engine for any projects using Chrome DevTools Protocol. This library should embody the following:Flexibility: Allow for any use case that the CDP supports.Minimal external dependencies: Opt for built-in python libraries where possible.Clean code: No hacks, workarounds, or spaghetti code.UsageStarting ChromeThe following will launch chrome through the command line.importasynciofromaiocdpimportChromeasyncdefsetup_chrome():chrome=Chrome.init(host="localhost",port=9222,)chrome.start()# run your logic hereif__name__=="__main__":asyncio.run(setup_chrome())NOTE:If you had chrome open previously, you may run into connection issues.
If this is the case, close your tabs, run the script to relaunch chrome, and then reopen your tabs.Opening a tabimportasynciofromaiocdpimportChromeasyncdefsetup_tabs():chrome=Chrome.init(host="localhost",port=9222,)chrome.start()# opens a new tab. Return aiocdp.ITarget instance.target=chrome.open_tab("https://www.google.com")target=chrome.open_tab("https://www.yahoo.com")target=chrome.open_tab("https://www.github.com/amirdevstudio/aiocdp")# opens a new tab. The parameter is optionaltarget=chrome.open_tab()if__name__=="__main__":asyncio.run(setup_tabs())PackageYou can find the AIOCDP package published to pypi.org/project/aiocdpFor DevelopersScopeThis library is built to be "one and done" except for performance optimizations or design changes.
This library should limit the dependencies it has on the CDP unless it's a core feature (opening sessions, etc.).DependenciesBuilt-indataclassesmodule for classesBuilt-intypingmodule for type hints, enum literals, and other goodiesBuilt-injsonmodule for JSON serializationBuilt-inasynciomodule for async functionalityExternalrequestsmodule for HTTP communicationExternalwebsocketsmodule for websocket communicationInternalsModule Organizationaiocdp- Root package. Contains core and utility modulesaiocdp.core- Core functionality for communicating with the Chrome DevTools Protocolaiocdp.core.chrome.Chrome-> Represents the Chrome instance / process.aiocdp.core.target.Target-> Represents a chrome devtools protocol target (Page, Frame, Worker, etc)aiocdp.core.connection.Connection-> Represents a websocket connection to a targetaiocdp.core.session.TargetSession-> Represents a session to a specific target.aiocdp.core.stream.EventStream-> Represents a stream of events from a connection.aiocdp.core.stream.EventStreamReader-> Readonly reader to an event stream.TODO:Setup proper typehints for setting subclasses. (use a type var in a shared module)documentationPublishing to PyPiUpdate the version insetup.pyand / orpyproject.tomlRunpython -m pip install build twineRunpython -m buildRuntwine check dist/*Runtwine upload dist/aiocdp-<MAJOR>.<MINOR>.<PATCH>*
Package: aiocertstream
aiocertstreamAn async client to connect to certstream in Python.InstallationWindows:pip install aiocertstreamorpy -3 -m pip install aiocertstream*Nix:pip3 install aiocertstreamExample usageFor this example we'll just print out the cert index:fromaiocertstreamimportClientclient=Client()@client.listenasyncdefmy_handler(event:dict)->None:print(event["data"]["cert_index"])client.run()
Package: aiocfscrape
A simple async Python module to bypass Cloudflare's anti-bot page.
Based on aiohttp ClientSession. Solution was inherited fromcfscrapemodule.You could use it eg. with Python 3 andasynciofor concurrent crawling of web resources protected with CloudFlare.Table of ContentsInstallationBasic UsageDependenciesLicenseChangelog1.0.0 (2020-03-25)0.0.9 (2019-03-21)0.0.8 (2019-03-16)0.0.7 (2019-01-10)0.0.6 (2018-06-19)0.0.5 (2018-06-19)0.0.4 (2018-03-06)0.0.3 (2017-11-21)0.0.2 (2016-08-26)0.0.1 (2016-08-26)InstallationInstall with pippipinstallaiocfscrapeBasic Usageaiocfscrape is a aiohttp.ClientSession wrapper. Soaiohttp client referencecan be used as the base.To make simple get request do the following:importasynciofromaiocfscrapeimportCloudflareScraperasyncdeftest_open_page(url):asyncwithCloudflareScraper()assession:asyncwithsession.get(url)asresp:returnawaitresp.text()if__name__=='__main__':asyncio.run(test_open_page('<your url>'))DependenciesPython3.5.3+aiohttp>=3.1.3, <4ajs2pyLicenseaiocfscrape is offered under the MIT license.Changelog1.0.0 (2020-03-25)Update anti-bot integration to latest cfscrape version [Nachtalb]Constrain aiohttp to <4a because ofhttps://github.com/aio-libs/aiohttp/pull/3933[Nachtalb]Update package information [Nachtalb]0.0.9 (2019-03-21)Update anit-bot integration to latest cfscrape version [gaardiolor]0.0.8 (2019-03-16)Update anit-bot integration to latest cfscrape version [gaardiolor]0.0.7 (2019-01-10)Fix error when host does not return a “Server” header [pavlodvornikov]Update anit-bot integration to latest cfscrape version [gaardiolor]0.0.6 (2018-06-19)Update readme [pavlodvornikov]0.0.5 (2018-06-19)Fix aiohttp version 3 compatibility [ape364]Bump js2py [ape364]Update anti-bot integration to latest cfscrape version [dteh]0.0.4 (2018-03-06)Update anti-bot integration to latest cfscrape version [slazarov]0.0.3 (2017-11-21)Fix AttributError [ape364]0.0.2 (2016-08-26)Support timeout inside request [pavlodvornikov]Update package information [pavlodvornikov]Remove obsolete files [pavlodvornikov]0.0.1 (2016-08-26)Initial implementation
Package: aioch
aiochaiochis a library for accessing a ClickHouse database over native interface from the asyncio.
It wraps features ofclickhouse-driverfor asynchronous usage.InstallationThe package can be installed usingpip:pipinstallaiochTo install from source:gitclonehttps://github.com/mymarilyn/aiochcdaioch
pythonsetup.pyinstallUsagefromdatetimeimportdatetimeimportasynciofromaiochimportClientasyncdefexec_progress():client=Client('localhost')progress=awaitclient.execute_with_progress('LONG AND COMPLICATED QUERY')timeout=20started_at=datetime.now()asyncfornum_rows,total_rowsinprogress:done=num_rows/total_rowsiftotal_rowselsetotal_rowsnow=datetime.now()# Cancel query if it takes more than 20 seconds to process 50% of rows.if(now-started_at).total_seconds()>timeoutanddone<0.5:awaitclient.cancel()breakelse:rv=awaitprogress.get_result()print(rv)asyncdefexec_no_progress():client=Client('localhost')rv=awaitclient.execute('LONG AND COMPLICATED QUERY')print(rv)loop=asyncio.get_event_loop()loop.run_until_complete(asyncio.wait([exec_progress(),exec_no_progress()]))For more information seeclickhouse-driverusage examples.Parametersexecutor- instance of custom Executor, if not supplied default executor will be usedloop- asyncio compatible event loopOther parameters are passing to wrapped clickhouse-driver's Client.Licenseaioch is distributed under theMIT license.
Package: aio-ch
aiochaiochis a library for accessing a ClickHouse database over native interface from the asyncio.
It wraps features ofclickhouse-driverfor asynchronous usage.InstallationThe package can be installed usingpip:pipinstallaio_chUsagefromdatetimeimportdatetimeimportasynciofromaiochimportClientasyncdefexec_progress():client=Client('localhost')progress=awaitclient.execute_with_progress('LONG AND COMPLICATED QUERY')timeout=20started_at=datetime.now()asyncfornum_rows,total_rowsinprogress:done=num_rows/total_rowsiftotal_rowselsetotal_rowsnow=datetime.now()# Cancel query if it takes more than 20 seconds to process 50% of rows.if(now-started_at).total_seconds()>timeoutanddone<0.5:awaitclient.cancel()breakelse:rv=awaitprogress.get_result()print(rv)asyncdefexec_no_progress():client=Client('localhost')rv=awaitclient.execute('LONG AND COMPLICATED QUERY')print(rv)loop=asyncio.get_event_loop()loop.run_until_complete(asyncio.wait([exec_progress(),exec_no_progress()]))For more information seeclickhouse-driverusage examples.Parametersexecutor- instance of custom Executor, if not supplied default executor will be usedloop- asyncio compatible event loopOther parameters are passing to wrapped clickhouse-driver's Client.Licenseaioch is distributed under theMIT license.
Package: aioch2
aioch2aioch2is a library for accessing a ClickHouse database over native interface from the asyncio.
It wraps features ofclickhouse-driverfor asynchronous usage.InstallationThe package can be installed usingpip:pipinstallaioch2Usagefromdatetimeimportdatetimeimportasynciofromaioch2importClientasyncdefexec_progress():client=Client('localhost')progress=awaitclient.execute_with_progress('LONG AND COMPLICATED QUERY')timeout=20started_at=datetime.now()asyncfornum_rows,total_rowsinprogress:done=num_rows/total_rowsiftotal_rowselsetotal_rowsnow=datetime.now()# Cancel query if it takes more than 20 seconds to process 50% of rows.if(now-started_at).total_seconds()>timeoutanddone<0.5:awaitclient.cancel()breakelse:rv=awaitprogress.get_result()print(rv)asyncdefexec_no_progress():client=Client('localhost')rv=awaitclient.execute('LONG AND COMPLICATED QUERY')print(rv)loop=asyncio.get_event_loop()loop.run_until_complete(asyncio.wait([exec_progress(),exec_no_progress()]))For more information seeclickhouse-driverusage examples.Parametersexecutor- instance of custom Executor, if not supplied default executor will be usedloop- asyncio compatible event loopOther parameters are passing to wrapped clickhouse-driver's Client.Licenseaioch2 is distributed under theMIT license.