Saravanan666/pypi-org huggingface dataset:
Package: aiosubpub
AioSubPubAsync pub sub implementation.Inspired by someone else whose name I cannot find anymore. If you see your code (I did some improvements on it I think) please let me know and I am happy to give you credit.Installationpip install aiosubpubUsageimportaiosubpubimportasyncioloop=asyncio.get_event_loop()# create a channela_channel=aiosubpub.Channel()# subscribe to the channel using a callback.defcall_back(data):print(data)subscription=loop.create_task(a_channel.subscribe(call_back))# Publish a message.a_channel.publish("a message")subscription.un_subscribe()# Without callback:subscription=a_channel.get_subscription()asyncdef_custom_subscriber():withsubscriptionassub:result=awaitsub.get()print(result)a_channel.publish("a message")result=await_custom_subscriber()changelog1.0.10Addget_latestto the channel.
Package: aiosupabase
aiosupabaseUnofficial Asyncronous Python Client for SupabaseLatest Version:FeaturesUnified Asyncronous and Syncronous Python Client forSupabaseSupports Python 3.6+Strongly Typed withPydanticUtilizes Environment Variables for ConfigurationAPIsBoth async and sync Apis are available for the followingAuthPostgrestStorageRealtimeFunctionsInstallation# Install from PyPIpipinstallaiosupabase# Install from sourcepipinstallgit+https://github.com/trisongz/aiosupabase.gitUsageExample UsageimportasynciofromaiosupabaseimportSupabasefromaiosupabase.utilsimportlogger"""Environment Vars that map to Supabase.configure:all vars are prefixed with SUPABASE_SUPABASE_URL (url): str   | Supabase URLSUPABASE_KEY (key): str   | API KeySUPABASE_DEBUG_ENABLED (debug_enabled): bool - defaults to FalseSUPABASE_CLIENT_SCHEMA (client_schema): str - defaults to 'public'SUPABASE_HEADERS (headers): Dict - defaults to {}SUPABASE_AUTO_REFRESH_TOKENS (auto_refresh_tokens): bool - defaults to TrueSUPABASE_PERSIST_SESSION (persist_session): bool - defaults to TrueSUPABASE_REALTIME_CONFIG (realtime_config): Dict - defaults to NoneSUPABASE_TIMEOUT (timeout): int - defaults to 5 [DEFAULT_POSTGREST_CLIENT_TIMEOUT]SUPABASE_COOKIE_OPTIONS (cookie_options): Dict - defaults to NoneSUPABASE_REPLACE_DEFAULT_HEADERS (replace_default_headers): bool - defaults to False"""Supabase.configure(url='...',key="...",debug_enabled=True,)asyncdefasync_fetch_table(table:str="profiles",select:str="*"):# Async fetch# note that table is `atable` for asyncreturnawaitSupabase.atable(table).select(select).execute()deffetch_table(table:str="profiles",select:str="*"):# Sync fetchreturnSupabase.table(table).select(select).execute()asyncdefasync_fetch_users():# Async `ListUsers`# note that most async methods are prefixed with# `async_`returnawaitSupabase.auth.async_list_users()deffetch_users():# Sync `ListUsers`# note that most async methods are prefixed withreturnSupabase.auth.list_users()asyncdefrun_test():# Async fetchasync_data=awaitasync_fetch_table()logger.info(f"async_data:{async_data}")async_users=awaitasync_fetch_users()logger.info(f"async_users:{async_users}")# Sync fetchsync_data=fetch_table()logger.info(f"sync_data:{sync_data}")sync_users=fetch_users()logger.info(f"sync_users:{sync_users}")asyncio.run(run_test())
Package: aioswitchbee
pySwitchbeeA Python module library to controlSwitchBeesmart home devices.Example code usage:fromasyncioimportget_event_loopfromaiohttpimportClientSession,ClientTimeout,TCPConnectorfromswitchbee.apiimportCentralUnitAPIfromswitchbee.deviceimportApiStateCommand,DeviceTypeasyncdefmain():session=ClientSession(connector=TCPConnector(ssl=False),timeout=ClientTimeout(total=3),)cu=CentralUnitAPI("192.168.50.2","user","pass",session)awaitcu.connect()print(f"Central Unit Name:{cu.name}")print(f"Central Unit MAC:{cu.mac}")print(f"Central Unit Version:{cu.version}")devices=awaitcu.devicesfordeviceindevices:# set the dimmer lights to 50% brightnessifdevice.type==DeviceType.Dimmer:print("Discovered Dimmer device called{device.name}"" current brightness is{device.brigt}")awaitcu.set_state(device.id,50)# set the shutters position to 30% openedifdevice.type==DeviceType.Shutter:print("Discovered Shutter device called{device.name}"" current position is{device.position}")awaitcu.set_state(device.id,30)# turn off switchesifdevice.type==DeviceType.Switch:print("Discovered Switch device called{device.name}"" current state is{device.state}")awaitcu.set_state(device.id,ApiStateCommand.OFF)# set timer switch on for 10 minutesifdevice.type==DeviceType.TimedPower:print("Discovered Timed Power device called{device.name}"" current state is{device.state}with{device.minutes_left}""minutes left until shutdown")awaitcu.set_state(device.id,10)session.close()if__name__=="__main__":get_event_loop().run_until_complete(main())exit()Using the CLI tool:Alternatively, it is possible to controlSwitchBeedevices using the cli toolswitchbee_cli.pyas following:To list devices that currently on:python switchbee_cli.py -i 192.168.50.2 -u USERNAME -p PASSWORD get_states --only-on'_state': 'ON',
    'hardware': <HardwareType.Switch: 'DIMMABLE_SWITCH'>,
    'id': 311,
    'name': 'Ceiling',
    'type': <DeviceType.Switch: 'SWITCH'>,
    'zone': 'Outdoo Storage'}

{   '_state': 'ON',
    'hardware': <HardwareType.Switch: 'DIMMABLE_SWITCH'>,
    'id': 142,
    'name': 'Spotlights',
    'type': <DeviceType.Switch: 'SWITCH'>,
    'zone': 'Porch'}To set shutter with device id 392 position 50%:python switchbee_cli.py -i 192.168.50.2 -u USERNAME -p PASSWORD set_state --device-id 392 --state 50To turn on Power Timed Switch with device id 450 for 30 minutes:python switchbee_cli.py -i 192.168.50.2 -u USERNAME -p PASSWORD set_state --device-id 450 --state 30To turn off light with device id 122:python switchbee_cli.py -i 192.168.50.2 -u USERNAME -p PASSWORD set_state --device-id 122 --state OFF
Package: aiosysbus
aiosysbusManage your Livebox in PythonEasily manage your Livebox in Python.
Check your config, configure your dhcp, disable your wifi, monitor your LAN activity and many others, on LAN or remotely.aiosysbus is a python library implementing fir the Livebox v3.This project is based on stilllman/aiofreepybox, which provides the same features as aiofreepybox in a synchronous manner.WARNINGVersion 1.0.0 and abovemakes all these calls asynchronously.
It breaks the compatibility of previous codesInstallUse the PIP package manager$pipinstallaiosysbusOr manually download and install the last version from github$gitclonehttps://github.com/cyr-ius/aiosysbus.git
$pythonsetup.pyinstallGet startedaiosysbus < 1.0.0# Import the aiosysbus package.fromaiosysbusimportAIOSysbusasyncdefreboot()# Instantiate the Sysbus class using default options.lvbx=AIOSysbus('192.168.1.1','80','xxxxxx')# Connect to the livebox with default options.lvbx.connect()# Do something useful, rebooting your livebox for example.lvbx.system.reboot()# Properly close the session.lvbx.close()aiosysbus >= 1.0.0importasyncioimportloggingasyncdefasync_main()->None:# Instantiate the Sysbus class using default options.api=AIOSysbus(username=xxxx,password=xxxx,host=HOST)# Connect to the livebox.awaitapi.async_connect()# Query exampleparameters={"parameters":{"expression":{"wifi":"wifi && .Active==False"}}}devices=awaitapi.devices.async_get_devices(parameters)awaitapi.async_close()if__name__=="__main__":loop=asyncio.get_event_loop()loop.run_until_complete(async_main())Have a look at theexample.pyfor a more complete overview.Notes on HTTPSNot implemented
Package: aiotaika
aiotaikaTaika asynchronous client library for PythonThis library provides a very intuitive API for developers to easily create Python applications for Taika Tech's Spatial User Interface (SUI). With SUI, you can program actions to your physical environment, which are triggered based on location, orientation, and/or gesture data coming from a Taika Ring or Taika Tag.You can find aiotaika's documentation fromRead the Docs.Basic ExamplesFor more examples, seeexamplesfolder of the repository.Callback ExampleIn this example, we subscribe to move events and gesture events of ring ID 3.
In the callback function, we track the latest position and when a gesture event
happens, we print out which gesture was made with the latest location data.With callbacks one can register one or more callbacks to a single callback function.
However, the Event type must be a parent class of all incoming event objects in that
callback function. HereRingGestureEventandRingMoveEventinherit fromRingEvent.import asyncio

from aiotaika import TaikaClient
from aiotaika.events import EventType
from aiotaika.ring import RingGestureEvent, RingMoveEvent

Vector3 last_position

async def my_callback(event: RingEvent) -> None:
    if isinstance(event, RingMoveEvent):
        last_position = event.position
    elif isinstance(event, RingGestureEvent):
        print(f"{event.gesture} in position {last_position}")


async def main() -> None:
    async with TaikaClient(
        host="127.0.0.1", username="root", password=""
    ) as taika:
        rings = taika.rings
        for key, ring in rings.items():
            print("{}: {}".format(key, ring.metadata))
        await rings[3].register_event_cb(EventType.RING_MOVE_EVT, my_callback)
        await rings[3].register_event_cb(EventType.RING_GESTURE_EVT, my_callback)
        await asyncio.sleep(5)


try:
    asyncio.run(main())
except KeyboardInterrupt:
    passAsynchronous Generator Example (no callbacks!)This example shows simply how all the incoming events can be handled via theeventsAsyncGenerator of theTaikaClientclass. In this example, we simply print out a
ring's name and position when aRingMoveEventhappens.import asyncio

from aiotaika import TaikaClient
from aiotaika.ring import RingMoveEvent

async def main() -> None:
    async with TaikaClient(
        host="127.0.0.1", username="root", password=""
    ) as taika:
        async with taika.events() as events:
            async for event in events:
                if isinstance(event, RingMoveEvent):
                    print(f"Ring {event.metadata.name} position:")
                    print(f"x: {event.position.x}, z: {event.position.z}")
                    print(f"height: {event.position.y}")


try:
    asyncio.run(main())
except KeyboardInterrupt:
    passRequirements:HardwareTaika Development KitSoftwareNote: these should be automatically satisfied ifaiotaikais installed viapip.You can find precise version requirements frompyproject.tomlPythonasyncio-mqttaiomysql
Package: aiotailwind
aiotailwindasyncio library to interact withTailwinddevices using theirlocal JSON API.Local Control KeyIn order to use the local control API, it's necessary to obtain your Local Control Key (a 6-digit code), which you then provide when initialising anAuthinstance.To obtain your Local Control Key, ensure that you've updated your Tailwind iQ3 to the v9.95 firmware or later, and then:VisitTailwind WebLog in with your Tailwind accountClick "Local Control Key" in the top menu (red box in screenshot)If no key is displayed, click the "Create new local command key" buttonEnter the 6-digit code (green box in screenshot) into the integration configurationSupported DevicesThis library has been developed and tested against a Tailwind iQ3 garage door opener controller.  A rudimentary attempt to support the Light device referenced in the API documentation has been made, but without access to a physical device, it has not been possible to test whether this works.DemoSeedemo.pyfor a basic demo.
Package: aiotaipit
aioTaipitAsynchronous Python API forTaipit cloud meters.InstallationUse pip to install the library:pip install aiotaipitUsageimportasynciofrompprintimportpprintimportaiohttpfromaiotaipitimportSimpleTaipitAuth,TaipitApiasyncdefmain(username:str,password:str)->None:"""Create the aiohttp session and run the example."""asyncwithaiohttp.ClientSession()assession:auth=SimpleTaipitAuth(username,password,session)api=TaipitApi(auth)meters=awaitapi.async_get_meters()pprint(meters)if__name__=="__main__":_username="<YOUR_USER_NAME>"_password="<YOUR_PASSWORD>"asyncio.run(main(_username,_password))TheSimpleTaipitAuthclient also accept custom client ID and secret (this can be found by sniffing the client).This will return a price object that looks a little like this:[{'address':'Санкт-Петербург, Ворошилова, 2','category':0,'ecometerdata':{'P_aver':0.21986280758339,'P_averSmall':0.15261778589793,'P_averSmall_':109.88480584651,'P_aver_':158.30122146004,'P_aver_TF1':False,'P_aver_TF2':False,'P_aver_TF31':False,'P_aver_TF32':False,'P_aver_TF33':False,'P_norm':0.0066666666666667,'currentTS':1671485359,'ecoStatus':None,'lastReading':{'energy_a':1004.85,'energy_t1_a':794.45,'energy_t2_a':210.4,'energy_t3_a':0,'ts_tz':1671483628,'value':0.02},'meterCategory':0,'time':1671485359,'timezone':3,'trend':-48.41641561353,'trendTF1':False,'trendTF2':False},'id':2147485997,'isLowDataFreq':False,'isOwner':False,'isVirtual':0,'metername':'НЕВА МТ 114 (Wi-Fi) (22001110)','owner':{'peopleNumber':None,'type':0,'typeCode':'person'},'serialNumber':'22001110','usericopath':'/uploads/user/photo/3edba895933a54540fbdb88614f24f480a9eeb68.png','username':'Компания Тайпит','waterHot':False},{'address':'Санкт-Петербург, Ворошилова, 2','category':0,'ecometerdata':{'P_aver':0.25422232030182,'P_averSmall':0.2494024938596,'P_averSmall_':179.56979557891,'P_aver_':183.04007061731,'P_aver_TF1':False,'P_aver_TF2':False,'P_aver_TF31':False,'P_aver_TF32':False,'P_aver_TF33':False,'P_norm':0,'currentTS':1671485359,'ecoStatus':None,'lastReading':{'energy_a':11595.62,'energy_t1_a':10420.94,'energy_t2_a':1174.68,'energy_t3_a':0,'ts_tz':1671483641,'value':0},'meterCategory':0,'time':1671485359,'timezone':3,'trend':-3.4702750384005,'trendTF1':False,'trendTF2':False},'id':2147485996,'isLowDataFreq':False,'isOwner':False,'isVirtual':0,'metername':'НЕВА МТ 114 (Wi-Fi) (22001114)','owner':{'peopleNumber':None,'type':0,'typeCode':'person'},'serialNumber':'22001114','usericopath':'/uploads/user/photo/3edba895933a54540fbdb88614f24f480a9eeb68.png','username':'Компания Тайпит','waterHot':False}]Timeoutsaiotaipit does not specify any timeouts for any requests. You will need to specify them in your own code. We recommend thetimeoutfromasynciopackage:importasynciowithasyncio.timeout(10):all_readings=awaitapi.async_get_meters()
Package: aiotankerkoenig
aiotankerkoenigAsynchronous Python client for tankerkoenig.de.AboutThis package allows you to fetch data from tankerkoenig.de.InstallationpipinstallaiotankerkoenigUsageimportasynciofromaiotankerkoenigimportTankerkoenigasyncdefmain()->None:"""Run the example."""asyncwithTankerkoenig(api_key="abc123")astk:station_details=awaittk.station_details("12345678-1234-1234-1234-123456789012")print(f"Name:{station_details.name}")if__name__=="__main__":asyncio.run(main())Changelog & ReleasesThis repository keeps a change log usingGitHub's releasesfunctionality. The format of the log is based onKeep a Changelog.Releases are based onSemantic Versioning, and use the format
ofMAJOR.MINOR.PATCH. In a nutshell, the version will be incremented
based on the following:MAJOR: Incompatible or major changes.MINOR: Backwards-compatible new features and enhancements.PATCH: Backwards-compatible bugfixes and package updates.ContributingThis is an active open-source project. I am always open to people who want to
use the code or contribute to it.Thank you for being involved! :heart_eyes:Setting up development environmentThis Python project is fully managed using thePoetrydependency manager. But also relies on the use of NodeJS for certain checks during development.You need at least:Python 3.11+PoetryNodeJS 20+ (including NPM)To install all packages, including all development requirements:npminstall
poetryinstallAs this repository uses thepre-commitframework, all changes
are linted and tested with each commit. You can run all checks and tests
manually, using the following command:poetryrunpre-commitrun--all-filesTo run just the Python tests:poetryrunpytestAuthors & contributorsThe content is byJan-Philipp Benecke.For a full list of all authors and contributors,
checkthe contributor's page.LicenseMIT LicenseCopyright (c) 2024 Jan-Philipp BeneckePermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Package: aiotapioca-wrapper
AioTapioca-WrapperIt's an asynchronous fork oftapioca-wrapperlibrary.Tapioca helps you generating Python clients for APIs.
APIs wrapped by Tapioca are explorable and follow a simple interaction pattern that works uniformly so developers don't need to learn how to use a new coding interface/style for each service API.DocumentationFull documentation hosted byreadthedocs.FlavoursYou can find the full list of available tapioca clientshere.To create new flavours, refer toBuilding a wrapperin the documentation. There is also acookiecutter templateto help bootstraping new API clients.Other resourcesContributorsChangelogBlog post explaining the basics about Tapioca
Package: aiotapioca-yandex-metrika
Python client for allAPI Yandex MetrikaIt's an asynchronous fork oftapi-yandex-metrikalibrary.Installationpip install aiotapioca-yandex-metrikaDocumentationManagement APIReports APILogs APIDependenciesaiohttpaiotapioca-wrapperHelpAndrey IlinAuthorPavel MaksimovGood luck friend! Star the repo ;)Удачи тебе, друг! Поставь звездочку ;)Copyright (c) Pavel Maksimov.The author of this modification Andrey Ilin.
Package: aiotarantool
Connector required tarantool version 1.6:$ pip install aiotarantoolTry it example:importasyncioimportaiotarantoolcnt=0asyncdefinsert_job(tnt):globalcntforitinrange(2500):cnt+=1r=awaittnt.insert("tester",(cnt,cnt))loop=asyncio.get_event_loop()tnt=aiotarantool.connect("127.0.0.1",3301)tasks=[loop.create_task(insert_job(tnt))for_inrange(40)]loop.run_until_complete(asyncio.wait(tasks))loop.run_until_complete(tnt.close())loop.close()Under this scheme the aiotarantool driver makes a smaller number of read/write tarantool socket.See benchmark results time for insert/select/delete 100K tuples on 1.5KBytes:calltarantoolaiotarantoolinsert35.93804712.701088select24.38974812.746204delete35.22451513.905095
Package: aiotarantool_queue
Bindings require tarantool version 1.6 and aiotarantool connector:$ pip install aiotarantool_queue aiotarantoolTry it example:importasyncioimportaiotarantool_queueimportrandom@asyncio.coroutinedefput_job(queue):fortube_namein("tube1","tube2","tube3"):tube=queue.tube(tube_name)task=yield fromtube.put({"task_data":random.random()})@asyncio.coroutinedeftake_job(tube):whileTrue:task=yield fromtube.take(5)ifnottask:breakprint(task.data)yield fromtask.ack()loop=asyncio.get_event_loop()queue=aiotarantool_queue.Queue("127.0.0.1",3301)put_tasks=[asyncio.async(put_job(queue))for_inrange(20)]take_tasks=[asyncio.async(take_job(queue.tube(tube_name)))fortube_namein("tube1","tube2","tube3")]loop.run_until_complete(asyncio.wait(put_tasks+take_tasks))loop.run_until_complete(queue.close())loop.close()This code makes it easy to develop your application to work with queue.
Package: aio-task
aio-taskSimple and reliable asynchronous tasks manager that is asyncio friendly.Key FeaturesA simple worker interface to register coroutines as tasks.A simple broker interface to produce and fetch tasks.Broker and worker(s) can be setup in a single program avoiding external service dependencies (by using dummies queue and cache).Task is not lost if worker crash during processing it, it's kept in the queue and re-processed until a worker acknowledge it.Task exceptions are not lost: you will retrieve them in the task's result.Support rabbitmq, redis and sentinel.Easily hackable to add new queuing/caching servicesGetting StartedUsedocker-compose -f examples/docker-compose.yml upto bring up a rabbitmq and a redis to run this example.Installpip install aio-taskWorker → run tasksimportasynciofromaio_taskimportWorkerasyncdefaddition(a,b):""" Task example. """returna+basyncdefstart_worker():rabbitmq_config={"url":"amqp://guest:guest@localhost:5672","routing_key":"tasks_queue"}redis_config={"address":"redis://localhost"}worker=awaitWorker.create("rabbitmq",rabbitmq_config,"redis",redis_config)worker.register_handler(addition)awaitworker.start()returnworkerloop=asyncio.get_event_loop()worker=loop.run_until_complete(start_worker())try:loop.run_forever()exceptKeyboardInterrupt:loop.run_until_complete(worker.close())# gracefull shutdownloop.close()Broker → produce tasksimportasynciofromaio_taskimportBrokerasyncdefsample_addition():# setup brokerrabbitmq_config={"url":"amqp://guest:guest@localhost:5672","routing_key":"tasks_queue"}redis_config={"address":"redis://localhost"}broker=awaitBroker.create("rabbitmq",rabbitmq_config,"redis",redis_config)# produce tasktask_id=awaitbroker.create_task("addition",{"a":1,"b":2})awaitasyncio.sleep(0.1)# fetch tasktask=awaitbroker.get_task(task_id)print(task)awaitbroker.close()# graceful shutdownloop=asyncio.get_event_loop()loop.run_until_complete(sample_addition())loop.run_until_complete(broker.close())💡 More examples in examples/ !Run testsunit testspip install -e .[test]
pytest -xvs tests/unitintegration testspip install -e .[test]
docker-compose -f tests/integration/compose/docker-compose.yml up -d
IP_HOST=localhost pytest -xvs tests/integration