Saravanan666/pypi-org huggingface dataset:
Package: async-service
async-serviceLifecycle management for async applicationsRead more in thedocumentation on ReadTheDocs.View the change log.Quickstartpipinstallasync-serviceDeveloper SetupIf you would like to hack on async-service, please check out theSnake Charmers
Tactical Manualfor information on how we do:TestingPull RequestsCode StyleDocumentationDevelopment Environment SetupYou can set up your dev environment with:gitclonegit@github.com:ethereum/async-service.gitcdasync-service
virtualenv-ppython3venv
.venv/bin/activate
pipinstall-e.[dev]Testing SetupDuring development, you might like to have tests run on every file save.Show flake8 errors on file change:# Test flake8when-changed-v-s-r-1async_service/tests/-c"clear; flake8 async_service tests && echo 'flake8 success' || echo 'error'"Run multi-process tests in one command, but without color:# in the project root:pytest--numprocesses=4--looponfail--maxfail=1# the same thing, succinctly:pytest-n4-f--maxfail=1Run in one thread, with color and desktop notifications:cdvenv
ptw--onfail"notify-send -t 5000 'Test failure ⚠⚠⚠⚠⚠' 'python 3 test on async-service failed'"../tests../async_serviceRelease setupFor Debian-like systems:apt install pandocTo release a new version:makereleasebump=$$VERSION_PART_TO_BUMP$$How to bumpversionThe version format for this repo is{major}.{minor}.{patch}for stable, and{major}.{minor}.{patch}-{stage}.{devnum}for unstable (stagecan be alpha or beta).To issue the next version in line, specify which part to bump,
likemake release bump=minorormake release bump=devnum. This is typically done from the
master branch, except when releasing a beta (in which case the beta is released from master,
and the previous stable branch is released from said branch).If you are in a beta version,make release bump=stagewill switch to a stable.To issue an unstable version when the current version is stable, specify the
new version explicitly, likemake release bump="--new-version 4.0.0-alpha.1 devnum"
Package: async-services
Async ServicesRun fast asynchronous code from a synchronous code. Async Services provide a synchronous wrapper to run
third party asynchronous code or any coroutine for that matter in a synchronous way from a synchronous code.Installationpip install async_servicesFor Development PurposesInstall project Dependenciespip install -r requirements.txtpip install -U .Running the testsYou can run the tests with the following commandpytest .And coding style testspycodestyle .Example Usagefrom async_services.core import run_coro, run_manager, stop_manager
from async_services.core.manager import CoroStatus
import asyncio

async def coroutine(seconds=1, raise_exception=False):
    await asyncio.sleep(seconds)
    if raise_exception:
        raise Exception("Sample Exception")
    return "Hello World"

run_manager()
result = run_coro(coroutine(), block=True)
print(result)
assert result[0] == CoroStatus.Completed
assert result[1] == "Hello World"
stop_manager()OutputResult will be a tuple consisting of two values (status, result)
status will be a integer between 0 and 5 and it defines the state of the coruotine(1, 'Hello World')Coroutine StatusPresently there are six status of a coruotineQueued = 0                   -> Coroutine is still queued waiting to be executed or is being executedCompleted = 1                -> Coroutine has Completed SuccessfullyFailed = 2                   -> Coroutine Completed Successfully , But callback function raised an exceptionCancelled = 3                -> Coroutine was CancelledTimeout = 4                  -> Coroutine did not complete in the given timeCoroutineException = 5       -> Coroutine Itself Raised an ExceptionAuthorsAnkit Kathuria-Initial workLicenseThis project is licensed under the MIT License - see theLICENSE.mdfile for detailsAcknowledgmentsHat tip to anyone whose code was usedInspirationetc
Package: asyncsip
SIP support for AsyncIO written in pure Python.Warning: SIP knowledge is necessary to use this library. The public
API is currently very unstable.Seeexamples/folder for examples.Free software: Apache2 licenseFeatures tested on productionSIP endpoint client modeSIP proxy/server modeUDP and TCP supportREGISTERNOTIFYSUBSCRIBEINVITEMESSAGEMissing featuresDocumentationunit testsHistory0.2.0 (2017-09-14)A lot of bugs fixesProxy supportaiohttp dependency removed in favor of multidictCode refactoringSpecial thanks to Simon Gomizelj (vodik) on this release: almost come from his contributions0.1.0 (2014-12-28)First release on PyPI.
Package: asyncsleepiq
AsyncSleepIQAsyncSleepIQ is an library for accessing the SleepIQ API from Python.SleepIQis an addon forSleepNumber beds.InstallationpipinstallasyncsleepiqUsageThe library is structured with classesSleepIQBed,SleepIQSleeper, andSleepIQFoundationthat get updated with data fetched through the API.After creating an intsance ofAsyncSleepIQ()theloginfunction should be called, followed by theinit_beds()function to initialize the data structures and fetch the static data from the API.  Following that, thefetch_bed_statuses()function can be called to get updated bed occupancy and sleep number values.There are two authentication methods available: The older API with key parameter and the newer cookie-based Authentication header.  As of Feb-2022 both work equally well.Thelogin()function should only be called once when the program is started, thefetch_bed_statuses()can be called more frequently to get the bed state.  When implementing, do not poll the API by callinglogineach time, instead keep the sameAsyncSleepIQobject and fetch data as needed.  The library will re-authenticate automtically if the original authentication expires.Here is a full exampleimportasynciofromasyncsleepiqimportAsyncSleepIQ,LOGIN_KEY,LOGIN_COOKIEemail="user@example.com"password="passw0rd"asyncdefmain():api=AsyncSleepIQ(login_method=LOGIN_COOKIE)print(f"Logging in as{email}...")awaitapi.login(email,password)print("Initializing bed data...")awaitapi.init_beds()awaitapi.fetch_bed_statuses()print("Beds:")forbedinapi.beds.values():print(bed)bed=list(api.beds.values())[0]awaitbed.fetch_pause_mode()print(f"Pause mode:{bed.paused}")awaitbed.set_pause_mode(notbed.paused)awaitbed.fetch_pause_mode()print(f"New Pause mode:{bed.paused}")print("Calibrating...")awaitbed.calibrate()print("Stopping pump...")awaitbed.stop_pump()asyncio.get_event_loop().run_until_complete(main())Future DevelopmentWithout documentation for the API, development requires obvserving how other interfaces interact with it.  Given the hardware dependencies are fairly high, any future development requires someone with the appropriate bed to be able to obvserve and test against.Special ThanksThanks to all the other people that have tried to dig into this API, especially the projects:https://github.com/technicalpickles/sleepyq(python)https://github.com/erichelgeson/sleepiq(swagger)https://github.com/DeeeeLAN/homebridge-sleepiq(javascript)https://bitbucket.org/Esity/sleepiq/(ruby)https://javalibs.com/artifact/org.syphr/sleepiq-api(java)
Package: asyncspotify
asyncspotify is an asynchronous, object-oriented python wrapper for the Spotify Web API.InstallationSimply install the library from PyPI:python-mpipinstallasyncspotifyDocumentationThe documentation can be found atreadthedocs.UsageTo get going quickly, read thequickstart.For complete examples, please check the documentation. Here’s some snippets:Authenticating using the Client Credentials flow, and getting a playlist:fromasyncspotifyimportClient,ClientCredentialsFlowauth=ClientCredentialsFlow(client_id='your client id',client_secret='your client secret',)asyncwithClient(auth)assp:playlist=awaitsp.get_playlist('1MG01HhbCvVhH9NmXhd9GC')asyncfortrackinplaylist:print(track.name)Searching for and getting tracks:results=awaitsp.search_tracks(q='involvers',limit=2)# [<SimpleTrack id='5xoJhWwvzPJD9k8j8BE2xO' name='27'>, <SimpleTrack id='0WUTBejxPUhURFCFfSYbDc' name='Fighting My Fight'>]track=awaitsp.get_track('0hqAWKZDhuOfFb6aK002Ph')# <FullTrack id='0hqAWKZDhuOfFb6aK002Ph' name='Bone Dry'>Fetching and creating playlists:# get a playlistplaylist=awaitsp.get_playlist('1wPvaRtuI8mt10CpP2KnlO')# <FullPlaylist id='1wPvaRtuI8mt10CpP2KnlO' name='my playlist'># iterate through playlist tracksfortrackinplaylist.tracks:print(track)# get current userme=awaitsp.get_me()# <PrivateUser id='runie13'># create new playlistmy_playlist=awaitme.create_playlist(name='My playlist!')# <FullPlaylist id='0YTCnj0WE5gGb1lRqD6Ks9' name='My playlist!'># add tracks from previews playlist to the new playlistawaitmy_playlist.add_tracks(*playlist.tracks)Reporting bugsPlease report issues here atGitHub.
Package: async-spotify
AsyncSpotifyDocumentationThe full documentation can be viewedhere.Why should you use this library100% Code coverageCompletely type annotatedCompletely asyncScales up to (theoretically) unlimited requests per second (tested with 1000 simultaneous requests which lead to a 429)Customize the timeout, maximal simultaneous requestThrows custom errors, so you can catch different errors easily
+ Token expiration
+ Rate limit violation
+ An invalid album idGets rid of the client credential workflow if you provide spotify cookiesGood for automated testingOffers a hook which gets called if the token expires, so you can automatically update the tokenInstallationYou need at least python3.6 to install the packagepipinstallasync-spotifyExampleFor more in depth examples take a lookhereor visit the documentation.fromasync_spotifyimportSpotifyApiClientfromasync_spotify.authentificationimportSpotifyAuthorisationTokenfromasync_spotify.authentification.authorization_flowsimportAuthorizationCodeFlow# Create a auth_code_flow object and load the auth_code_flow from env variablesauth_flow=AuthorizationCodeFlow()auth_flow.load_from_env()# Create a new Api client and pass the auth_code_flowapi_client=SpotifyApiClient(auth_flow,hold_authentication=True)# Get the auth token with your codecode:str="Your Spotify Code"auth_token:SpotifyAuthorisationToken=awaitapi_client.get_auth_token_with_code(code)# Create a new clientawaitapi_client.create_new_client(request_limit=1500)# Start making queries with the internally saved tokenalbum_tracks:dict=awaitapi_client.albums.get_tracks('03dlqdFWY9gwJxGl3AREVy')# If you pass a valid auth_token this auth_token will be used for making the requestsalbum_tracks:dict=awaitapi_client.albums.get_tracks('03dlqdFWY9gwJxGl3AREVy',auth_token)# Every argument mentioned by the Spotify API can be passed as kwarg. The client will figure out if your provided kwarg# should be added to the request body, or the urlawaitapi_client.player.play(context_uri="spotify:album:5ht7ItJgpBH7W6vJ5BqpPr",device_id="whatever_id")#                                 ^                                                 ^#                                URL                                               BODYTestsSeehere.
Package: async-sqlalchemy
asyncnsqasyncio sqlalchemy support,with async/awaitadd asyncio sqlalchemy supportInstallpip install async-sqlalchemyUsage examplesimportasynciofromsqlalchemyimportInteger,Column,String,ForeignKeyfromasync_sqlalchemy.manager.async_pgimportPostgresManagerfromasync_sqlalchemy.model.mixinimportMixinfromsqlalchemy.ext.declarativeimportdeclarative_basefromsqlalchemy.ormimportrelationshipfromsqlalchemy.sqlimportselectdsn="postgres://postgres:test@localhost:2345/test"conf={'dsn':dsn}Base=declarative_base()Manager=PostgresManager(conf=conf)classUser(Mixin,Base):_manager=Manager__tablename__='test'id=Column(Integer,autoincrement=True,primary_key=True)name=Column(String(50))def__repr__(self):return"<User(name='%s', id='%s')>"%(self.name,self.id)classParent(Mixin,Base):__tablename__='parent'_manager=Managerid=Column(Integer,primary_key=True)child=relationship("Child",lazy='joined')classChild(Mixin,Base):_manager=Manager__tablename__='child'id=Column(Integer,primary_key=True)parent_id=Column(Integer,ForeignKey('parent.id'))parent=relationship("Parent",back_populates="child")if__name__=='__main__':loop=asyncio.get_event_loop()loop.run_until_complete(Manager.connect())result=loop.run_until_complete(Manager.get(User.objects([User.id]).join(Parent.__table__,Parent.id==User.id)))print(result)# result = loop.run_until_complete(Child.create_table())# print(result)# u = loop.run_until_complete(User.create(name='test'))# print('create', u)# print('get', loop.run_until_complete(User.get(name='test')))# print('all', loop.run_until_complete(User.all()))# u.name = 'aaa'# print('save', loop.run_until_complete(u.save()))LicenseThe asyncnsq is offered under MIT license.
Package: asyncsqlite3
asyncsqlite3 - asynchronous driver for sqlite3.Asynchronous interface with context managers for sqlite database:asyncwithasyncsqlite3.connect(...)asconn:asyncwithconn.execute("INSERT INTO some_table ..."):awaitconn.commit()asyncwithconn.execute("SELECT * FROM some_table")ascursor:rows=awaitcursor.fetchall()And without context managers:conn=awaitasyncsqlite3.connect(...)cursor=awaitconn.execute("SELECT * FROM some_table")rows=awaitcursor.fetchall()awaitcursor.close()awaitconn.close()Connection pool and transaction:asyncwithasyncsqlite3.create_pool(...,min_size=1,max_size=2)aspool:asyncwithpool.acquire(timeout=1.5)asconn:# You can use a timeout when getting a connection from queue.asyncwithconn.transaction():asyncwithconn.execute("INSERT INTO some_table ..."):...asyncwithpool.acquire()asconn:asyncwithconn.execute("SELECT id, name FROM some_table")ascursor:asyncforrowincursor:print(row)# <Record id=1 name='alex'>print(row[0],row["id"],row.get("id"))# 1 1 1print(dict(row))# {'id': 1, 'name': 'alex'}print(tuple(row),list(row),set(row))# (1, 'alex') [1, 'alex'] {1, 'alex'}Installationasyncsqlite3 is compatible with Python 3.7 and newer. Use pip to install:$ pip install asyncsqlite3You can speed up asyncsqlite3 as follows:$ pip install asyncsqlite3[uvloop]DetailsHow you see this module very look likeaiosqliteandasyncpg.Implicit transactions are turned off, but you can use Connection methodtransaction.LicenseMIT
Package: async-sqs-consumer
Async SQS consumerPython asynchronous (async/await) worker for consuming messages
from AWS SQS.This is a hobby project, if you find the project interesting
any contribution is welcome.UsageYou must create an instance of the worker with the url of the queue.Aws credentials are taken from environment variables, you must set the
following environment variables. Or you can provide a Context object with the
aws credentialsasync_sqs_consumer.types.ContextAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYExample:You can get the queue url with the follow aws cli commandaws sqs get-queue-url --queue-name xxxxxx# test_worker.pyfromasync_sqs_consumer.workerimport(Worker,)worker=Worker(queue_url="https://sqs.us-east-1.amazonaws.com/xxxxxxx/queue_name")@worker.task("report")asyncdefreport(text:str)->None:print(text)if__name__:"__main__":worker.start()Now you can initialize the workerpython test_worker.pyNow you need to post a message for the worker to processimportjsonimportboto3importuuidclient=boto3.client("sqs")client.send_message(QueueUrl="https://sqs.us-east-1.amazonaws.com/xxxxxxx/queue_name",MessageBody=json.dumps({"task":"report","id":uuid.uuid4().hex,"args":["hello world"],}),)Or you can use aioboto3importasyncioimportjsonimportaioboto3importuuidasyncdefmain()->None:session=aioboto3.Session()asyncwithsession.client("sqs")asclient:awaitclient.send_message(QueueUrl="https://sqs.us-east-1.amazonaws.com/xxxxxxx/queue_name",MessageBody=json.dumps({"task":"report","id":uuid.uuid4().hex,"args":["hello world"],}),)if__name__=="__main__":asyncio.run(main())To publish the messages they must have the following structure{"type":"object","properties":{"task":{"type":"string"},"id":{"type":"string"},"args":{"type":"array"},"kwargs":{"type":"object"},"retries":{"type":"number"},"eta":{"type":"string"},"expires":{"type":"string"},},"required":["task","id"],}
Package: asyncsshscript
AsyncSSHScript: running remote commands or scripts with asyncsshAsyncSSHScript is a Python package which provides an ability to run command or script directly on remote host withAsyncSSHevensudois required.importasyncioimportasyncsshscriptasyncdefrun_client_test():conn=asyncsshscript.AuthHostSession('10.10.10.178',username='yourname',password='yourpassword')ret=awaitconn.connect()ifnotret:print("connection error")returnprint("----------command start--------------")print(awaitconn.command('ip a'))print("----------command done--------------")print("----------sudo command start--------------")print(awaitconn.command('dmidecode',sudo=True))print("----------sudo command done--------------")print("----------local bash file start--------------")print(awaitconn.bash_file('script_test.sh'))print("----------local bash file done--------------")print("----------sudo local bash file start--------------")print(awaitconn.bash_file('script_test_sudo.sh',sudo=True))print("----------sudo local bash file done-------------")print("----------local python file start--------------")print(awaitconn.python_file('script_test.py'))print("----------local python file done--------------")print("----------local sudo python file start--------------")print(awaitconn.python_file('script_test_sudo.py',sudo=True))print("----------local sudo python file done--------------")awaitconn.close()try:asyncio.get_event_loop().run_until_complete(run_client_test())except(OSError,asyncssh.Error)asexc:sys.exit('SSH connection failed: '+str(exc))LicenseCopyright (c) 2020 by NoevilMe and others.This program and the accompanying materials are made available under
the terms of the Eclipse Public License v2.0 which accompanies this
distribution and is available at:http://www.eclipse.org/legal/epl-2.0/This program may also be made available under the following secondary
licenses when the conditions for such availability set forth in the
Eclipse Public License v2.0 are satisfied:GNU General Public License, Version 2.0, or any later versions of
that licenseSPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-laterPrerequisitesPython 3.6+Asyncssh 2.2+InstallationInstall AsyncSSHScript by running:pip install asyncsshscript
Package: asyncssh-unofficial
AsyncSSH OverviewAsyncSSH is a Python package which provides an asynchronous client and
server implementation of the SSHv2 protocol on top of the Python asyncio
framework. It requires Python 3.4 or later and either the PyCA library or
the PyCrypto library for some cryptographic functions.This package is released under the following terms:Copyright (c) 2013-2014 by Ron Frederick <ronf@timeheart.net>.
All rights reserved.This program and the accompanying materials are made available under
the terms of the Eclipse Public License v1.0 which accompanies this
distribution and is available at:http://www.eclipse.org/legal/epl-v10.htmlContributors:Ron Frederick - initial implementation, API, and documentationNotable features include:Written from the ground up to be based on Python 3Support for a number of key exchange methodsDiffie Hellman group1 and group14 with SHA1Diffie Hellman group exchange with SHA1 and SHA256Elliptic Curve Diffie Hellman (nistp256, nistp384, and nistp521)Curve25519 (if curve25519-donna Python wrapper is installed)Support for multiple authentication methodsPassword, public key, and keyboard-interactiveSupport for a variety of public key formatsDSA, RSA, and ECDSA keysPKCS#1/PKCS#8 DER and PEM, OpenSSH, and RFC4716 formatsPassword-based encryption of private keysSupport for a variety of ciphers (provided via PyCA or PyCrypto)AES, ARC4, Blowfish, CAST, and Triple DESSupport for a variety of MAC algorithmsHMAC with MD5, SHA1, SHA256, and SHA512Support for gzip compressionIncluding OpenSSH variant to delay compression until after authSupport for passing environment variables, terminal type, and window sizeSupport for multiple simultaneous sessions on a single SSH connectionSupport for handling multiple SSH connections in a single event loopSupport for direct and forwarded TCP/IP channelsSupport for both byte and string based I/O with settable encodingCompatibility with OpenSSH “Encrypt then MAC” option for better securityTime and byte-count based session key renegotiationDesigned to be easy to extend to support new forms of key exchange,
authentication methods, ciphers, and compression algorithmsPrerequisitesTo useasyncssh, you need the following:Python 3.4 or laterPyCrypto 2.6 or later and/or PyCA 0.6.1 or laterInstallationInstall Python 3.4 or later fromhttp://www.python.orgor your
favorite packaging system.Optionally install PyCrypto 2.6 or later fromhttp://www.pycrypto.orgor your favorite packaging system.Optionally install PyCA 0.6.1 or later fromhttps://cryptography.ioor your favorite packaging system.Optionally install curve25519-donna fromhttp://github.com/agl/curve25519-donnaif you want support for
Curve25519 Diffie Hellman key exchange.Install AsyncSSH by running:% pip install asyncsshCheck out theexamplesto get started!Mailing ListsThree mailing lists are available for AsyncSSH:asyncssh-announce@googlegroups.com: Project announcementsasyncssh-dev@googlegroups.com: Development discussionsasyncssh-users@googlegroups.com: End-user discussions
Package: asyncstatsd
asyncstatsdInstallation$ pip install asyncstatsdUsagePure statsdfromasyncstatsd.clientimportStatsdClientdeffoo(statsd):statsd.incr('some.counter')statsd.timing('some.timer',320)asyncdefbar(statsd):statsd.incr('some.counter')statsd.timing('some.timer',320)withstatsd.timer('some.timer'):awaitasyncio.sleep(1)asyncdefmain():client=StatsdClient('localhost',8125)awaitclient.connect()foo(client)awaitbar(client)Statsd extended with Datadog tagsfromasyncstatsd.clientimportDatadogClientdeffoo(statsd):statsd.incr('some.counter',tags=dict(tag1='value1',tag2='value2'))statsd.timing('some.timer',320,tags=dict(tag1='value1',tag2='value2'))asyncdefbar(statsd):statsd.incr('some.counter',tags=dict(tag1='value1',tag2='value2'))statsd.timing('some.timer',320,tags=dict(tag1='value1',tag2='value2')withstatsd.timer('some.timer',tags=dict(tag1='value1',tag2='value2'):awaitasyncio.sleep(1)asyncdefmain():client=DatadogClient('localhost',8125)awaitclient.connect()foo(client)awaitbar(client)
Package: asyncstdlib
Theasyncstdliblibrary re-implements functions and classes of the Python
standard library to make them compatible withasynccallables, iterables
and context managers.
It is fully agnostic toasyncevent loops and seamlessly works withasyncio, third-party libraries such astrio, as well as
any customasyncevent loop.Full set ofasyncversions of advantageous standard library helpers,
such aszip,map,enumerate,functools.reduce,itertools.tee,itertools.groupbyand many others.Safe handling ofasynciterators to ensure prompt cleanup, as well as
various helpers to simplify safely using customasynciterators.Small but powerful toolset to seamlessly integrate existing sync code
intoasyncprograms and libraries.Check out thedocumentationto get started or take a look around.