Saravanan666/pypi-org huggingface dataset:
Package: asynch-lxneng
asynchIntroductionasynchis an asyncio ClickHouse Python Driver with native (TCP) interface support, which reuse most ofclickhouse-driverand comply withPEP249.Install>pipinstallasynchor if you want to installclickhouse-cityhashto enable
transport compression>pipinstallasynch[compression]UsageConnect to ClickHousefromasynchimportconnectasyncdefconnect_database():conn=awaitconnect(host="127.0.0.1",port=9000,database="default",user="default",password="",)Create table by sqlasyncdefcreate_table():asyncwithconn.cursor(cursor=DictCursor)ascursor:awaitcursor.execute('create database if not exists test')awaitcursor.execute("""CREATE TABLE if not exists test.asynch(`id`       Int32,`decimal`  Decimal(10, 2),`date`     Date,`datetime` DateTime,`float`    Float32,`uuid`     UUID,`string`   String,`ipv4`     IPv4,`ipv6`     IPv6)ENGINE = MergeTreeORDER BY id""")Usefetchoneasyncdeffetchone():asyncwithconn.cursor()ascursor:awaitcursor.execute("SELECT 1")ret=awaitcursor.fetchone()assertret==(1,)Usefetchmanyasyncdeffetchall():asyncwithconn.cursor()ascursor:awaitcursor.execute("SELECT 1")ret=awaitcursor.fetchall()assertret==[(1,)]UseDictCursorto get result with dictasyncdefdict_cursor():asyncwithconn.cursor(cursor=DictCursor)ascursor:awaitcursor.execute("SELECT 1")ret=awaitcursor.fetchall()assertret==[{"1":1}]Insert data with dictfromasynch.cursorsimportDictCursorasyncdefinsert_dict():asyncwithconn.cursor(cursor=DictCursor)ascursor:ret=awaitcursor.execute("""INSERT INTO test.asynch(id,decimal,date,datetime,float,uuid,string,ipv4,ipv6) VALUES""",[{"id":1,"decimal":1,"date":"2020-08-08","datetime":"2020-08-08 00:00:00","float":1,"uuid":"59e182c4-545d-4f30-8b32-cefea2d0d5ba","string":"1","ipv4":"0.0.0.0","ipv6":"::",}],)assertret==1Insert data with tupleasyncdefinsert_tuple():asyncwithconn.cursor(cursor=DictCursor)ascursor:ret=awaitcursor.execute("""INSERT INTO test.asynch(id,decimal,date,datetime,float,uuid,string,ipv4,ipv6) VALUES""",[(1,1,"2020-08-08","2020-08-08 00:00:00",1,"59e182c4-545d-4f30-8b32-cefea2d0d5ba","1","0.0.0.0","::",)],)assertret==1Use connection poolasyncdefuse_pool():pool=awaitasynch.create_pool()asyncwithpool.acquire()asconn:asyncwithconn.cursor()ascursor:awaitcursor.execute("SELECT 1")ret=awaitcursor.fetchone()assertret==(1,)pool.close()awaitpool.wait_closed()ThanksToclickhouse-driver, ClickHouse Python Driver with native interface support.LicenseThis project is licensed under theApache-2.0License.
Package: asynchron
asynchronPython service framework with code generator based on AsyncAPI specificationUsage exampleinstall and run codegenpoetryaddasynchron-Ecli
poetryrunasynchron-f/path/to/asyncapi.yamlcodegenpython-aio-pika-o/output/dirinstall dependencies for you generated codepoetryaddasynchron-Eaio-pikaDevelopmentUse bash script to install all necessary dependencies. It installs all defined extras frompyproject.toml./scripts/install-dev.sh
Package: asynchronet
Asynchronet (Under Construction)Inspired byNetmiko, Asynchronet is a multi-vendor library for asynchronously interacting with network devices through the CLI.Asynchronet is a fork ofNetdev, which is no longer maintained. This project was forked to continue to expand and enhance the existing capabilities while enabling community contribution.The key features are:Asynchronous CLI Interactions: Thanks toasyncssh, which powers asynchronet provides support for multiple SSH connections within a single event loop.Multi-Vendor Support: Currently twelve of the most popular networking hardware vendors are supported, with more to be added in the future.Autodetect Device Type: By portingNetmiko'sbattle-testedSSHDetectclass to work asynchronously withasyncssh, asynchronet makes automatic device type detection a breeze.Simple: Intuitive classes make it easy to interact with your favorite flavor of device.RequirementsPython 3.10+Installationpip install asynchronetExampleimportasyncioimportasynchronetasyncdeftask(param):asyncwithasynchronet.create(**param)asios:# Send a simple commandout=awaitios.send_command("show ver")print(out)# Send a full configuration setcommands=["line console 0","exit"]out=awaitios.send_config_set(commands)print(out)# Send a command with a long outputout=awaitios.send_command("show run")print(out)# Interactive dialogout=awaitios.send_command("conf",pattern=r"\[terminal\]\?",strip_command=False)out+=awaitios.send_command("term",strip_command=False)out+=awaitios.send_command("exit",strip_command=False,strip_prompt=False)print(out)asyncdefrun():device_1={"username":"user","password":"pass","device_type":"cisco_ios","host":"ip address",}device_2={"username":"user","password":"pass","device_type":"cisco_ios","host":"ip address",}devices=[device_1,device_2]tasks=[task(device)fordeviceindevices]awaitasyncio.wait(tasks)loop=asyncio.get_event_loop()loop.run_until_complete(run())
Package: asynchronizer
Asynchronizeris simple module that can be used to run multiple functions asynchronously. To convert a function, you just need to add a decorator@asynchronizeto the function. This project is still in development, so report any bugshere. For examples, see theexamples folderContentsRequirementsInstallationHow to useBasic useExample Script:Things to keep in mindAdvanced useContributingLicenseCopyrightRequirementspython 2.xorpython 3.xInstallationAsynchronizercan be installed using pip:pipinstallasynchronizerHow to useBasic useSuppose you have a function like this:importrequestsdefsend_requests():r=requests.get('http://httpbin.org/get')printr.status_codefor_inrange(20):send_requests()You can modify it like this to make it asynchronous:importrequestsfromasynchronizerimportasynchronize,Wait@asynchronizedefsend_requests():r=requests.get('http://httpbin.org/get')printr.status_codefor_inrange(20):send_requests()Wait()Example Script:This example script will take 55 seconds to run normally, but only 10 seconds when run asynchronouslyimporttimefromasynchronizerimportasynchronize,Wait,setWorkers@asynchronizedeffunc(i):time.sleep(i)printiforiinrange(1,11):func(i)Wait()Things to keep in mindThe functionWait()is necessary. IfWait()is not present, your script will end without waiting for any unfinished functions to finish.The functionWait()is also a blocking function, meaning that the execution of your script will pause here till all the async functions called before this are finished. This is why it should usually be added at the end of your scriptThe decorated functions are async to each other, but the code inside the functions is synchronous, which means this is wrong:# wrong way@asynchronizedefsend_requests():for_inrange(20):r=requests.get('http://httpbin.org/get')send_requests()and this is the correct way:# correct way@asynchronizedefsend_requests():r=requests.get('http://httpbin.org/get')for_inrange(20):send_requests()Instead of returning values from your functions, send them to a callback. For example:@asynchronizedefsend_requests():r=requests.get('http://httpbin.org/get')parse(r.text)# instead of return r.textAdvanced useIf you want to use a custom number of workers, just addsetWorkers(n)at the start of your script, withnbeing the number of concurrent greenlet threads you want. Default is 32.To assign priority to a specific function call, addpriority=nto the parameters of the function call, withnbeing the priority you want to set. For Example:func(param1,param2,param3,priority=2)ContributingIf you want to contribute to this project, feel free to send a Pull Request toGithubTo report any bugs or request new features, head over to theIssuespageLicenseLicensed underThe MIT License (MIT).CopyrightCopyright (c) 2016 Arsh
Package: asynchronous-requests
asynchronous_requestsBrings support forasync/awaitsyntax to Python's fabulousrequestslibrary.RequirementsPython 3.6+Installation$pipinstallasynchronous_requestsUsageJust usethe standard requests API, but useawaitfor making requests.Note: Useipythonto try this from the console, since it supportsawait.importasynchronous_requestsasrequestsresponse=awaitrequests.get('https://example.org')print(response.status_code)print(response.text)Or use explicit sessions, with an async context manager.importasynchronous_requestsasrequestsasyncwithrequests.Session()assession:response=awaitsession.get('https://example.org')print(response.status_code)print(response.text)Theasynchronous_requestspackage subclassesrequests, so you're getting all the
standard behavior and API you'd expect.Streaming responses & requestsTheiter_content()anditer_lines()methods are async iterators.response=awaitrequests.get('https://example.org',stream=True)asyncforchunkinresponse.iter_content():...The method signatures remain the same as the standardrequestsAPI:iter_content(chunk_size=1, decode_unicode=False)iter_lines(chunk_size=512, decode_unicode=False, delimiter=None)The methods will yield text ifdecode_unicodeis set and the response includes
an encoding. Otherwise the methods will yield bytes.You can also stream request bodies. To do this you should use an asynchronous
generator that yields bytes.asyncdefstream_body():...response=awaitrequests.post('https://example.org',data=stream_body())Mock RequestsIn some situations, such as when you're testing a web application, you may
not want to make actual outgoing network requests, but would prefer instead
to mock out the endpoints.You can do this using theASGISession, which allows you to plug into
any ASGI application, instead of making actual network requests.importasynchronous_requests# Create a mock service, with Starlette, Responder, Quart, FastAPI, Bocadillo,# or any other ASGI web framework.mock_app=...ifTESTING:# Issue requests to the mocked application.requests=asynchronous_requests.ASGISession(mock_app)else:# Make live network requests.requests=asynchronous_requests.Session()Test ClientYou can also useASGISessionas a test client for any ASGI application.You'll probably want to installpytestandpytest-asyncio, or something
equivalent, to allow you to writeasynctest cases.fromasynchronous_requestsimportASGISessionfrommyprojectimportappimportpytest@pytest.mark.asyncioasyncdeftest_homepage():client=ASGISession(app)response=awaitclient.get("/")assertresponse.status_code==200
Package: asynchrony
asynchronyPythonasyncioframework for writing safe and fast concurrent code.Features:Type annotated and type safeMakes it easy to work with cancellation, errors, and scheduling.Well tested and well documented.Zero dependency.Based on real world experience and pain.Installation and usagepython3-mpipinstallasynchronyA simple example of starting concurrent tasks for all URLs (maximum 100 tasks at the same time) and waiting for all of them to finish:fromasynchronyimportTasksasyncdefdownload_page(url:str)->bytes:...urls=[...]tasks=Tasks[bytes](timeout=10,max_concurrency=100)tasks.map(urls,download_page)try:pages=awaittasksexceptException:failed=sum(t.failedfortintasks)print(f'{failed}tasks failed')cancelled=sum(t.cancelledfortintasks)print(f'{cancelled}tasks cancelled')else:print(f'finished{len(tasks)}tasks')Seetutorialfor runnable usage examples.
Package: asynch-tikon93
asynchIntroductionasynchis an asyncio ClickHouse Python Driver with native (TCP) interface support, which reuse most ofclickhouse-driverand comply withPEP249.Install>pipinstallasynchUsageConnect to ClickHousefromasynchimportconnectasyncdefconnect_database():conn=awaitconnect(host="127.0.0.1",port=9000,database="default",user="default",password="",)Create table by sqlasyncdefcreate_table():asyncwithconn.cursor(cursor=DictCursor)ascursor:awaitcursor.execute('create database if not exists test')awaitcursor.execute("""CREATE TABLE if not exists test.asynch(`id`       Int32,`decimal`  Decimal(10, 2),`date`     Date,`datetime` DateTime,`float`    Float32,`uuid`     UUID,`string`   String,`ipv4`     IPv4,`ipv6`     IPv6)ENGINE = MergeTreeORDER BY id""")Usefetchoneasyncdeffetchone():asyncwithconn.cursor()ascursor:awaitcursor.execute("SELECT 1")ret=cursor.fetchone()assertret==(1,)Usefetchmanyasyncdeffetchall():asyncwithconn.cursor()ascursor:awaitcursor.execute("SELECT 1")ret=cursor.fetchall()assertret==[(1,)]UseDictCursorto get result with dictasyncdefdict_cursor():asyncwithconn.cursor(cursor=DictCursor)ascursor:awaitcursor.execute("SELECT 1")ret=cursor.fetchall()assertret==[{"1":1}]Insert data with dictfromasynch.cursorsimportDictCursorasyncdefinsert_dict():asyncwithconn.cursor(cursor=DictCursor)ascursor:ret=awaitcursor.execute("""INSERT INTO test.asynch(id,decimal,date,datetime,float,uuid,string,ipv4,ipv6) VALUES""",[{"id":1,"decimal":1,"date":"2020-08-08","datetime":"2020-08-08 00:00:00","float":1,"uuid":"59e182c4-545d-4f30-8b32-cefea2d0d5ba","string":"1","ipv4":"0.0.0.0","ipv6":"::",}],)assertret==1Insert data with tupleasyncdefinsert_tuple():asyncwithconn.cursor(cursor=DictCursor)ascursor:ret=awaitcursor.execute("""INSERT INTO test.asynch(id,decimal,date,datetime,float,uuid,string,ipv4,ipv6) VALUES""",[(1,1,"2020-08-08","2020-08-08 00:00:00",1,"59e182c4-545d-4f30-8b32-cefea2d0d5ba","1","0.0.0.0","::",)],)assertret==1Use connection poolasyncdefuse_pool():pool=awaitasynch.create_pool()asyncwithpool.acquire()asconn:asyncwithconn.cursor()ascursor:awaitcursor.execute("SELECT 1")ret=cursor.fetchone()assertret==(1,)pool.close()awaitpool.wait_closed()ThanksToclickhouse-driver, ClickHouse Python Driver with native interface support.LicenseThis project is licensed under theApache-2.0License.
Package: asynchttp
asynchttp is an almost drop in replacement for httplib2 that provides
asynchronous http request behavior.asynchttp uses python threading and Queues and provides callback mechanisms to
allow de-serialization and process to happen in the background (worker threads)
as well. You can queue up arbitrary numbers of requests and a specified maximum
number of workers will process each request in turn.There are two known differences between straight httplib2 and asynchttp:exceptions are thrown when the response and/or content is accessed. since
sending the request and receiving the response is happening in the background
exceptions won’t be thrown during the call to request.content (returned from request) is an object rather than a plain string. This
is required since the content isn’t actually known until the background worker
has completed the request, the returned content is a “promise” object of
sorts. It defines a __str__ method that should in most cases cause the object
to behave as required, but unfortunately there may be times when you have to
str(content) to force it in to a string to get the desired behavior. (a side
note, but content should really be a buffer/io object rather than a plain
string in the first place.)ExampleA simple example making a single request (not that interesting):>>> from asynchttp import Http
>>> http = Http()
>>> url = 'http://proximobus.appspot.com/agencies.json'
>>> response, content = http.request(url)
# http.request will return immediately and response and content will be
# "promise" objects that will block (if necessary) when accessed. you
# could/should continue to do other work or send off more requests here and
# when you're ready...
>>> print response.status
200
# if the request had already completed in the background the status code
# would immediately print. if not the script would block until the work had
# completed and then print.See the examples directory for more detailed/interesting examples.LoggingAsynchronous code can be a pain to debug so asynchttp is pretty aggressive when
it comes to logging. If you’re trying to track things down your best bet is
probably to turn on debug logging, at least for the asynchttp logger, and to use
a format that includes the the time and thread id or name.Adding the following snippet to your app should do the trick:import logging

fmt = '%(asctime)s %(thread)d %(name)s %(levelname)-8s %(message)s'
logging.basicConfig(level=DEBUG, format=format)
Package: async_http
OriginThis package was originally written as a sort of proof-of-concept github gist
on December 25, 2011 by Josiah Carlson. This updated package is copyright
2012, and is released under the GNU LGPL v2.1 license.DescriptionThis package offers the ability to connect to http servers via the asyncore
and asynchat modules, in an attempt to download files, or otherwise integrate
connecting to other services from within asyncore-derived services.Download FilesThe included async_http.get module, which can be used on the command line:$ python -m async_http.get <list of urls>… will fetch the provided urls in parallel. If you check the source for the
get.py module, you can see how you can override the http_body(), http_done(),
and http_close() method to (for example) fetch content remotely and possibly
redirect it somewhere else.By properly subclassing from DownloadFile you can serve remote files, similar
to the requested feature here:http://code.google.com/p/pyftpdlib/issues/detail?id=197Make OAuth RequestsThe included async_http.oauth module, which can be used on the command line:$ python -m async_http.oauth ckey,csecret [tkey,tsecret] <url>… will perform an Oauth 1.0a request against the provided url with the given
client key and secret, with optional token key and secret (your url will
determine whether you need a some sort of access or request token).FeaturesHTTP/HTTPSredirect supportchunked transfer encodingtimeoutstransparent gzip handling
(derived fromhttp://effbot.org/zone/consumer-gzip.htm)OAuth 1.0a client support (no other 3rd party libraries required)APIIf you want to write your own handlers for events, subclass from
_http.AsyncHTTPRequest, and override one or more of the following methods:def http_setup(self):
    '''
    Called just before the connection is set up. You can manipulate
    headers, request body, etc.
    '''

def http_response(self):
    '''
    Called after the response is read. You can handle redirects, perform
    additional logging, start a reply in a proxy, etc.
    '''

def http_body(self):
    '''
    Called at the end of every chunk with chunked transfer encoding, and
    any time data is read for the body otherwise.
    '''

def http_chunk(self):
    '''
    Called after every chunk with the chunked transfer encoding,
    immediately after the body callback.
    '''

def http_done(self):
    '''
    Called when the body has finshed being transferred. This will not be
    called when there is an error.
    '''

def http_close(self):
    '''
    Called when the connection has been closed.
    '''
Package: async-http2
async-http2asyncio-compatible HTTP2 client for Python based onreqwestRust crate and pyo3/pyo3-asyncioInstallationpipinstallasync-http2Usageimportasyncioimportloggingfromasync_http2importClientdefmain():logging.basicConfig(level=logging.INFO,format='%(asctime)-15s%(message)s')client=Client(timeout=60)loop=asyncio.get_event_loop()loop.run_until_complete(work(client))asyncdefwork(client):resp_data=awaitclient.get('http://localhost:1010',{'fast':'1',})logging.info(resp_data)if__name__=='__main__':main()LicenseThis work is released under the MIT license. A copy of the license is provided in theLICENSEfile.
Package: async-http-minimal
# Minimalistic async HTTP serverThis framework was inspired by [sanic](https://github.com/huge-success/sanic) framework.This framework designed to be fast and be capable to start within 1.5 seconds at max (see [cold start problem](https://medium.com/@denismakogon/investigating-pythons-performance-issue-cold-start-8ebf443a8a20)).## How to install```bashpip install async-http-minimal```## Example```pythonimport asyncioimport socketfrom async_http import appfrom async_http import routerfrom async_http import responseasync def hello(request):return response.text("hello-world!")if __name__ == "__main__":loop = asyncio.get_event_loop()sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)sock.bind(("localhost", 9999))rtr = router.Router()rtr.add("/hello", frozenset({"GET"}), hello)srv = app.AsyncHTTPServer(name="hello-world-server", router=rtr)start_serving, run_forever = srv.run(sock=sock, loop=loop)start_serving()# here you can do some additional operations before starting an infinite serving# can be helpful for unix sockets, etc.run_forever()```
Package: async-iamport
IAMPORT async python rest clientfromhttps://github.com/iamport/iamport-rest-client-python개선 사항sync -> asyncToken 재사용만료 60s 이상 남았을 경우 재사용그 이하일 경우 재인증.format() -> f-stringtyping 적용, mypy 적용변경 사항python2 지원 안함requests -> aiohttp기존 retry(3회) 옵션 제거작업 예정필수 필드 검증을 아에 제거하고 iamport api 의 응답만 확인하도록 해서 필드 변경에 대한 유연성 및 코드의 책임 범위를 낮추기기존 method 호환을 위해 유지추가 API는 path parameter 만 positional args 으로 처리, 나머지는 kwargs로 payload 담음함수들의 이름을 iamport api들의 호출 이름과 유사하게 전부 정리하기기존 client api 유지미구현 API 추가 예정param validation 제거type annotation 추가docstring 추가주의 사항사용 중 발생한 문제의 책임은 사용자에게 있습니다.iamport 정식 api로 동작 완전성 테스트 되지 않았습니다. url 이상 여부만 검증 되었습니다.Depspython >= 3.7Aiohttp >= 3.8.3arrow >= 1.2.3Installpip install async-iamportFastAPI ExamplefromfastapiimportFastAPIfromasync_iamportimportAsyncIamportDEFAULT_TEST_IMP_KEY="imp_apikey"DEFAULT_TEST_IMP_SECRET=("ekKoeW8RyKuT0zgaZsUtXXTLQ4AhPFW3ZGseDA6b""kA5lamv9OqDMnxyeB9wqOsuO9W3Mx9YSJ4dTqJ3f")async_iamport=AsyncIamport(imp_key=DEFAULT_TEST_IMP_KEY,imp_secret=DEFAULT_TEST_IMP_SECRET)app=FastAPI(on_shutdown=[async_iamport.close_session])mocked_response={"status":"paid","amount":1000,}@app.get("/")asyncdefroot():returnawaitasync_iamport.find_by_merchant_uid(merchant_uid="1234qwer")uvicorn main:app --reload
Package: async-icq
Async ICQ/VK Teams bot API wrapperPure Async Python interface for Bot API.Table of contentsIntroductionQuick startInstallingExamplesAPI descriptionIntroductionThis library provides complete ICQ/Myteam Bot API 1.0 interface and requires Python 3.5+Quick startCreate your own bot by sending the /newbot command toMetabotand follow the instructions.Note: a bot can only reply after the user has added it to his contact list, or if the user was the first to start a dialogue.You can configure the domain that hosts your ICQ server. When instantiating the Bot class, add the address of your domain.Example: Bot(token=TOKEN, url="https://api.icq.net"), by default we use the domain:https://api.icq.net(ICQ) orhttp://myteam.mail.ru(VK Teams)InstallingInstall using pip:pipinstall-Uasync-icqInstall from sources:gitclonehttps://github.com/dasshit/async-icq.gitcdasync-icq
pythonsetup.pyinstallExamplesBasic example of using this library will look like thisfromasync_icq.botimportAsyncBotfromasync_icq.eventsimportEvent# Creating botexample=AsyncBot(token='TOKEN',url='https://api.icq.net',)# Adding some basic event handler by decorators (handler must accept 2 arguments: bot and event)# Diffent decorators will set it up for diffent types of events@example.message_handler()asyncdefhello(event:Event):awaitevent.answer(text=f'Hi,{event.from_.userId}')awaitevent.log(f'Answered to{event.chat.chatId}to{event.from_.userId}')# Starting to poll new events and sending them to middleware and handlersexample.start_poll()Example of how to use this library could be found in async-icq/examplesAPI descriptionicq.com/botapi/agent.mail.ru/botapi/myteam.mail.ru/botapi/
Package: asyncify
asyncifyTLDR:Sync 2 Async decoratorInstall:pip install asyncifyUsage:importasyncify# ORfromasyncifyimportasyncifyfromasyncifyimportrun# asyncio.run polyfill for python36defadd(a,b):returna+bassertadd(1,2)==3@asyncifydefadd_async(a,b):returna+bres=awaitadd_async(1,2)assertres==3
Package: asyncify-python
A python library with helpful things to be used with asyncio!Documentationhttps://asyncify.readthedocs.io/en/latest/InstallationPython 3.7 or higher is required$pipinstall-Uasyncify-pythonExampleimportasyncifyimportrequests@asyncify.asyncify_funcdefget(url:str)->str:returnrequests.get(url).text# `get` is no longer a blocking function# it is now a coroutine functionasyncdefmain():text=awaitget('https://python.org')# this is very useful to turn a blocking library into an async libraryget=asyncify(requests.get)