Saravanan666/pypi-org huggingface dataset:
Package: aiochannel
aiochannel - AsyncIO ChannelChannel concept for asyncio.Installpip install aiochannelChangelogChangelogUsageBasicsChannelhas a very similar API toasyncio.Queue.
The key difference is that a channel is only considered
"done" when it has been both closed and drained, so calling.join()on a channel will wait for it to be both closed and drained (UnlikeQueuewhich will return from.join()once the queue is empty).NOTE:Closing a channel is permanent. You cannot open it again.importasynciofromaiochannelimportChannel# ...asyncdefmain():# A Channel takes a max queue size and an loop# both optional. loop is not recommended as# in asyncio is phasing out explicitly passed event-loopmy_channel:Channel[str]=Channel(100)# You add items to the channel withawaitmy_channel.put("my item")# Note that this can throw ChannelClosed if the channel# is closed, during the attempt at adding the item# to the channel. Also note that .put() will block until# it can successfully add the item.# Retrieving is done withmy_item=awaitmy_channel.get()# Note that this can also throw ChannelClosed if the# channel is closed before or during retrival.# .get() will block until an item can be retrieved.# Note that this requires someone else to close and drain# the channel.# Lastly, you can close a channel with `my_channel.close()`# In this example, the event-loop call this asynchronouslyasyncio.get_event_loop().call_later(0.1,my_channel.close)# You can wait for the channel to be closed and drained:awaitmy_channel.join()# Every call to .put() after .close() will fail with# a ChannelClosed.# you can check if a channel is marked for closing withifmy_channel.closed():print("Channel is closed")asyncio.run(main())Like theasyncio.Queueyou can also call non-async get and put:# non-async version of putmy_channel.put_nowait(item)# This either returns None,# or raises ChannelClosed or ChannelFull# non-async version of getmy_channel.get_nowait()# This either returns the next item from the channel# or raises ChannelEmpty or ChannelClosed# (Note that ChannelClosed emplies that the channel# is empty, but also that is will never fill again)As of0.2.0Channelalso implements the async iterator protocol.
You can now useasync forto iterate over the channel until it
closes, without having to deal withChannelClosedexceptions.# the channel might contain data hereasyncforiteminchannel:print(item)# the channel is closed and empty herewhich is functionally equivalent towhileTrue:try:data=yield fromchannel.get()exceptChannelClosed:break# process data here
Package: aiochat
Server Usageimportaiochatimportaiohttp.webclassAgent(aiochat.ServerAgent):@aiochat.useasyncdefjoin(self,*args,delimit=','):returndelimit.join(map(str,args))app=aiohttp.web.Application()routes=aiohttp.web.RouteTableDef()@routes.get('/connect')asyncdefhandle(request):websocket=aiohttp.web.WebSocketResponse()awaitwebsocket.prepare(request)agent=Agent()awaitagent.start(websocket)value='eggs and bacon and salad'# remote callresult=awaitagent.split(value,delimit=' and ')print('result:',result)# wait until disconnectionawaitagent.wait()returnwebsocketapp.router.add_routes(routes)aiohttp.web.run_app(app)Client UsageimportaiochatimportaiohttpimportasyncioclassAgent(aiochat.ClientAgent):@aiochat.useasyncdefsplit(self,value,delimit=','):returnvalue.split(delimit)loop=asyncio.get_event_loop()url='http://localhost:8080/connect'asyncdefmain():session=aiohttp.ClientSession(loop=loop)asyncdefconnect():whilenotsession.closed:try:websocket=awaitsession.ws_connect(url)exceptaiohttp.ClientError:awaitasyncio.sleep(0.5)else:breakreturnwebsocketagent=Agent(connect)awaitagent.start()values=('crooked man','mile','sixpence','stile')# remote callresult=awaitagent.join(*values,delimit=' ')print('result:',result)# disconnectawaitagent.stop()awaitsession.close()coroutine=main()loop.run_until_complete(coroutine)DetailsClients will attempt to auto-reconnect until told to stop.Method names have to follow python function name limitations.The reconnection protocol reserves thehelloalertmethods.Implementation reserves thebindwaitstartstopmethods.Annotations are not considered; schema checking should be done manually.Keyword arguments cannot be passed in a positional manner and vice versa.WebSockets should not be used outside of Agent context while connected.Installingpython3 -m pip install aiochat
Package: aioChatbase
aioChatbaseis a library forChatbase Generic Message APIwritten in Python 3.6 withasyncioandaiohttp.
It helps to integrate Chatbase with your chatbot.How to installpython3.6 -m pip install aioChatbaseHow to useImport ChatbasefromaiochatbaseimportChatbaseCreate cb instancecb=Chatbase(API_KEY,BOT_PLATFORM)Register handled messageawaitcb.register_message(user_id='123456',intent='start')Register non-handled messageawaitcb.register_message(user_id='123456',intent='unknown message',not_handled=True)Register url clickawaitcb.register_click(url='google.com')Close instance on your app shutdownawaitcb.close()ExamplesCheck more examples at the/examplesfolderWikiFeel free to read ourWiki
Package: aiocheck
aiocheckA python asyncio host health checker using native ping commands.Example:pip install aiocheck
aiocheck 10.20.30.40 10.20.30.50 10.20.30.60stdout:###########
# Running #
###########

Addresses: ['10.20.30.50', '10.20.30.40', '10.20.30.60']

Press CTRL+C to exitaiocheck_log.csv:address, alive, timestamp
10.20.30.60, False, 2020-06-22 17:35:40.398753
10.20.30.40, False, 2020-06-22 17:35:40.398729
10.20.30.50, False, 2020-06-22 17:35:40.398660For further details visit theDocumentation.InstallUsing pippip install aiocheck
aiocheck localhostUsing binary from GitHubgit clone https://github.com/kruserr/aiocheck.git
cd aiocheck
./bin/aiocheck.exe localhostFor further install instructions visit theDocumentation.DevelopOpen in VS Codegit clone https://github.com/kruserr/aiocheck.git
python -m pip install --upgrade pip setuptools wheel pytest tox twine pyinstaller
cd aiocheck
python -m pip install -e .
code .Run VS Code TasksCTRL+SHIFT+BorCTRL+P>Tasks: Run TaskFor further developing instructions visit theDocumentation.
Package: aiochris
aiochrisChRISPython client library built onaiohttp(async HTTP client) andpyserde(dataclassesdeserializer).InstallationRequires Python 3.10 or 3.11.pipinstallaiochris# orpoetryaddaiochrisFor convenience, container images are also provided.dockerpullghcr.io/fnndsc/aiochris:0.3.0Quick ExampleimportasynciofromaiochrisimportChrisClientasyncdefreadme_example():chris=awaitChrisClient.from_login(username='chris',password='chris1234',url='https://cube.chrisproject.org/api/v1/')dircopy=awaitchris.search_plugins(name_exact='pl-brainmgz',version='2.0.3').get_only()plinst=awaitdircopy.create_instance(compute_resource_name='host')feed=awaitplinst.get_feed()awaitfeed.set(name="hello, aiochris!")awaitchris.close()# do not forget to clean up!asyncio.run(readme_example())Documentation LinksClient documentation:https://fnndsc.github.io/aiochrisDeveloper documentation:https://github.com/FNNDSC/aiochris/wiki
Package: aiochroma
AIOChromaAIOChromais an API wrapper for communication with Razer Chroma devices.Up till now, it is mostly used for thecustom Chroma integration for Home Assistant. But you are welcome to use it for your purposes, as well as suggest new features which you would like to use.A short presentation of the features can be found in thisYouTube video.InstallationInstallation of the latest release is available from PyPI:pip install aiochromaUsageThis section is still under development.Supported devicesThis list provides only the models tested by me or other users.Some of the devices might be in the group which you would not expect. This is not related to the integration but to the Chroma SDK.GroupDevicesChromalinkChroma Addressable RGB Controller(link*)Mousepads:Goliathus Extended Chroma(link)Services:AuraConnectHeadsetKraken 7.1 V2(link),Kraken X USB(link)KeyboardBlackWidow Chroma(link),BlackWidow Elite(link),BlackWidow V3 Pro(link)Cynosa Chroma(link)Huntsman Elite(link),Huntsman V2 Analog(link)KeypadTartarus V2(link)MouseBasilisk(link)DeathAdder V2 Pro(link)Mamba Tournament Edition(link)Viper Ultimate(link) (+Mouse Dock) (link)MousepadBase Station V2 Chroma(link)Firefly V2(link)Mouse Bungee V3 Chroma(link)* As an Amazon Associate I earn from qualifying purchases. Not like I ever got anything yet (:Support the developmentThis library is a free-time project. If you like it, you can support me by buying a coffee.
Package: aiochsa
Clickhouse Python/asyncio library for use with SQLAlchemy coreExampleimportaiochsaimportsqlalchemyassatable=sa.Table('test',sa.MetaData(),sa.Column('id',sa.Integer),sa.Column('name',sa.String),)asyncwithaiochsa.connect('clickhouse://127.0.0.1:8123')asconn:awaitconn.execute(table.insert(),[{'id':1,'name':'Alice'},{'id':2,'name':'Bob'},],)rows=awaitconn.fetch(table.select())To addFINALmodifier usewith_hint(table, 'FINAL')(seeSQLAlchemy docs for details).Configure logging to show SQL:logging.getLogger('aiochsa.client.SQL').setLevel(logging.DEBUG)Custom type convertersHere is an example of installing converter for ClickHouse’sDateTimetype
that requires and returns timezone-aware Python’sdatetimeobject and
stores it as UTC:fromdatetimeimportdatetimeimportaiochsafromaiochsa.typesimportDateTimeUTCType,TypeRegistrytypes=TypeRegistry()types.register(DateTimeUTCType,['DateTime'],datetime)conn=aiochsa.connect(dsn,types=types)Change logSeeCHANGELOG.DevelopmentPrerequizites: Python (use pyenv to manage multiple versions), pip, tox,
coverage, docker, docker-compose.Running tests:# Run whole tests matrix:tox# Run test with specific Python version only:tox-epy38# Test with specific Clickhouse version:tox-epy38----clickhouse-version=21.2.2.8# Run specified test(s):tox-epy38--tests/test_execute.py::test_aggregate_function
Package: aiocian
aiocianDescriptionUnofficial library for interaction withCianContentsRelease Notes0.0.1Getting StartedInstallation from pipInstallation from GitHubQuick StartRelease NotesVersion 0.0.1Created libraryAdd simple searchGetting StartedInstallation from pipFor installation botovod library from pip you should have pip with python (prefer python3.6 or
later)pipinstallaiocianInstallation from GitHubTo basic installation from GitHub repository you should have git, python3 (prefer python3.6 or
later), pip (optionally) in your systemgitclonehttps://github.com/OlegYurchik/aiocian.gitcdaiocian
pipinstall.orgitclonehttps://github.com/OlegYurchik/aiocian.gitcdaiocian
pythonsetup.pyinstallQuick StartAfter installation, you can use the library in your code. Below is a sneak example of using the
libraryfromaiocianimportBUY,CianClient,FLAT,SPBimportasyncioasyncdefmain():asyncwithCianClient()asclient:search=client.search(region=SPB,action=BUY,places=(FLAT,))asyncforresultinsearch:print(result.url)loop=asyncio.get_event_loop()loop.run_until_complete(main)loop.close()
Package: aioclamd
aioclamdThis package is an asynchronous version of the pleasant packagepython-clamd. It has the same external
API, only all methods are coroutines and all communication is handled
asynchronously using theasyncioframework.TheClamdAsyncClientconnects to aClamAVantivirus instance and scans
files and data for malicious threats. This package does not bundle ClamAV in any way,
so a running instance of theclamddeamon is required.Installationpip install aioclamdUsageTo scan a file (on the system where ClamAV is installed):importasynciofromaioclamdimportClamdAsyncClientasyncdefmain(host,port):clamd=ClamdAsyncClient(host,port)print(awaitclamd.scan('/etc/clamav/clamd.conf'))asyncio.run(main("127.0.0.1",3310))# Output:# {'/etc/clamav/clamd.conf': ('OK', None)}To scan a data stream:importasyncioimportbase64fromioimportBytesIOfromaioclamdimportClamdAsyncClientEICAR=BytesIO(base64.b64decode(b"WDVPIVAlQEFQWzRcUFpYNTQoUF4pN0NDKTd9JEVJQ0FSLVNU"b"QU5EQVJELUFOVElWSVJVUy1URVNU\nLUZJTEUhJEgrSCo=\n"))asyncdefmain(host,port):clamd=ClamdAsyncClient(host,port)print(awaitclamd.instream(EICAR))asyncio.run(main("127.0.0.1",3310))# Output:# {'stream': ('FOUND', 'Win.Test.EICAR_HDB-1')}DevelopmentA local instance ofClamAVcan be had with Docker:dockerrun-p3310:3310--rmclamav/clamav
Package: aiocleverbot
aiocleverbotAn async python wrapper for cleverbot.
Does not require API KEYInstallationpip install aiocleverbotUsagefromaiocleverbotimportcleverbot# Without contextresponse=awaitcleverbot("Hello")print(response)# With context# Please note that context should include messages sent to Cleverbot as well as the responsesresponse=awaitcleverbot("Bad",["hi","How are you?"])print(response)
Package: aiocli
Async cli client/commander frameworkaiocli is a Python library for simple and lightweight async console runner.Full compatibility with argparse module and highly inspired by aiohttp module.InstallationUse the package managerpipto install aiocli.pipinstallaiocliDocumentationVisitaiocli docs.UsagefromloggingimportgetLogger,Logger,StreamHandlerfromosimportgetenvfromaiocli.commanderimportrun_app,Application,Depends,Stateapp=Application(state={'envs':{'LOGGER_NAME':str(getenv('LOGGER_NAME','example_app')),'LOGGER_LEVEL':str(getenv('LOGGER_LEVEL','INFO')),}})def_get_logger(state:State)->Logger:logger=getLogger(state.get('envs')['LOGGER_NAME'])logger.setLevel(state.get('envs')['LOGGER_LEVEL'])handler=StreamHandler()logger.addHandler(handler)returnlogger@app.command(name='greet:to',positionals=[('name',{'default':'World!'})])asyncdefhandle_greeting(name:str,logger:Logger=Depends(_get_logger))->int:logger.info(f'Hello{name}')return0@app.command(name='div',optionals=[('--a',{'type':float}),('--b',{'type':float})])asyncdefhandle_division(a:float,b:float,logger:Logger=Depends(_get_logger))->int:try:logger.info(f'Result{a}/{b}={(a/b)}')return0exceptBaseExceptionaserr:logger.error(f'Error:{err}')return1# python3 main.py <command> <positionals> <optionals>if__name__=='__main__':run_app(app)RequirementsPython >= 3.7ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.LicenseMIT
Package: aio-clickhouse
aiochaiochis a library for accessing a ClickHouse database over native interface from the asyncio.
It wraps features ofclickhouse-driverfor asynchronous usage.InstallationThe package can be installed usingpip:pipinstallaioclickhouseUsagefromdatetimeimportdatetimeimportasynciofromaiochimportClientasyncdefexec_progress():client=Client('localhost')progress=awaitclient.execute_with_progress('LONG AND COMPLICATED QUERY')timeout=20started_at=datetime.now()asyncfornum_rows,total_rowsinprogress:done=num_rows/total_rowsiftotal_rowselsetotal_rowsnow=datetime.now()# Cancel query if it takes more than 20 seconds to process 50% of rows.if(now-started_at).total_seconds()>timeoutanddone<0.5:awaitclient.cancel()breakelse:rv=awaitprogress.get_result()print(rv)asyncdefexec_no_progress():client=Client('localhost')rv=awaitclient.execute('LONG AND COMPLICATED QUERY')print(rv)loop=asyncio.get_event_loop()loop.run_until_complete(asyncio.wait([exec_progress(),exec_no_progress()]))For more information seeclickhouse-driverusage examples.Parametersexecutor- instance of custom Executor, if not supplied default executor will be usedloop- asyncio compatible event loopOther parameters are passing to wrapped clickhouse-driver's Client.Licenseaioch is distributed under theMIT license.
Package: aioclient
aioclientInstallationpipinstallaioclientUsageimportaioclientasyncdefget_example():status,headers,body=awaitaioclient.get('https://www.example.com/')print(body)Changelogv0.1.0GET requests returnstatus, headers, bodytuplesv0.2.0Support OPTIONS, HEAD, POST, PUT, PATCH, and DELETE requestsDeserialize text/xml responses as XML ElementTreev0.2.1Fix project description
Package: aio-clients
aiohttp clientWhat is the difference from aiohttp.Client?It is simpler and as a RequestsInstall beta:pipinstallaio-clientsExample:Base reqeust:importasynciofromaio_clientsimportHttp,Optionsasyncdefmain():r=awaitHttp().get('https://google.com',o=Options(is_json=False,is_close_session=True))print(f'code={r.code}body={r.body}')asyncio.run(main())Async reqeustimportasyncioimportaiohttpfromaio_clientsimportHttp,Optionsasyncdefon_request_start(session,trace_config_ctx,params):print("Starting request")asyncdefon_request_end(session,trace_config_ctx,params):print("Ending request")asyncdefmain():trace_config=aiohttp.TraceConfig()trace_config.on_request_start.append(on_request_start)trace_config.on_request_end.append(on_request_end)http=Http(host='https://google.com/search',option=Options(trace_config=trace_config,is_json=False),)r=awaitasyncio.gather(http.get(q_params={'q':'test'}),http.get(q_params={'q':'hello_world'}),http.get(q_params={'q':'ping'}),)print(f'status code={[i.codeforiinr]}body={[i.bodyforiinr]}')awaithttp.close()asyncio.run(main())Multipart reqeust:importasynciofromaio_clientsimportHttp,Optionsfromaio_clients.multipartimportEasy,Form,File,Writerasyncdefmain():withEasy('form-data')asform:form.add_form(Form(key='chat_id',value=12345123))form.add_form(Form(key='audio',value='hello world'))form.add_form(File(key='file',value=b'hello world file',file_name='test.py'))r=awaitHttp(option=Options(is_close_session=True,is_json=False)).post('http://localhost:8081',form=form,)writer=Writer()awaitform.write(writer)print(f'code={r.code}body={r.body}')print(f'full body:\n{writer.buffer.decode()}')asyncio.run(main())
Package: aiocloudpayments
aiocloudpaymentsPython AsyncCloudPaymentsLibraryClient Basic Usage Examplefrom datetime import date

from aiocloudpayments import AioCpClient


async def main():
    client = AioCpClient(PUBLIC_ID, API_SECRET)

    await client.test()

    await client.charge_card(
        amount=10,
        currency="RUB",
        invoice_id="1234567",
        ip_address="123.123.123.123",
        description="Payment for goods in example.com",
        account_id="user_x",
        name="CARDHOLDER NAME",
        card_cryptogram_packet="01492500008719030128SMfLeYdKp5dSQVIiO5l6ZCJiPdel4uDjdFTTz1UnXY+3QaZcNOW8lmXg0H670MclS4lI+qLkujKF4pR5Ri+T/E04Ufq3t5ntMUVLuZ998DLm+OVHV7FxIGR7snckpg47A73v7/y88Q5dxxvVZtDVi0qCcJAiZrgKLyLCqypnMfhjsgCEPF6d4OMzkgNQiynZvKysI2q+xc9cL0+CMmQTUPytnxX52k9qLNZ55cnE8kuLvqSK+TOG7Fz03moGcVvbb9XTg1oTDL4pl9rgkG3XvvTJOwol3JDxL1i6x+VpaRxpLJg0Zd9/9xRJOBMGmwAxo8/xyvGuAj85sxLJL6fA==",
        payer=Person(
            first_name="Test",
            last_name="Test",
            middle_name="Test",
            birth=date(1998, 1, 16),
            address="12A, 123",
            street="Test Avenue",
            city="LosTestels, City of Test Angels",
            country="Testland",
            phone="+1 111 11 11",
            post_code="101011010"
        )
    )

    await client.disconnect()AiohttpDispatcher Basic Usage Examplefrom aiocloudpayments import AiohttpDispatcher, Result
from aiocloudpayments.types import PayNotification, CancelNotification, CheckNotification


CERT_FILE = "cert.pem"
CERT_FILE = "pkey.pem"


def main():
    dp = AiohttpDispatcher()

    # router is not needed here, but I am just showing the logic
    router = Router()

    # register with router
    @router.cancel(lambda n: 5 > n.amount > 1)
    async def foo(notification: CancelNotification):
        print(f"{notification=}")
        # return {"result": 0}
        return Result.OK

    # register with router
    @router.pay(lambda n: n.amount <= 1)
    async def foo(notification: PayNotification):
        print(f"{notification.amount=}")
        # return {"result": 0}
        return Result.OK
        
   # register with router
    @router.check()
    async def foo(notification: CheckNotification):
        print(f"{notification.amount=}")
        # return {"result": 12}
        return Result.WRONG_AMOUNT

    # register with dp
    @dp.cancel(lambda n: n.amount > 5)
    async def foo(notification: CancelNotification):
        print(f"{notification.amount=}, > 5")
        # if you don't return anything, Result.OK is assumed

    dp.include_router(router)

    ssl_context = SSLContext()
    ssl_context.load_cert_chain(CERT_FILE, KEY_FILE)

    dp.run_app(
        AioCpClient(PUBLIC_ID, API_SECRET),
        "/test",
        pay_path="/pay",
        cancel_path="/cancel",
        ssl_context=ssl_context,
        check_hmac=False  # disable hmac check, only use in development environments
    )architecture inspired byaiogram
Package: aiocmdline
aiocmdlinePython has a builtin module that provides a line-oriented command interpreter.
However, the builtin module is difficult to use with async Python code. This
module provides a ready-to-use class that simplifies the implementation of
regular and async commands.Dependencies:aioreadlineExampleclass MyCmdline(AIOCmdline):
	def do_quit(self):
		self.stop_cmdloop()
	
	async def do_sleep(self, arg):
		await asyncio.sleep(int(arg))
		print("sleep done")

mycmdline = MyCmdline(prompt="mycmd> ", history=True)
mycmdline.cmdloop()
Package: aiocodingame
Use thecodingame moduleinstead.Install that module:pipinstallcodingame[async]To create an asynchronous client:importasyncioimportcodingameasyncdefmain():client=codingame.Client(is_async=True)# if you want to log inawaitclient.login("email@example.com","password")# get a codingamercodingamer=awaitclient.get_codingamer("username")print(codingamer.pseudo)# get the global leaderboardglobal_leaderboard=awaitclient.get_global_leaderboard()# print the pseudo of the top codingamerprint(global_leaderboard.users[0].pseudo)asyncio.run(main())
Package: aiocoingecko
Asynchronous CoinGecko API wrapperPython3 wrapper around theCoinGeckoAPI (V3)Features 100% API implementation and full Pythonic documentation.InstallationPyPIpipinstallaiocoingeckoUsageimportasynciofromaiocoingeckoimportAsyncCoinGeckoAPISessionasyncdefmain():asyncwithAsyncCoinGeckoAPISession()ascg:print(awaitcg.ping())asyncio.run(main())
Package: aiocomelit
aiocomelitPython library to control Comelit SimplehomeInstallationInstall this via pip (or your favourite package manager):pip install aiocomelitContributors ✨Thanks goes to these wonderful people (emoji key):This project follows theall-contributorsspecification. Contributions of any kind welcome!CreditsThis package was created withCopierand thebrowniebroke/pypackage-templateproject template.