Saravanan666/pypi-org huggingface dataset:
Package: asyncio-zabbix-sender
Zabbix senderDependency free implementation of the Zabbix Sender protocol using asyncio.Key features:Full specificationimplemented compared to other Zabbix sender implementationsCompressionis enabled as defaultAsynchronousimplementation allows the program to continue while waiting for a response from ZabbixInstallationThe package can be found on PyPI and installed using pip:pip install asyncio-zabbix-senderUsageThe measurements for theZabbix trapper item(s)can be sent using a high-level API.
TheMeasurementsobject is a collection of measurements.
The measurements can both be added via the constructor (as per the example below), but also dynamically via theadd_measurementmethod.importdatetimefromasyncio_zabbix_senderimportZabbixSender,Measurements,Measurementsender=ZabbixSender("example.com")measurements=Measurements([Measurement("vm-game-server","cheat.used[doom,player1]","idkfa",datetime.datetime.utcnow())])response=awaitsender.send(measurements)This package can also be used on a lower level to send packets directly.fromasyncio_zabbix_senderimportcreate_packet,ZabbixSenderpacket=create_packet(request=b'{"request":"sender data","data":[{"host":"<hostname>","key":"trap","value":"test value"}]}',use_compression=True)sender=ZabbixSender("example.com")response=awaitsender.send_packet(packet)LoggingThe logger can be configured by using the nameasyncio-zabbix-sender:importlogginglogger=logging.getLogger("asyncio-zabbix-sender")logger.setLevel(logging.DEBUG)Example from thetest_sendunit test by running pytest with--log-cli-level=DEBUG:DEBUG    asyncio-zabbix-sender:_protocol.py:47 Compressed packet: 40 bytes. Original 35.
DEBUG    asyncio-zabbix-sender:_zabbix_sender.py:63 Created packet from measurements. Used compression: True.
DEBUG    asyncio-zabbix-sender:_zabbix_sender.py:78 Sending packet: b'ZBXD\x03(\x00\x00\x00#\x00\x00\x00x\x9c\xabVJI,IT\xb2\x8a\x8e\xd5Q*J-,M-.Q\xb2R*N\xcdKI-R\x00K\xd5\x02\x00\xd3\xc2\x0b\xfb'
DEBUG    asyncio-zabbix-sender:_zabbix_sender.py:84 Got response: b'x\x9c\x15\xc8\xc1\n\x80 \x0c\x00\xd0_\x19;G\xa0\xd9!\xfd\x1a\xd1\t\x82l\xe2\xec\x14\xfd{y{\xbc\x07\x07i\x17VB\x0f\xa8wJ\xa4\x8a\x1b`\xe5"\xab\xfa\x90U\x94=8\x13\xa0\xc4\xda\x96m\x80)3\xb6\x7f\x8f\x00JI8+h\'\x9e\x1e\x0e\xb3;s^\x16\xdf\x0f\xc8\xd6\x1d\xb5'
INFO     asyncio-zabbix-sender:_zabbix_sender.py:87 Packet sent: 53 bytes. Response data received: 88 bytes. Response flags 3.
DEBUG    asyncio-zabbix-sender:_zabbix_sender.py:97 Parsed response payload: {'response': 'success', 'info': 'processed: 41; failed: 2; total: 43; seconds spent: 31.41592'}Note that only a summary of the packet that are send and the response received are logged as informational.
Everything else is logged at debug level.The INFO log entry contains the response flags.
A response flag are set by:0x01 - Zabbix communications protocol0x02 - If compression is used0x04 - If the response is a large packetRoad mapThe following improvements are planned (not necessary in order):Encryption between the sender and Zabbixconnection using TLS and a pre-shared key (psk)connection using TLS and a certificate (cert)Better error handlingMore documentation
Package: asyncipfscluster
Async IPFS APIInstallpipinstallasyncipfsclusterUsageimportasynciofromasyncipfsclusterimportIPFSClientclient=IPFSClient("http://127.0.0.1:9094")asyncdefmain():asyncwithclientassession:cid=awaitclient.add_bytes(b"Hello from cofob!","text/plain")print(cid)asyncio.run(main())
Package: async-iterator
async-iteratorEasy way to use async iterator without take care about asyncio’s TaskGroup.Documentation:https://async-iterator.lpthong90.devSource  Code:https://github.com/lpthong90/async-iteratorThe package helps to use async iterator without take care about asyncio's taskgroup.Installation$pipinstallasync-iterator---> 100%Successfully installed async-iteratorBasic Usageimportasyncioimporttimefromasync_iteratorimportaiter,siterinputs=[1,2,3]asyncdefafunc(it:int)->int:awaitasyncio.sleep(2)returnit+1defsfunc(it:int)->int:time.sleep(2)returnit+1asyncdefamain():returnawaitaiter(afunc)(inputs)defsmain():returnsiter(sfunc)(inputs)if__name__=="__main__":format="%Y-%m-%d%H:%M:%S"print(time.strftime(format))print("async",asyncio.run(amain()))# it takes ~2 secondsprint(time.strftime(format))print("sync",smain())# it takes ~6 secondsprint(time.strftime(format))Output2024-01-06 00:58:54
async [2, 3, 4]
2024-01-06 00:58:56
sync [2, 3, 4]
2024-01-06 00:59:02LicenseThis project is licensed under the terms of theMIT license.
Package: async-itertools
This library provides wrappers and routines inspired byitertoolsandmore_itertools, but forasynchronousiterables.This project is currently under development.
Feel free to share your thoughts or ideas by submitting an issue or start a discussion.Installasync-itertools requires python >= 3.8To install with pip, run:pip install async_itertoolsOverviewThis section gives a simple overview of all available functions.
For detailed usage, please refer to the document.categoryfunctionsgroupingwindowingwrappingas_asyncothersBuild and TestThis project uses PEP-517 packaging API. This requiresbuildpackage:pip install buildTo build bothsdistandwheelpackage, run:python -m buildTo install all development dependencies, run:pip install setuptools setuptools-scm tox coverage pytest pytest-cov mypy flake8 sphinx furoThis project usestoxto integrate linting and testing.
To run tests on all supported python versions(you will need to install them first), run:toxTo run static check(flake8) and type check(mypy) only, run:tox -e lintingTo run tests on specific python versions, for example, on cpython3.9 and 3.10, use:tox -e py39,py310The documents are built usingsphinxand thefurotheme.To build docs on linux, run:cd docs && make htmlLICENSEThis project is licensed under the MIT license.
For detailed information. please read theLICENSEfile in the repository.
Package: async-itunes-app-scraper-dmi
iTunes App Store ScraperThis defines a lightweight Python class that can be used to scrape app
information from the iTunes App Store. It defines a couple of methods that can
be used to get relevant app IDs given a set of parameters, and a couple of
methods to then scrape data about these app IDs.Much of this has been adapted fromapp-store-scraper, a
nodeJS-based scraper that does similar things. But this scraper uses Python.Getting startedThe following scrapes app details about all apps similar to the first result
for the 'fortnite' search query:fromitunes_app_scraper.scraperimportAppStoreScraperimportasyncioimportpprintasyncdefmain():scraper=AppStoreScraper()results=awaitscraper.get_app_ids_for_query("fortnite")# similar = await scraper.get_similar_app_ids_for_app(results[0])asyncforappinscraper.get_multiple_app_details(results):pprint.pprint(app)loop=asyncio.get_event_loop()loop.run_until_complete(main())Documentation is not available separately yet, but the code is relatively
simple and you can look in thescraper.pyfile to see what methods are
available and what their parameters are.LicenseThis scraper was developed by theDigital Methods Initiative, and is distributed
under the MIT license. See LICENSE for details.
Package: asyncj
AsyncJAsyncJ - Python module for fast asynchronous work with JSON filesExamplesGet a dictionary from a JSON file# Importing modulesimportasyncio# To run the asynchronous main() functionfromasyncjimportAsyncJson# Main class used in the example# Initialize the class with filenameasyncjson=AsyncJson("test.json")# The asynchronous main() functionasyncdefmain()->None:# Getting a dictionarydata:dict=awaitasyncjson.read()# Displaying the resulting dictionaryprint(data)# Running the asynchronous main() functionif__name__=="__main__":asyncio.run(main())Change dictionary in JSON file# Importing modulesimportasyncio# To run the asynchronous main() functionfromasyncjimportAsyncJson# Main class used in the examplefromrandomimportrandint# To generate a random number# Initialize the class with filenameasyncjson=AsyncJson("test.json")# The asynchronous main() functionasyncdefmain()->None:# Getting a dictionarydata:dict=awaitasyncjson.read()# Getting a random numberrandom_number:int=randint(100,999)# Setting a new random value in the dictionary for the "test" keydata["test"]=random_number# Writing the modified dictionary to a JSON fileawaitasyncjson.write(data)# Running the asynchronous main() functionif__name__=="__main__":asyncio.run(main())RequirementsPython version 3.8 or higher
Package: async-jaeger
Client-side library that can be used for distributed trace collection from
Python apps via TCP (HTTP) to Jaeger.See theOpenTracing Python APIfor additional detail.Installationpip3installasync-jaegerDebug Traces (Forced Sampling)ProgrammaticallyThe OpenTracing API defines asampling.prioritystandard tag that
can be used to affect the sampling of a span and its children:fromopentracing.extimporttagsasext_tagsspan.set_tag(ext_tags.SAMPLING_PRIORITY,1)Via HTTP HeadersJaeger Tracer also understands a special HTTP Headerjaeger-debug-id,
which can be set in the incoming request, e.g.curl-H"jaeger-debug-id: some-correlation-id"http://myhost.comWhen Jaeger sees this header in the request that otherwise has no
tracing context, it ensures that the new trace started for this
request will be sampled in the “debug” mode (meaning it should survive
all downsampling that might happen in the collection pipeline), and
the root span will have a tag as if this statement was executed:span.set_tag('jaeger-debug-id','some-correlation-id')This allows using Jaeger UI to find the trace by this tag.LicenseApache 2.0 License.
Package: asyncjob
asyncjobasyncjob- is just another simple scheduler for asyncio jobs.InstallThe package is available on PyPI.#python3-mpipinstallasyncjobVery fast usageimportasyncioimportasyncjobasyncdefcoro():...loop=asyncio.new_event_loop()scheduler=asyncjob.Scheduler(loop)job=[[loop.create_task(asyncio.sleep(2.0))],[loop.create_task(coro())]]scheduler.push_job(job)try:loop.run_until_complete(scheduler.run())exceptKeyboardInterruptasexc:scheduler.cancel()loop.run_until_complete(scheduler.wait_stopped())
Package: asyncjson
asyncjsonAsynchronous json library with support of nested awaitable objects in data.The most important features are supporting async functions and async generators on any level of
data structure, even for dict keys.Now the library contains async version ofjson.dumpsfunction. This library was made to help
stream the heavy json structures without blocking the event loop.Be aware, this is alpha version of library.Installingpip install asyncjsonExampleimportsysimportasyncioimportrandomimportstringimportasyncjsonasyncdefrandom_number():awaitasyncio.sleep(random.random())returnrandom.randrange(0,100)asyncdefrandom_strings():foriinrange(random.randint(0,10)):awaitasyncio.sleep(random.random())yield''.join(random.choice(string.ascii_letters)for_inrange(random.randint(1,10)))asyncdefrun():obj={'dictkey':{'list':[1,'2',3.0],'random strings':random_strings(),'random number':random_number(),random_strings():"joined random strings in key",random_number():"random number in key"},'another random number':random_number(),'awaitable objects in list':["sample",random_number(),random_strings(),[],{}],'intkey':123,'stringkey':"qwer",}asyncforiinawaitasyncjson.dumpgen(obj):sys.stdout.write(i)sys.stdout.flush()loop=asyncio.get_event_loop()loop.run_until_complete(run())Will give the result which will appear piece by piece because of sleeps added for
demonstration purposes:{"dictkey":{"list":[1,"2",3.0],"random strings":["IuaNSw"],"random number":65,"ZuuBZyEMYTtqyOzYoILOZXCgnTYYsu":"joined random strings in key",43:"random number in key"},"another random number":85,"awaitable objects in list":["sample",16,["wQ","Jp","xDfTNZCUv"],[],{}],"intkey":123,"stringkey":"qwer"}To be doneImplement async versions ofdump,loads,loadfunctionsImplement async encoder/decoder on C in order to increase performance
Package: asyncjsonrpc
asyncjsonrpcAn asynchronous JSON-RPC client/server for Python. Currently supports WebSocket transports, though more may be added in the future.Module documentationasyncjsonrpc on PyPiInstallInstall from PyPi via pip:pip3 install asyncjsonrpcFeaturesCompliant with the JSON-RPC 2.0 specificationTransport-agnostic design, could potentially work with any network protocol supported by Python and asyncioJSON-RPC over WebSockets support viaaiohttpUnimplemented JSON-RPC FeaturesBatched requestsManifestsExamplesSee the examples directory for more.Quick server exampleimportasyncjsonrpcfromaiohttpimportwebmethods=asyncjsonrpc.MethodGroup()@methods.methoddefgreet(name):returnf'Hello{name}!'rpcserver=asyncjsonrpc.server.AiohttpWebsocketServer(methods)app=web.Application()app.add_routes([web.get('/',rpcserver)])web.run_app(app)Quick client exampleimportasyncjsonrpc,asynciofromaiohttpimportwebasyncdefmain():client=asyncjsonrpc.client.AiohttpWebsocketClient()awaitclient.connect('http://localhost:8080/')print(awaitclient.greet('world'))asyncio.run(main())
Package: asynckafka
Fast python Kafka client for asyncio.
Asynckafka is written inCythonon top ofRdkafkaas Kafka driver.The documentation can be foundhere.FeaturesConsumer using a balanced groupProducerThe library was born as a project to learn Cython, right now it only has the basic
features implemented, some of the most important missing features are:Offset management in the consumerPrecise partition managementExamplesSimple consumerHow to use a consumer:consumer = Consumer(
    brokers='localhost:9092',
    topics=['my_topic'],
    group_id='my_group_id',
)
consumer.start()

async for message in consumer:
    print(f"Received message: {message.payload}")Simple producerHow to use a producer:producer = Producer(brokers="localhost:9092")
producer.start()
await producer.produce("my_topic", b"my_message")BenchmarkThe test was performed in June of 2018 using a single Kafka broker without replication.
The purpose of the benchmark was only to have an idea of the order of magnitude of the
library’s performance under these conditions.Comparison between asynckafka and aiokafka in production and consumption:ProductionConsumptionThe benchmark used for asynckafka is in benchmark directory while the
benchmark used for aiokafka is in its own repository, also in the benchmark folder.
Package: asyncKirara
Async-KiraraAn async port of pyKirara, that's about itUsageimportasyncKiraraimportasyncioasyncdefcards(loop):client=asyncKirara.Kirara()cards=awaitclient.get_id('card_t','uzuki',card_rarity='ssr')# Get all SSR card IDS for Uzukistuff=awaitclient.get_cards(cards,en_translate=True)# Converts IDS into card objectsforcardinstuff:# Print the cards' attributesprint('='*30)print(card.title)print(card.lead_skill.name)print(card.skill.name)print('\n')awaitclient.close()if__name__=='__main__':# Async loop stuffloop=asyncio.get_event_loop()loop.run_until_complete(cards(loop))RequirementsPython 3.6+ (Mabye I'll backport it to 3.5, if I feel like it)aiohttplibraryLicenseMIT
Package: asynckivy-ext-queue
QueueExtension forasynckivyprograms.fromkivy.appimportAppimportasynckivyasakfromasynckivy_ext.queueimportQueueasyncdefproducer(q):forcin"ABC":awaitq.put(c)print('produced',c)q.half_close()asyncdefconsumer(q):asyncforcinq:print('consumed',c)q=Queue(capacity=1)ak.start(producer(q))ak.start(consumer(q))App().run()produced A
consumed A
produced B
consumed B
produced C
consumed CTheconsumer()above can be written in more primitive way:fromasynckivy_ext.queueimportClosedasyncdefconsumer(q):try:whileTrue:c=awaitq.get()print('consumed',c)exceptClosed:passInstallationIt's recommended to pin the minor version, because if it changed, it means someimportantbreaking changes occurred.poetry add asynckivy-ext-queue@~0.2
pip install "asynckivy-ext-queue>=0.2,<0.3"Tested onCPython 3.9 + Kivy 2.2.1CPython 3.10 + Kivy 2.2.1CPython 3.11 + Kivy 2.2.1
Package: asynckraken
# Installation`pip install asynckraken`PyPI package [https://pypi.python.org/pypi/asynckraken](https://pypi.python.org/pypi/asynckraken)# Usage```pythonimport aiohttpimport asynciofrom asynckraken import Clientasync def main():client = Client(key='api_key', secret='api_secret')result_public = await client.query_public('Depth', {'pair': 'XETHZEUR'})print(result_public)result_private = await client.query_private('Balance')print(result_private)loop = asyncio.get_event_loop()loop.run_until_complete(main())```# DevelopmentRun with async python console: `docker-compose run shell`Tests: `docker-compose run tests`Full tests with type checking: `docker-compose run full_tests`# AttributionCore code is licensed under LGPLv3. See ``LICENSE.txt``.Thanks for veox for writting [https://github.com/veox/python3-krakenex](python3-krakenex). I was using that code as example.
Package: async-lichess-sdk
This package is meant to be an unofficial Python API Client for lichess.org.For information about the API please refer tohttps://lichess.org/apiEvery API endpoint uses async Python methods (asyncio).InstallationPypi:pip install async-lichess-sdkTest Pypi:pip install -i https://test.pypi.org/simple/ async-lichess-sdkDocumentationAuto generated documentationSample NotebookNotebook with all methodsDependenciesTo use this package you need to install all of the dependencies located underrequirements.txt.pipinstallrequirements.txtSupported python versions:python >= 3.6How to buildBuilding script is located underbuild.sh.Steps:shbuild.sh
pipinstall-U.Implemented Lichess EndpointsaccountboardsbotsbroadcastchallengesgamesmessagesrelationssimulationsstudiesteamstournamentsusersSample usageClient initialization and usageimportasynciofromlichess_clientimportAPIClientasyncdefmain():client=APIClient(token="your_lichess_account_token")response=awaitclient.account.get_my_profile()print(response)loop=asyncio.get_event_loop()loop.run_until_complete(main()).....{'metadata':{'method':<RequestMethods.GET:'GET'>,'url':'https://lichess.org/api/account/kid','content_type':'application/json','timestamp':b'Fri, 13 Mar 2020 19:05:27 GMT'},'entity':{'code':200,'reason':'OK','status':<StatusTypes.SUCCESS:'success'>,'content':{'kid':False}}}Access to the response propertiesprint(response.metadata.timestamp)b'Fri, 13 Mar 2020 19:11:32 GMT'print(response.entity.content){'kid':False}
Package: asynclog
## asynclog[![Build Status](https://travis-ci.org/unpluggedcoder/asynclog.svg?branch=master)](https://travis-ci.org/unpluggedcoder/asynclog) [![Coverage Status](https://coveralls.io/repos/github/unpluggedcoder/asynclog/badge.svg?branch=master)](https://coveralls.io/github/unpluggedcoder/asynclog?branch=master)`asynclog` provide the asynchronous way for python logging. Leave the logging I/O(especially the network I/O when we want to logging to a network endpoint) to the asynchronous thread or asynchronous task provided by [celery](http://www.celeryproject.org/) .#### Requirements* Python 3.5+#### Install```shellpip install asynclog```#### Usage* Config from dict```pythonlog_cfg = {'version': 1,'disable_existing_loggers': False,'formatters': {'simple': {'format': '%(asctime)s \n %(levelname)s \n %(message)s'},},'handlers': {'async_handler': {'level': 'INFO','formatter': 'simple','class': 'asynclog.AsyncLogDispatcher','func': '[Dot_Path_To_Your_Func]',}},'loggers': {'asynclogger': {'handlers': ['async_handler', ],'level': 'DEBUG','propagate': False,},}}logging.config.dictConfig(log_cfg)logger = logging.getLogger('asynclogger')logger.info('Test asynclog')```* Using thread```pythonimport loggingimport timefrom asynclog import AsyncLogDispatcherdef write_log(msg):# Do write stuff, such as write log msg into network.# ...time.sleep(0.5)logger = logging.getLogger()logger.setLevel(logging.INFO)handler = AsyncLogDispatcher(write_log)handler.setLevel(logging.INFO)logger.addHandler(handler)logger.info('Test Log')```* Using Celery```pythonfrom celery import shared_task@shared_taskdef write_task(msg):# Write log in Network IOprint(msg)celery_handler = AsyncLogDispatcher(write_task, use_thread=False, use_celery=True)celery_handler.setLevel(logging.INFO)logger.addHandler(celery_handler)logger.info('Test Log')```#### Test```shellpython3 -m unittest......----------------------------------------------------------------------Ran 6 tests in 0.007sOK```
Package: asyncloop
A Celery-like event loop with `asyncio` and no dependenciesIt runs anasyncioevent loop in a separate thread, drives native coroutines within the loop, and then returns the future in an asynchronous manner.DependencyIt requires Python 3.5+.Installation$ git clone https://github.com/dgkim5360/asyncloop.git
$ cd asyncloop
asyncloop$ python setup.py installGetting startedimport asyncio as aio

from asyncloop import AsyncLoop


# A simple job, which should be a native coroutine
async def job_to_wait(sleep_sec):
    await aio.sleep(sleep_sec)
    return sleep_sec


# A simple callback
def callback(fut):
    if fut.cancelled():
        print('CANCELLED:', fut)
    elif fut.done():
        print('DONE:', fut)
        print('RESULT:', fut.result()


# AsyncLoop starts
aloop = AsyncLoop()  # <AsyncLoop(Thread-##, initial)>
aloop.start()  # <AsyncLoop(Thread-##, started ##########)>

# Submit a job and be free to work on
# it returns an AsyncJob object, a simple wrapper of concurrent.Future
ajob = aloop.submit(job_to_wait(10), callback)
ajob  # <AsyncJob at 0x####>

# After 10 seconds the callback activated
# DONE: <Future at 0x#### state=finished returned int>
# RESULT: 10

# Get a result
ret = ajob.result()  # 10

# You MUST stop the aloop before exit or destroy
aloop.stop()  # <AsyncLoop(Thread-##, stopped ##########)>So far, that’s all.
Package: async-lru
info:Simple lru cache for asyncioInstallationpipinstallasync-lruUsageThis package is a port of Python’s built-infunctools.lru_cachefunction forasyncio. To better handle async behaviour, it also ensures multiple concurrent calls will only result in 1 call to the wrapped function, with allawaits receiving the result of that call when it completes.importasyncioimportaiohttpfromasync_lruimportalru_cache@alru_cache(maxsize=32)asyncdefget_pep(num):resource='http://www.python.org/dev/peps/pep-%04d/'%numasyncwithaiohttp.ClientSession()assession:try:asyncwithsession.get(resource)ass:returnawaits.read()exceptaiohttp.ClientError:return'Not Found'asyncdefmain():fornin8,290,308,320,8,218,320,279,289,320,9991:pep=awaitget_pep(n)print(n,len(pep))print(get_pep.cache_info())# CacheInfo(hits=3, misses=8, maxsize=32, currsize=8)# closing is optional, but highly recommendedawaitget_pep.cache_close()asyncio.run(main())TTL (time-to-live, expiration on timeout) is supported by acceptingttlconfiguration
parameter (off by default):@alru_cache(ttl=5)asyncdeffunc(arg):returnarg*2The library supports explicit invalidation for specific function call bycache_invalidate():@alru_cache(ttl=5)asyncdeffunc(arg1,arg2):returnarg1+arg2func.cache_invalidate(1,arg2=2)The method returnsTrueif corresponding arguments set was cached already,Falseotherwise.Python 3.8+ is requiredThanksThe library was donated byOcean S.A.Thanks to the company for contribution.