Saravanan666/pypi-org huggingface dataset:
Package: aiocometd
aiocometdaiocometd is aCometDclient built usingasyncio, implementing theBayeuxprotocol.CometDis a scalable WebSocket and HTTP based event and message routing bus.CometDmakes use of WebSocket and HTTP push technologies known asCometto
provide low-latency data from the server to browsers and client applications.FeaturesSupported transports:long-pollingwebsocketAutomatic reconnection after network failuresExtensionsUsageimportasynciofromaiocometdimportClientasyncdefchat():nickname="John"# connect to the serverasyncwithClient("http://example.com/cometd")asclient:# subscribe to channels to receive chat messages and# notifications about new membersawaitclient.subscribe("/chat/demo")awaitclient.subscribe("/members/demo")# send initial messageawaitclient.publish("/chat/demo",{"user":nickname,"membership":"join","chat":nickname+" has joined"})# add the user to the chat room's membersawaitclient.publish("/service/members",{"user":nickname,"room":"/chat/demo"})# listen for incoming messagesasyncformessageinclient:ifmessage["channel"]=="/chat/demo":data=message["data"]print(f"{data['user']}:{data['chat']}")if__name__=="__main__":loop=asyncio.get_event_loop()loop.run_until_complete(chat())For more detailed usage examples take a look at thecommand line chat exampleor for a more complex example with
a GUI check out theaiocometd-chat-demo.Documentationhttps://aiocometd.readthedocs.io/Changelog0.4.5 (2019-03-14)Fix connection issues when used with reverse proxy servers with cookie based
sticky sessions0.4.4 (2019-02-26)Refactor the websocket transport implementation to use a single connection
per client0.4.3 (2019-02-12)Fix reconnection issue on Salesforce Streaming API0.4.2 (2019-01-15)Fix the handling of invalid websocket transport responsesFix the handling of failed subscription responses0.4.1 (2019-01-04)Add documentation links0.4.0 (2019-01-04)Add type hintsAdd integration tests0.3.1 (2018-06-15)Fix premature request timeout issue0.3.0 (2018-05-04)Enable the usage of third party JSON librariesFix detection and recovery from network failures0.2.3 (2018-04-24)Fix RST rendering issues0.2.2 (2018-04-24)Fix documentation typosImprove examplesReorganise documentation0.2.1 (2018-04-21)Add PyPI badge to README0.2.0 (2018-04-21)Supported transports:long-pollingwebsocketAutomatic reconnection after network failuresExtensions
Package: aiocometd-ng
aiocometdaiocometd is aCometDclient built usingasyncio, implementing theBayeuxprotocol.CometDis a scalable WebSocket and HTTP based event and message routing bus.CometDmakes use of WebSocket and HTTP push technologies known asCometto
provide low-latency data from the server to browsers and client applications.FeaturesSupported transports:long-pollingwebsocketAutomatic reconnection after network failuresExtensionsUsageimportasynciofromaiocometdimportClientasyncdefchat():nickname="John"# connect to the serverasyncwithClient("http://example.com/cometd")asclient:# subscribe to channels to receive chat messages and# notifications about new membersawaitclient.subscribe("/chat/demo")awaitclient.subscribe("/members/demo")# send initial messageawaitclient.publish("/chat/demo",{"user":nickname,"membership":"join","chat":nickname+" has joined"})# add the user to the chat room's membersawaitclient.publish("/service/members",{"user":nickname,"room":"/chat/demo"})# listen for incoming messagesasyncformessageinclient:ifmessage["channel"]=="/chat/demo":data=message["data"]print(f"{data['user']}:{data['chat']}")if__name__=="__main__":loop=asyncio.get_event_loop()loop.run_until_complete(chat())For more detailed usage examples take a look at thecommand line chat exampleor for a more complex example with
a GUI check out theaiocometd-chat-demo.Documentationhttps://aiocometd.readthedocs.io/Changelog0.4.5 (2019-03-14)Fix connection issues when used with reverse proxy servers with cookie based
sticky sessions0.4.4 (2019-02-26)Refactor the websocket transport implementation to use a single connection
per client0.4.3 (2019-02-12)Fix reconnection issue on Salesforce Streaming API0.4.2 (2019-01-15)Fix the handling of invalid websocket transport responsesFix the handling of failed subscription responses0.4.1 (2019-01-04)Add documentation links0.4.0 (2019-01-04)Add type hintsAdd integration tests0.3.1 (2018-06-15)Fix premature request timeout issue0.3.0 (2018-05-04)Enable the usage of third party JSON librariesFix detection and recovery from network failures0.2.3 (2018-04-24)Fix RST rendering issues0.2.2 (2018-04-24)Fix documentation typosImprove examplesReorganise documentation0.2.1 (2018-04-21)Add PyPI badge to README0.2.0 (2018-04-21)Supported transports:long-pollingwebsocketAutomatic reconnection after network failuresExtensions
Package: aiocometd-noloop
A CometD client, updated for Python 3.10Explore the docs »Getting Started·Documentation·LicenseAbout the Projectaiocometd-noloop is an updated version of theaiocometd Python package, which is a python client forCometD.This package is updated for compatibility with Python 3.10, allowing for usage with modern more modern Python features and projects.Getting Startedaiocometd-noloop is available onPyPI. To use it in your project, run:pip install aiocometd-noloopBasic UsageSee the original repository for usage examples and any further details.LicenseDistributed under the MIT License. SeeLICENSEfor further details.(Back to Top)
Package: aioconcurrency
aioconcurrencyRun a coroutine with each item in an iterable, concurrentlyInstallpip install aioconcurrencyUsage exampleimport aioconcurrency

items = [1, 2, 3, 4]
async def f(item):
    return item * 2

async def main():
    await aioconcurrency.map(items, f, concurrency=2)  # Returns [2, 4, 6, 8]

    async for result in aioconcurrency.each(items, f, concurrency=2):
        print(result)  # Prints 2 4 6 8 in random orderApiaioconcurrency.mapRuns the given coroutine concurrently with each item in an iterable.
The list of the return values will be ordered as if ran serially.itemsAn iterable object.coroCoroutine to feed each item to.optional: concurrencyNumber of concurrent runs ofcoro. Defaults toaioconcurrency.Infinite.optional: executorCan be an instance of ThreadPoolExecutor.optional: loopThe asyncio event loop that will be used.aioconcurrency.eachRuns the given coroutine concurrently with each item in an iterable.
Returns a generator that may be used to iterate over the return values. The generator yields values as soon as they are available.itemsAn iterable object. If anasyncio.Queueis passed then.eachwill read from it indefinitely.coroCoroutine to feed each item to.optional: concurrencyNumber of concurrent runs ofcoro. Defaults toaioconcurrency.Infinite.optional: executorCan be an instance of ThreadPoolExecutor.optional: loopThe asyncio event loop that will be used.optional: discard_resultsIf truthy, discard the return value ofcoro. Defaults to false.property: wait()Coroutine. May be used to wait until all items have been processed.property: processed_countThe number of items that have been processed so far.property: cancel()Cancels all runs ofcoro.Testspytest .
Package: aioconfig
aioconfigaioconfigefficientlyandthread-safelystores configurations in the
background (asynchronously).InstallationpipinstallaioconfigUsageThe interface ofaioconfigis dramatically easy to use.
For example, bothset(key, value)andawait set(key, value)store a pair of
key/value, which the former one is a fire-and-forget asynchronous function call
while the latter one blocks until the data written onto the disk.Initimportaioconfigstorage=aioconfig.get_storage(awaitaioconfig.attach('example.db'))section=awaitaioconfig.get('default')Deletesection.delete(key='foo')Blocking delete (wait until it's done)awaitsection.delete(key='foo')Getvalue1=awaitsection.get(key='foo',default='bar')value2=awaitsection.get(key='baz',default=12.3)Get allvalue=awaitsection.get_all()Set (fire-and-forget)section.set(key='foo',value='bar')section.set(key='baz',value=12.3)Blocking set (wait until it's done)awaitsection.set(key='foo',value='bar')awaitsection.set(key='baz',value=12.3)Batch set (fire-and-forget) (TBD)withstorage.transation():storage.set(key='foo',value='bar',section='default_section')storage.set(key='baz',value=12.3,section='default_section')Blocking batch set (wait until it's done) (TBD)asyncwithstorage.transation():storage.set(key='foo',value='bar',section='default_section')storage.set(key='baz',value=12.3,section='default_section')
Package: aioconsole
Asynchronous console and interfaces for asyncioaioconsoleprovides:asynchronous equivalents toinput,print,execandcode.interactan interactive loop running the asynchronous python consolea way to customize and run command line interface usingargparsestreamsupport to serve interfaces instead of using standard streamstheapythonscript to access asyncio code at runtime without modifying the sourcesRequirementsPython >= 3.8Installationaioconsoleis available onPyPIandGitHub.
Both of the following commands install theaioconsolepackage
and theapythonscript.$pip3installaioconsole# from PyPI$python3setup.pyinstall# or from the sources$apython-husage: apython [-h] [--serve [HOST:] PORT] [--no-readline]
               [--banner BANNER] [--locals LOCALS]
               [-m MODULE | FILE] ...

Run the given python file or module with a modified asyncio policy replacing
the default event loop with an interactive loop. If no argument is given, it
simply runs an asynchronous python console.

positional arguments:
  FILE                  python file to run
  ARGS                  extra arguments

optional arguments:
  -h, --help            show this help message and exit
  --serve [HOST:] PORT, -s [HOST:] PORT
                        serve a console on the given interface instead
  --no-readline         force readline disabling
  --banner BANNER       provide a custom banner
  --locals LOCALS       provide custom locals as a dictionary
  -m MODULE             run a python moduleSimple usageThe following example demonstrates the use ofawaitinside the console:$apythonPython 3.5.0 (default, Sep 7 2015, 14:12:03)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
---
This console is running in an asyncio event loop.
It allows you to wait for coroutines using the 'await' syntax.
Try: await asyncio.sleep(1, result=3, loop=loop)
--->>>awaitasyncio.sleep(1,result=3)# Wait one second...3>>>DocumentationFind more examples in thedocumentationand theexample directory.LimitationsThe python console exposed byaioconsoleis quite limited compared to modern consoles such asIPythonorptpython. Luckily, those projects gained greater asyncio support over the years. In particular, the following use cases overlap withaioconsolecapabilities:Embedding a ptpython console in an asyncio programUsing the await syntax in an IPython consoleContactVincent Michel:vxgmichel@gmail.com
Package: aiocontextvars
aiocontextvarsIMPORTANT:This package will be deprecated aftercontextvars asyncio backportis fixed. Before then, this library
experimentally provides the missing asyncio support for thecontextvarsbackport library. Please read more in Python 3.7contextvars
documentation.CompatibilityIn Python 3.7 this packageis100%contextvars.In Python 3.5 and 3.6, this package added asyncio support to the PEP-567
backport package also namedcontextvars, in a very different way than
Python 3.7contextvarsimplementation:call_soon()and family methods.Python 3.7 added keyword argumentcontexttocall_soon()and its family
methods. By default those methods will copy (inherit) the current context and
run the given method in that context. Butaiocontextvarswon’t touch the
loop, so in order to achieve the same effect, you’ll need to:loop.call_soon(copy_context().run, my_meth)Task local.Python 3.7 used above keyword argumentcontextinTaskto make sure
that each step of a coroutine is ran in the same context inherited at the time
its driving task was created. Meanwhile,aiocontextvarsusesTask.current_task()to achieve similar effect: it hacks asyncio and
attaches a copied context to the task on its creation, and replaces thread
local with current task instance to share the context. This behaves identically
to Python 3.7 in most times. What you need to do is to importaiocontextvarsbefore creating loops.Custom tasks and loops.Because above hack is done by replacingasyncio.get_event_loopandloop.create_task, therefore tasks and loops created by custom/private API
won’t behave correctly as expected, e.g.uvloop.new_event_loop()orasyncio.Task(). Also, event loops created before importingaiocontextvarsare not patched either. So over all, you should importaiocontextvarsat the beginning before creating event loops, and always useasyncio.*to operate loops/policies, and public asyncio API to create
tasks.CreditsFantix King is the author and maintainer of this library. This library is open
source software under BSD license.History0.2.1 (2018-10-24)Changed to single module layout.Updated README.0.2.0 (2018-09-09)This is a breaking change.Most implementation is replaced withcontextvars. In Python 3.5 and 3.6,aiocontextvarsdepends oncontextvarsthe PEP-567 backport in PyPI, and patches it to partially
support asyncio; in Python 3.7aiocontextvarsis only a delegate to the
built-incontextvarslibrary.ModifiedContextVar.set()to return a token.AddedContextVar.reset(token).RemovedContextVar.delete().Removedenable_inherit()anddisable_inherit(), inherit is always enabled.Addedcopy_context()andContext.run().RemovedContext.current()andContext.inherited.Fixed issue thatset_event_loop(None)fails (contributed by J.J. Jackson in #10 #11)0.1.2 (2018-04-04)Supported Python 3.5.0.1.1 (2017-12-03)Fixed setup.py0.1.0 (2017-12-03)First release on PyPI.
Package: aio-cooker-client
Cooker Client PythonPython (asyncio) client library for Quortex Cooker API.InstallationThis client can be installed by runningpip install aio_cooker_client. It requires Python 3.7+ to run.Usageimportaio_cooker_clientclient=aio_cooker_client.CookerClient(cooker_domain_name=DOMAIN_NAME,client_id=CLIENT_ID,client_secret=CLIENT_SECRET,cache_ttl=120,)cred=client.get_credential()
Package: aiocord
A modern API wrapper for Discord.InstallationpipinstallaiocordFeaturesComplete: Implements the entirety of Discord’s services.Asynchronous: Written in pureasynciofor native parallelism.Modular: Any component (such as HTTP) can be used in isolation.Ergonomic: Comes with extreme purpose-driven data reception and cacehing.Interactive: Supports slash-commands and related utilities out of the box.ExampleCreate awidget/__init__.pyfile.importaiocord@aiocord.widget.callback(aiocord.events.CreateMessage)asyncdefhandle(info,event):if(message:=event.message).author.id==info.client.cache.user.id:returnawaitinfo.client.create_message(message.channel_id,content=f'{message.author.mention()}said{message.content}!')And run the following in your terminal:aiocord--token<TOKEN>startwidgetThis is a simple example to get you started in seconds, but the library covers a vast wealth tools to fit any scenario.Check out theDocumentation’sExamplessection for more,
such as how to useCommandsandInteractions.
Package: aiocouch
aiocouchAn asynchronous client library for CouchDB 2.0 based on asyncio using aiohttpKey featuresAll requests are asynchronus using aiohttpSupports CouchDB 2.x and 3.xSupport for modern Python ≥ 3.7Library installationpip install aiocouchGetting startedThe following code retrieves and prints the list ofincredientsof theapple_pierecipe.
Theincredientsare stored as a list in theapple_pieaiocouch.document.Document,
which is part of therecipeaiocouch.database.Database. We use the context manageraiocouch.CouchDBto create a new session.fromaiocouchimportCouchDBasyncwithCouchDB("http://localhost:5984",user="admin",password="admin")ascouchdb:db=awaitcouchdb["recipes"]doc=awaitdb["apple_pie"]print(doc["incredients"])We can also create new recipes, for instance for some delicious cookies.new_doc=awaitdb.create("cookies",data={"title":"Granny's cookies","rating":"★★★★★"})awaitnew_doc.save()For further details please refer to the documentation, which is availablehere on readthedocs.org.Run examplesSetup the CouchDB URL and credentials using the environment variablesInstall dependencies usingpip install --editable '.[examples]'run for instancepython examples/getting_started.pyRun testsInstall dependencies usingpip install --editable '.[tests]'Setup the CouchDB URL and credentials using the environment variables (COUCHDB_HOST,COUCHDB_USER,COUCHDB_PASS)runpytest --cov=aiocouchGenerate documentationInstall dependencies usingpip install '.[docs]'switch to thedocsdirectory:cd docsrunmake html
Package: aiocqhttp
aiocqhttpaiocqhttp是OneBot(原酷Q的CQHTTP 插件) 的 Python SDK，采用异步 I/O，封装了 web 服务器相关的代码，支持 OneBot 的 HTTP 和反向 WebSocket 两种通信方式，让使用 Python 的开发者能方便地开发插件。本 SDK 要求使用 Python 3.7 或更高版本，以及建议搭配支持 OneBot v11 的 OneBot 实现。文档使用方法见文档。遇到问题如果在使用本 SDK 时遇到任何问题，请提交 issue，也欢迎参与项目开发，具体流程请参考贡献指南。
Package: aiocqhttp-sanic
CQHTTP Python Async SDKCQHTTP Python Async SDK 是酷Q的CQHTTP 插件的 Python SDK 异步版本，采用异步 I/O，封装了 web 服务器相关的代码，支持 CQHTTP 的 HTTP 和反向 WebSocket 两种通信方式，让使用 Python 的开发者能方便地开发插件。本 SDK 要求使用 Python 3.7 或更高版本、CQHTTP v4.8 或更高版本。CQHTTP Python SDK 同步版本见python-cqhttp。文档使用方法见文档。遇到问题如果在使用本 SDK 时遇到任何问题，请提交 issue，也欢迎参与项目开发，具体流程请参考贡献指南。
Package: aiocqlengine
aiocqlengineAsync wrapper for cqlengine of cassandra python driver.This project is built oncassandra-python-driver.Installation$pipinstallaiocqlengineChange log0.3.0Due toaiocassandrais not maintained, removed theaiocassandradependency.0.2.0Create new session wrapper forResultSet, users need to wrap session byaiosession_for_cqlengine:fromaiocqlengine.sessionimportaiosession_for_cqlengineAdd new method ofAioModelfor paging:asyncforresultsinAioModel.async_iterate(fetch_size=100):# Do something with resultspass0.1.1AddAioBatchQuery:batch_query=AioBatchQuery()foriinrange(100):Model.batch(batch_query).create(id=uuid.uuid4())awaitbatch_query.async_execute()Example usageimportasyncioimportuuidimportosfromaiocqlengine.modelsimportAioModelfromaiocqlengine.queryimportAioBatchQueryfromaiocqlengine.sessionimportaiosession_for_cqlenginefromcassandra.clusterimportClusterfromcassandra.cqlengineimportcolumns,connection,managementclassUser(AioModel):user_id=columns.UUID(primary_key=True)username=columns.Text()asyncdefrun_aiocqlengine_example():# Model.objects.create() and Model.create() in async way:user_id=uuid.uuid4()awaitUser.objects.async_create(user_id=user_id,username='user1')awaitUser.async_create(user_id=uuid.uuid4(),username='user2')# Model.objects.all() and Model.all() in async way:print(list(awaitUser.async_all()))print(list(awaitUser.objects.filter(user_id=user_id).async_all()))# Model.object.update() in async way:awaitUser.objects(user_id=user_id).async_update(username='updated-user1')# Model.objects.get() and Model.get() in async way:user=awaitUser.objects.async_get(user_id=user_id)awaitUser.async_get(user_id=user_id)print(user,user.username)# Model.save() in async way:user.username='saved-user1'awaituser.async_save()# Model.delete() in async way:awaituser.async_delete()# Batch Query in async way:batch_query=AioBatchQuery()User.batch(batch_query).create(user_id=uuid.uuid4(),username="user-1")User.batch(batch_query).create(user_id=uuid.uuid4(),username="user-2")User.batch(batch_query).create(user_id=uuid.uuid4(),username="user-3")awaitbatch_query.async_execute()# Async iteratorasyncforusersinUser.async_iterate(fetch_size=100):pass# The original cqlengine functions were still thereprint(len(User.objects.all()))defcreate_session():cluster=Cluster()session=cluster.connect()# Create keyspace, if already have keyspace your can skip thisos.environ['CQLENG_ALLOW_SCHEMA_MANAGEMENT']='true'connection.register_connection('cqlengine',session=session,default=True)management.create_keyspace_simple('example',replication_factor=1)management.sync_table(User,keyspaces=['example'])# Wrap cqlengine connectionaiosession_for_cqlengine(session)session.set_keyspace('example')connection.set_session(session)returnsessiondefmain():# Setup connection for cqlenginesession=create_session()# Run the example function in asyncio looploop=asyncio.get_event_loop()loop.run_until_complete(run_aiocqlengine_example())# Shutdown the connection and loopsession.cluster.shutdown()loop.close()if__name__=='__main__':main()LicenseThis project is under MIT license.
Package: aiocron
Usageaiocronprovide a decorator to run function at time:>>> import aiocron
>>> import asyncio
>>>
>>> @aiocron.crontab('*/30 * * * *')
... async def attime():
...     print('run')
...
>>> asyncio.get_event_loop().run_forever()You can also use it as an object:>>> @aiocron.crontab('1 9 * * 1-5', start=False)
... async def attime():
...     print('run')
...
>>> attime.start()
>>> asyncio.get_event_loop().run_forever()Your function still be available atattime.funcYou can also await a crontab. In this case, your coroutine can accept
arguments:>>> @aiocron.crontab('0 9,10 * * * mon,fri', start=False)
... async def attime(i):
...     print('run %i' % i)
...
>>> async def once():
...     try:
...         res = await attime.next(1)
...     except Exception as e:
...         print('It failed (%r)' % e)
...     else:
...         print(res)
...
>>> asyncio.get_event_loop().run_forever()Finally you can use it as a sleep coroutine. The following will wait until
next hour:>>> await crontab('0 * * * *').next()If you don’t like the decorator magic you can set the function by yourself:>>> cron = crontab('0 * * * *', func=yourcoroutine, start=False)Notice that unlike standard unix crontab you can specify seconds at the 6th
position.aiocronusecroniter. Refer to
it’s documentation to know more about crontab format.
Package: aiocronjob
aiocronjobSchedule and runasynciocoroutines and manage them from a web interface or programmatically using the rest api.Requires python >= 3.8How to installpip3installaiocronjobUsage exampleSeeexamples/simple_tasks.pyRest APIOpenlocalhost:8000/docsfor endpoints docs.curlexample:$curlhttp://0.0.0.0:8000/api/jobsTBDDevelopmentRequirements:Python>= 3.8 andPDMfor backendInstall dependencies$gitclonehttps://github.com/devtud/aiocronjob.git

$cdaiocronjob

$pdmsyncRun testspdmruncoveragerun-munittestdiscover

pdmruncoveragereport-m
Package: aiocrontab
AIOCRONTABSample project to "flex" my asyncio skills.Usageimporttimeimportaiocrontab@aiocrontab.register("*/5 * * * *")defprint_every_five_mminutes():print(f"{time.ctime()}: Hello World!!!!!")@aiocrontab.register("* * * * *")defprint_every_mminute():print(f"{time.ctime()}: Hello World!")aiocrontab.run()TODOsupport for diff timezonessupport for async tasktake logger as dependencyAdd more meaningful testsfix mypy errorsdocument the codebasedocument usage in readme