Saravanan666/pypi-org huggingface dataset:
Package: asya
ASynchronously-Your-Acquaintances fromGitHubissuesInstallationYou can simply install Asya in standard Python way (system-wide or with virtual env).
Python 3.4 or higher is required (asynciois in Python since 3.4).python setup.py installUsageAfter installation, you can use the CLI of Asya:asya --help
asya MarekSuchanek --token <your-secret-API-token>DocumentationVisitasya.readthedocs.ioor after installing Asya, you can also build the documentation on your own:cd docs
pip install -r requirements.txt
make htmlThen opendocs/_build/html/index.htmlin your browser. For more information visitSphinx documentation.LicenseThis project is licensed under the MIT License - see theLICENSEfile for more details.
Package: asyevent
AsyeventAn implementation of events and asynchronous callbacks using decorators.Report BugÂ·Request FeatureTable of ContentsAbout The ProjectBuilt usingGetting StartedInstallationUsageRoadmapContributingLicenseContactAbout The ProjectAn implementation of events and asynchronous callbacks using decorators.
The project is currently in development.
The main features are stables and work perfectly as I've tested,
but if you notice any issue, or you have a suggestion to make, it's
greatly appreciated.Built usingasyncioGETTING STARTEDInstallationpipinstallasyeventUsageimportasynciofromasyeventimportEventManager# creates a main event managermanager=EventManager()# creates an eventsample_event=manager.create_event("sample_event")# adds `call_on_event` coroutine as sample_event's callback@sample_event.as_callback()asyncdefsample_event_callback(text:str):print(text)awaitasyncio.sleep(2)# uses `.after` event which refers to an event that is raised# when the parent event's callbacks are ended (data_lost)@sample_event.after(pass_extra=True).as_callback()asyncdefafter_event(time_took:int,*args):# invokes the command `say`awaitmanager.invoke_command("say",f"I've been here for{time_took}seconds")# adds the `say_stm` coroutine as a callback of the command `say`@manager.as_command(name="say")asyncdefsay_stm(name:str):print(f"Hello,{name}!")if__name__=="__main__":loop=asyncio.get_event_loop()# raises the event `sample_event`loop.run_until_complete(sample_event("Hello, world !"))More example inasyevent/examples/folder.RoadmapSee theopen issuesfor a list of proposed features (and known issues).ContributingContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make aregreatly appreciated.Fork the ProjectCreate your Feature Branch (git checkout -b feature/AmazingFeature)Commit your Changes (git commit -m 'Add some AmazingFeature')Push to the Branch (git push origin feature/AmazingFeature)Open a Pull RequestLicenseDistributed under the MIT License. SeeLICENSEfor more information.ContactZucchinetti HervÃ©GitHubReadme template
Package: asyhttp
This is asyhttp, a simple module to perform asynchronous HTTP requests using asyncio and aiohttp.It provides a trivial way to perform a set of async HTTP requests.FeaturesProxy supportCustom headersAllow redirectsUse TLSHow to use loop()asyhttp loop() accepts someargsurlsa set of dictionaries, each dict represent an HTTP request.proxy(str) proxt URL, str (optional).process_outa user defined function that can be used to process the response of each HTTP request.
It will be called by the async function that perform each HTTP request, as soon as the response arrive (optional).redirects(bool) – If set to True, follow redirects. False by default (optional).verify_tls(bool) True for check TLS cert validation, False by default (optional).Getting startedfromasyhttpimportlooprequests=[{'url':'http://exam.ple/page.html','method':'GET'},{'url':'http://exam.ple/page.html','method':'POST','body':'blabla'}]loop(urls=requests)Use casesasyhttp loop can be useful to write quick bruteforces against vulnerable systems
or as a core for tools like dirfister.An early version of this code comes fromhttps://pawelmhm.github.io/asyncio/python/aiohttp/2016/04/22/asyncio-aiohttp.htmlDocsProcess HTTP responsesBy default, asyhttp loop print on stdout HTTP status code and reason for each response received.
You can override its default behavior writing custom code to process the response your HTTP requests.
Your code has to be written in a function and passed to loop as a kwarg called process_out.
That function will be called by the async function that perform each of your HTTP requests,
as soon as the response arrive.In your custom code you can process:
- url: url of the HTTP request
- return_code
- reason
- resp_body
- user_dataExamplepip install asyhttpfromasyhttpimportlooprequests=[{'url':'http://exam.ple/page.html','method':'GET'}]loop(urls=requests)Examplefromasyhttpimportloopdefprocess_output(url,return_code,reason,resp_body,user_data):ifreturn_code==200:sys.stdout.write("url")requests=[{'url':'http://exam.ple/page.html','method':'GET'}]loop(urls=requests,process_out=process_output)asyhttp loop’sargsurlsprocess_outproxyverify_tlsredirectsSupported HTTP methodsGETPOSTHEADHTTP requests format{'method':'GET','url':'http://exam.ple/page.html'}{'method':'POST','url':'http://exam.ple/page.html','body':'blablabl=balbal'}{'url':'http://exam.ple/page.html','method':'GET','headers':'X-Custom-Header:YEAH'}Proxy supportloop(urls=url_dict_list,proxy="http://127.0.0.1:8080")Custom headersTo add HTTP headers to a request, pass them as a dict.{'url':'http://exam.ple/page.html','method':'GET','headers':{'User-agent':'YEAH'}}Allow redirectsFalse by defaultloop(urls=requests,process_out=process_response,redirects=True)Verify TLSFalse by defaultloop(urls=requests,process_out=process_response,verify_tls=True)
Package: asymcrypt
Super easy asymmetric encryption for pythonIntroductionpython-asymcrypt is a wrapper around pycryptodome to make it even more easier
for asymmetric encryption.InstallationWith pippip install asymcryptUsageGenerate keys filesimport asymcrypt

asymcrypt.generate_keys('my_private_key_file.pem','my_public_key_file.pem')Encrypt datadata = 'A string, not an unicode'
encrypted_data = asymcrypt.encrypt_data(data,'my_public_key_file.pem')Decrypt datadata = asymcrypt.decrypt_data(encrypted_data,'my_private_key_file.pem')Unicode, Str, Bytesasymcrypt is using pycryptodome which is awaiting, for data, bytes for python3 or str for python2.
So it is preferable to use these types. Nevertheless, asymcrypt provides a type detection, it will keep
the type you used at encryption time for the decryption time :For python 2, if you use unicode data for encryption, it will be automatically encoded as utf-8 str before encryption and
decoded back to unicode after decryption. If you use str data, no encoding/decoding will be done.For python 3, if you use str data for encryption, it will be automatically encoded as utf-8 bytes before encryption and
decoded back to str after decryption. If you use bytes data, no encoding/decoding will be done.PassphraseAs an option, you can usepassphraseoption in each functions to generate encrypted keys
and read them when using encrypt/decrypt_data() functionsBase64By default, output/input are binary. Nevertheless, you can encode into base64 inencrypt_data()by using optionout_format='base64'or decode from base64 indecrypt_data()by using optionin_format='base64'Command lineAsymcrypt provides 3 commands :To generate keys pairasymgenkeys -priv private_key.pem -pub public_key.pemTo encryptasymencrypt -k public_key.pem -in file_to_encrypt.txt -out dest_file.encTo decryptasymdecrypt -k private_key.pem -in encrypted_file.enc -out dest_file.txtNote :  you may use option-bor--base64to encode/decode in base64
and-por--passphraseto specify a passphrase to encrypt/decrypt keysNote 2 : If you do not specify-inor-outin above commands, the standard input/output will be used.Compatibility with opensslasymcrypt uses RSA keys, RSA encryption protocol according to PKCS#1 OAEP, AES with EAX AEAD mode.
The keys will be encrypted with scrypt And AES128-CBC if a passphrase is provided.
The encrypted data keep track of the original python data type.
All these make impossible to use openssl directly to decode files generated by asymcrypt.News0.0.10 (2019-05-24)Use Python 3.6 in Pipfile0.0.9 (2019-02-06)fix asymdecrypt script0.0.6 (2018-10-02)Keep track of orginal data type (unicode, str, bytes)0.0.4 (2018-10-01)Add console commandsKeys files are now cached0.0.2 (2018-09-28)First running version
Package: asymmetree
AsymmeTreeAsymmeTree is an open-source Python library for the simulation and analysis of phylogenetic scenarios.
It includes a simulator for species and gene trees with heterogeneous evolution rates, nucleotide and amino acid sequences with or without indels, as well as whole genomes/proteomes.Moreover, it includes a matplotlib-based visualization of the simulated trees as well as tools for the extraction of information from the simulated scenarios such as orthology, best matches, and xenology.The library is primarily designed to explore and validate mathematical concepts, and to test inference methods for various steps on the way to more realistically-available data, i.e., dated gene trees, additive distances of gene sets, noisy distances and finally sequences.InstallationAsymmeTree requires Python 3.7 or higher.Easy installation with pipTheasymmetreepackage is available on PyPI:pip install asymmetreeFor details about how to install Python packages seehere.Installation with the setup fileAlternatively, you can download or clone the repo, go to the root folder of package and install it using the command:python setup.py installDependenciesAsymmeTree has several dependencies (which are installed automatically when usingpip):NetworkXScipy and NumpyMatplotlibtraldaUsage and descriptionA user manual with example code can be found in theWiki.
AsymmeTree is divided into several subpackages and modules, see also the followingdocumentationgenerated from the source code.CitationIf you use AsymmeTree in your project or code from it, please consider citing:David Schaller, Marc Hellmuth, and Peter F. Stadler. AsymmeTree: A Flexible Python Package for the Simulation of Complex Gene Family Histories. Software 2022, 1(3), 276-298; doi: 10.3390/software1030013Please report any bugs and questions in theIssuessection.
Also, feel free to make suggestions for improvement and/or new functionalities.
Package: asymmetric-jwt-auth
What?This is an library designed to handle authentication inserver-to-serverAPI requests. It accomplishes this using RSA public /
private key pairs.Why?The standard pattern of using username and password works well for
user-to-server requests, but is lacking for server-to-server
applications. In these scenarios, since the password doesn’t need to be
memorable by a user, we can use something far more secure: asymmetric
key cryptography. This has the advantage that a password is never
actually sent to the server.How?A public / private key pair is generated by the client machine. The
server machine is then supplied with the public key, which it can store
in any method it likes. When this library is used with Django, it
provides a model for storing public keys associated with built-in User
objects. When a request is made, the client creates a JWT including
several claims and signs it using it’s private key. Upon receipt, the
server verifies the claim to using the public key to ensure the issuer
is legitimately who they claim to be.The claim (issued by the client) includes components: the username of
the user who is attempting authentication, the current unix timestamp,
and a randomly generated nonce. For example:{
    "username": "guido",
    "time": 1439216312,
    "nonce": "1"
}The timestamp must be within ±20 seconds of the server time and the
nonce must be unique within the given timestamp and user. In other
words, if more than one request from a user is made within the same
second, the nonce must change. Due to these two factors no token is
usable more than once, thereby preventing replay attacks.To make an authenticated request, the client must generate a JWT
following the above format and include it as the HTTP Authorization
header in the following format:Authorization: JWT <my_token>Important note: the claim isnotencrypted, only signed.
Additionally, the signature only prevents the claim from being tampered
with or re-used. Every other part of the request is still vulnerable to
tamper. Therefore, this is not a replacement for using SSL in the
transport layer.Full Documentation:https://asymmetric-jwt-auth.readthedocs.io
Package: asymmetric-matchers
asymmetric-matchersA collection of asymmetric matchers in Python for testing or general uses.What are asymmetric matchers?An asymmetric matcher is an object that can be compared equally to a variety of other objects. Practically speaking, it's useful to test if a value satisfies a set of rules, but not an equality comparison.Popular examples are the asymmetric matchers present in theJasmineandJest(JavaScript testing frameworks.)ExampleSay we have a function similar that calls an external API:defget_user(user_id:str,fields:List[str])->User:fields=add_default_fields(fields)returnexternal_api.get_user({user_id:user_id,fields:fields})And we want to write a test that asserts theexternal_api.get_user()was called with the correct arguments:deftest_external_get_user_is_called():withmock.patch("external_api.get_user")asext_mock:get_user("abc4321",["name","profile_picture"])ext_mock.assert_called_once_with("abc4321",["name","profile_picture"])It doesn't work because we don't know what are the default fields added and perhaps the context of this specific test is not concerned on the behavior of theadd_default_fieldsfunction. So we write more specific assertions:deftest_external_get_user_is_called():withmock.patch("external_api.get_user")asext_mock:get_user("abc4321",["name","profile_picture"])ext_mock.assert_called_once()args=ext_mock.call_args[0]assertargs[0]=="abc4321"assert"name"inargs[1]assert"profile_picture"inargs[1]Great! Now we're testing exactly what we want, but it's not as straight-forward to a future reader what exactly we want to test.That's where an asymmetric tester is useful. We can rewrite this test as:fromasymmetric_matchersimportlist_containingdeftest_external_get_user_is_called():withmock.patch("external_api.get_user")asext_mock:get_user("abc4321",["name","profile_picture"])ext_mock.assert_called_once_with("abc4321",list_containing(["name","profile_picture"]))Very nice! Now it's more clear what's our intent with this test to future readers.It's very useful in situations when we can combine two or more matchers. One example is to test that a dict contains a specific key and its value is a list that contains some elements:assert"fields"insome_dictassert"name"insome_dict["fields"]assert"profile_picture"insome_dict["fields"]# using asymmetric matchersassertsome_dict==dict_containing({"fields":list_containing(["name","profile_picture"])})APIanything()Matcher is equal to any value, exceptNone.plugin_mock.assert_called_once_with("app_name",anything(),True)It's similar tounittest.mock.ANY.string_matching(str_or_pattern)Matcher is equal to a string that matches the pattern (usingre.search).assertgenerate_id()==string_matching(r"[a-z]{4}[0-9}3")list_containing(expected)Matcher is equal to a list that contains all items fromexpected.assertfields==list_containing(["name","profile_pic"])dict_containing(expected)Matcher is equal to a dict that contains all keys fromexpectedand their values match.assertrequest_dict==dict_containing({"user_id":"abc123"})LicenseApache-2.0 License
Package: asynapplicationinsights
Azure Application Insights client using asyncio and aiohttpAzure Application InsightsPython SDK using asyncio, including a middleware foraiohttpweb framework.WhyThe officialPython SDK for Application Insightsfrom Microsoft is designed to work with both 2.x and 3.x versions of Python language.This repository contains an alternative Python SDK for Application Insights with support forasyncioandasync/awaitsyntax, targeting Python >=3.6 and also taking advantage of support for type hinting, available since recent versions of Python language.To install:>>> pip install asynapplicationinsightsRepositoryGitHub:https://github.com/RobertoPrevato/asynapplicationinsightsDocumentationWiki:https://github.com/RobertoPrevato/asynapplicationinsights/wiki
Package: async4s
async4s - 一个简单易用的异步执行模块About这是一个简单易用的异步执行模块，可以使原有方法轻松变为异步执行。RequirementsPython3Install通过pip命令安装：pipinstallasync4sExampleasync by threadimporttimefromasync4s.mw.threadimportMaster,Workerdefwork(i):time.sleep(i)returnidefcallback(results):print(results)print(time.perf_counter())workers=[Worker(work,i)foriinrange(5)]m=Master(workers,callback)print("main")m.wait()print(time.perf_counter())async by asyncioimporttimeimportasynciofromasync4s.mw.coroutineimportMaster,Workerasyncdefwork(i):awaitasyncio.sleep(i)returnidefcallback(results):print(results)print(time.perf_counter())workders=(Worker(work,i)foriinrange(5))master=Master(workders,callback=callback)print("main")master.wait()print(time.perf_counter())Release History0.0.1(2021-01-26)Birth1.0.0(2021-10-29)Master-Worker modeboth implement by thread and asyncioAuthorRocky Peng
Package: async7zip
async7zipasync7zip is an asynchronous interface for interacting with the 7-Zip command line tool. It allows for unpacking archive files in an asynchronous manner and provides properties for accessing the return code, error count, and process return code of the 7-Zip command.Tested on 22.01 7-Zip english version.InstallationYou can install async7zip via pip:pip install async7zipUsageimportasynciofromasync7zipimportasync7zip,ReturnCodes7zipasyncdefmain():# Initialize the async7zip objectsevenzip=async7zip(archive_path='path/to/archive.7z',unpack_path='path/to/unpack')# Unpack the archivereturn_code=awaitsevenzip.unpack()# Check the return codeifreturn_code==ReturnCodes7zip.SUCCESS:print("Archive unpacked successfully!")else:print(f"Error code:{return_code}")loop=asyncio.new_event_loop()asyncio.set_event_loop(loop)loop.run_until_complete(main())NoteMake sure to have7zzin your path, otherwise you need to specify path of7zzinsevenzip_path
Package: async8ball
async8ballAsynchronous 8ball response generator.
Example:importasync8ballasyncdefyour_function():response=awaitasync_8ball.response()Deco Example:fromasync8ball.decoratorsimportball_decorator@ball_decoratordefmy_function(**kwargs):returnkwargs['response']Discord.py command implement:fromasync8ball.decoratorsimportball_decorator@ball_decoratordefmy_func(question,**kwargs):returnkwargs['response']@bot.command()asyncdefmy_command(ctx,*,question:str):awaitctx.send(ball8(question))orimportasync8ball@bot.command(self,ctx,*,question:str):awaitctx.send(awaitasync8ball.response(question))
Package: asyncache
Helpers to use cachetools with asyncio.Installationasyncache is available fromPyPIand can be installed by running:pip install asyncacheExamplefromasyncacheimportcachedfromcachetoolsimportTTLCachepool=...@cached(TTLCache(1024,60))asyncdefget_username(user_id):rec=awaitpool.fetchrow("""
        SELECT
            username
        FROM
            users
        WHERE
            id = $1
        """,user_id,)returnrecandrec["username"]LicenseThis project is licensed under the MIT License - see theLICENSEfile for details.Acknowledgmentscachetools
Package: asyncactor
AsyncActor is an async Python module that aids in service discovery and
“somewhat-leader” election in a heterogenous, sometimes-disconnected
network.AsyncActor can run on top of any reliable broadcast channel.
This version includes back-ends for Serf and MQTT.AsyncActor sends as few packets as possible, thus is well-suited for
IoT-related applications with many stations but limited bandwidth.Theory of operationAssume that you have a non-lossy network with a bounded latency (let’s
assume one second). Assume further that you’d like to know within ten
seconds whether your node is still online.AsyncActor sends one beacon message every seven to nine seconds. The message
includes a list of N previous hosts that have transmitted the beacon; the
host that’s last in this list will be the next transmitter.The time slot starting at the seven-second mark is used for random hosts
which would like to enter the beacon sending business. This is somewhat
likely if the list of hosts is currently smaller than N. The slot at eight
seconds is used for the hosts at the end of the list; the last host will
send first, but if its beacon is not seen then the next-to-last will send
its message, and so on.The time slot at nine seconds is used for last-resort messages, i.e. any
participating host can and will send its beacon message.Collisions are resolved at the ten-second mark, i.e. the list of messages
is ordered deterministically: the winner will announce to its clients that
a new slot has started and whether all N host slots are filled.It usesanyio <https://github.com/agronholm/anyio>as its underlying
async framework.InstallationAsyncActor requires a back-end, i.e. either a running Serf agent or a MQTT
broker.To install AsyncActor, run the following command:$pipinstallasyncactoror alternatively (you really should be using pip though):$easy_installasyncactoror from source:$pythonsetup.pyinstallGetting StartedThese examples require a running async loop.Trio <https://github.com/python-trio/trio>is recommended, thoughasyncioworks too.fromasyncactorimportclientasactorfromsomewhereimportsome_transportasyncwithsome_transport.connect('localhost')ast:asyncwithactor(t,prefix=('actor','test'))asclient:asyncforclient.eventsasm:print(m)DevelopmentYou can run the tests using the following commands:$serfagent&# start serf agent$mosquitto$python3-mpytesttests
Package: async-adbc
ADBCADBC是ADB Client的纯python异步实现，ADBC直接跟ADB Server通信不需要靠进程调用命令行来执行ADB命令。
有以下特性：支持async/await和同步调用封装了一些性能测试相关的方法，供性能采集工具使用以service（服务）为单位封装命令方法，能够跟adb和android shell命令更加一致。安装pipinstallasync-adbc快速入门使用ADBClientADBClient对应的是adb命令note当连接设备只有一个的时候，adb命令可以省略-s <serialno>，但是ADBClient不会包含这种默认设备的命令方法。因为async-adbc认为adb和device应该职责分明不应有太多的潜规则。因此用户想要操作某个设备一定要使用Device对象下的方法，Device下的方法相当于是帮我们默认传递了-s <serialno>。fromasync_adbcimportADBClientadbc=ADBClient()# 默认连接 127.0.0.1:5037 ，也就是本机的adb serverversion=awaitadbc.version()# 对应 `adb version`print(version)# 获取Android设备对象，对应 `adb devices`devices=adbc.devices()fordeviceindevices:print(device.serialno)使用DeviceDevice对象是对Android设备的抽象，所有需要指定-s <serialno>的操作都被封装到Device类中。fromasync_adbcimportADBClientadbc=ADBClient()# 获取Android设备对象，对应 `adb devices`default_device=adbc.device()# 获取 `adb devices` 的第一个设备product_model=awaitdefualt_device.prop.get("ro.product.model")print(product_model)# `device.pm` 对应 `adb shell pm`packages=awaitdefault_device.pm.list_packages()print(packages)# `device.shell` 对应 `adb shell`ret=awaitdefault_device.shell("echo hello")print(ret)# 封装了 `fps` ，用来获取安卓游戏的帧率，方案参考了`solopi`fps_stat=awaitdefault_device.fps.stat("PKG_NAME")print(fps_stat)# 封装了 `mem`，用来获取安卓设备的内存信息mem_stat=awaitdefault_device.mem.stat("PKB_NAME")print(mem_stat)# 还有流量、温度等等工具的封装...参考adb协议https://github.com/kaluluosi/adbDocumentation/blob/master/README.zh-cn.mdppadbhttps://github.com/Swind/pure-python-adb