Saravanan666/pypi-org huggingface dataset:
Package: aioelectricitymaps
aioelectricitymapsAsynchronous Python client for Electricity Maps.AboutThis package allows you to fetch data from electricitymaps.com.InstallationpipinstallaioelectricitymapsUsageimportasynciofromaioelectricitymapsimportElectricityMapsasyncdefmain()->None:"""Run the example."""asyncwithElectricityMaps(token="abc123")asem:response=awaitem.latest_carbon_intensity_by_country_code("DE")print(f"Carbon intensity in Germany:{response.data.carbon_intensity}gCO2eq/kWh")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) 2023 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: aioelpris
aioelprisAn aio library to retrieve current electricity price in (some parts) of the Nordics. Current supported regions are:DK1: Denmark/west of the Great BeltDK2: Denmark/east of the Great BeltNO2: Norway/KristiansandSE3: Sweden/StockholmSE4: Sweden/MalmöPrices are returned in DKK and EUR currencies.Basic exampleimportasynciofromaiohttpimportClientSessionfromaioelprisimportElPrisfromaioelpris.core.modelsimportPriceasyncdefexample()->Price:asyncwithClientSession()assession:pris=ElPris(session=session,price_area="SE3")price:Price=awaitpris.get_current_price()print(price.SpotPriceDKK)returnpriceasyncio.run(example())Data sourcesEnergi Data Service.
Package: aioemit
aioemitaioemit allows you to manage events asynchonosly and notify subscribers when those events occur. It provides a simple way to implement event bus pattern in an event driven architecture application.InstallationpipinstallaioemitUsageCreating EventsTheEventclass represents an event with a specified event type and optional data. You can create an event by initializing an instance of theEventclass with the event type and data (if any).event=Event("example_event","example_data")Creating an EmitterTo use the event emitter, create an instance of theEmitterclass.emitter=Emitter()Subscribing to EventsTo subscribe to events, use thesubscribemethod of theEmitterclass. Pass the event type and an observer function that will be called when the event is emitted.defevent_observer(event):# Handle the eventprint("Received event:",event)emitter.subscribe("example_event",event_observer)Unsubscribing from EventsIf you no longer want to receive notifications for a specific event, you can unsubscribe from it using theunsubscribemethod. Provide the event type and the observer function that you want to remove.emitter.unsubscribe("example_event",event_observer)Emitting EventsTo emit an event and notify all subscribers, use theemitmethod of theEmitterclass. Pass the event you want to emit.event=Event("example_event","example_data")awaitemitter.emit(event)Theemitmethod will asynchronously call all the subscribed observer functions that are associated with the event type.LicenseThis project is licensed under theMIT License. Feel free to use, modify, and distribute the code as per the terms of the license.
Package: aioenkanetworkcard
GitHub|Example|Discord|DocumentationEnkaNetworkCardWrapper forEnkaNetwork.pyto create character cards in Python.Installation:pip install aioenkanetworkcardDependencies:Dependencies that must be installed for the library to work:Pillowrequestsiomaththreadingdatetimerandomenkanetwork.pyloggingSample Results:The result of a custom images and adaptation (template= 1).Usual result (template= 1).The result of a custom images and adaptation (template= 2).Usual result (template= 2).
Package: aioeos
aioeosAsync Python library for interacting with EOS.io blockchain.FeaturesAsync JSON-RPC client.Signing and verifying transactions using private and public keys.Serializer for basic EOS.io blockchain ABI types.Helpers which provide an easy way to generate common actions, such as token
transfer.InstallationLibrary is available on PyPi, you can simply install it usingpip.$ pip install aioeosUsageImporting a private keyfrom aioeos import EosAccount

account = EosAccount(private_key='your key')Transferring fundsfrom aioeos import EosJsonRpc, EosTransaction
from aioeos.contracts import eosio_token


rpc = EosJsonRpc(url='http://127.0.0.1:8888')
block = await rpc.get_head_block()

transaction = EosTransaction(
   ref_block_num=block['block_num'] & 65535,
   ref_block_prefix=block['ref_block_prefix'],
   actions=[
      eosio_token.transfer(
         from_addr=account.name,
         to_addr='mysecondacc1',
         quantity='1.0000 EOS',
         authorization=[account.authorization('active')]
      )
   ]
)
await rpc.sign_and_push_transaction(transaction, keys=[account.key])Creating a new accountfrom aioeos import EosJsonRpc, EosTransaction, EosAuthority
from aioeos.contracts import eosio


main_account = EosAccount(name='mainaccount1', private_key='private key')
new_account = EosAccount(name='mysecondacc1')
owner = EosAuthority(
   threshold=1,
   keys=[new_account.key.to_key_weight(1)]
)

rpc = EosJsonRpc(url='http://127.0.0.1:8888')
block = await rpc.get_head_block()

await rpc.sign_and_push_transaction(
   EosTransaction(
      ref_block_num=block['block_num'] & 65535,
      ref_block_prefix=block['ref_block_prefix'],
      actions=[
            eosio.newaccount(
               main_account.name,
               new_account.name,
               owner=owner,
               authorization=[main_account.authorization('active')]
            ),
            eosio.buyrambytes(
               main_account.name,
               new_account.name,
               2048,
               authorization=[main_account.authorization('active')]
            )
      ],
   ),
   keys=[main_account.key]
)DocumentationDocs and usage examples are availablehere.Unit testingTo run unit tests, you need to bootstrap an EOS testnet node first. Use the providedensure_eosio.shscript.$ ./ensure_eosio.sh
Package: aioeosabi
aioeosabiUpdated version of aioeos to no longer rely on API calls to serialize data. Integrateshttps://github.com/stuckatsixpm/antelopyto serialize instead.
Should be usable as a drop-in replacement for the original aioeos.For Documentation: See the original aioeos Docs. Only difference is thatsign_and_push_transactionnow lets you specify if you want to use a stored ABI or fetch a new one. Also two new helper functions.smart_sign_and_push_transaction: Signs and pushes a transaction using the cached ABI, refetching the ABI if the first try fails.push_actions: Pushed out a transaction, trying out various endpoints until one succeeds.Async Python library for interacting with EOS.io blockchain.FeaturesAsync JSON-RPC client.Signing and verifying transactions using private and public keys.Serializer for basic EOS.io blockchain ABI types.Helpers which provide an easy way to generate common actions, such as token
transfer.InstallationLibrary is available on PyPi, you can simply install it usingpip.$pipinstallaioeosabiUsageImporting a private keyfromaioeosabiimportEosAccountaccount=EosAccount(private_key='your key')Transferring fundsfromaioeosabiimportEosJsonRpc,EosTransactionfromaioeosabi.contractsimporteosio_tokenrpc=EosJsonRpc(url='http://127.0.0.1:8888')block=awaitrpc.get_head_block()transaction=EosTransaction(ref_block_num=block['block_num']&65535,ref_block_prefix=block['ref_block_prefix'],actions=[eosio_token.transfer(from_addr=account.name,to_addr='mysecondacc1',quantity='1.0000 EOS',authorization=[account.authorization('active')])])awaitrpc.sign_and_push_transaction(transaction,keys=[account.key])Creating a new accountfromaioeosabiimportEosJsonRpc,EosTransaction,EosAuthorityfromaioeosabi.contractsimporteosiomain_account=EosAccount(name='mainaccount1',private_key='private key')new_account=EosAccount(name='mysecondacc1')owner=EosAuthority(threshold=1,keys=[new_account.key.to_key_weight(1)])rpc=EosJsonRpc(url='http://127.0.0.1:8888')block=awaitrpc.get_head_block()awaitrpc.sign_and_push_transaction(EosTransaction(ref_block_num=block['block_num']&65535,ref_block_prefix=block['ref_block_prefix'],actions=[eosio.newaccount(main_account.name,new_account.name,owner=owner,authorization=[main_account.authorization('active')]),eosio.buyrambytes(main_account.name,new_account.name,2048,authorization=[main_account.authorization('active')])],),keys=[main_account.key])DocumentationDocs and usage examples are availablehere.Unit testingTo run unit tests, you need to bootstrap an EOS testnet node first. Use the providedensure_eosio.shscript.$./ensure_eosio.sh
Package: aioerl
aioerlaioerlis a python library that mimics the philosophy of Erlang's processes with asyncio tasks.Implements the following ideas:Each process has a mailbox: a queue to receive messages from other processes.Message passing: processes communicate entirely with messages (from the point of view of the developer)Supervisor/monitors: processes can monitor other processes (when a process dies or crashes, sends a message to its supervisor with the exit reason or the exception)Why?asynciois awesome and built-in structures likeasyncio.Queueare great for communicating between tasks but is hard to manage errors.Withaioerl, a process just waits for incoming messages from other processes and decides what to do for each event (seeexample).QuickstartRequirements: Python 3.7+Installation:pipinstallaioerlExamplefromaioerlimportreceivefromaioerlimportreplyfromaioerlimportsendfromaioerlimportspawnimportasyncioasyncdefping_pong():whilem:=awaitreceive(timeout=10):ifm.is_ok:ifm.body=="ping":awaitreply("pong")else:raiseException("Invalid message body")elifm.is_timeout:return# terminate processasyncdefmain():p=awaitspawn(ping_pong())awaitsend(p,"ping")print(awaitreceive())# Message(sender=<Proc:Task-2>, event='ok', body='pong')awaitsend(p,"pang")print(awaitreceive())# Message(sender=<Proc:Task-2>, event='err', body=Exception('Invalid message body'))awaitsend(p,"ping")print(awaitreceive())# Message(sender=<Proc:Task-2>, event='exit', body='noproc')if__name__=="__main__":asyncio.run(main())TODO:Lot of things!
Package: aioes
aioesis aasynciocompatible library for working withElasticsearchDocumentationReadaioesdocumentation on Read The Docs:http://aioes.readthedocs.io/Exampleimport asyncio
from aioes import Elasticsearch

@asyncio.coroutine
def go():
    es = Elasticsearch(['localhost:9200'])
    ret = yield from es.create(index="my-index",
                               doc_type="test-type",
                               id=42,
                               body={"str": "data",
                                     "int": 1})
    assert (ret == {'_id': '42',
                    '_index': 'my-index',
                    '_type': 'test-type',
                    '_version': 1,
                    'ok': True})

    answer = yield from es.get(index="my-index",
                               doc_type="test-type",
                               id=42)
    assert answer['_source'] == {'str': 'data', 'int': 1}

loop = asyncio.get_event_loop()
loop.run_until_complete(go())RequirementsPython3.3+asyncioor Python 3.4+aiohttp1.3+TestsMake sure you have an instance of Elasticsearch running on port 9200
before executing the tests.In order for all tests to work you need to add the following lines in theconfig/elasticsearch.ymlconfiguration file:Enable groovy scripts:script.groovy.sandbox.enabled: trueSet a repository path:path.repo: ["/tmp"]The test suite usespy.test, simply run:$ py.testLicenseaioes is offered under the BSD license.CHANGES0.7.2 (2017-04-19)Allow customConnectorinTransport: #138, #137.Several typos in documentation fixed.0.7.0 (2017-03-29)Fix Elasticsearch 5.x compatibility issues: #48, #72, #112, #73, #123.Addstored_fieldstomget,searchandexplainmethods (#123).Addwait_for_no_relocating_shardsparameter inhealth(#123).Addfilter,token_filter,char_filterparams inanalyze(#123).Addforce_mergemethod (renamedoptimize) (#123).Add ignore_idle_threads param in hot_threads #123.Update project dependencies.Convert tests to pytest.0.6.1 (2016-09-08)Accept bytes as payload #42ConvertElasticsearch.close()into a coroutine.0.6.0 (2016-09-08)Add support for verify_ssl #430.5.0 (2016-07-16)Allow scheme, username and password in connections #400.4.0 (2016-02-10)Fix ES2+ compatibility in transport address regex #380.3.0 (2016-01-27)Use aiohttp.ClientSession internally #360.2.0 (2015-10-08)Make compatible with Elasticsearch 1.7Support Python 3.5Drop Python 3.3 supportRelicense under Apache 20.1.0 (2014-10-04)Initial release
Package: aioes-ext
aioesis aasynciocompatible library for working withElasticSearchDocumentationReadaioesdocumentation on Read The Docs:http://aioes.readthedocs.org/Exampleimport asyncio
from aioes import Elasticsearch

@asyncio.coroutine
def go():
    es = Elasticsearch(['localhost:9200'])
    ret = yield from es.create(index="my-index",
                               doc_type="test-type",
                               id=42,
                               body={"str": "data",
                                     "int": 1})
    assert (ret == {'_id': '42',
                    '_index': 'my-index',
                    '_type': 'test-type',
                    '_version': 1,
                    'ok': True})

    answer = yield from es.get(index="my-index",
                               doc_type="test-type",
                               id=42)
    assert answer['_source'] == {'str': 'data', 'int': 1}

loop = asyncio.get_event_loop()
loop.run_until_complete(go())RequirementsPython3.3+asyncioor Python 3.4+aiohttp0.9.1+TestsMake sure you have an instance of elastic-search running on port 9200
before executing the tests.In order for all tests to work you need to add the following lines in theconfig/elasticsearch.ymlconfiguration file:Enable groovy scripts:script.groovy.sandbox.enabled: trueSet a repository path:path.repo: ["/tmp"]The test suite usesnose, to execute:nosetests testsLicenseaioes is offered under the BSD license.CHANGES0.6.1 (2016-09-08)Accept bytes as payload #42ConvertElasticsearch.close()into a coroutine.0.6.0 (2016-09-08)Add support for verify_ssl #430.5.0 (2016-07-16)Allow scheme, username and password in connections #400.4.0 (2016-02-10)Fix ES2+ compatibility in transport address regex #380.3.0 (2016-01-27)Use aiohttp.ClientSession internally #360.2.0 (2015-10-08)Make compatible with Elasticsearch 1.7Support Python 3.5Drop Python 3.3 supportRelicense under Apache 20.1.0 (2014-10-04)Initial release
Package: aioesphomeapi
aioesphomeapiallows you to interact with devices flashed withESPHome.InstallationThe module is available from thePython Package Index.$pip3installaioesphomeapiAn optional cython extension is available for better performance, and the module will try to build it automatically.The extension requires a C compiler and Python development headers. The module will fall back to the pure Python implementation if they are unavailable.Building the extension can be forcefully disabled by setting the environment variableSKIP_CYTHONto1.UsageIt’s required that you enable theNative APIcomponent for the device.# Example configuration entryapi:password:'MyPassword'Check the output to get the local address of the device or use thename:``under``esphome:from the device configuration.[17:56:38][C][api:095]:APIServer:[17:56:38][C][api:096]:Address:api_test.local:6053The sample code below will connect to the device and retrieve details.importaioesphomeapiimportasyncioasyncdefmain():"""Connect to an ESPHome device and get details."""# Establish connectionapi=aioesphomeapi.APIClient("api_test.local",6053,"MyPassword")awaitapi.connect(login=True)# Get API version of the device's firmwareprint(api.api_version)# Show device detailsdevice_info=awaitapi.device_info()print(device_info)# List all entities of the deviceentities=awaitapi.list_entities_services()print(entities)loop=asyncio.get_event_loop()loop.run_until_complete(main())Subscribe to state changes of an ESPHome device.importaioesphomeapiimportasyncioasyncdefmain():"""Connect to an ESPHome device and wait for state changes."""cli=aioesphomeapi.APIClient("api_test.local",6053,"MyPassword")awaitcli.connect(login=True)defchange_callback(state):"""Print the state changes of the device.."""print(state)# Subscribe to the state changesawaitcli.subscribe_states(change_callback)loop=asyncio.get_event_loop()try:asyncio.ensure_future(main())loop.run_forever()exceptKeyboardInterrupt:passfinally:loop.close()Other examples:CameraAsync printSimple printInfluxDBDevelopmentFor development is recommended to use a Python virtual environment (venv).# Setup virtualenv (optional)$python3-mvenv.$sourcebin/activate# Install aioesphomeapi and development depenencies$pip3install-e.$pip3install-rrequirements_test.txt# Run linters & test$script/lint# Update protobuf _pb2.py definitions (requires a protobuf compiler installation)$script/gen-protocA cli tool is also available for watching logs:aioesphomeapi-logs--helpA cli tool is also available to discover devices:aioesphomeapi-discoverLicenseaioesphomeapiis licensed under MIT, for more details check LICENSE.
Package: aioethereum
aioethereumEthereum RPC client library for thePEP 3156Python event loop.FeaturesujsonsupportYesuvloopsupportYesHigh-level APIsYesHTTP supportYesUnix domain socket (IPC) supportYesSSL/TLS supportYesTested CPython versions3.4, 3.5, 3.6Tested Geth versions1.7.0Implemented RPC apisadmin, db, debug, eth, miner, net, personal, shh, txpool, web3Documentationhttp://aioethereum.readthedocs.io/Usage examplesSimple high-level interface (through HTTP):importasyncioimportaioethereumloop=asyncio.get_event_loop()asyncdefgo():client=awaitaioethereum.create_ethereum_client('http://localhost:8545',loop=loop)val=awaitclient.web3_clientVersion()print(val)loop.run_until_complete(go())# will print like 'Geth/v1.7.0-stable-6c6c7b2a/darwin-amd64/go1.9'or via IPCimportasyncioimportaioethereumloop=asyncio.get_event_loop()asyncdefgo():client=awaitaioethereum.create_ethereum_client('ipc://<path_to_unix_socket>',loop=loop)val=awaitclient.web3_clientVersion()print(val)loop.run_until_complete(go())# will print like 'Geth/v1.7.0-stable-6c6c7b2a/darwin-amd64/go1.9'RequirementsPython3.3+asyncioorPython3.4+ujsonaiohttpNoteujson is preferred requirement.
Pure C JSON encoder and decoder is implemented as well and can be used
automatically when installed.LicenseThe aioethereum is offered under MIT license.0.2.2 (2018-04-10)Fix bug, related tohttps://www.python.org/dev/peps/pep-0492/#new-syntax;Fix port detection for client when only domain;0.2.1 (2017-10-08)Add admin and debug management apis;Add new tests;Add uvloop support (python 3.5+ required);0.2.0 (2017-10-05)Add more docstrings to the code;Add tests for all rpc methods;Add admin and debug;Fix error for unixsocket retring;Fix unixsocket invalid loop for Python 3.4;BaseAsyncIOClient._rpc marked as deprecated and will be removed in 0.3.0;0.1.1 (2017-10-01)Add sphinx docs;0.1.0 (2017-09-30)Initial release;Ethereum client implemented;WIP on RPC management.
Package: aioeventlet
aioeventlet implements the asyncio API (PEP 3156) on top of eventlet. It makes
possible to write asyncio code in a project currently written for eventlet.aioeventlet allows to use greenthreads in asyncio coroutines, and to use
asyncio coroutines, tasks and futures in greenthreads: seelink_future()andwrap_greenthread()functions.The main visible difference between aioeventlet and trollius is the behaviour
ofrun_forever():run_forever()blocks with trollius, whereas it runs
in a greenthread with aioeventlet. It means that aioeventlet event loop can run
in an greenthread while the Python main thread runs other greenthreads in
parallel.aioeventlet documentationaioeventlet project in the Python Cheeseshop (PyPI)aioeventlet project at BitbucketCopyright/license: Open source, Apache 2.0. Enjoy!
Package: aioevents
aioeventsEvents for asyncio (PEP 3156)UsageTo declare an event:fromaioeventsimportEventclassSpam:egged=Event("The spam has been egged")To register a handler:spam=Spam()@spam.egged.handlerdefon_egged(sender,amt):print("Spam got egged{}times".format(amt)")Triggering an event:spam.egged(42)
Package: aioevents-ng
A simple library for managing events through an asynchronous queueInstallationpipinstallaioevents-ngUsage exampleimportasynciofromdataclassesimportdataclassimportaioevents@dataclassclassMyEvent(aioevents.Event):payload:str@aioevents.manager.register(MyEvent)asyncdefevent_hadler(event:aioevents.Event):print(f"recieved:{event}")asyncdefproduce():asyncwithaioevents.eventsasevents:awaitevents.publish(MyEvent("Hello!"))asyncdefmain():aioevents.start(asyncio.get_event_loop())awaitproduce()print('stopping worker')aioevents.stop()# wait for all coroutinesawaitasyncio.sleep(1)if__name__=="__main__":asyncio.run(main())Licenseaioeventslibrary is offered under Apache 2 license.