Saravanan666/pypi-org huggingface dataset:
Package: aiodecorator
aiodecoratorPython decorators for asyncio, includingthrottle: Throttle a (coroutine) function that return anAwaitableInstall$pipinstallaiodecoratorUsageimporttimeimportasynciofromaiodecoratorimport(throttle)now=time.time()# -----------------------------------------------------# The throttled function is only called twice a second@throttle(2,1)asyncdefthrottled(index:int):diff=format(time.time-now,'.0f')print(index,f'{diff}s')# -----------------------------------------------------asyncdefmain():loop=asyncio.get_running_loop()tasks=[loop.create_task(throttled(index))forindexinrange(5)]awaitasyncio.wait(tasks)asyncio.run(main())# Output# 0 0s# 1 0s# 2 1s# 3 1s# 4 2sAPIsthrottle(limit: int, interval: Union[float, int])limitintMaximum number of calls within aninterval.intervalUnion[int, float]Timespan for limit in seconds.Returns a decorator functionLicenseMIT
Package: aiodecorators
aiodecoratorsFunction decorators based on asyncio Lock, Semaphore and BoundedSemaphoreInstallpip3 install aiodecoratorsUsageasyncio.Lockfrom aiodecorators import Lock

@Lock()
async def f():
    passasyncio.Semaphorefrom aiodecorators import Semaphore

@Semaphore(n)
async def f():
    passasyncio.BoundedSemaphorefrom aiodecorators import BoundedSemaphore

@BoundedSemaphore(n)
async def f():
    pass
Package: aiodeepl
Asynchronous API for DeepL TranslatorIt also shipped with a simple command line interface.Installationpipinstall-UaiodeeplAPI UsageDocumentation is yet complete. Apart from the following example, you can also refer to the__main__.pyfile for more examples.importaiodeeplasyncdefmain():translator=aiohttp.Translator(api_key="123")result=awaittranslator.translate("Hello, World!",target_lang="DE")print(result)CLI Usageaiodeepl--api-key123-t"Hello, World!"-dDEYou can saveapi_keyin config file or input it interactively for security.To translate a document, you can use the following command:aiodeepl--api-key123-fREADME.pdf-dDE-oREADME_DE.pdf
Package: aiodeluge
✨ aiodeluge ✨An asyncio deluge client talk todelugeUsageimportasynciofromaiodelugeimportClientasyncdefmain():asyncwithClient(timeout=10)asclient:print(awaitclient.send_request("daemon.login","synodriver","123456",client_version="2.1.1"))print(awaitclient.send_request("core.get_auth_levels_mappings"))print(awaitclient.send_request("core.get_external_ip"))print(awaitclient.send_request("core.get_config"))if__name__=="__main__":asyncio.run(main())Public apiimportsslasssl_fromtypingimportCallable,Dict,Optional,UnionclassClient:host:strport:intusername:strpassword:strevent_handlers:dictssl:ssl_.SSLContexttimeout:Union[int,float]def__init__(self,host:str="127.0.0.1",port:Optional[int]=58846,username:Optional[str]="",password:Optional[str]="",event_handlers:Optional[Dict[str,Callable]]=None,ssl:Optional[ssl_.SSLContext]=None,timeout:Optional[Union[int,float]]=None,):...asyncdefconnect(self):...asyncdefdisconnect(self):...asyncdefsend_request(self,method:str,*args,**kwargs):...asyncdef__aenter__(self):...asyncdef__aexit__(self,exc_type,exc_val,exc_tb):...def__eq__(self,other:"Client"):...
Package: aiodesa
Asyncio Dead Easy Sql APISimplify Your Personal Projects with AIODesaAre you tired of the hassle of setting up complex databases for small apllications and personal projects? Designed to streamline monotony, AIODesa makes managing asynchronous database access easy. Perfect for smaller-scale applications where extensive database operations are not a priority.No need to write even a single line of raw SQL.A straightforward and 100% Python interface for managing asynchronous database API's by leveraging Python's built-ins and standard library. It wraps around AioSqlite, providing a hassle-free experience to define, generate, and commit data effortlessly, thanks to shared objects for tables and records.Ideal for Personal ProjectsAIODesa is specifically crafted for simpler projects where database IO is minimal. It's not intended for heavy production use but rather serves as an excellent choice for personal projects that require SQL structured data persistence without the complexity of a full-scale database setup. SQLite is leveraged here, meaning youre free to use other SQLite drivers to consume and transform the data if your project outgrows AIODesa.Read the docsUsageInstall via pippip install aiodesaSample API usage:from aiodesa import Db
import asyncio
from dataclasses import dataclass
from aiodesa.utils.tables import ForeignKey, UniqueKey, PrimaryKey, set_key


async def main():
	# Define structure for both tables and records
	# Easily define key types
	@dataclass
	@set_key(PrimaryKey("username"), UniqueKey("id"), ForeignKey("username", "anothertable"))
	class UserEcon:
		username: str
		credits: int | None = None
		points: int | None = None
		id: str | None = None
		table_name: str = "user_economy"


	async with Db("database.sqlite3") as db:
		# Create table from UserEcon class
		await db.read_table_schemas(UserEcon)

		# Insert a record
		record = db.insert(UserEcon.table_name)
		await record('sockheadrps', id="fffff")

		# Update a record
		record = db.update(UserEcon.table_name, column_identifier="username")
		await record('sockheadrps', points=2330, id="1234")
		

asyncio.run(main())Development:Ensure poetry is installed:pip install poetryInstall project using poetrypoetry add git+https://github.com/sockheadrps/AIODesa.git
poetry installcreate a python file for using AIODesa and activate poetry virtual env to run itpoetry shell
poetry run python main.py
Package: aiodesktop
aiodesktopA set of tools which simplify building cross-platform desktop apps with Python, JavaScript, HTML & CSS.FeaturesIn contrast to typical desktop GUI frameworks such astkinter,wxPython,PyQtorKivy:does not define own widgets/layout system (Kivy,Qt,wx), simply use a browser as a platform which already provides those thingsreuse time-saving libraries likeReact,BootstraporHighchartsreuse technologies likeWebRTC,WebGL,WebAssemblyaccess platform features such ascameras,geolocationandothersyour app is client-server and cross-platform by design, different devices may use it simultaneouslyCompared to existing alternatives such asEel,async-eelandguy:runs onasyncioinstead of threads or gevent greenletshighly customizableaiohttpserverno global state / singleton APIInstallInstall from pypi withpip:pipinstallaiodesktopHello, World!importaiodesktopclassServer(aiodesktop.Server):asyncdefon_startup(self):aiodesktop.launch_chrome(self.start_uri)# Use `expose` decorator to mark method as visible from JS@aiodesktop.exposeasyncdefget_string(self):# Use `await self.js.xxx()` to call JS functions from Pythonreturn'Hello, '+awaitself.js.getWorld()bundle=aiodesktop.Bundle()server=Server(bundle=bundle,init_js_function='onConnect',index_html='''<html><body><script>async function onConnect(server) {// Exposing JS function to pythonserver.expose({async getWorld() {return 'World!'}});// Use `await server.py.xxx()` to call Python methods from JSdocument.body.innerHTML += await server.py.get_string();};</script></body></html>''',)server.run()Seeexample/for aslightlymore complicated app with:static filespyinstaller executableJS & webpackhttps
Package: aiodeta
aiodetaUnofficial client for Deta CloundSupported functionalityDeta BaseDeta DriveDecorator for cron tasksExamplesimportasynciofromaiodetaimportDetaDETA_PROJECT_KEY="xxx_yyy"asyncdefgo():db_name="users"# Initialize Deta clientdeta=Deta(DETA_PROJECT_KEY)# Initialize Deta Base clientbase=deta.Base(db_name)# Create row in Deta Baseuser={"username":"steve","active":False}resp=awaitbase.insert(user)print(resp)user_key=resp["key"]# Update row by keyresp=awaitbase.update(user_key,set={"active":True})print(resp)# Get row by keyresp=awaitbase.get(user_key)print(resp)# Delete row by keyresp=awaitbase.delete(user_key)print(resp)# Create multiple rows in one requestusers=[{"username":"jeff","active":True},{"username":"rob","active":False},{"username":"joe","active":True}]resp=awaitbase.put(users)print(resp)# Query dataquery=[{"active":True},{"username?pfx":"j"}]result=awaitbase.query(query=query,limit=10)print(result)# Close connectionawaitdeta.close()loop=asyncio.get_event_loop()loop.run_until_complete(go())
Package: aiodevision
aiodevisionA simple async wrapper for the idevision api.Note: this may be unstable. This is an experimental wrapper, and is undocumented (for now).If you would like to contribute/add anything, feel free to make a PR.InstallationFor installing the stable version, dopipinstallaiodevisionIf you wanna install the dev version, dopipinstallgit+https://github.com/MrKomodoDragon/aiodevisiontodo:Add Better Exception HaandlingHandle Ratelimits
Package: aiodhcpwatcher
aiodhcpwatcherDocumentation:https://aiodhcpwatcher.readthedocs.ioSource Code:https://github.com/bdraco/aiodhcpwatcherWatch for DHCP packets with asyncioInstallationInstall this via pip (or your favourite package manager):pip install aiodhcpwatcherUsageimportasyncioimportaiodhcpwatcherdef_async_process_dhcp_request(response:aiodhcpwatcher.DHCPRequest)->None:print(response)asyncdefrun():cancel=aiodhcpwatcher.start(_async_process_dhcp_request)awaitasyncio.Event().wait()asyncio.run(run())Contributors ✨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.
Package: aiodinweb
OdinWeb API framework for aiohttp. For building your APIs using asyncio.NoteCurrently in development, APIs can change.Features:API Framework designed around OpenAPIBuilt in support for OpenAPI specBuilt in support for CORSHandling of validation of all incoming parameters (via Odin)Handling of Serialisation and Deserialisation of data into common API
content types including JSON, XML, and YAML.Easily extensible.Built in Authorisation and customisable Authentication.Fully type annotated with Python 3.6+ typing support.ContributionsContributions are always welcome, however please ensure the following
guidelines are met to ensure your PR will be accepted.AIOdinWeb uses Git-FlowCheck with Flake8, this must passEnsure type annotations are fully applied.Ensure your contribution comes with fast test cases (for PyTest)Documentation is generated from code, ensure your contribution is
documented.Thanks!
Package: aiodiskqueue
Persistent queue for Python AsyncIO.DescriptionThis library provides a persistent FIFO queue for Python AsyncIO:Queue content persist a process restartFeature parity with Python’sasyncio.QueueSimilar API to Python’sasyncio.QueueSane loggingType hintsFully testedSupports different storage engines and can be extended with custom storage enginesUsageHere is a basic example on how to use the queue:importasynciofromaiodiskqueueimportQueueasyncdefmain():q=awaitQueue.create("example_queue.sqlite")awaitq.put("some item")item=awaitq.get()print(item)asyncio.run(main())Please see theexamplesfolder for more usage examples.InstallationYou can install this library directly from PyPI with the following command:pipinstallaiodiskqueueLoggingThe name of the logger for all logging by this library is:aiodiskqueue.Storage Enginesaiodiskqueue support different storage engines. The default engine isDbmEngine.We measured the throughput for a typical load scenario (5 producers, 1 consumer) with each storage engine:DbmEngine: Consistent throughput at low and high volumes and about 3 x faster then SqlitePickledList: Very fast at low volumes, but does not scale wellSqliteEngine: Consistent throughput at low and high volumes. Relatively slow.The scripts for running the measurements and generating this chart can be found in the measurements folder.
Package: aiodispatch
AioDispatchAioDispatch is a simple and pluggable async dispatcher framework with batteries included. AioDispatch can be used
to offload expensive operations to external workers. For example, you might use the framework to send email, execute
big queries or analyse large datasets.AioDispatch is designed to work right of out the box, but to remain pluggable. For example a custom broker is
a matter of subclassingaiodispatch.brokers.abc.Brokerand a serializeraiodispatch.serializers.abc.Serializer.InstallpipinstallaiodispatchUsageimportasynciofromaiodispatch.brokers.memoryimportMemoryBrokerfromaiodispatch.decoratorsimporttaskfromaiodispatch.dispatchimportDispatcherfromaiodispatch.serializers.jsonimportJsonSerializerfromaiodispatch.workerimportWorker@task()asyncdefslow_greeter(name:str)->None:awaitasyncio.sleep(2)print(f"Hello{name}")asyncdefproducer(num:int=10)->None:foriinrange(num):awaitslow_greeter(name=str(i))asyncdefmain():broker=MemoryBroker()serializer=JsonSerializer()dispatcher=Dispatcher(broker,serializer)worker=Worker(dispatcher,semaphore=asyncio.Semaphore(1))asyncwithasyncio.TaskGroup()astg:tg.create_task(worker.start())tg.create_task(producer())if__name__=="__main__":asyncio.run(main())
Package: aiodistbus
A Distributed Eventbus using ZeroMQ and AsyncIO for Python.The objective of this library is to provide both a local and distributed eventbus that are compatible to communicate. A similar API can be used in both versions of the eventbuses implementations.InstallationFor installing the package, download from PyPI and install withpip:pipinstallaiodistbusHere is a link to theDocumentation. If you encounter any issues in terms of code or documentation, please don't hesitate to make an issue.EventBus ExampleThe eventbus implementation follows a client-server design approach, with theDEventBusas the server andDEntryPointas the client. Here is a quick example to emit an event.importasynciofromdataclassesimportdataclassfromdataclasses_jsonimportDataClassJsonMixin# DO NOT FORGET THIS!importaiodistbusasadb@dataclassclassExampleEvent(DataClassJsonMixin):# NEEDS TO BE A DataClassJsonMixin!msg:strasyncdefhandler(event:ExampleEvent):print(event)asyncdefmain():# Create resourcesbus,e1,e2=adb.DEventBus(),adb.DEntryPoint(),adb.DEntryPoint()# Connectawaite1.connect(bus.ip,bus.port)awaite2.connect(bus.ip,bus.port)# Add funcsawaite1.on("test",handler,ExampleEvent)# Send messageawaite2.emit("test",ExampleEvent("hello"))# Flushawaitbus.flush()# Close resourcesawaite1.close()awaite2.close()awaitbus.close()if__name__=='__main__':asyncio.run(main())DesignIn theaiodistbuslibrary, we provided 2 eventbus implementations:EventBusandDEventBus. TheEventBusclass is for local (within same Python runtime) observer pattern. In the other hand,DEventBusclass is for a distributed eventbus that leverages ZeroMQ -- closing following theClone pattern.The Clone pattern uses a client-server structure, where a centralized broker broadcasts messages sent by clients. As described in the ZeroMQ Guide, this creates a single point of failure, but yields in a simpler and more scalable implementation.ContributingContributions are welcomed! OurDeveloper Documentationshould provide more details in how ChimeraPy works and what is in current development.LicenseChimeraPyandChimeraPy/aiodistbususes the GNU GENERAL PUBLIC LICENSE, as found inLICENSEfile.Funding InfoThis project is supported by theNational Science Foundationunder AI Institute  Grant No.DRL-2112635.
Package: aiodistributor
aiodistributorPython Asynchronous Library for Synchronization of Replicated MicroservicesThis library provides a set of tools for synchronizing replicated microservices using Redis. The main goal is to facilitate inter-service communication, rate limiting, and throttling mechanisms in a distributed environment.Features:Distributed sliding counter for implementing rate limiting or throttle mechanisms.Distributed waiter for waiting for signals from other nodes or services and triggering the appropriate callback.Distributed task for managing and distributing tasks across multiple nodes or services.Distributed cache for caching data and sharing it among services.Distributed notifier for event-driven communication between nodes or services.Utilizes Redis for storage and message passing between nodes.Asynchronous and non-blocking design using Python's asyncio library.DependenciesPython 3.10+Redis serverredis-py or aioredisInstallationTo install the aiodistributor library, you can simply use pip:pip install aiodistributorUsageDetailed examples and usage instructions can be found inexamplesfolderContributingContributions are welcome! Please submit a pull request or create an issue to discuss proposed changes.
Package: aiodjango
This is a proof-of-concept experiment to combine a Django WSGI app mixed with
async views/websocket handlers using aiohttp. The API is highly unstable
and I wouldn’t recommend that you use this code for anything other than
wild experimentation.How It Worksaidjango.get_aio_applicationbuilds an application which combines both
request handlers/views from Django andaiohttp.web.
Views are defined using the normal Django url pattern syntax but
any handler which is a coroutine is handled by theaiohttpapplication
while the rest of the views are handled by the normal Django app.Internal this makes use ofaiohttp-wsgiwhich runs the Django WSGI app in a thread-pool to minimize blocking the async
portions of the app.Running the DemoThe example project requires Python 3.4+ to run. You should create a virtualenv
to install the necessary requirements:$ git clone https://github.com/mlavin/aiodjango.git
$ cd aiodjango/
$ mkvirtualenv aiodjango -p `which python3.4`
(aiodjango) $ add2virtualenv .
(aiodjango) $ cd example
(aiodjango) $ pip install -r requirements.txt
(aiodjango) $ python manage.py migrate
(aiodjango) $ python manage.py runserverThis starts the server onhttp://localhost:8000/with a new version of Django’s
built-in runserver. For a more multi-process server you can run using the
aiohttp worker along with Gunicorn:(aiodjango) $ gunicorn example.wsgi:app --worker-class aiohttp.worker.GunicornWebWorker --workers 2
Package: aiodl
AiodlAiodl – Yet another command line download accelerator.FeaturesAccelerate the downloading process by using multiple connections for
one file.Reasonable retries on network errors.Breakpoint resume.Installation$pip3installaiodl--user# or$sudopip3installaiodlUsageCommandlineSimply callaiodlwith the URL:$aiodlhttps://dl.google.com/translate/android/Translate.apkFile: Translate.apk
  Size: 16.8M
  Type: application/vnd.android.package-archive

 11%|████▎                                  | 1.78M/16.0M [00:03<00:26, 565KB/s]Hit Ctrl+C to stop the download. Aiodl will save necessary information
to<download-file>.aiodl, next time it will automatically continue
to download from here.Other arguments:--fake-user-agent, -u  Use a fake User-Agent.
--num-tasks N, -n N    Limit number of asynchronous tasks.
--max-tries N, -r N    Limit retries on network errors.In your scriptimportaiodl# in an async functionfilename=awaitaiodl.download('https://dl.google.com/translate/android/Translate.apk',quiet=True)
Package: aiodns
aiodns provides a simple way for doing asynchronous DNS resolutions usingpycares.Exampleimportasyncioimportaiodnsloop=asyncio.get_event_loop()resolver=aiodns.DNSResolver(loop=loop)asyncdefquery(name,query_type):returnawaitresolver.query(name,query_type)coro=query('google.com','A')result=loop.run_until_complete(coro)The following query types are supported: A, AAAA, ANY, CAA, CNAME, MX, NAPTR, NS, PTR, SOA, SRV, TXT.APIThe API is pretty simple, three functions are provided in theDNSResolverclass:query(host, type): Do a DNS resolution of the given type for the given hostname. It returns an
instance ofasyncio.Future. The actual result of the DNS query is taken directly from pycares.
As of version 1.0.0 of aiodns (and pycares, for that matter) results are always namedtuple-like
objects with different attributes. Please check thedocumentationfor the result fields.gethostbyname(host, socket_family): Do a DNS resolution for the given
hostname and the desired type of address family (i.e.socket.AF_INET).
Whilequery()always performs a request to a DNS server,gethostbyname()first looks into/etc/hostsand thus can resolve
local hostnames (such aslocalhost).  Please checkthe documentationfor the result fields. The actual result of the call is aasyncio.Future.gethostbyaddr(name): Make a reverse lookup for an address.cancel(): Cancel all pending DNS queries. All futures will getDNSErrorexception set, withARES_ECANCELLEDerrno.Note for Windows usersThis library requires the asyncio loop to be aSelectorEventLoop, which is not the default on Windows since
Python 3.8.The default can be changed as follows (do this very early in your application):asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())This may have other implications for the rest of your codebase, so make sure to test thoroughly.Running the test suiteTo run the test suite:python tests.pyAuthorSaúl Ibarra Corretgé <s@saghul.net>Licenseaiodns uses the MIT license, check LICENSE file.Python versionsPython >= 3.6 are supported.ContributingIf you’d like to contribute, fork the project, make a patch and send a pull
request. Have a look at the surrounding code and please, make yours look
alike :-)
Package: aiodnsbl
aiodnsblDNSBLlists checker based onaiodns. Checks if an IP or a domain is listed on anti-spam DNS blacklists.NotesThis is a fork ofpydnsbl.Key differences:Fully type annotatedNo sync wrapper (async only)No category classificationInstallationpipinstallaiodnsblUsageimportasynciofromaiodnsblimportDNSBLCheckerloop=asyncio.get_event_loop()checker=DNSBLChecker()# Check IPloop.run_until_complete(checker.check("8.8.8.8"))# <DNSBLResult: 8.8.8.8  (0/10)>loop.run_until_complete(checker.check("68.128.212.240"))# <DNSBLResult: 68.128.212.240 [BLACKLISTED] (4/10)># Check domainloop.run_until_complete(checker.check("example.com"))# <DNSBLResult: example.com  (0/4)># Bulk checkloop.run_until_complete(checker.bulk_check(["example.com","8.8.8.8","68.128.212.240"]))# [<DNSBLResult: example.com  (0/4)>, <DNSBLResult: 8.8.8.8  (0/10)>, <DNSBLResult: 68.128.212.240 [BLACKLISTED] (4/10)>]importasynciofromaiodnsblimportDNSBLCheckerasyncdefmain():checker=DNSBLChecker()res=awaitchecker.check("68.128.212.240")print(res)# <DNSBLResult: 68.128.212.240 [BLACKLISTED] (4/10)>print(res.blacklisted)# Trueprint([provider.hostforproviderinres.providers])# ['b.barracudacentral.org', 'bl.spamcop.net', 'dnsbl.sorbs.net', 'ips.backscatterer.org', ...]print([provider.hostforproviderinres.detected_by])# ['b.barracudacentral.org', 'dnsbl.sorbs.net', 'spam.dnsbl.sorbs.net', 'zen.spamhaus.org']loop=asyncio.get_event_loop()loop.run_until_complete(main())
Package: aiodogstatsd
aiodogstatsdAn asyncio-based client for sending metrics to StatsD with support ofDogStatsDextension.Library fully tested withstatsd_exporterand supportsgauge,counter,histogram,distributionandtimingtypes.aiodogstatsdclient by default uses9125port. It's a default port forstatsd_exporterand it's different from8125which is used by default in StatsD andDataDog. Initialize the client with the proper port you need if it's different from9125.InstallationJust type:$pipinstallaiodogstatsdAt a glanceJust simply use client as a context manager and send any metric you want:importasyncioimportaiodogstatsdasyncdefmain():asyncwithaiodogstatsd.Client()asclient:client.increment("users.online")asyncio.run(main())Please followdocumentationor look atexamples/directory to find more examples of library usage, e.g. integration withAIOHTTPorStarletteframeworks.ContributingTo work on theaiodogstatsdcodebase, you'll want to clone the project locally and install the required dependencies viapoetry:$gitclonegit@github.com:Gr1N/aiodogstatsd.git
$makeinstallTo run tests and linters use command below:$makelint&&maketestIf you want to run only tests or linters you can explicitly specify which test environment you want to run, e.g.:$makelint-blackLicenseaiodogstatsdis licensed under the MIT license. See the license file for details.