Saravanan666/pypi-org huggingface dataset:
Package: asgi-replay
asgi-replayA tool for recording and replaying requests using ASGI.Very early prototypeThis is an early prototype. I have used this tool exactly once.Installationpipinstallasgi-replayUsageThe tool provides two commands - one for recording logs of ASGI requests and one for running a server to replay them.Recordingasgi-replayrecordhttps://www.example.comlog.json--port8000This runs a local server on port8000that proxies content through towww.example.com- and logs each request tolog.json.Thelog.jsonfile will be over-written for each request. This tool is mainly designed for capturing a single HTTP interaction.If you add--incrementa new file will be written for each request, starting withlog-0.jsonand thenlog-1.jsonand so on.ReplayingTo replay a single log - such that any HTTP request to the local server will replay that exact response - run this:asgi-replayreplaylog.json--port8000(8000 is the default port for both commands.)What I built this forI wanted to build a tiny application that could simulate the streaming response from an OpenAI completion endpoint.The app I built is here:https://github.com/simonw/openai-canned-completionYou can hit it usingLLMlike this:OPENAI_API_KEY='x'\OPENAI_API_BASE='https://openai-canned-completion.vercel.app/v1'\llm'hello'I first ran the following on my own machine:asgi-replayrecordhttps://api.openai.comlog.json--port8000Then:OPENAI_API_BASE='http://localhost:8000/v1'\llm'hello'This ran a real request against OpenAI and saved the response inlog.json.Then I ran the replay like this:asgi-replayrecordhttps://api.openai.comlog.json--port8000And when I ran thellmcommand again I got the same response, without hitting the OpenAI API:OPENAI_API_BASE='http://localhost:8000/v1'\llm'hello'Hello! How can I assist you today?I copied the saved ASGI logs into this ASGI app:https://github.com/simonw/openai-canned-completion/blob/main/canned.py
Package: asgi-request-id
asgi-request-idThis was developed atGRIDfor use with our
python backend services and intended to make it easier to log/generate
request IDs.installationpip install asgi-request-idusageimportloggingimportuvicornfromstarlette.applicationsimportStarlettefromstarlette.responsesimportPlainTextResponsefromasgi_request_idimportRequestIDMiddleware,get_request_idlogger=logging.getLogger(__name__)app=Starlette()@app.route("/")defhomepage(request):logger.info(f"Request ID:{get_request_id()}")returnPlainTextResponse("hello world")app.add_middleware(RequestIDMiddleware,incoming_request_id_header="x-amzn-trace-id",prefix="myapp-",)if__name__=="__main__":uvicorn.run(app)The package will do the following:Search for an incoming request identifier and use it as the request id if found.
If it is not found, an unique request id with an optional prefix is generated.The request id is stored in a context variable and made available viaget_request_idFinally, it is set as therequest_idresponse header.
Package: asgi-s3
asgi-s3Static file management tools andASGImiddleware support forAmazon S3.Work in Progress: A lot of what is here currently will be changing, not recommended for any serious usage at this point.Requirements: Python 3.6+Installationpipinstallasgi-s3...but you probably just want to clone themasterbranch for the moment.CLIs3create-bucketCreateanewS3bucket.

s3list-bucketsListallS3buckets.

s3sync-bucketSyncabucketwithalocalstaticfiledirectory....todoMiddlewareThe middleware is designed to work with any ASGI application. Here is raw ASGI example:fromasgi_s3.middlewareimportS3StorageMiddleware,s3_url_forAWS_ACCESS_KEY_ID="access-key-id"AWS_SECRET_ACCESS_KEY="secret-access-key"BUCKET_NAME="my-bucket"REGION_NAME="region-name"STATIC_DIR="path/to/static/files"asyncdefapp(scope,receive,send):awaitsend({"type":"http.response.start","status":200,"headers":[[b"content-type",b"text/html; charset=utf-8"]],})html_content=f"""<!DOCTYPE html><html><head><title>ASGI S3 example</title><link rel="stylesheet" href="{s3_url_for('style.css')}"></head><body>Hello, world.</body></html>"""awaitsend({"type":"http.response.body","body":html_content.encode()})app=S3StorageMiddleware(app,bucket_name=BUCKET_NAME,static_dir=STATIC_DIR,region_name=REGION_NAME,aws_access_key_id=AWS_ACCESS_KEY_ID,aws_secret_access_key=AWS_SECRET_ACCESS_KEY,)And here is an example usingStarlette:fromstarlette.applicationsimportStarlettefromstarlette.templatingimportJinja2Templatesfromasgi_s3.middlewareimportS3StorageMiddleware,s3_url_fortemplates=Jinja2Templates("templates")app=Starlette()@app.route("/")defhomepage(request):returntemplates.TemplateResponse("index.html",{"request":request,"s3_url_for":s3_url_for})AWS_ACCESS_KEY_ID="access-key-id"AWS_SECRET_ACCESS_KEY="secret-access-key"BUCKET_NAME="my-bucket"REGION_NAME="region-name"STATIC_DIR="path/to/static/files"app.add_middleware(S3StorageMiddleware,bucket_name=BUCKET_NAME,static_dir=STATIC_DIR,region_name=REGION_NAME,aws_access_key_id=AWS_ACCESS_KEY_ID,aws_secret_access_key=AWS_SECRET_ACCESS_KEY,)
Package: asgi-sage
🧙 asgi-sageSecurity Headers Middleware for Asgi App heavily inspired byflask-talismanInstallationpip install asgi-sageUsagefrom asgi_sage.middleware import SageMiddleware

async def app(scope, receive, send):
    assert scope["type"] == "http"
    headers = [(b"content-type", "text/plain")]
    await send({"type": "http.response.start", "status": 200, "headers": headers})
    await send({"type": "http.response.body", "body": b"Hello, world!"})

app = SageMiddleware(app)Optionsfeature_policy: dict = {}, force_https: bool = Trueforce_https: bool = Falseforce_https_permanent: bool = Falseframe_options: Optional[str] = "SAMEORIGIN"strict_transport_security: bool = Truestrict_transport_security_preload: bool = Falsestrict_transport_security_max_age: int = 60 * 60 * 24 * 365strict_transport_security_include_subdomains: bool = Truecontent_security_policy: Optional[dict] = Nonereferrer_policy: str = "strict-origin-when-cross-origin"session_cookie_secure: bool = Truesession_cookie_http_only: bool = Truecontent_type_nosniff: bool = TrueRoad MapPer Request overridingAdd tests for different ASGI frameworks likeQuartandDjango 3.0+Properly support websocketsAuto ChangelogLicenseMIT
Package: asgi-sessions
asgi-sessions– Cookie-Based HTTP sessions for ASGI applications (Asyncio/Trio, /Curio)ContentsFeaturesRequirementsInstallationUsageOptionsBug trackerContributingLicenseFeaturesSupports base64 sessionsSupportsJWTsigned sessionsSupportsFernetencrypted sessionsRequirementspython >= 3.7Installationasgi-sessionsshould be installed using pip:pip install asgi-sessionsTo install optionalJWT,Fernetsupport:pip install asgi-sessions[jwt]
pip install asgi-sessions[fernet]UsageCommon ASGI applications:fromasgi_sessionsimportSessionMiddlewareasyncdefmy_app(scope,receive,send):"""Read session and get the current user data from it or from request query."""# The middleware puts a session into scope['session]session=scope['session']status,headers=200,[]ifscope['query_string']:# Store any information inside the sessionsession['user']=scope['query_string'].decode()status,headers=307,[(b"location",b"/")]# Read a stored info from the sessionuser=(session.get('user')or'anonymous').title().encode()awaitsend({"type":"http.response.start","status":status,"headers":headers})awaitsend({"type":"http.response.body","body":b"Hello%s"%user})app=SessionMiddleware(my_app,session_type='jwt',secret_key="sessions-secret")# http GET / -> Hello Anonymous# http GET /?tom -> Hello Tom# http GET / -> Hello TomAs ASGI-Tools Internal middlewarefromasgi_toolsimportAppfromasgi_sessionsimportSessionMiddlewareapp=App()app.middleware(SessionMiddleware.setup(session_type='jwt',secret_key='SESSION-SECRET'))@app.route('/')asyncdefindex(request):user=request.session.get('user','Anonymous')return'Hello%s'%user.title()@app.route('/login/{user}')asyncdeflogin(request):request.session['user']=request.path_params.get('user','Anonymous')return'Done'@app.route('/logout')asyncdeflogout(request,*args):delrequest.session['user']return'Done'# http GET / -> Hello Anonymous# http GET /login/tom -> Done# http GET / -> Hello Tom# http GET /logout -> Done# http GET / -> Hello AnonymousOptionsfromasgi_sessionsimportSessionMiddlewareapp=SessionMiddleware(# Your ASGI applicationapp,# Session type (base64|jwt|fernet)session_type="base64",# Secret Key for the session (required for JWT/Fernet sessions)secret_key=None,# Cookie name to keep the session (optional)cookie_name='session',# Cookie max age (in seconds) (optional)max_age=14*24*3600,# Cookie samesite (optional)  # Python 3.8+ onlysamesite='lax',# Cookie secure (https only) (optional)secure=False,)Bug trackerIf you have any suggestions, bug reports or
annoyances please report them to the issue tracker
athttps://github.com/klen/asgi-sessions/issuesContributingDevelopment of the project happens at:https://github.com/klen/asgi-sessionsLicenseLicensed under aMIT license.
Package: asgi-tools
asgi-tools– Is a really lightweightASGIToolkit to build ASGI applications faster.Documentation is here:https://klen.github.io/asgi-toolsASGI-Tools is designed to be used as an ASGI Toolkit to quickly build really
lightweight ASGI applications/middlewares/tools.For instance these middlewares were built with the library:ASGI-SessionsASGI-BabelASGI-PrometheusFeatures:Supports all most popular async python libraries:Asyncio,TrioandCurioRequest– Parse ASGI scope, get url, headers, cookies, read a request’s data/json/form-dataResponse– Send HTTP (text, html, json, stream, sse, file, http errors) responsesResponseWebsocket– Work with websocketsRequestMiddleware– Parse a scope and insert the parsed request into the scopeResponseMiddleware– Parse responses and convert them into ASGI messagesRouterMiddleware– Route HTTP requestsLifespanMiddleware– Process a lifespan cycleStaticFilesMiddleware– Serve static files from URL prefixesasgi_tools.tests.TestClient– A test client with websockets support to test asgi applicationsApp– A simple foundation for ASGI appsContentsRequirementsInstallationA Quick ExampleBug trackerContributingLicenseRequirementspython >= 3.8Notepypy3 is also supportedASGI-Toolsbelongs to the category ofASGIweb frameworks, so it requires
an ASGI HTTP server to run, such asuvicorn,daphne, orhypercorn.Installationasgi-toolsshould be installed using pip:pip install asgi-toolsA Quick ExampleYou can use any of ASGI-Tools components independently.Dispite this ASGI-Tools containsApphelper to quickly build ASGI
applications. For instance:Save this toapp.py.fromasgi_toolsimportAppapp=App()@app.route('/')asyncdefhello(request):return"Hello World!"Run it withuvicorn$uvicornapp:appBug trackerIf you have any suggestions, bug reports or
annoyances please report them to the issue tracker
athttps://github.com/klen/asgi-tools/issuesContributingDevelopment of the project happens at:https://github.com/klen/asgi-toolsLicenseLicensed under aMIT license.
Package: asgl
asglpackageIntroductionasglis a Python package that solves several regression related models for simultaneous variable selection and prediction, in low and high dimensional frameworks. This package is directly related to research work shown onthis paper.The current version of the package supports:Linear regression modelsQuantile regression modelsAnd considers the following penalizations for variable selection:No penalized modelslassogroup lassosparse group lassoadaptive lassoadaptive group lasssoadaptive sparse group lassoRequirementsThe package makes use of some basic functions fromscikit-learnandnumpy, and is built on top of the wonderfulcvxpyconvex optimization module. It is higly encouraged to installcvxpyprior of the installation ofasglfollowing the instructions from the original authors, that can be foundhere). Additionally,asglmakes use of pythonmultiprocessingmodule, allowing, if requested, for parallel execution of the code highly reducing computation time.Usage example:In the following example we will analyze theBostonHousingdataset (availablehere). Even though theasglpackage can easily deal with much more complex datasets, we will work using this one so we are not affected by computation time. We will show how to implement cross validation on a grid of possible parameter values for an sparse group lasso linear model, how to find the optimal parameter values and finally, how to compute the test error.Example:The following code performs cross validation in a grid of
different parameter values for an sparse group lasso model on the well knownBostonHousingdataset:# Import required packages
import numpy as np
from sklearn.datasets import load_boston
import asgl

# Import test data #
boston = load_boston()
x = boston.data
y = boston.target
group_index = np.array([1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5])

# Define parameters grid
lambda1 = (10.0 ** np.arange(-3, 1.51, 0.2)) # 23 possible values for lambda
alpha = np.arange(0, 1, 0.05) # 20 possible values for alpha

# Define model parameters
model = 'lm'  # linear model
penalization = 'sgl'  # sparse group lasso penalization
parallel = True  # Code executed in parallel
error_type = 'MSE'  # Error measuremente considered. MSE stands for Mean Squared Error.

# Define a cross validation object
cv_class = asgl.CV(model=model, penalization=penalization, lambda1=lambda1, alpha=alpha,
                   nfolds=5, error_type=error_type, parallel=parallel, random_state=99)

# Compute error using k-fold cross validation
error = cv_class.cross_validation(x=x, y=y, group_index=group_index)

num_models, k_folds = error.shape
# error is a matrix of shape (number_of_models, k_folds)
print(f'We are considering a grid of {num_models} models, optimized based on {k_folds}-folds cross validation')

# Obtain the mean error across different folds
error = np.mean(error, axis=1)For a full review on the capabilities of these package we suggest accessing the  user_guide notebook provided in theGitHub repository. Additionally, you can find morehereandhere.CitingIf you use ASGL for academic work, we encourage you tocite our paper. Thank you for your support and we hope you find this package useful!
Package: ash2048
ash2048Implementation of the 2048 Game for Gym Environments with state rendering through PyGame.Usage and Notes:The package follows gymnasium conventions.
To render the board while playing, setdisplay=Truein the constructor.
To save the render to a gif, setsave_animation=Truein the constructor.
To save the generated animation to a file, callsave_render(filename)where the filaname is the outfile gif file.
The animation is reset upon callingreset().
Package: ashar
Asharashar - free & open source project for text encryption with password protection.Python Package Installation:# install from pypi:
❯ pip install ashar

# local install:
❯ git clone https://github.com/yasserbdj96/ashar.git
❯ cd ashar
❯ sudo python setup.py install

# uninstall:
❯ pip uninstall asharRun without installation:# Dwonload:
❯ git clone https://github.com/yasserbdj96/ashar.git
❯ cd ashar

# default run on any os:
❯ python3 run.py <CONDITION*> <PASSWORD*> <TEXT*>

# Run with Makefile:
❯ make run con="<CONDITION*>" pass="<PASSWORD*>" text="<TEXT*>"

# *         = All inputs must be entered.
# PASSWORD  = The password used for encrypt your text.
# TEXT      = The text to be encrypted.
# CONDITION = The nature of the process is encryption or decryption "encode/decode".Script Usage:fromasharimportashar#For encryptionp1=ashar("<PASSWORD*>","<TEXT*>").encode()# p1=ashar("<PASSWORD*>","<TEXT*>",chars='abcdefghijklmnopqrstuvwxyz',upchars='ABCDEFGHIJKLMNOPQRSTUVWXYZ',smbls=')(}{][><!?$%&-_=+;',numb='1234567890').encode()print(p1)#To decryptp2=ashar("<PASSWORD*>","<ENCRYPTED_TEXT*>").decode()print(p2)# *   = All inputs must be entered.Script Examples:fromasharimportashar# Example:1#For encryptionp1=ashar("123","Example:1").encode()print(p1)#To decryptp2=ashar("123",p1).decode()print(p2)Changelog History:Click to See changelog HistoryDevelopment By:Developer / Author:yasserbdj96License:The content of this repository is bound by the followingLICENSE.Support:If you like `ashar` and want to see it improve furthur or want me to create intresting projects , You can buy me a coffeeBTC: bc1q2dks8w8uurca5xmfwv4jwl7upehyjjakr3xga9website.github.gitlab.linkedin.twitter.instagram.facebook.youtube.pypi.docker.telegram.gitter.e-mail.sponsor
Package: ashares
ashares代码非原创，是对项目Ashare的封装, 中国股市A股股票行情实时数据最简封装API接口, 包含日线,分时分钟线,全部格式成DataFrame格式数据,可用来研究，量化分析，证券股票程序化自动化交易系统 行情系统包括新浪腾讯双数据核心，自动故障切换，为量化研究者在数据获取方面极大地减轻工作量，更加专注于策略和模型的研究与实现。功能特点双内核封装，新浪财经，腾讯股票的实时行情数据，包括任意历史日线，周线，月线，分钟线，小时线等，已经稳定运行数年双内核一主一备，自动热备，自动切换，Ashare即使用来做量化实盘行情源也可以满足。全部数据格式清理成DataFrame格式数据，让您非常方便的使用pandas来分析和处理和其他行情库（tushare等）比的优点是什么？ -- 简单 轻量 便携 开源Ashare把复杂的数据获取，拆分，整合逻辑全部封装成一个函数get_price()看完下面例子就会了Ashare可以用在任何需要量化研究，量化分析的场合安装pip install akshares快速上手fromasharesimportget_price,# 证券代码兼容多种格式 通达信，同花顺，聚宽# sh000001 (000001.XSHG)    sz399006 (399006.XSHE)   sh600519 ( 600519.XSHG )df=get_price('sh000001',frequency='1d',count=5)#默认获取今天往前5天的日线实时行情print('上证指数日线行情\n',df)df=get_price('000001.XSHG',frequency='1d',count=5,end_date='2021-04-30')#可以指定结束日期，获取历史行情print('上证指数历史行情\n',df)df=get_price('000001.XSHG',frequency='1w',count=5,end_date='2018-06-15')#支持'1d'日, '1w'周,  '1M'月print('上证指数历史周线\n',df)df=get_price('sh600519',frequency='15m',count=5)#分钟线实时行情，可用'1m','5m','15m','30m','60m'print('贵州茅台15分钟线\n',df)df=get_price('600519.XSHG',frequency='60m',count=6)#分钟线实时行情，可用'1m','5m','15m','30m','60m'print('贵州茅台60分钟线\n',df)Run#上证指数日线行情----------------------------------------------------
              open    close     high      low       volume
2021-06-07  3597.14  3599.54  3600.38  3581.90  303718677.0
2021-06-08  3598.75  3580.11  3621.52  3563.25  304491470.0
2021-06-09  3576.80  3591.40  3598.71  3572.64  298323296.0
2021-06-10  3587.53  3610.86  3624.34  3584.13  318174808.0
2021-06-11  3614.11  3589.75  3614.40  3587.15  360554970.0


#贵州茅台60分钟线----------------------------------------------------
                       open    close     high      low    volume
2021-06-10 14:00:00  2237.00  2224.16  2245.00  2222.00   4541.53
2021-06-10 15:00:00  2222.21  2238.48  2240.34  2222.21   4146.88
2021-06-11 10:30:00  2239.00  2220.00  2244.00  2197.86  12030.00
2021-06-11 11:30:00  2220.01  2210.18  2231.80  2200.18   4868.00
2021-06-11 14:00:00  2210.10  2223.35  2224.48  2206.01   4544.00
2021-06-11 15:00:00  2223.33  2178.81  2226.80  2178.81  12529.00更多B站:大邓和他的python公众号：大邓和他的python知乎专栏：数据科学家
Package: ashberry
ashberryA tool to search for websites by generating random domainsinstallpip install ashberryusing$ ashberry
Level
> {LEVEL}
Searching...level{LEVEL}can be:10(Level.FIRST)15(Level.SECOND)20(Level.THIRD)Level.FIRST- All lowercase letters used in generationLevel.SECOND- All lowercase & uppercase used in generationLevel.THIRD- All lowercase & uppercase letters with digits used in generation
Package: ashe
ashe✨asheis a super extension of Python.1 FeatureSystemsizeDictmergeremoveListreverseStringfindFilereadwriteDatetodayyesterdayweekyearget_interval_daysget_week_daysget_month_days2 Getting Startedinstallationpipinstallashe-Uusagefromasheimport*# get sizen=1print(size(n))# 28# reverse the listl=[1,2,3]print(reverse(l))# [3, 2, 1]# remove key and value from dictd={"a":1,"b":2}print(remove("a",d))# {'b': 2}# get today and yesterdayprint(today())# 2022-10-23print(yesterday())# 2022-10-22print(get_interval_days(interval=3))# ["2022-10-21", "2022-10-22", "2022-10-23"]3 Consistency- Whyreverse(list)notlist.reverse()?- Becauselen(list)notlist.len().I find built-in method namedreversed🤦‍.4 License
Package: asheeshs-django-optimizer
About this packageThis package is a total dummy package. Don’t use it in any real apps.
It exists for the purpose of demonstrating what a vulnerable/malicious
dependency could be like.During the web security tutorial, pretend this is a real package and you
actually need it for the web app in question.Purpose of this packageAsheesh’s Django Optimizer lets you see your “hashed password”, which
is private information that only you should be able to see.Luckily, this package is secure – it only shows it if you’re logged in
as the user you’re looking up.To see your hashed password, visit:/optimizer/optimize_user/:usernameassuming that you have mapped in theurls.pyfrom this app at/optimizer/in your site.This is an optimization because visiting this URLwarm the database
cachefor your data! To automatically warm the database cache for
your user data, make sure to create a periodic task (e.g., cron job)
that accesses this URL.Also about this packageVersion history:1.0: Does nothing, successfully.1.2: Actually implement cache warming functionality.2.0: Total rewrite!!! Way faster! Still 100% safe.
Package: ashell
ashell provide bashrc functionality to android shell.
The rc file is in ‘~/.adbrcInstallationpip install ashellUseageashell
ashell -hTo install the default adbrc runashell --print-default > ~/.adbrcDefault adbrcThe major feature of the default adbrc is to add history across sessions.
The default adbrc also contain some nice aliases and more.Known IssuesThe last command doesn’t saved to the history fileBugsPlease report bugs, issues, feature requests, etc. onGitHub.LinksProject home page (GitHub)LicenseLicensed under the terms of theMIT Licens.
Package: ash-encrypt
Ash-file-Encryptor/DecryptorImage and File encryptor/decryptor with PythonInstallationWorks perfectly on Windows 10 and Ubuntu 21.10You can use thispip3 install -U PyCryptodomefor install pycryptoFlagseEncryption ModedDecryption Mode-pPassword-fFileNameUsageEncryptionash-encrypt e -p 123321 -f picture.pngash-encrypt e -p 123321 -f file.txtit will encrypt picture.png to picture.ash  with123321passwordalso it will encrypt file.txt to file.ash  with123321passwordDecryptionash-encrypt d -p 123321 -f picture.ashash-encrypt d -p 123321 -f file.ashit will decrypt picture.ash to picture.png with123321passwordalso  it will decrypt file.ash to file.txt with123321password
Package: asherah
asherah-pythonAsherah envelope encryption and key rotation libraryThis is a wrapper of the Asherah Go implementation using the Cobhan FFI libraryUsageExample code:fromasherahimportAsherah,AsherahConfigconfig=AsherahConfig(kms='static',metastore='memory',service_name='TestService',product_id='TestProduct',verbose=True,enable_session_caching=True)crypt=Asherah()crypt.setup(config)data=b"mysecretdata"encrypted=crypt.encrypt("partition",data)print(encrypted)decrypted=crypt.decrypt("partition",encrypted)print(decrypted)BenchmarkingIncluded is abenchmark.pyscript that will give you an idea of the execution
speeds you can see from this library. Our goal is to make this as performant as
possible, as demonstrated by this example output:>pythonbenchmark.py
Benchmarkingencrypt/decryptroundtripsof"mysecretdata".
Executed100iterationsin0.026045440000000003seconds.
Executed1000iterationsin0.237702095seconds.
Executed10000iterationsin2.3570790550000003seconds.
Executed100000iterationsin23.717442475seconds.