Saravanan666/pypi-org huggingface dataset:
Package: aio_ping
aio_pingAn asyncio-based python ping implementation using raw sockets.Compatible with Python 3.5 ff.Note that ICMP messages can only be sent from processes running as root   (in Windows, you must run this script as ‘Administrator’).Original VersionMatthew Dixon Cowlescopyleft 1989-2016 by the python-ping team, seeAUTHORSfor more details.license: GNU GPL v2, seeLICENSEfor more details.Usageusage: ping [-h] [-w TIMEOUT] [-c COUNT] [-i INTERVAL] [-4] [-6]
            [-I SOURCEINTF] [-s NUMDATABYTES] [-T] [-S SOURCEIP]
            hostname

A pure python implementation of the ping protocol. *REQUIRES ROOT*

positional arguments:
  hostname              The address to attempt to ping.

optional arguments:
  -h, --help            show this help message and exit
  -w TIMEOUT, --deadline TIMEOUT
                        The maximum amount of time to wait until ping times
                        out.
  -c COUNT, --request_count COUNT
                        The number of attempts to make. Zero=infinite.
  -i INTERVAL, --interval INTERVAL
                        Time between ping attempts
  -4, --ipv4            Flag to use IPv4.
  -6, --ipv6            Flag to use IPv6.
  -I SOURCEINTF, --interface SOURCEINTF
                        Interface to use.
  -s NUMDATABYTES, --packet_size NUMDATABYTES
                        Designate the amount of data to send per packet.
  -T, --test_case       Flag to run the default test case suite.
  -S SOURCEIP, --source_address SOURCEIP
                        Source address from which ICMP Echo packets will be
                        sent.Using as lib# python3
>>> from aio_ping import ping
>>> ping('google.com', timeout=3000, count=3, delay=0.5)
True
>>> ping('google.com', timeout=3000, count=3, delay=0.5, verbose=True)

PYTHON PING google.com (216.58.212.46): 1300 data bytes
72 bytes from 216.58.212.46: icmp_seq=0 ttl=59 time=4.42 ms
72 bytes from 216.58.212.46: icmp_seq=1 ttl=59 time=4.70 ms
72 bytes from 216.58.212.46: icmp_seq=2 ttl=59 time=4.44 ms
72 bytes from 216.58.212.46: icmp_seq=3 ttl=59 time=4.47 ms

----216.58.212.46 PYTHON PING Statistics----
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip (ms)  min/avg/max = 4.4/4.5/4.7

1Async usage is via the {Ping} class, which can be used like this:from aio_ping import Ping,VerbosePing
async def ping(hostname, verbose=True, handle_signals=False, **kw):
    """
    Send @count ping to @hostname with the given @timeout
    """
    ping = (VerbosePing if verbose else Ping)(verbose=verbose, **kw)
    if handle_signals: ping.add_signal_handler()
    await ping.init(hostname)
    res = await ping.looped()
    if verbose:
        ping.print_stats()
    ping.close()
    return rescontributeFork this repoonGitHubandsend pull requests. Thank you.Revision historyRevision historyLinksSourcecode at GitHubhttps://github.com/M-o-a-T/aioping
Package: aiopipe
aiopipe -- Multiprocess communication pipes for asyncioThis package wraps theos.pipesimplex communication pipe so it can be used as part of the non-blockingasyncioevent loop. A duplex pipe
is also provided, which allows reading and writing on both ends.Simplex exampleThe following example opens a pipe with the write end in the child process and the read
end in the parent process.>>>frommultiprocessingimportProcess>>>importasyncio>>>>>>fromaiopipeimportaiopipe>>>>>>asyncdefmain():...rx,tx=aiopipe()......withtx.detach()astx:...proc=Process(target=childproc,args=(tx,))...proc.start()......# The write end is now available in the child process...# and detached from the parent process.......asyncwithrx.open()asrx:...msg=awaitrx.readline()......proc.join()...returnmsg>>>>>>defchildproc(tx):...asyncio.run(childtask(tx))>>>>>>asyncdefchildtask(tx):...asyncwithtx.open()astx:...tx.write(b"hi from the child process\n")>>>>>>asyncio.run(main())b'hi from the child process\n'>>>Duplex exampleThe following example shows a parent and child process sharing a duplex pipe to exchange
messages.>>>frommultiprocessingimportProcess>>>importasyncio>>>>>>fromaiopipeimportaioduplex>>>>>>asyncdefmain():...mainpipe,chpipe=aioduplex()......withchpipe.detach()aschpipe:...proc=Process(target=childproc,args=(chpipe,))...proc.start()......# The second pipe is now available in the child process...# and detached from the parent process.......asyncwithmainpipe.open()as(rx,tx):...req=awaitrx.read(5)...tx.write(req+b" world\n")...msg=awaitrx.readline()......proc.join()...returnmsg>>>>>>defchildproc(pipe):...asyncio.run(childtask(pipe))>>>>>>asyncdefchildtask(pipe):...asyncwithpipe.open()as(rx,tx):...tx.write(b"hello")...rep=awaitrx.readline()...tx.write(rep.upper())>>>>>>asyncio.run(main())b'HELLO WORLD\n'>>>InstallationThis package requires Python 3.7+ and can be installed withpip:pip install aiopipe
Package: aio-pipe
AIO-PIPE========.. image:: https://travis-ci.org/mosquito/aio-pipe.svg:target: https://travis-ci.org/mosquito/aio-pipe:alt: Travis CI.. image:: https://img.shields.io/pypi/v/aio-pipe.svg:target: https://pypi.python.org/pypi/aio-pipe/:alt: Latest Version.. image:: https://img.shields.io/pypi/wheel/aio-pipe.svg:target: https://pypi.python.org/pypi/aio-pipe/.. image:: https://img.shields.io/pypi/pyversions/aio-pipe.svg:target: https://pypi.python.org/pypi/aio-pipe/.. image:: https://img.shields.io/pypi/l/aio-pipe.svg:target: https://pypi.python.org/pypi/aio-pipe/Real asynchronous file operations with asyncio support.Status------Development - BETAFeatures--------* aio-pipe is a helper for POSIX pipes.Code examples-------------Useful example... code-block:: pythonimport asynciofrom aio_pipe import AsyncPIPEasync def main(loop):p = AsyncPIPE(loop)for _ in range(1):await p.write(b"foo" * 1000)await p.read(3000)p.close()loop = asyncio.get_event_loop()loop.run_until_complete(main(loop))Write and read with helpers:.. code-block:: python
Package: aio-piston
Aio-pistonThis is an unoffical Api wrapper for thepiston code execution engineExamplesimportaio_pistonimportasyncioasyncdefmain():asyncwithawaitaio_piston.Piston()aspiston:out=awaitpiston.execute('print("hello world")',language="python")#execute the codeout2=awaitpiston.execute('print(input("what is your name"))',language="python",inputs="bob")returnout,out2#*OR* without a context managerpiston=awaitaio_piston.Piston()...#do stuff...#at the endawaitpiston.close()out,out2=asyncio.run(main())print(str(out))#full outputprint(vars(out).keys())#all the attributes of the response class
Package: aiopjlink
aiopjlinkA modern Python asyncio PJLink library (Class I and Class II).What is PJLink?Most projectors that have RJ45 ports on the back can be controlled viaPJLink.PJLink is a communication protocol and unified standard for operating and controlling data projectors viaTCP/IP, regardless of manufacturer.PJLink consists ofClass 1commands and queries, as well asClass 2notifications and extensions.Class 1 is the most common type of PJLink, and is used for basic commands such as power on/off, input selection, and adjusting volume.Class 2 is an extended version of the protocol that supports additional commands such as opening and closing the projector's lens cover, and is typically used by more sophisticated devices.What is aiopjlink?A Python library that usesasyncioto talk to one or more projectors connected to a network using the PJLink protocol.It has these advantages:✅ Clean modern asyncio API✅ High level API abstraction (eg.lamp.hours)✅ Pure Python 3 implementation (no dependencies)✅ Full suite of test cases✅ Context managers for keeping track of connections and resources✅ High quality error handlingUsageEach "connection" to a projector is managed through aPJLinkcontext manager.  Once this is connected, you access the different functions through a high level API (e.g.conn.power.turn_off(),conn.lamps.hours(),conn.errors.query(), etc).For example, create aPJLinkconnection to the projector and issue commands:asyncwithPJLink(address="192.168.1.120",password="secretpassword")aslink:# Turn on the projector.awaitlink.power.turn_on()# Wait a few seconds, then print out all the error information.awaitasyncio.sleep(5)print("errors = ",awaitlink.errors.query())# Then wait a few seconds, then turn the projector off.awaitasyncio.sleep(5)awaitlink.power.turn_off()DevelopmentWe use thePDM package manager.pdminstall--dev# install all deps required to run and test the codepdmrunlint# check code qualitypdmruntest# check all test cases run OKpdmpublish# Publish the project to PyPIOther notes:There are more "pdm scripts" in the.tomlfile.Set the env variableAIOPJLINK_PRINT_DEBUG_COMMSto print debug comms to the console.RoadmapPull requests with test cases are welcome. There are still some things to finish, including:Search Protocol (§3.2)Status Notification Prototol (§3.3)
Package: aioplemmy
AIOPlemmy: a Python package for accessing the Lemmy API asynchronouslyAIOPlemmy allows you to interact with any Lemmy instance using Python and theLemmyHttp API.WARNING:Plemmy is still in development and needs testing!InstallationFor the most up-to-date version of AIOPlemmy, clone and install from the repository:git clone https://github.com/schicksal-hq/plemmy-aio
cd plemmy
pip3 install .Basic usageInteract with a Lemmy instance using theLemmyHttpobject:importaiohttpimportasyncioimportorjsonfromaioplemmyimportLemmyHttp,responsesasyncdefmain():# Unlike in original Plemmy, Plemmy-AIO accepts aiohttp session from outside and relies on developer to set# base_url parametersess=aiohttp.ClientSession(base_url="https://lemmy.ml",json_serialize=lambdax:str(orjson.dumps(x)))lemmy=LemmyHttp(client=sess,key=None)# login anonymously (as guest, no key)# The API requests are async :3resp=awaitlemmy.get_community(name="anime")resp=responses.GetCommunityResponse(resp)print(resp)asyncio.run(main())Logging in:importaiohttpimportasyncioimportorjsonfromaioplemmyimportLemmyHttp,responsesasyncdefmain():sess=aiohttp.ClientSession(base_url="https://lemmy.ml",json_serialize=lambdax:str(orjson.dumps(x)))# Use anonymous access to log inkey=awaitLemmyHttp(client=sess,key=None).login("test@example.org","j12345678")# And then create the LemmyHttp instance you'll actually use.# Of course, you can (and should) reuse the same aiohttp session.lemmy=LemmyHttp(client=sess,key=key)resp=awaitlemmy.get_community(name="anime")resp=responses.GetCommunityResponse(resp)print(resp)asyncio.run(main())Catching errors:importaiohttpimportasyncioimportorjsonfromaioplemmyimportLemmyHttp,LemmyError,responsesasyncdefmain():sess=aiohttp.ClientSession(base_url="https://lemmy.ml",json_serialize=lambdax:str(orjson.dumps(x)))lemmy=LemmyHttp(client=sess,key=None)try:resp=awaitlemmy.get_community(name="nonexistingcommunity")resp=responses.GetCommunityResponse(resp)print(resp)exceptLemmyErrorase:# The error code will be in the `error` property# Keep in mind that this property will be set if and only if# the Lemmy API could generate a response.## Unexpected I/O and HTTP errors will trigger LemmyError, but will# not set the property.print(e.error)# should print COULDNT_FIND COMMUNITYasyncio.run(main())Full documentation and further API refinements are on their way, but in meantime you should check out source code
andexamplesfrom upstream. The method names are essentially the
same after all, and you're unlikely to spot any difference if you just pipe LemmyHttp results to Response objects.
The important differences are:aioplemmy has its LemmyHttp methods all async...and the methods return objects parsed from JSON response, not response itself...and methods occasionally throw LemmyErrorReporting issues, making contributions, etc.Pull requests and issues are welcome. You're also welcome to submit them to the upstream repository, I will pull the fixes from there :)
Package: aioplisio
aioplisio - Asynchronous wrapper for Plisio APIМодуль в разработке, сейчас недоступны методы withdrawУстановка 💾Установка, используя пакетный менеджер pip$ pip install aioplisioУстановка с GitHub(требуетсяgit)$ git clone https://github.com/Fsoky/aioplisio
$ cd aioplisio
$ python setup.py installИли$ pip install git+https://github.com/Fsoky/aioplisioДополнительно:Зарегистрируйтесь на сайтеPlisioи получите API-ключ.Официальная документация по API:PLISIO API DOCSПримеры использования:ШаблонimportasynciofromaioplisioimportAIOPlisioClientasyncdefmain()->None:asyncwithAIOPlisioClient("API-KEY")asplisio:...if__name__=="__main__":asyncio.run(main())Получение транзакцийasyncwithAIOPlisioClient("YOUR API-KEY")asplisio:transactions=awaitplisio.get.transactions()# You can pass txnID for search by itprint(transactions.data)Инвойсы (чеки)asyncwithAIOPlisioClient("YOUR API-KEY")asplisio:invoice=awaitplisio.invoice.create("ORDER-NAME",12345001,# Order numberamount=10# 10 USDTcurrency="USDT"# Cryptosource_currency="USD"# Fiatexpire_min=15)print(f"Your invoice:{transaction.data.invoice_url}")transaction=awaitplisio.get.transactions(invoice.data.txn_id)print(transaction.data.status)...И также другие методы
Package: aiopluggy
Pleaseread the docsto learn more!A definitive exampleimportaiopluggy,asynciohookspec=aiopluggy.HookspecMarker("myproject")hookimpl=aiopluggy.HookimplMarker("myproject")classMySpec(object):"""A hook specification namespace.
    """@hookspecdefmyhook(self,arg1,arg2):"""My special little hook that you can customize.
        """classPlugin_1(object):"""A hook implementation namespace.
    """@hookimpl.asyncioasyncdefmyhook(self,arg1,arg2):print("inside Plugin_1.myhook()")returnarg1+arg2classPlugin_2(object):"""A 2nd hook implementation namespace.
    """@hookimpldefmyhook(self,arg1,arg2):print("inside Plugin_2.myhook()")returnarg1-arg2asyncdefmain():# create a manager and add the specpm=aiopluggy.PluginManager("myproject")pm.register_specs(MySpec)# register pluginsawaitpm.register(Plugin_1())awaitpm.register(Plugin_2())# call our `myhook` hookresults=awaitpm.hook.myhook(arg1=1,arg2=2)print(results)asyncio.get_event_loop.run_until_complete(main())
Package: aiopokeapi
AioPokéApiAn Asynchronous API wrapper for thePokéApi.Report issue·Request feature·Fork project🗝️ Key FeaturesUse of modern Python keywords:asyncandawait.Every object is fully type hinted.Objects get cached, this increases speed and avoids unnecessary API requests.🌍 DocumentationAioPokéApi has a very minimal website, which you can findhere. It also has somedocumentation.☄️ Installationpipinstallaiopokeapi⚙️Didn't work?Depending on your Python installation, you might need to use one of the
following:Python is not in PATHpath/to/python.exe-mpipinstallaiopokeapiPython is in PATH but pip is notpython-mpipinstallaiopokeapiUnix systems can use pip3/python3 commandspip3installaiopokeapipython3-mpipinstallaiopokeapiUsing multiple Python versionspy-mpipinstallaiopokeapi🚀 Getting startedAiopoke's goal is to be simple and easy to use:importasyncioimportaiopokeasyncdefmain():client=aiopoke.AiopokeClient()ability=awaitclient.get_ability(1)generation=awaitability.generation.fetch()awaitclient.close()asyncio.run(main())Or even better, using a context manager:# in main()asyncwithaiopoke.AiopokeClient()asclient:ability=awaitclient.get_ability(1)generation=awaitability.generation.fetch()
Package: aio-pool
aio-poolExtending Python'smultiporcessing.Poolto support coroutine functions.Can be useful for when using a server with very high bandwidth or doing both very large IO and CPU tasks at the same time.All methods ofmultiprocessing.Poolare supported.All paramters for multiprocessing.Pool are supported.examples:Setting concurrency limit. This means each process can run with up to 8 concurrent tasks at a time.importasynciofromaio_poolimportAioPoolasyncdefpowlong(a):awaitasyncio.sleep(1)returna**2if__name__=='__main__':withAioPool(processes=2,concurrency_limit=8)aspool:results=pool.map(powlong,[iforiinrange(16)])# Should take 2 seconds (2*8).print(results)Async initliazers are also suppported.importasynciofromaio_poolimportAioPoolasyncdefstart(message):awaitasyncio.sleep(1)print(message)asyncdefpowlong(a):awaitasyncio.sleep(1)returna**2if__name__=='__main__':withAioPool(processes=2,concurrency_limit=8,initializer=start,init_args=("Started with AioPool",))aspool:results=pool.map(powlong,[iforiinrange(16)])# Should take 2 seconds (2*8).print(results)By default, AioPool also set up a default executor for any non-async tasks.The size can be determined bythreadpool_sizearguemnt, which defaults to 1.None default event loops(uvloopfor example) are supported as well, using theloop_initializerargument.Also, non-async functions are supported by default, as the AioPool worker identify if the function is async or not.If the function is not async, it runs inside the threadpool, to allow the requested concurrency.This means that order of execution is not guaranteed, even if the function is not async.However, the order of results is guaranteed through the pool API (map, starmap, apply, etc...).fromaio_poolimportAioPoolimportuvloopwithAioPool(loop_initializer=uvloop.new_event_loop,threadpool_size=4)pool:pool.map(print,[iforiinrange(8)])
Package: aiopriman
AioprimanAttention! the project is at the initial stage of development, so there may be changes that break backward compatibilityThis package provides the ability to manage asyncio synchronization primitives.
Allows you to create storages of primitives, provides convenient means for accessing them using context managers,
factories, creation and access to synchronization primitives by key.Designed to solve the problem of managing dynamically created synchronization primitives for different resources.Primitives are stored in memory only when needed.Installpip install aioprimanUsage ExamplesWorking with a specific type of Manager, storage data must be specified as a parameterimportasyncioimportloggingfromaiopriman.managerimportLockManager,SemaphoreManagerfromaiopriman.storageimportStorageDataasyncdefrun_lock(storage,name):logging.debug(f"START Lock{name}")asyncwithLockManager(storage_data=storage,key="test")aslock:logging.debug(f"HERE LOCKED{name}:{lock}")awaitasyncio.sleep(3)asyncdefrun_sem(storage,name):logging.debug(f"START Sem{name}")asyncwithSemaphoreManager(storage_data=storage,key="test",value=2)assem:logging.debug(f"HERE SEM LOCKED{name}:{sem}")awaitasyncio.sleep(3)asyncdefmain_run(*args):awaitasyncio.gather(*args)if__name__=='__main__':logging.basicConfig(level=logging.DEBUG,format='%(levelname)s:%(name)s:(%(filename)s).%(funcName)s(%(lineno)d):%(message)s')tasks=[]storage_data=StorageData()foriinrange(1,10):tasks.append(run_lock(storage_data,i))tasks.append(run_sem(storage_data,i))asyncio.run(main_run(*tasks))
Package: aioprint
aioprintaioprintprovides an asynchronous interface forprintby usingaiofilesas a backend.InstallationUsing PyPIpip3 install -U aioprintUsing git with this GitHub repopip3 install -U git+https://github.com/crrapi/aioprintUsageimportasyncioimportsysimportaioprintclassA:asyncdef__aiostr__(self):# The __aiostr__ magic method is preferred# over the __str__ method to provide# a coroutine interfacereturn"pony trick yasuo"asyncdefmain():awaitprint(["sub",2,"pew"],"he is great",end="",sep="LOL")a=A()awaitprint("error",file=sys.stderr)awaitprint(a,file="out.txt")loop=asyncio.get_event_loop()loop.run_until_complete(main())AcknowledgementsSpecial thanks toGelbpunkt aka Adrianfor reviving this and making it useful
Package: aio-prometheus-client
Asyncio Prometheus ClientPrometheus Http Client for Asyncio of Pythoninstallpip install aio-prometheus-clientusagefrom aio_prometheus_client import PrometheusClient

client = PrometheusClient('http://127.0.0.1:9090')
result = await client.query('http_requests_total')

for s in result.series:
    print(s.metric, s.value.timestamp, s.value.value)
Package: aioprometheus-summary
aioprometheus-summaryAioprometheus summary with quantiles over configurable sliding time windowInstallationpip install aioprometheus-summary==0.1.0This package can be found onPyPI.CollectingBasic usagefromaioprometheus_summaryimportSummarys=Summary("request_latency_seconds","Description of summary")s.observe({},4.7)With labelsfromaioprometheus_summaryimportSummarys=Summary("request_latency_seconds","Description of summary")s.observe({"method":"GET","endpoint":"/profile"},1.2)s.observe({"method":"POST","endpoint":"/login"},3.4)With custom quantiles and precisionsBy default, metrics are observed for next quantile-precision pairs((0.50, 0.05), (0.90, 0.01), (0.99, 0.001))but you can provide your own value when creating the metric.fromaioprometheus_summaryimportSummarys=Summary("request_latency_seconds","Description of summary",invariants=((0.50,0.05),(0.75,0.02),(0.90,0.01),(0.95,0.005),(0.99,0.001)),)s.observe({},4.7)With custom time window settingsTypically, you don't want to have a Summary representing the entire runtime of the application,
but you want to look at a reasonable time interval. Summary metrics implement a configurable sliding time window.The default is a time window of 10 minutes and 5 age buckets, i.e. the time window is 10 minutes wide, and
we slide it forward every 2 minutes, but you can configure this values for your own purposes.fromaioprometheus_summaryimportSummarys=Summary("request_latency_seconds","Description of summary",# time window 5 minutes wide with 10 age buckets (sliding every 30 seconds)max_age_seconds=5*60,age_buckets=10,)s.observe({},4.7)QueryingSuppose we have a metric:fromaioprometheus_summaryimportSummarys=Summary("request_latency_seconds","Description of summary")To show request latency bymethod,endpointandquntileuse next query:max by (method, endpoint, quantile) (request_latency_seconds)To only 99-th quantile:max by (method, endpoint) (request_latency_seconds{quantile="0.99")
Package: aioprometheus-thin
aioprometheus-thinThis package wraps the aioprometheus package and gives the developer the way of easy writing AsyncIO Prometheus custom collectors, without the need of any AsyncIO deep knowledge.Hi !Hello there.
This is my first python package, it's pretty small but has a big impact on my way of working.
I would like you guys to help me improve my Python skills with some issues/ implemntations improvments.
Thank youUsage ExamplesWill be added soon.
Package: aioproperty
Installpip3installaiopropertyDocumentationYou can find documentationhereDescriptionaioproperty presents async properties with both async getter and setter in one place.Example:fromaiopropertyimportaiopropertyimportasyncioclassSomeClass:@aiopropertyasyncdefhello(self,value):awaitasyncio.sleep(1)returnvaluesome_obj=SomeClass()some_obj.hello='hello'asyncdefrun():print(awaitsome_obj.hello)asyncio.run(run())aioproperty is not a property in a classic meaning, it keeps values inside asincio tasks. Once
you set a new value, it is scheduled in a task. If any task is running now, it will wait untill it is finished.
When you get value, you actually get a current task, and you can await it to get a value.
More of that: you can use math without awaiting like that:other=some_obj.hello+' byby'print(awaitother)We also introduce chaining:classSomeClass:@aiopropertyasyncdefhello(self,value):awaitasyncio.sleep(1)returnvalue@hello.chainasyncdefsome_more(self,value):push_value(value)Chains works like a reducer. It applies each function to a new value iteratively. It can return value or return nothing.
If nothing is return, the value will be kept asis. Anychainedfunction is inserted by default in the end of chain, but
you can control it with a priority parameter, or with is_first parameter. If is_first is True, it will be inserted in the
beginning of the chain.You can also use inheritance and modify inhereted properties with our special decoratorinject:classParent:@aiopropertyasyncdefhello(self,value):awaitasyncio.sleep(1)returnvalue@hello.chainasyncdefsome_more(self,value):push_value(value)classChild(Parent):@inject(Parent.hello,priority=100)asyncdefinjected_method(self,value):print('hello from injection')#another form of injection using name of a property@inject('hello')asyncdefinjected_method_2(self,value):print('hello from injection 2')Read more in ourdocs