Saravanan666/pypi-org huggingface dataset:
Package: async-data-api
async_data_api - Async DataApi ClientTable of ContentsIntroductionInstallationQuick-start GuidDocumentationDependenciesContributeProject Changes and Tagged ReleasesDeveloper NotesContactIntroductionThis project/package aims to provide a fully asynchronous client for PSIs REST DataAPI.InstallationInstall with pippipinstallasync_data_apiQuick-start GuideHere are some simple examples to get you started:importasynciofromdatetimeimportdatetime,timedeltafromasync_data_apiimport(Aggregation,Backends,ChannelName,DataApi,EventFields,RangeByDate,)asyncdefsearch_channels_example():"""Example of how to find a channel by it's name on any backend."""asyncwithDataApi(base_url="https://data-api.psi.ch/")asapi:channels=awaitapi.find_channels(regex="MMAC3:STR:2",return_config=True,)print(channels)asyncdefget_data_example():"""Example to get the data for a channel of the last 3 days, aggregated and binned to 500 bins, as pandas dataframe."""asyncwithDataApi(base_url="https://data-api.psi.ch/")asapi:asyncforresultinapi.get_data(channels=ChannelName(name="MMAC3:STR:2",backend=Backends.proscan),range=RangeByDate(start_date=datetime.now()-timedelta(days=3),endDate=datetime.now(),start_expansion=False,),event_fields=[EventFields.global_millis,EventFields.raw_value],aggregation=Aggregation(aggregations=[Aggregation.Aggregations.min,Aggregation.Aggregations.mean,Aggregation.Aggregations.max,],nr_of_bins=500,),):df=api.json_to_dataframe(result)print(df)asyncdefmain():"""Uncomment the example you want to run"""#await search_channels_example()#await get_data_example()passif__name__=="__main__":asyncio.run(main())DocumentationCurrent Features:Fully asynchronous100% Test coverageSearch for channelsget data as pandas dataframeCheck out the wiki for more info!DependencieshttpxisodatepandasContributeTo contribute, simply clone the project.
You can usespip -r requirements.txtor the Makefile to set up the project.
After that you can make changes and create a pull request or if allowed merge your changes.Project Changes and Tagged ReleasesSee the Changelog file for further informationProject releases are available in pypi (NOT YET)Developer NotesCurrently NoneContactIf you have any questions pleas contract 'niklas.laufkoetter@psi.ch'
Package: asyncdef
Meta package for the asyncdef project.This package currently contains no significant code for the asyncdef project.Future releases will bundle the common/core asyncdef features.LicenseCopyright 2016 Kevin ConwayLicensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Package: asyncdef.emitter
Tools for handling async events.Example UsageThis project is an implementation of theEventEmitterinterface and closely follows the behaviour described by the documentation for
theeventsmodule.fromasyncdef.emitterimportEmitteremitter=Emitter()emitter.on('my_event',print)emitter.emit('my_event',True,False,None)TestingAll tests suites are paired one-to-one with the module they test and live
directly adjacent to that same module. All tests are expected to pass for
Python 3.5 and above. To run tests use tox with the included tox.ini file or
create a virtualenv and install the ‘[testing]’ extras.LicenseCopyright 2016 Kevin ConwayLicensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.ContributingFirstly, if you’re putting in a patch then thank you! Here are some tips for
getting your patch merged:StyleAs long as the code passes the PEP8 and PyFlakes gates then the style is
acceptable.DocsThe PEP257 gate will check that all public methods have docstrings. If you’re
adding something new, like a helper function, try out thenapoleon style of docstrings.TestsMake sure the patch passes all the tests. If you’re adding a new feature don’t
forget to throw in a test or two. If you’re fixing a bug then definitely add
at least one test to prevent regressions.
Package: asyncdef.interfaces
Public APIs for the core asyncdef components.This package contains the public interface definitions for the core asyncdef
components. This package leveragesifacefor the definitions. Items in
this package are intended to be used withisinstanceandissubclassfor
interface comparisons.fromasyncdef.interfaces.engineimportiengineassertisinstance(some_implementation,iengine.IEngine)assertiface.isinstance(some_implementation,iengine.IEngine)Interface definitions are placed here to prevent the need for importing the
actual implementation code in order to check the interface.LicenseCopyright 2016 Kevin ConwayLicensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.ContributingFirstly, if you’re putting in a patch then thank you! Here are some tips for
getting your patch merged:StyleAs long as the code passes the PEP8 and PyFlakes gates then the style is
acceptable.DocsThe PEP257 gate will check that all public methods have docstrings. If you’re
adding something new, like a helper function, try out thenapoleon style of docstrings.
Package: asyncdgt
asyncdgt uses asyncio to communicate asynchronously with a DGT electronic
chess board.View reference documentation.ExampleCreate an event loop and a connection to the DGT board.importasyncioloop=asyncio.get_event_loop()dgt=asyncdgt.auto_connect(["/dev/ttyACM*"],loop)Register somepyeeevent handlers. They
will be called whenever a board gets connected, disconnected or the position
changed.@dgt.on("connected")defon_connected(port):print("Board connected to{0}!".format(port))@dgt.on("disconnected")defon_disconnected():print("Board disconnected!")@dgt.on("board")defon_board(board):print("Position changed:")print(board)print()Get some information outside of an event handler using the coroutineget_version().print("Version:",loop.run_until_complete(dgt.get_version()))Run the event loop.try:loop.run_forever()exceptKeyboardInterrupt:passfinally:dgt.close()loop.close()Seeasyncdgt/__main__.pyfor the complete example. Run withpython-masyncdgt /dev/ttyACM0.HardwareTested with the following boards:DGT e-Board 3.1DGT e-Board 3.1 BluetoothClocks:DGT Clock 3000DependenciesPython 3.4pyeepyserialpip install-rrequirements.txtRelated projectspython-chess,
a general purpose chess library.picochess,
a standalone chess computer for DGT boards. Some of the DGT protocol handling
has been shamelessly extracted from their code.Licensepython-asyncdtg is licensed under the GPL3. See theLICENSE.txtfile for
the full license text.
Package: asyncdictionary
asyncdictionaryAn asynchronous Python wrapper for https://dictionaryapi.dev/NOTE: Currently I have only implemented fetching words from English, not other languages. This is because the actual API's implementation of languages other than english is different. Support for different languages coming soon though.RequirementsPython 3.6+aiohttpFeaturesAsynchronousTypedEasy to useInstallationAvailable through PyPi (pip)$pipinstallasyncdictionaryOr through git.$pipinstallgit+https://github.com/Ay-355/asyncdictionaryYou might have to dopython3 -m pipDocumentationYou can find a markdown filehere.IssuesAny issues directly with the API should be reported at theAPI's repository page.If there is anything wrong with this package, feel free to open up an issue and explain what happened.ExamplesAn example to print out some information about a wordimportasyncdictionaryimportasyncio# create an instance of the clientdictionary=asyncdictionary.Client()asyncdefword_info(word):word=awaitdictionary.get_word(word)# get a Word objectprint(f"Word:{word.word}")print(f"Phonetic text:{word.phonetics[0].text}")print(f"Part of Speech:{word.meanings[0].part_of_speech}")print(f"Definition:{word.meanings[0].definitions[0].definition}")print(f"Synonyms:{', '.join(word.meanings[0].definitions[0].synonyms)}")print(f"Example:{word.meanings[0].definitions[0].example}")asyncio.run(word_info("hello"))LinksDocumentationPyPifreeDictionaryAPI repositoryAPI Home PageLicenseMIT
Package: async-direct-redis
Direct-Redis (Async)Serialize any python datatypes and executes redis commands using redis-pyWhen loading, it auutomatically converts serialized data into original data typesGetting StartedInstall via pypipip install async-direct-redisInstantiatefromdirect_redisimportAsyncDirectRedisr=AsyncDirectRedis(host='localhost',port=6379)All methods should be awaitedSupporting Data TypesBuilt-instringnumber(int, float)dictionarylisttupleetc (all other python built-in types)Module ClassespandasnumpySupporting Redis CommandsDirect-Redis SupportsBasic FunctionsKEYSRANDOMKEYTYPESETGETHash FunctionsHKEYSHSETHMSETHGETHMGETHGETALLHVALSSet FunctionsSADDSREMSMEMBERSSPOPSDIFFSCARD (Default)SRANDMEMBERList FunctionsLPUSHRPUSHLPUSHXRPUSHXLRANGELPOPRPOPLINDEXExamplesStringOriginally redis stores string into bytes.>>>s="This is a String.\n스트링입니다.">>>print(s)ThisisaString.스트링입니다.>>>r.set('s',s)>>>r.get('s')'This is a String.\n스트링입니다.'>>>type(r.get('s'))<class'str'>Numbers>>>mapping={...'a':29,...'b':0.5335113,...'c':np.float64(0.243623466363223),...}>>>r.hmset('nums',mapping)>>>r.hmget('nums',*mapping.keys())[29,0.5335113,0.243623466363223]>>>list(mapping.values())==r.hmget('nums',*mapping.keys())TrueNested Dictionaries and Lists>>>l=[1,2,3]>>>d={'a':1,'b':2,'c':3}>>>r.hmset('list and dictionary',{'list':l,'dict':d})>>>r.hgetall("list and dictionary"){'list':[1,2,3],'dict':{'a':1,'b':2,'c':3}}>>>type(r.hgetall("list and dictionary")['list'])<class'list'>>>>type(r.hgetall("list and dictionary")['dict'])<class'dict'>Pandas DataFrame>>>df=pd.DataFrame([[1,2,3,'235','@$$#@'],['a','b','c','d','e']])>>>print(df)012340123235@$$#@1abcde>>>r.set('df',df)>>>r.get('df')012340123235@$$#@1abcde>>>type(r.get('df'))<class'pandas.core.frame.DataFrame'>Numpy Array>>>arr=np.random.rand(10).reshape(5,2)>>>print(arr)[[0.258738870.00937433][0.04728110.94004351][0.927439430.93898677][0.877063410.85135288][0.063906520.86362001]]>>>r.set('a',arr)>>>r.get('a')array([[0.25873887,0.00937433],[0.0472811,0.94004351],[0.92743943,0.93898677],[0.87706341,0.85135288],[0.06390652,0.86362001]])>>>type(r.get('a'))<class'numpy.ndarray'>Authordirect-redisis developed and maintained by Yonghee Cheon (yonghee.cheon@gmail.com).It can be found here:https://github.com/yonghee12/direct-redisSpecial thanks to:Andy McCurdy, the author of redis-py.
Package: async-django-session
Async Django SessionIt gives you ability to share session betweendjangoand an async framework
likeaiohttp,starlette,fastapietc.pip install async-django-sessionAPIBackendsThere's two ways of communicating to database available:throughdatabases- which is compatible with most of major RDBMS:database=databases.Database(DB_URI)awaitdatabase.connect()backend=async_django_session.databases.Backend(database,SECRET_KEY)or directly throughasyncpg(PostgreSQL only):pool=awaitasyncpg.create_pool(DB_URI)backend=async_django_session.asyncpg.Backend(pool,SECRET_KEY)SessionTo fetch session from db by its key there'sbackend.get_sessionmethod. IfkeyisNonea new session will be created:session=backend.get_session(key)It's lazy so the session data won't be actually fetched until you call itsloadmethod. In caches the result, so it's inexpensive to call it multiple
times:awaitsession.load()You can combine them into a single line as theloadmethod returns session
itself:session=awaitbackend.get_session(key).load()Session provides dict-interface to read / write data:session["foo"]="bar"print(session["foo"])To sync session with database you should explicitly call itssavemethod. It
won't make unnecessary db call if the session wasn't changed (the boolean value
it returns is intend to indicate if it was the case).saved=awaitsession.save()During saving of a new session a random key will be generated and available assession.keyparameter afterwords.Frameworks integrationThere's built-in middlewares for a few frameworks to automatically load (using
session id from cookies) and save sessions.AiohttpAfter adding ofsession middleware:session_middleware=async_django_session.aiohttp.middleware(async_django_session.databases.Backend(db,SECRET_KEY))app=web.Application(middlewares=[session_middleware])You can get requests session as:session=awaitrequest.get_session()A full aiohttp example can be foundhere.StarletteAfter adding ofsession middleware:async_django_session.starlette.middleware(app,async_django_session.databases.Backend(db,SECRET)))Session of a current request is available as:session=awaitrequest.state.get_session()A working starlette example ishere.FastapiPerform starlette app initialization from above as fastapi based on it.
After that you can get session using dependency injection as:fromasync_django_session.fastapiimportget_sessionfromasync_django_session.sessionimportSessionasyncdefindex(session:Session=Depends(get_session)):...A working fastapi example ishere.Running examplesRunning theexamplesyou can see different frameworks using the same session
data. To see session data openhttp://localhost:8000/after running of each
example.Install requirements:cd examples
pip install -r requirements.txtCreate database and tables:createdb async_django_session
python django_app.py migrateRunaiohttp examplewhich usesdatabases backend:python aiohttp_app.pyRunstarlette examplewhich usesasyncpg backend:python starlette_app.pyRunfastapi examplewhich usesasyncpg backend:python fastapi_app.pyRundjango example:python django_app.py runserver
Package: async-django-user
Async Django UserUsingdjangouser with async frameworks likeaiohttp,starletteetc.pip install async-django-session async-django-usertl;drTake a look at registration / authorization examples foraiohttp + databasesorstarlette + asyncpg.APIBackendsThere's two ways of communicating to database available:throughdatabases- which is compatible with most of major RDBMS:database=databases.Database(DB_URI)awaitdatabase.connect()backend=async_django_user.databases.Backend(database,SECRET_KEY)or directly throughasyncpg(PostgreSQL only):pool=awaitasyncpg.create_pool(DB_URI)backend=async_django_user.asyncpg.Backend(pool,SECRET_KEY)UserTo fetch an user from db by its id stored in [django session] there'sbackend.get_user_from_sessionmethod:user=backend.get_user_from_session(session)It's lazy so the user data won't be actually fetched until you call itsloadmethod. It caches the result, so it's inexpensive to call it multiple
times:awaituser.load()User provides dict interface to it's data (eguser["username"]) and a few
methods:await user.authenticate(username, password)- checks credentials and populates
the user from database if they're validuser.login()- sets session variables logging the user inuser.logout()- clears the session dataawait user.set_password(password)- sets a new password for the userawait user.save([fields])- saves the whole user or a particular set of its
fieldsawait register()- saves a new user into dbFrameworks integrationThere's built-in middlewares for a few async frameworks to automatically load
user of the current request. Take a look atexamplesfolder for:aiohttp examplewithdatabases backendstarlette examplewithasyncpg backendRunning examplesRunning theexamplesyou can see different frameworks using the same session
and user data.Install the requirements:cd examples
pip install -r requirements.txtCreate database and tables:createdb async_django_session
python django_app.py migrateCreate a user:python django_app.py createsuperuserRunaiohttp examplewhich usesdatabases backend:python aiohttp_app.pyRunstarlette examplewhich usesasyncpg backend:python starlette_app.pyRundjango example:python django_app.py runserver
Package: asyncdns2
asyncdns - Pure Python asynchronous DNS for asyncioWhat is this?asyncdnsis a pure Python asynchronous DNS resolver implementation written
on top of asyncio.  It doesn’t require any external libraries, and it doesn’t
use threads or blocking functions.Usageasyncdnsdoesn’t have an equivalent to the widely usedgethostbyname()orgetaddrinfo()functions.  Instead, you use it by constructing aQueryobject specifying the DNS query you wish to run, then pass it to aResolverto actually perform the query.There are a handful of built-in resolvers, but for demonstration purposes the
easiest one to use is theSmartResolver, which automatically makes use of/etc/hosts, multicast DNS and regular DNS as appropriate.For instance, do a simple lookup for an A record:>>> import asyncdns, asyncio
>>> resolver = asyncdns.SmartResolver()
>>> loop = asyncio.get_event_loop()
>>> query = asyncdns.Query('www.example.com', asyncdns.A, asyncdns.IN)
>>> f = resolver.lookup(query)
>>> loop.run_until_complete(f)
>>> print(f.result())
;; No error (RD, RA)
; 1 answers:
www.example.com       54950   IN      A       93.184.216.34
; 0 authorities:
; 0 additional:Note that you may or may not want to useSmartResolverin your code,
depending on your requirements - it probably isn’t a good idea using multicast
DNS on an untrusted network, for instance.
Package: async-dnsbl-client
async-dnsbl-clientAsynchronous dnsbl clientInstallpip3 install async-dnsbl-clientorpip3 install git+https://github.com/yaroslaff/async-dnsbl-clientCLI usage:$ adnsbl.py 117.207.230.178 
dnsbl.sorbs.net
dul.dnsbl.sorbs.net
spam.dnsbl.sorbs.net
zen.spamhaus.org
noptr.spamrats.com
b.barracudacentral.org
web.dnsbl.sorbs.net
pbl.spamhaus.org

# or with hostname
$ bin/adnsbl.py gmail-smtp-in.l.google.comyou may remove some DNSBL from checklist with-r/--remove:-r dnsbl.sorbs.net dul.dnsbl.sorbs.net, or add new
DNSBL zones same way with-a/--append.adnsbl.pyexit code is 0 if host isn't blacklisted anywhere, and 1 otherwise.Usage in your python codeSee adnsbl.py sources, it's simple.importasyncioimportasync_dnsbl_clientresult=asyncio.run(async_dnsbl_client.dnsbl('gmail-smtp-in.l.google.com'))Why not adns?There is already python3 adns support inpython3-adnspackage. But it crashes on ARM machines (such as Raspberri Pi (arch: armv7l) and Oracle Ampere A1 (arch: aarch64)). (maybe you know why?)>>>importadns>>>adns.init()Segmentationfault(coredumped)on 'normal' amd64 it works fine,async-dnsbl-client works fine on ARM machines (), checking host in 53 blacklists in 0.127s (fastest).See alsoThis project usesaiodns packagepydnsbl- more mature package, looks more powerful, same fast. (But I need my project because sometimes simpler is better)
Package: async-doh
async-dohDNS over HTTPS based on aiohttp andasync_dns.Installation$pipinstallasync-dohUsageCommand-lineusage: python3 -m async_doh.client [-h] [-n NAMESERVERS [NAMESERVERS ...]] [-t TYPES [TYPES ...]] hostnames [hostnames ...]

Async DNS resolver with DoH

positional arguments:
  hostnames             the hostnames to query

optional arguments:
  -h, --help            show this help message and exit
  -n NAMESERVERS [NAMESERVERS ...], --nameservers NAMESERVERS [NAMESERVERS ...]
                        name servers
  -t TYPES [TYPES ...], --types TYPES [TYPES ...]
                        query types, default as `any`Examples:$python3-masync_doh.client-nhttps://223.5.5.5/dns-query-tANY--www.google.comClientimportasyncioimportaiohttpfromasync_doh.clientimportDoHClientasyncdefmain():asyncwithDoHClient()asclient:result=awaitclient.query('https://1.1.1.1/dns-query','www.google.com','A')print('query:',result)result=awaitclient.query_json('https://1.1.1.1/dns-query','www.google.com','A')print('query_json:',result)asyncio.run(main())Serverfromaiohttpimportwebfromasync_doh.serverimportapplicationweb.run(application)Now you havehttp://localhost:8080/dns-queryas an endpoint.Patching async_dnsBy importing the patch, async_dns will use aiohttp to send queries through HTTPS (aka DNS over HTTPS):importasynciofromasync_dns.coreimporttypesfromasync_dns.resolverimportProxyResolverfromasync_doh.clientimportpatchasyncdefmain():revoke=awaitpatch()resolver=ProxyResolver(proxies=['https://dns.alidns.com/dns-query'])res,_=awaitresolver.query('www.google.com',types.A)print(res)awaitrevoke()asyncio.run(main())Referenceshttps://tools.ietf.org/html/rfc8484
Package: async-download
Async downloadUses coroutines to download urlsNote: Greedy and built for speed. [10K cdn hosted urls; 0.5GB Total data; <5 minutes; M1 laptop]UsageUsage: async_download [COMMAND] <OPTIONS>
Commands:
    headers - hit urls with the head request
    download - download urls

`headers` Options:
  --header TEXT         Headers to extract (default: Content-Length, Server)
  --batch-size INTEGER  number of concurrent requests (default: 1000)
  --help                Show this message and exit.

`download` Options:
  --batch-size INTEGER  number of concurrent requests (default: 1000)
  --execute             required to do something
  --help                Show this message and exit.Free software: MIT licenseDocumentation:https://async-download.readthedocs.io.Install & Runpipxinstallasync-download
async_download--helpDevelopmentpython-mvenv.venv--prompt.
../.venv/bin/activate
pipinstall--editable.[testing]maketestCreditsThis package was created with Cookiecutter and theaudreyr/cookiecutter-pypackageproject template.Cookiecutteraudreyr/cookiecutter-pypackageThe main loop was taken fromA Twilio tuitorialHistory1.2.0 (2022-08-29)better progress bars.1.1.0 (2022-08-29)add a validate option.1.0.0 (2022-08-29)First release on PyPI.