Saravanan666/pypi-org huggingface dataset:
Package: retroapi
RetroSynthesis APIretroapi get predict routes given target molecule.supply plausible value for all predicts.predict conditions base on one reaction.add aync supportInstallusing pippipinstallretroapiUsagefromretroapiimportRetroApi,Name2Smilestoken=""# you may get token firstretro_api=RetroApi(token)# if you have simles of molecule.smiles="COc1cccc(OC(=O)/C=C/c2cc(OC)c(OC)c(OC)c2)c1"# else:chemical_name="4-Hydroxycoumarin"name2smiles=Name2Smiles()smiles=name2smiles.get_smiles(chemical_name)# check if smiles is valid or notis_valid_smiles=retro_api.validate_smiles(smiles)ifis_valid_smiles:routes=retro_api.predict_routes(smiles)ifroutesisnotNone:# work with routespass# check if chemical is buyable or notis_buyable=retro_api.check_stock(smiles)# check reaction conditions# first you should get product smile# second you should get reactants smileproducts="COc1cc(C(=O)O)cc(OC)c1OC"reactants="C=CC(=O)O.COc1cc(Br)cc(OC)c1OC"conds=retro_api.process_reaction(product,reactants)ifcondsisnotNone:# check reaction condition with plausiblepassAsync UsagefromretroapiimportRetroApi,Name2Smilesasyncdeffoo():retro_api=RetroApi(token)# if you have simles of molecule.smiles="COc1cccc(OC(=O)/C=C/c2cc(OC)c(OC)c(OC)c2)c1"# else:chemical_name="4-Hydroxycoumarin"name2smiles=Name2Smiles()smiles=awaitname2smiles.aget_smiles(chemical_name)# check if smiles is valid or notis_valid_smiles=awaitretro_api.avalidate_smiles(smiles)ifis_valid_smiles:routes=awaitretro_api.apredict_routes(smiles)ifroutesisnotNone:# work with routespass# check if chemical is buyable or notis_buyable=awaitretro_api.acheck_stock(smiles)# check reaction conditions# first you should get product smile# second you should get reactants smileproducts="COc1cc(C(=O)O)cc(OC)c1OC"reactants="C=CC(=O)O.COc1cc(Br)cc(OC)c1OC"conds=awaitretro_api.aprocess_reaction(product,reactants)ifcondsisnotNone:# check reaction condition with plausiblepassChange log:Add try_times in predict_routes and process_reaction w/ asyncroutes=awaitretro_api.apredict_routes(smiles,try_num=20)Need Tokento use this packageIt's wrap package for askcos.mit.edu API, so you can get token from website first.add aync for packagewith function name prefix with 'a', for example get_smile -> aget_smileAPI DocumentationClass Name2Smilesget_smilesparameterchemical_name: stroutputsmiles: strClass RetroApivalidate_smilesparametersmiles: stroutputtrue/falsepredict_routesparametersmiles: stroutputroutes: listprocess_reactionparameterproduct: strproduct smilesreactants: strreactants smiles jointed by "." like "C=CC(=O)O.COc1cc(Br)cc(OC)c1OC"output
conditions: list
Package: retroBot
retroBotPython IRC Twitch bot module integratingtwitchAPIandirc.Installationclone this repositorygit clone https://github.com/retrontology/retroBotinstall the dependenciescd retroBot
pip install -r requirements.txtinstall the modulepython setup.py installOverviewThe bot is split into two main components: theretroBot.retroBotand theretroBot.channelHandler. These are designed as a base skeleton class to be subtyped.retroBot.retroBotis the bot itself, a subtype derived fromirc.bot.SingleServerIRCBotand controls the main thread.AretroBot.channelHandleris created for each channel in the channels parameter passed toretroBot.retroBotconstructor. One can also pass their ownretroBot.channelHandlersubtype to theretroBot.retroBotconstructor via the handler parameter, which is ideal as the base handler class does nothing. TheretroBot.retroBotinstance, when started, passes messages to the respective channel handler instance in a new thread.There is also theretroBot.configmodule which needs to be imported separately. This is a simple dict subtype that can save and load itself from a yaml file. I personally use it to supply the bots with the information they need to run, but it's not required.ExamplesThere are a few examples in theexamplesdirectoryTwitchMarkovA fork ofTwitchMarkovwritten in retroBot.attonA Twitch bot that sends a message in a channel when the channel goes live.twitchloggerA Twitch bot that listens to selected channels and logs the messages to a pre-configured PostgreSQL database.testThe simplest bot that does nothing. Used as a test when developing.
Package: retro-data-structures
Retro-data-structuresConstruct type definitions for Retro Studios gameFormatPrime 1 (Read)Prime 1 (Write)Prime 2 (Read)Prime 2 (Write)Prime 3 (Read)Prime 3 (Write)PAK✓✓✓✓✗✗MLVL✓✗✓✗✓✗MREA✗✗✓✗ [2]✗✗MAPA✓✗✓✗✗✗CMDL✓✓✓✓✗✗ANCS✓✓✓✓✗✗ANIM✓✓✓✓✗✗CSKR✓✓✓✓✗✗CINF✓✓✓✓✗✗PART✓✓✓✓✓ [1]✓ [1]HIER--✓✓--STRG✓✓✓✓✓✓SAVW✓✓✗✗✗✗[1] All existing files parse, but not checked if exhaustive for what the game supports.[2] Missing re-calculation of how sections are split between blocks.Example Usagefromretro_data_structures.formats.pak_gcimportPAK_GCdefread_file(path):withopen(path,"rb")asf:returnf.read()PAK_GC.build_file({'named_resources':[{"asset":{"type":'TXTR',"id":201335801},"name":'TXTR_ElevatorIcon_1'},{"asset":{"type":'TXTR',"id":239414538},"name":'TXTR_ElevatorIcon'},{"asset":{"type":'TXTR',"id":564256465},"name":'TXTR_QuaterCurve'},{"asset":{"type":'TXTR',"id":568030977},"name":'TXTR_SaveStationIcon_1'},],'resources':[{"asset":{"type":'TXTR',"id":201335801},"compressed":1,"contents":{"value":read_file("ElevatorIcon_1.TXTR")},},{"asset":{"type":'TXTR',"id":201335801},"compressed":1,"contents":{"value":read_file("ElevatorIcon.TXTR")},},{"asset":{"type":'TXTR',"id":201335801},"compressed":1,"contents":{"value":read_file("QuaterCurve.TXTR")},},{"asset":{"type":'TXTR',"id":201335801},"compressed":1,"contents":{"value":read_file("SaveStationIcon_1.TXTR")},},]},"Game.pak")
Package: retrofix
RetroFix is a python library for reading and writing fixed-size field text file
and more specifically for managing files from Spanish banks and public
institutions, including:CSB 19, 32, 34 (several versions), 43, 57 & 58AEAT 182, 303, 340, 347 & 349InstallingSee INSTALLPackage Contentsdoc/documentation in reStructuredText. To generate the HTML:make htmlretrofix/retrofix sourcesSupportLicenseSee LICENSECopyrightSee project files for the complete list of Copyright owners.
Package: retroforth
Retro: A Modern, Pragmatic ForthRETRO is a modern, pragmatic Forth drawing influences from many
sources. It's clean, elegant, tiny, and easy to grasp and adapt
to various uses.Features:Open Source (ISC License)Portable (runs on a MISC-style virtual machine)Small source & binariesBuilds into a single, self contained binary for easy deploymentSources in literate format, using a Markdown variantQuick StartFor most systems (FreeBSD, NetBSD, OpenBSD, macOS, Linux):makeYou will need a standard C compiler andmake.ExecutablesBinaries will be placed in thebindirectory.The primary executable isretro. This is used for running the
examples and the Atua (gopher) & Casket (http) servers that
power forthworks.com.Theretroexecutable embeds the image into the binary, making
it trivial to copy and deploy.This interface layer also extends the language with many new
words and vocabularies, adds scripting, file i/o, gopher, and
floating point math support.Theretroexecutable can handle a variety of command line
arguments:retro -iStarts thelistener, a basic REPL for interactive use.retro filenameThis will run the code in the specified file, then exit. This
is also used to run programs as shell-type scripts using a
header line like#!/usr/bin/env retro.retro -i -f filenameThis will run the code in the specified file, then start the
listener.retro -hDisplays a summary of the command line arguments.Source files for use withretroare written with code in
fenced blocks:commentary here

~~~
code here
~~~Anything outside the fenced blocks will be ignored.DocumentationThe primary documentation is in RETRO-Book.md (and the formatted
RETRO-Book.html.) Additional notes can be found in thedocdirectory.Alternative ImplementationsIn addition to the C and Python implementations, this source
tree includes additional implementations in C#, JavaScript,
and Pascal. These are not as well tested or as feature complete
as the main implementations, but are provided for your use if
the standard implementations will not suffice.PatreonI have a Patreon athttps://www.patreon.com/_crcfor those that
want to financially support development. All funds raised via
Pateron are put into development related expenses (server expenses,
app store fees, hardware).Thanks go out to my current and past patrons:Kiyoshi YONEDAKrinkleneckRick CarlinoScott McCallum
Package: retro-games
RetroA simple framework for Terminal-based games.╔════════════════════════════════╗
║                                ║
║                                ║
║                                ║
║      *************             ║
║      *                         ║
║      *                         ║
║      **>                       ║
║             @                  ║
║                                ║
║                                ║
╠════════════════════════════════╣
║score: 153                      ║
║                                ║
╚════════════════════════════════╝LayoutThere are two panes, a fixed-size play area at the top and a state window
at the bottom. When enabled, a sidebar containing debug messages is also shown.Concepts and skills neededWe need to discuss immutability, and the difference between
mutable objects and immutable values.Specifically, we care about the difference between tuples and lists.State must be immutable!Objects are only ever equal to themselves.The game is structured as a collection of agents which interact.Design/pedagogical criteriaMake thinking visible.Avoid subclasses; they require interaction with invisible parent attributes.Instead, compose functionality from other classes which might be somewhat black-boxed.
Package: retrolover
# retroloverCommand-line simple ROM automatic downloader for your retropie### source has been changed to the romsmania so that tool is working againinstall:`pip install retrolover`Usage:`~ retrolover --console snes Castlevania````retrolover --helpusage: retrolover [-h] [--console {snes,nes,gba,gbc,gb,genesis}][--romsdir ROMSDIR]query [query ...]Retro consoles ROM Downloaderpositional arguments:query                 search queryoptional arguments:-h, --help            show this help message and exit--console {snes,nes,gba,gbc,gb,genesis}console--romsdir ROMSDIR, -r ROMSDIRroms directory```TODO:- add more consoles
Package: retronix.py-benfosterdev
retronix.pyA Python library designed for interacting with the RetronixMC Public API.This is the stable version. If you'd like to take a look at upcoming goodies that are in progress, then take a look at ourdevbranch!Be aware though, what you code with it might spook your program with a creepy-crawly code creature...DocumentationThe entirety of the Library is peppered in documentation internally, including new features that are in progress. Feel free to take a browse around the files and take a look at how stuff works to get a better understanding. Otherwise, basic guidance and detailing of the library is outlined in the Wiki section of the repository. If you need any help, feel free to get in touch with the dev team in the Discord.Bugs and code insectsIn the event you find a bug, we ask that you open up an issue for further investigation. From there, a pull request can be made in an attempt to rectify the bug. Please follow the guidance and templates as stated in the issues tab on the proper procedure for filing an Issue. It makes your life much easier and keeps our sanity together.Likewise for suggestions for what can be added to the library to make it more efficient or easier to use, open an issue with the suggestion label and follow the instructions from there. We'd love to hear your thoughts.
Package: retropass
RetropassAn NES password generation toolRetropass is a library and cli tool for generating passwords for NES-era
video games. Yes, there's quite a few, but I had a few goals not shared
(or at least not satisfied) by existing tools:Retropass is intended to support multiple games.Retropass can be incorporated into other generation tools. If you
like writing UI's, you don't need to get bogged down in binary to get
anywhere.Retropass's CLI is easily scriptable, if for whatever reason you want
that.Retropass ships with machine- and human- readable specifications of
the password formats. It can be used as a reference when developing
other programs.StatusStill beta. CLI and API details are subject to change. The following
games are supported (so far):Mega Man 2Mega Man 3MetroidKid IcarusSolar JetmanBattle of OlympusInstallationInstall Python 3.6 or above.Install Pip, if needed. On windows platforms, Pip is included in the
python installation.Runpip install --user retropassUsage (by players)Retropass is intended as a library for use by other tools, but it has a
command line interface as well. You feed it a file containing the
options you want, and it generates a password that implements those
options.retropass --helpwill print the available games and options.An example, from metroid:Runretropass metroid --dump > metroid.confto create the file.Edit the file to set whatever options you want.Runretropass metroid --conf metroid.conf. It will print the corresponding
password.Enter it in your game of choice and play.Usage (by developers)The API is minimal. There is a Password class. It has subclasses for
each game, and a .make classmethod that creates the appropriate type of
object given the game's name. A list of available names is available via
retropass.Password.supported_games()The options available for a given password can be set either
attribute-style (pw.option = 1) or dictionary-style (pw['option'] = 1). You can get the available options and their current settings as a
dictionary withdict(pw), or as a pretty-printed string withprint(pw.dump()). Stringifying or printing the password object will
produce the resulting password.Usage example:from retropass import Password

pw = Password.make('metroid')
pw.has_marumari = 1
pw.has_longbeam = 1
print(pw)Known IssuesThere's no great way of handling lists of related bits, e.g. all the
missile containers in MetroidExtra CreditsThe following links were instrumental, either as documentation or as
reference implementations. Credit for figuring out the password
mechanics belongs to these people, not me:Metroid Password Format Guide(John Ratliff)True Peace in Space(Alex Rasmussen)Solar Jetman Password Generator(CyberN)Battle of Olympus Password Generator(Steven Hicks)Mega Man 2 Password Mechanics(StrategyWiki, multiple authors)Kid Icarus Password Generator (KIP)(Parasyte? (no author
listed, but seearchive.org)
Package: retropath2-wrapper
Retropath2.0 wrapperImplementation of the KNIME retropath2.0 workflow. Takes for input the minimal (dmin) and maximal (dmax) diameter for the reaction rules and the maximal path length (maxSteps). The tool  expects the following files:rules.csv,sink.csvandsource.csvand produces results in an output folder.InputRequired:sink_file: (string) Path to the collection of chemical species to finish metabolic route explorationsource_file: (string) Path to the target compound desired to be synthesisedrules_file: (string) Path to the reaction rulesOptional:--outdir: (string, default='out') Path to the folder where result files are written--knime_exec: (integer, default=9999) Path to Knime exec file--max_steps: (integer, default='3') Maximal number of steps--topx: (integer, default: 100) For each iteration, number of rules--dmin: (integer, default: 0)--dmax: (integer, default: 1000)--mwmax_source: (integer, default: 1000)--mwmax_cof: (integer, default: 1000)--timeout: (integer, default: 30) Timeout in minutes--is_forward: (bool, default: False) Forward or reverse synthesisPrerequisitesPython 3KNIME (code was tested on 3.6.2 version)InstallFrom pipretropath2_wrapper requiresKnimewhich is not available through pip. The 3.6.2 version will be downloaded if not already installed.[sudo]python-mpipinstallretropath2_wrapperFrom Conda[sudo]condainstall-cbrsynthretropath2_wrapperRunretropath2_wrapper processFrom Python codefromretropath2_wrapperimportrun,build_args_parserparser=build_args_parser()args=parser.parse_args()run(args.sinkfile,args.sourcefile,args.rulesfile)From CLIpython-mretropath2_wrappersinkfile.csvsourcefile.csvrulesfile.csvTestAll modes can be tested with:cd tests
./test-in-docker.shHow to cite RetroPath2.0?Please cite:Delépine B, Duigou T, Carbonell P, Faulon JL. RetroPath2.0: A retrosynthesis workflow for metabolic engineers. Metabolic Engineering, 45: 158-170, 2018. DOI:https://doi.org/10.1016/j.ymben.2017.12.002
Package: retrospect
Dynamic logging after the factClassic logging expects perfect foresight, but only hindsight is 20/20!UsageInstall via pip, then enter in a shell:defhello(a,b=2):"""docstring"""a=1c=b*2a=b=c=a*2+b*cprint('output: a={}b={}c={}'.format(a,b,c))returna,b,cimportretrospectretro=retrospect.FunctionRetrospector(hello)Now you can start inspecting lines in real-time:>>>retro.implement(lines=True)>>>hello(10)((3,SetLineno,3),{'a':10,'b':2})((4,SetLineno,4),{'a':1,'b':2})((5,SetLineno,5),{'a':1,'b':2,'c':4})((6,SetLineno,6),{'a':10,'b':10,'c':10})output:a=10b=10c=10((7,SetLineno,7),{'a':10,'b':10,'c':10})((7,RETURN_VALUE,None),{'a':10,'b':10,'c':10})Or a specific set of lines:>>>retro.implement(lines=[4],boundaries=False)>>>hello(20)((4,SetLineno,4),{'a':1,'b':2})output:a=10b=10c=10Or only on symbol changes:>>>retro.implement(symbols=True,boundaries='start')>>>hello(30)((3,SetLineno,3),{'a':30,'b':2})((3,STORE_FAST,'a'),{'a':30,'b':2})((3,STORE_FAST,'a'),{'a':1,'b':2})((4,STORE_FAST,'c'),{'a':1,'b':2})((4,STORE_FAST,'c'),{'a':1,'b':2,'c':4})((5,STORE_FAST,'a'),{'a':1,'b':2,'c':4})((5,STORE_FAST,'a'),{'a':10,'b':2,'c':4})((5,STORE_FAST,'b'),{'a':10,'b':2,'c':4})((5,STORE_FAST,'b'),{'a':10,'b':10,'c':4})((5,STORE_FAST,'c'),{'a':10,'b':10,'c':4})((5,STORE_FAST,'c'),{'a':10,'b':10,'c':10})output:a=10b=10c=10Or specific opcodes:>>>retro.implement(opcodes=['LOAD_CONST'],boundaries='finish')>>>hello(40)((3,LOAD_CONST,1),{'a':40,'b':2})((4,LOAD_CONST,2),{'a':1,'b':2})((5,LOAD_CONST,2),{'a':1,'b':2,'c':4})((6,LOAD_CONST,'output: a={}b={}c={}'),{'a':10,'b':10,'c':10})output:a=10b=10c=10((7,RETURN_VALUE,None),{'a':10,'b':10,'c':10})Or return toexactoriginal:>>>retro.implement()>>>hello(50)output:a=10b=10c=10Any of the above can be mixed as necessary, eg.lines=True,symbols="c"
Package: retro-transformer
Retrieval-Enhanced Transformer (WIP)Easy-to-useRetroimplementation in PyTorch.This code based onlabml.aiandacceleratefor light inference and training on CPUs, GPUs, TPUs.fromretro_transformer.bertimportBERTForChunkEmbeddingsfromretro_transformer.tools.databaseimportbuild_database,RetroIndexfromretro_transformer.tools.datasetimportbuild_datasetfromretro_transformer.modelimportRetroModel,NearestNeighborEncoderfromretro_transformer.tools.trainimporttrainchunk_len=16d_model=128d_ff=512n_heads=16d_k=16n_layers=16workspace='./workspace'text_file='text.txt'bert=BERTForChunkEmbeddings('bert-base-uncased','cuda')index=RetroIndex(workspace,chunk_len,bert=bert)build_database(workspace,text_file,bert=bert,chunk_len=chunk_len)num_tokens=build_dataset(workspace,text_file,chunk_len=chunk_len,index=index)nearest_neighbor_encoder=NearestNeighborEncoder(chunk_len=chunk_len,n_layers=n_layers,d_model=d_model,d_ff=d_ff,n_heads=n_heads,d_k=d_k,ca_layers={3})model=RetroModel(n_vocab=num_tokens,d_model=d_model,n_layers=n_layers,chunk_len=chunk_len,n_heads=n_heads,d_k=d_k,d_ff=d_ff,encoder=nearest_neighbor_encoder,ca_layers={3,5})train(model,workspace,text_file,chunk_len=chunk_len,d_model=d_model)
Package: retroyaml
reyamlDescriptionSmall utility class to ease yaml configuration in python3.RequirementsCurrently only requirespyyaml.To install the requirements:pip3 install -r requirements.txtExampleconfig.yamlhello: world
this:
  is:
    - a
    - testexample.pyfrom retroyaml.yamlConf import yamlConf

config = yamlConf('config.yaml')

print(config.hello)worldprint(len(config.this.is))2
Package: retrrry
RetrrryDecorate flaky functions with@retryto apply retrying logic.Simplest way to useretrrryis actually to copy the code inretry.pyand use it in your
project, since there is no dependencies other than the standard library.@retrydefunreliable_func():importrandomifrandom.randint(0,10)<5:raiseIOError('Fail')else:return'Success'ConfigurationsSpecify stop condition (i.e. limit by number of attempts)Specify wait condition (i.e. exponential backoff sleeping between attempts)Specify certain ExceptionsSpecify expected returned resultInstallationpipinstallretrrryfromretrrryimportretryExamplesThe default behavior is to retry forever without waiting:@retrydefnever_stop_never_wait():print('Retry forever, ignore Exceptions, no wait between retries')raiseExceptionSet the number of attempts before giving up:@retry(stop_max_attempt_number=7)defstop_after_7_attempts():print('Stopping after 7 attempts')raiseExceptionSet a boundary for time for retry:@retry(stop_max_delay=10000)defstop_after_10_s():print('Stopping after 10 seconds')raiseExceptionSet wait time between retries:@retry(wait_fixed=2000)defwait_2_seconds():print('Wait 2 second between retries')raiseExceptionInject some randomness:@retry(wait_random_min=1000,wait_random_max=2000)defwait_1_to_2_seconds():print('Randomly wait 1 to 2 seconds between retries')raiseExceptionUse exponential backoff:@retry(wait_exponential_multiplier=1000,wait_exponential_max=10000)defwait_exponential_1000():print('Wait 2^i * 1000 milliseconds after ith retry, up to 10 seconds, then 10 seconds afterwards')raiseExceptionDeal with specific exceptions:defretry_if_io_error(exception):returnisinstance(exception,IOError)@retry(retry_on_exception=retry_if_io_error)defmight_have_io_error():print('Retry if an IOError occurs, raise any other errors')raiseException@retry(retry_on_exception=retry_if_io_error,wrap_exception=True)defmight_have_io_error_raise_retry_error():print('Retry if an IOError occurs, raise any other errors wrapped in RetryError')raiseExceptionAlter the behavior of retry based on a function return value:defretry_if_result_none(result):returnresultisNone@retry(retry_on_result=retry_if_result_none)defmight_return_none():print('Retry if return value is None')importrandomifrandom.randint(0,10)>1:returnNonereturn'Done'# Or retry if result is equal to 1@retry(retry_on_result=lambdares:res==1)defmight_return_one():print('Retry if return value is 1')importrandomifrandom.randint(0,10)>1:return1return0Finally, we can always combine all of the configurations.
Package: retryable-requests
retryable-requestsEasy to use retryable requests sessions.QuickstartCommon casefromretryable_requestsimportRetryableSessionwithRetryableSession()assession:session.get('https://httpbin.org/get')# will be retried up to 5 timesOnly retry on 429 errorsfromrequests.packages.urllib3.util.retryimportRetryfromretryable_requestsimportRetryableSessionretry_strategy=Retry(total=5,status_forcelist=[429],backoff_factor=0.1,)withRetryableSession(retry_strategy=retry_strategy)assession:session.get('https://httpbin.org/get')# will be retried up to 5 times, only for 429 errorsAutomatically use a base URL for every requestfromretryable_requestsimportRetryableSessionwithRetryableSession('https://httpbin.org/')assession:session.get('get')# 'https://httpbin.org/get' will be retried up to 5 timessession.post('post')# 'https://httpbin.org/post' won't be retried (POST request)FeaturesAutomatic backing off retries for failed requests that can be safely retriedQuick timeouts for non-responsive requestsSee alsourllib3.util.Retryrequests.Sessionrequests_toolbelt.sessions.BaseUrlSessionTimeouts in Requests