Saravanan666/pypi-org huggingface dataset:
Package: resto
OverviewAlong the last years, coding in  Python was fun enough to realize that
the amount  of freedom provided by  the platform could be  way to much
sometimes, specially while working with  a bigger team or thousands of
lines.This is based on a peculiariron triangle ideawhere the excess of
flexibility would cause harmful effects to a code base. This is one of
main motivations behind what you can think as lack of functionality in
this project.Out of ScopeThis project  avoids falling into  a deep  REST discussion; of  a kind
thatRoy  Fieldingwould care about.  Main concern is to  provide a
useful framework for companies and start ups willing to increase their
development speed by enforcing some  minimum quality at their Web REST
back-ends.
Package: restocks-client
Installationpip install restocks-clientIntroductionYou can search for products without being logged in, however, there are some client methods which require you to be logged in to your Restocks.net account to be used.You can either use the client with or without proxies. Proxies will rotate for each client call for those methods which do not require login. The same proxy will be used for all the client calls after you log in if you decide to do so.MethodDescriptionLoginsearch_productsSearches for products.NOget_productGets all the data of an specific product.NOget_size_lowest_priceGets the lowest price of a product size.YESget_sales_historyGets the account sold products.YESget_listings_historyGets the account current product listings.YESlist_productLists a product for sale.YESedit_listingEdits a product listing.YESdelete_listingDeletes a product listing.YESExamplefromrestocks.clientimportClientfromrestocks.filtersimportSellMethod,ListingDurationproxy={"https":"https://username:password@ip:port"}# or optionallyproxy=[{"https":"https://username:password@ip:port"},{"https":"https://username:password@ip:port"}]client=Client(proxy=proxy)# ---- Get product data ---------------------- #product=client.get_product("DD1391-100")print(product.name,product.sku)# -------------------------------------------- ## ---- Log in to your Restocks.net account --- #username="YOUR_USERNAME"password="YOUR_PASSWORD"client.login(username,password)# -------------------------------------------- ## ---- Get the account sales ----------------- #sales=client.get_sales_history()forsaleinsales:print(sale.name,sale.price,sale.date)# -------------------------------------------- ## ---- List a product for sale --------------- #listed=client.list_product(product=product,# DD1391-100store_price=3000,size="42",sell_method=SellMethod.Resell,duration=ListingDuration.Days60)print(listed)# -------------------------------------------- #
Package: restparse
Python parser for RESTful HTTP requestsA simple, lightweight parser for RESTful HTTP request data.Python 3.6+InstallationpipinstallrestparseExample usage:fromrestparse.parserimportParserparser=Parser(description="RESTful parameter parser")parser.add_param(name="name",type=str,description="The users name",required=True)parser.add_param(name="age",type=int,description="The users age",required=True)parser.add_param(name="online",type=bool,description="Is the user online?",default=False)parser.add_param(name="height",type=float,description="The users height",)parser.add_param(name="tags",description="Tags",)payload={"name":"John Doe","age":"40","online":False,"height":6.2,"tags":["python","javascript"]}params=parser.parse_params(payload)print(params.name)# John Doeprint(params.tags)# ['python', 'javascript']print(params.to_dict())# {'name': 'John Doe', 'age': 40, 'online': False, 'height': 6.2, 'tags': ['python', 'javascript']}Usage with FlaskParsing query strings:@app.route("/")defindex():""" Parsing query strings """parser=Parser(description="Parsing query strings")parser.add_param("q_from",type=int,description="Query from")parser.add_param("q_to",type=int,description="Query to")parser.add_param("search",type=str,description="Search query")params=parser.parse_params(request.args)print(params.q_from)print(params.q_to)print(params.search)returnf"Params = from:{params.q_from}, to:{params.q_to}, search:{params.search}"Parsing request payloads:@app.route("/json",methods=["POST"])defjson_payload():""" Parsing request payloads """parser=Parser(description="Parsing a request payload")parser.add_param("name",type=str,description="The users name",required=True)parser.add_param("age",type=int,description="The users age",required=True)parser.add_param("tags",type=list,description="Tags")params=parser.parse_params(request.get_json())print(params.name)print(params.age)print(params.tags)returnjsonify(params.to_dict())Parsing form data:@app.route("/form",methods=["POST"])defform_payload():""" Parsing form data """parser=Parser(description="Parsing form data")parser.add_param("name",type=str,description="The users name",required=True)parser.add_param("age",type=int,description="The users age",required=True)params=parser.parse_params(request.form)print(params.name)print(params.age)returnredirect(url_for("index"))add_param()parser.add_param("name",type=str,dest="new_name",description="A description of the param",required=True,choices=["foo","bar"])options:name (str): The parameter name
type (type): The type to which the parser should expect
dest (str): The name of the attribute to be added to the object returned by parse_params()
description (str): A description of the param
required (bool): Whether or not the param may be omitted
choices (container): A container of the allowable values for the argument
default: The value produced if the argument is absent from the params
Package: restpass
restpassTerminal based graphical utility for generating restorable passwordsInstallpipinstallrestpassUsageThe core principle is simple -for the same input you get the same output.
The input consist of input string, salt, length and alphabet.
Output is the generated password. In case of forgetting the password, it can always be restored (with the same input).RecommendationsUse memorable phrases (favorite quotes, song lyrics, etc) for input string and salt (not required by default).Use digits, lowercase and uppercase. Using symbols is the last thing to consider.Salt is used in cases when you want to reuse input string, but have different password. For example, the same input string could be used for desktop and laptop, but used with different salt.Minimum recommended length is 15. According tohowsecureismypassword.net, it would take a computer about558 QUADRILLION YEARSto crack your password.
Package: restpki-client
This library contains classes that encapsulate the calls to the REST PKI API.The recommend way to installRest PKI Client Libis through [PyPi](https://pypi.org/):$ pip install restpki-clientOr informing on your project’srequirements.txtfile:restpki-client==1.2.1SamplesPlease visit the [REST PKI samples repository](https://github.com/LacunaSoftware/RestPkiSamples/tree/master/Python)
for examples on how to use this library.
Package: rest-playbook-micro
Python REST PlaybookProvides a framework for defining a series (playbook) of rest messages to perform automated testing or access of an endpoint.FeaturesSubstitution of values in a templated REST messageContent can be optional or mandatory for provided valuesRun messages in a user defined orderDefine pause times between messagesTODO: Run python statements against step responsesUsageSince playbook is driven from defined input files the code required to run a playbook is short. All of the development time as a goal should be spent in the input filesfromrest_playbook_micro.rest_playbookimportRESTPlaybookasRPpb=RP("test.playbook","test.scenario","test.vars")results=pb.run_playbook()print(results)All files are flat text and we will discuss their format now. Examples are provided in./testVars fileAll variables are defined in the format<variable_name>=<value><variable_name> character set is best restricted to[A-Z_]and never=.=symbols in<value>do not need to be escaped since the parser will only use the first occurance in each line as a separator.PAGE=1
ID=ORDER001
SERVICE_ID=SERVICEORDER001
TIMESTAMP=2023-01-02 12:25:01ScenarioDefine a scenario for a specific message content.SCENARIO=block outlines meta information for the content, whereasHEADER=,PARAMS=andBODY=outline standard HTTP REST data. Close each block with the block name prepended with=Variable substitutions are marked with%ENV_<VARNAME>%. You can define content that will not be copied with%OPTIONAL:and enforce variables being provided with%MANDATORY:%----
SCENARIO=
NAME=EASY NAME
DESCRIPTION=Scenario Example
TYPE=POST
ENDPOINT=http://localhost:3876/200
=SCENARIO
HEADER=
	Content-Type:application/json
	Accept:application/json
=HEADER
PARAMS=
	page=%ENV_PAGE%
=PARAMS
BODY=
{
    "timestamp":"%ENV_TIMESTAMP%"
    %OPTIONAL:ENV_ID%,"id":"%ENV_ID%"
    %MANDATORY:ENV_SERVICE_ID%,"service_id":"%ENV_SERVICE_ID%"
}
=BODY
----PlaybookBuildpython-mbuild
python-mtwineuploaddist/*
Package: restproject
A sample project that exists as an aid to thePython Packaging User Guide’sTutorial on Packaging and Distributing
Projects.This projects does not aim to cover best practices for Python project
development as a whole. For example, it does not provide guidance or tool
recommendations for version control, documentation, or testing.This is the README file for the project.The file should use UTF-8 encoding and be written using ReStructured Text. It
will be used to generate the project webpage on PyPI and will be displayed as
the project homepage on common code-hosting services, and should be written for
that purpose.Typical contents for this file would include an overview of the project, basic
usage examples, etc. Generally, including the project changelog in here is not
a good idea, although a simple “What’s New” section for the most recent version
may be appropriate.
Package: rest-query
A parser for rest query request. like no-sql select style.(/?select=id,name,author{*}&id=gte.20&order=id.desc).Installingpip installrest-queryTestpython setup.py testUsageUsage:> from rest_query import BaseParamsParser
> args = {
        'select': 'id,name,author{id,name,school{*}}',
        'id': 'gte.20',
        'author.id': 'in.10,20,30,40,50',
        'order': 'id.desc',
        'page': 1,
        'limit': 5
    }
> parser = BaseParamsParser(params_args=args)
> parse.parse_select()
['author.school.*', 'author.id', 'author.name', 'id', 'name']
> parse.parse_where()
[
    {'field': 'id', 'value': '20', 'op': '>='},
    {'field': 'author.id', 'value': [10, 20, 30, 40, 50], 'op': 'in'}
]
> parse.parse_order()
[{'id': 'desc'}]
> parse.parse_paginate()
{'start': 0, 'end': 5, 'limit': 5, 'page': 1}LicenseMITContactsEmail:huiquanxiong@gmail.com
Package: restraint-fold
简化版蛋白质二级结构分类器使用方法首先通过pip进行安装：$python3-mpipinstallrestraint-fold--upgrade-ihttps://pypi.org/simple然后直接在命令行进行使用：$python3-mfold-h
usage:__main__.py[-h][-iI][-oO][-ohOH][--simplifiedSIMPLIFIED][--addhADDH]optionalarguments:-h,--helpshowthishelpmessageandexit-iISettheinputpdbfilepath.-oOSettheoutputtxtfilepath.-ohOHWritethehbondsintotxtfile.--simplifiedSIMPLIFIEDReturnthesimplifiedinformation,defaulttobe0.--addhADDHDecidetorebuildhydrogenatomsornot,defaulttobe0.示例执行一个生成完整的alpha和beta序列的命令：$python3-mfold-iexamples/pdb/case2-optimized.pdb-oexamples/case2-secondary.txt
Analysingalpha:100%|████████████████████████████████████████████████████████████████████████████████████████████|154/154[00:00<00:00,14563.23it/s]Analysingbeta:100%|█████████████████████████████████████████████████████████████████████████████████████████████|746/746[00:00<00:00,6425.08it/s]得到的结果如下所示：# case2-secondary.txt
alpha:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 31 32 33 34 35 36 37 39 40 41 42 43 44 45 46 78 79 80 81 82 83 84 85 86 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
beta:
23 24 25 26 27 28 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 93 94 95 96 97 98 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157$python3-mfold-iexamples/pdb/case2-optimized.pdb-oexamples/case2-secondary.txt--simplified1Analysingalpha:100%|████████████████████████████████████████████████████████████████████████████████████████████|154/154[00:00<00:00,17623.61it/s]Analysingbeta:100%|█████████████████████████████████████████████████████████████████████████████████████████████|746/746[00:00<00:00,6416.04it/s]得到的结果如下所示：# case2-secondary.txt
alpha:
1~25
31~37
39~46
78~86
94~109

beta:
23~28
46~72
93~98
118~157提示如果输入的pdb文件中氢原子有缺失，需要加上--addh 1自动补充氢原子的选项，或者手动通过Xponge或者Hadder等工具进行补氢，然后再对结构进行解析：$python3-mfold-iexamples/pdb/case2.pdb-oexamples/case2-secondary.txt--simplified1--addh11H-Addingtaskwith2529atomscompletein0.09seconds.
Thenewpdbfilepathisin:/tmp/restraint-fold/92de3be6-12f6-11ee-b491-b07b25070cd2.pdb
Analysingalpha:100%|████████████████████████████████████████████████████████████████████████████████████████████|154/154[00:00<00:00,15845.42it/s]Analysingbeta:100%|█████████████████████████████████████████████████████████████████████████████████████████████|746/746[00:00<00:00,6003.69it/s]
Package: restricted-input
Restricted InputImportant ChangeMade a small backward incompatible change. Instead ofexclude, useallow. I changed it because:There was a typo anyway. It wasexludeinstead ofexclude!I feel likeallowhas a better and clearer meaning thanexclude.excludemight be confusing sometimes.OverviewA way of imposing restrictions ininput().For example, if you want the user to only enter numbers, you could use this. Only want uppercase letters? Works here.It uses msvcrt.getch/alternative in *nix to get the keystroke and check it in real time.InstallationInstallrestricted_inputfrompypiusing:pipinstallrestricted_inputHow to use itImport itfromrestricted_inputimportr_inputr_inputis the function which can be used instead ofinput()It has five argumentsvariable=r_input(prompt,input_type,allow,maxlength,warning)prompt: is the prompt to be given for the input dialog.stringinput_type: is the type of data to which the input should be restricted to.stringIt can be"normal": normal text"string_all": Allows only string, space is not allowed"string_upper": Allows only uppercase string, space is not allowed"string_lower": Allows only lowercase string, space is not allowed"specials"Allows only special characters - `` ~ ! @ # $ % ^ & * ( ) - _ = + [ { ] } ; : ' " , < . > / ? \ |`. Space not included"integer": Allows only integers, doesn't allow-,.or space"float": Allows only integers, including.single time. Space or-not included"version": Allows only integers, including.multiple times. Space or-not included"nothing".    Obviously allows nothing. Useful in scenarios where you need only a limited number of characters.To get the list of input_types:fromrestricted_inputimportget_input_typesprint(get_input_types)allow: is the argument for allowing certain characters.string or listFor example, if you want to allow hyphens inintegers, you can user_input("Enter the number: ","integer","-")If you want to allow input of the characterv,a,bandgin version type input, use:r_input("Enter the version: ","version","vabg")# Orr_input("Enter the version: ","version",["v","a","b","g"])maxlength: is the argument for maximum length for input. Useful in scenarios where only single character is required.integerwarning: is the argument for any warnings is the user has entered something which isn't allowed.stringExampleIssues/limitationsIt will not work in some IDLEs like Spyder or PyCharm. This is because some IDLEs emulate a terminal which might not work with this module. Try to run the program in external terminal.You tell me!ContributingIf you need help, don't hesitate to open an issue. Pull requests are welcome, but please state the reason for it.LicenseThis project is underMIT License
Package: restricted-partition
Restricted PartitionA restricted partition is the subset of an integer partition with only partitions at
or below a certain length.fromrestricted_partitionimportiter_partitioniter_partition(5)# [1, 1, 1, 1, 1]# [1, 1, 1, 2]# [1, 1, 3]# [1, 2, 2]# [1, 4]# [2, 3]# [5]iter_partition(5,3)# [1, 1, 3]# [1, 2, 2]# [1, 4]# [2, 3]# [5]Uses the accel_asc algorithm (thank you, Jerome Kelleher), so it is pretty speedy in pure Python.I found the algorithm athttps://jeromekelleher.net/generating-integer-partitions.html.
Package: restricted_pkg
This python package provide a simple wrapper aroundDistributeto handle
private projects.
It is mostly intended for use in a package’ssetup.pyscript.It provides the following features:Using a private package index when fetching package dependencies duringpython setup.py installRestricting theregisteranduploadcommands to a private package index, or to disable them completelyEasy support for authenticated URLs when accessing the index.CompatibilityTherestricted_pkgpackage requires Distribute, and supports Python 2.6 and later (including Python3).UsageIn yoursetup.pyscript, ensure you have the following lines:from setuptools import find_packages
from restricted_pkg import setup

setup(
    ...,
    private_repository="https://@myrepo.example.tld/path/to/repo",
    install_requires=[
        "distribute",
        "restricted_pkg",
    ],
)
Package: restricted_pkg_ext
This python package provide a simple wrapper aroundDistributeto handle
private projects.
It is mostly intended for use in a package’ssetup.pyscript.It provides the following features:Using a private package index when fetching package dependencies duringpython setup.py installRestricting theregisteranduploadcommands to a private package index, or to disable them completelyEasy support for authenticated URLs when accessing the index.CompatibilityTherestricted_pkgpackage requires Distribute, and supports Python 2.6 and later (including Python3).UsageIn yoursetup.pyscript, ensure you have the following lines:from setuptools import find_packages
from restricted_pkg import setup

setup(
    ...,
    private_repository="https://@myrepo.example.tld/path/to/repo",
    install_requires=[
        "distribute",
        "restricted_pkg",
    ],
)
Package: restruct
Restruct is an easy light-weight formatting library that simplifies the process of representing SQL
results in a human readable format (JSON).  Pass the restruct method your SQL results and a
formatting structure and voila, you have turned your complex SQL result into beautiful JSON.  One of
the best features of Restruct is squashing all the duplicate entries from SQL joins into a sub
section of your JSON structure.Usage examplesLets assume we have a database with a user table that can be fetched with this query:SELECT id,
       first_name,
       last_name,
       email,
       age
  FROM usersFormattingHere is how you could write a simple template to turn the SQL result (list of dicts) into a
prettier JSON structure:struct = {
    "< id": {
        "id": "< id",
        "name": {
            "first": "< first_name",
            "last": "< last_name",
            "full": "{{first_name}} {{last_name}}"
        },
        "email": "< email",
        "age": "< age"
    }
}

collection                = Restruct.collection( <list_of_dicts_from_database_query> )
collection.format(struct)

# Example output:
{
    273667: {
        "id": 273667,
        "name": {
            "first": "Jeff",
            "last": "Goldbloom",
            "full": "Jeff Goldbloom"
        },
        "email": "jeff.goldbloom@example.com",
        "age": 49
    },
    93892: {
        "id": 93892,
        "name": {
            "first": "Marty",
            "last": "Mcfly",
            "full": "Marty Mcfly"
        },
        "email": "marty.mcfly@example.com",
        "age": 17
    },
    ...
}
Package: restructure
Dictionary Restructure ToolProjectThis project implements in Python a function calledrestructure():defrestructure(data:dict,specification:dict):...It is useful to restructure where keys are in a dictionary, for example to
upgrade a configuration file to a new schema.UsagefromrestructureimportrestructureMoving KeysTo move a nested dictionary to the top-level:input_data={'key1':{'key2':{'key3':'value',},},}specification={'key1.key2.key3':'key',}output=restructure(input_data,specification)assertoutput=={'key':'value',}or the opposite:input_data={'key':'value',}specification={'key':'key1.key2.key3',}output=restructure(input_data,specification)assertoutput=={'key1':{'key2':{'key3':'value',},}}Or to swap keys:input_data={'key1':{'key2':'value1',},'key3':{'key4':'value2',},}specification={'key1.key2':'key3.key4','key3.key4':'key1.key2',}output=restructure(input_data,specification)assertoutput=={'key1':{'key2':'value2',},'key3':{'key4':'value1',},}Copying KeysKeys can be copied using sets of key-paths:input_data={'key1':{'key2':{'key3':'value1',},},}specification={'key1.key2.key3':{'key1.key2.key3.key4','key1.key2.key5','key1.key6','key7'},}output=restructure(input_data,specification)assertoutput=={'key1':{'key2':{'key3':{'key4':'value1',},'key5':'value1',},'key6':'value1',},'key7':'value1',}Merging KeysKeys which contain dictionaries or equivalent values can be merged:input_data={'key1':{'key2':{'key3':'value1',},},'key4':{'key5':'value2',},'key6':'value1',}specification={'key4':'key1.key2','key6':'key1.key2.key3',}output=restructure(input_data,specification)assertoutput=={'key1':{'key2':{'key3':'value1','key5':'value2',},},}Removing KeysKeys can be removed by providingNoneor an empty string:input_data={'key1':{'key2':'value1','key3':'value2','key4':'value3',},}specification={'key1.key3':None,'key1.key4':'',}output=restructure(input_data,specification)assertoutput=={'key1':{'key2':'value1',},}For DevelopersFollowsSemantic Versioning 2.0.0Followsthis package structureTestingTo run unit tests, run the following command from the project root directory:python-munittestPackagingBefore packaging, update the version number inpyproject.tomlTo package & upload the project, run the following commands from the project root directory:python-mbuild
python-mtwineuploaddist/*
Package: restservice
RESTServiceAboutREST Service is small library.
This is template for REST services.
REST Service is wrapper foraiohttpframework.
This library wraps class Application from framework and adds middleware for handle exceptions and make web response from it.
Also throws config file to web handlers.InstallationpipinstallrestserviceClassesRESTService - class makes aiohttp app with middleware who catchs exceptions and makes web responseRESTConfig - class makes config and gets params from yaml fileRESTHandler - class wraps aiohttp View class and throws config in handlerRESTError - class for generate exceptionsExamplefromaiohttp.webimportjson_response,RouteTableDeffromrestserviceimportRESTError,RESTService,RESTConfig,RESTHandlerroutes=RouteTableDef()# Create class Config with params as annotation# config gets env variable ENVIRONMENT and find params in yaml file# if config not found param with current env config gets param from DEFAULT or return NoneclassConfig(RESTConfig):DB:str# make func handlerasyncdeffunc_handler(request):returnjson_response(awaitrequest.json())# make class handler with config@routes.view(r'/test/{user_id}')classTestHandler(RESTHandler):# GET handlerasyncdefget(self):user_id=self.request.match_info.get('user_id')db_path=self.config.DBifuser_id=='exc':raiseRESTError('USER_ID_ERROR','User id error.')returnjson_response({'user_id':user_id,'db_path':db_path})if__name__=='__main__':app=RESTService()# create aiohttp app with middlewareapp.config=Config('config.yaml')# add configapp.add_routes(routes)# add route tableapp.router.add_get('/example',func_handler)# add handlerapp.start()# run appexample request not found pagecurlhttp://localhost:8080/404response{"error":"HTTP_NOT_FOUND","message":"Http not found.","detail":null}