Saravanan666/pypi-org huggingface dataset:
Package: rxiter
RxIterRxIter brings observables to python in a bare bones way by usingasync generatorsand theasyncawaitsyntax. In this paradigmobservablesare analogous toasync iterables, andobserversanalogous toasync iterators.It implements 2 fundamental observable operations, which may be familar to those who knowrxpy.sharerepeatOperationsShareshareallows multiple "observers" to subscribe the same observableimportasynciofromrxiterimportshareasyncdefmain():@shareasyncdefcount():# a counting "observable"v=0whileTrue:print(f"returning value{v}")yieldvawaitasyncio.sleep(1)v+=1asyncdefcount_squared(obs):# a counting "observer"asyncforvinobs:print(f"{v}squared is{v**2}")square_task_subscription=asyncio.Task(count_squared(count()))# subscribeasyncdefcount_cubed(obs):# another counting "observerasyncforvinobs:print(f"{v}cubed is{v**3}")cube_task_subscription=asyncio.Task(count_cubed(count()))# subscribeawaitasyncio.gather(square_task_subscription,cube_task_subscription)asyncio.run(main())The output on this code would be:returning value 0
0 squared is 0
0 cubed is 0
returning value 1
1 squared is 1
1 cubed is 1
returning value 2
2 squared is 4
2 cubed is 8
etc...Repeatrepeattakes aiterator, and "records" it's outputed values so that it is turned into aniterable, and can be "listened" back multiple times.ExamplePolling an APISuppose we have a API endpoint that we would like to poll to get the most up to date weather in Toronto. We could set up an observable as follows:asyncget_toronto_weather():whileTrue:yieldawaitpoll_my_api("api_enpoint")awaitasyncio.sleep(60*30)# wait 30 minutesIf you want to "pipe" this to do further operations, like extract some specific content from the dict returned byget_toronto_weather()asyncget_temperature():asyncforvinpoll_api():yieldv["temperature"]Now if we want to have multiple listeners, that is where thesharecomes into the picture. We can do@shareasyncget_toronto_weather():whileTrue:yieldawaitpoll_my_api("api_enpoint")awaitasyncio.sleep(60*30)# wait 30 minutesasyncget_temperature():asyncforvinget_toronto_weather():yieldv["temperature"]asyncget_humidity():asyncforvinget_toronto_weather():yieldv["humidity"]asyncio.Task(get_temperature())asyncio.Task(get_humidity())andget_toronto_weather()will only run once for bothget_temperature()andget_humidity()Realtime stdout on python subprocessInstallationpip install rxiter
Package: rxjson
What is Rx?When adding an API to your web service, you have to choose how to encode the
data you send across the line. XML is one common choice for this, but it can
grow arcane and cumbersome pretty quickly. Lots of webservice authors want to
avoid thinking about XML, and instead choose formats that provide a few simple
data types that correspond to common data structures in modern programming
languages. In other words, JSON and YAML.Unfortunately, while these formats make it easy to pass around complex data
structures, they lack a system for validation. XML has XML Schemas and RELAX
NG, but these are complicated and sometimes confusing standards. They’re not
very portable to the kind of data structure provided by JSON, and if you wanted
to avoid XML as a data encoding, writing more XML to validate the first XML is
probably even less appealing.Rx is meant to provide a system for data validation that matches up with
JSON-style data structures and is as easy to work with as JSON itself.rxjsonrxjson is a python package that helps you validate your generated JSON
against a standardized json schema directly in your python app.It is a packaged version ofhttp://rx.codesimply.com/UsageHere is a little example of how to validate your json against a rx schema:importrequestsfromrxjsonimportRximportunittestclassSporeTest(unittest.TestCase):"""Test generate spore schema."""deftest_spore(self):rx=Rx.Factory({"register_core_types":True})withopen('spore_validation.rx')asf:spore_json_schema=json.loads(f.read())spore_schema=rx.make_schema(spore_json_schema)resp=requests.get('http://localhost:8000/spore',headers={'Content-Type':'application/json'})self.assertTrue(spore_schema.check(resp.json))Or even quicker:>>>importjson>>>fromrxjsonimportRx>>>rx=Rx.Factory({"register_core_types":True})>>>spore_json_schema=json.loads(open('spore_validation.rx').read())>>>spore_schema=rx.make_schema(spore_json_schema)>>>js=json.loads("""{
...     "base_url": "http://localhost:8000",
...     "expected_status": [200],
...     "version": "0.1",
...     "methods": {
...         "put_data_item": {
...             "path": "/data/:model_name/:data_item_id",
...             "description": "Update a data item.",
...             "required_params": ["model_name", "data_item_id"],
...             "method": "PUT",
...             "formats": ["json"]
...         }
...     },
...     "name": "daybed"
... }""")>>>spore_schema.check(js)Truespore_validation.rxis part ofhttps://github.com/SPORE/specificationsdaybedis a form model validation API:https://github.com/spiral-project/daybed
Package: rxml
rxmlWhat is rxml?rxmlis a simple python library to read xml files up to 2 times faster than python'sxml(ElementTree)library.InstallationTo installrxmlyou can usepip:pipinstallrxmlSimply as that!Example usageTo a given xml withtest.xmlas name:<?xml version="1.0" encoding="UTF-8"?><noteexample_attr="example value"><to><name>ExampleName</name></to><from><name>ExampleName</name></from><heading>AnExampleHeading</heading><body>AnExampleBody!</body></note>We write the following python code:fromrxmlimportread_fileroot_node=read_file("test.xml","note")where"test.xml"is thefile_nameand"note"is theroot_tag.After that we can simply iter through the children with:fornodeinroot_node.children:# do something with the node hereYou can also write it to a file or string(refer to the.pyifile for the args).fromrxmlimportNode,write_fileexample_node=Node(name="hello_world",attrs={"example_attr":"example"},text="Hello World!")write_file(example_node,"test_ex.xml")Node attributesThis is how theNodelooks like:classNode:name:strattrs:dict[str,str]children:list[Node]text:str
Package: rxn-availability
rxn-availabilityDevelopment setuppip install -e ".[dev,rdkit]"ExampleThe easiest way to use the package is to rely on theIsAvailableobject:fromrxn.availabilityimportIsAvailableis_available_object=IsAvailable()smiles="B1C2CCCC1CCC2"print(f"{smiles}availability:{is_available_object(smiles}")# BYOC: bring your own compoundscompounds_filepath="tests/example_compounds.txt"is_available_object=IsAvailable(additional_compounds_filepath=compounds_filepath)smiles="CC(Cc1ccc(cc1)C(C(=O)O)C)C"print(f"{smiles}availability:{is_available_object(smiles}")
Package: rxnconcompiler
rxnconcompiler is an iterative network building tool for Systems Biology.Magdalena Rother, Sebastian Thieme, Ulrike Muenzner and Marcus KrantzUSAGEGet help:python interface.py -hGenerate bngl file:python interface.py ‘A_ppi_B; ! A–C’ [-o output_file.name]Generate json file:python interface.py ‘A_ppi_B; ! A–C’ –json [-o output_file.name]Generate file with rxncon quick text:python interface.py ‘A_ppi_B; ! A–C’ –json [-o output_file.name]LEGAL DISCLAIMERrxnconcompiler is released under the GPL license, a copy of which
is included in the distribution (See COPYING for details).This software is provided “as-is”. There are no expressed or implied
warranties of any kind, including, but not limited to, the warranties of
merchantability and fitness for a given application. In no event shall
the authors be liable for any direct, indirect, incidental, special,
exemplary or consequential damages (including, but not limited to, loss
of use, data or profits, or business interruption) however caused and on
any theory of liability, whether in contract, strict liability or tort
(including negligence or otherwise) arising in any way out of the use
of this software, even if advised of the possibility of such damage.The authors take no responsibility for damage caused by this program
or its components.CREDITSMagdalena Rother- architecture and unit tests and implementationSebastian Thieme- model validation and testingFalko Krause- rxncon_parser.py (modified by MR)Ulrike Muenzner- contribution into conceptsMarcus Krantz- concept and supervisionACKNOWLEDGEMENTSCredit goes to our colleagues Falko Krause, Max Floettmann,
David Jesinghaus, and Janina Linnik for their comments,
ideas and support during development.REFERENCESMagdalena Rother, Ulrike Muenzner, Sebastian Thieme and Marcus KrantzInformation content and scalability in signal transduction
network reconstruction formats. Molecular BioSystems,
DOI: 10.1039/C3MB00005B (2013)FOR DEVELOPERSWhen using the repository version modify your ~/.bashrc :PYTHONPATH=$PYTHONPATH:/path/to/main/rxnconcompiler/:
/path/to/rxnconcompiler/tests/
export PYTHONPATHTo be able to run acceptance tests with BioNetGen,
install the BioNetGen software and add to ~/.bashrc :
BNG_PATH=/path/to/BioNetGen-2.2.2-stable/
export BNG_PATHClass Responsibility Collaboration doc:doc/_statis/rxncompiler.txtRelease making:git tag -a v1.2.0 -m ‘read and write json, cli added’git push –tagspython setup.py sdistpython setup.py sdist upload (sends package to PyPI)Generating documentation with Sphinx:pip install spxinxpython setup.py docscd docsmake html (index.html in docs/_build/index.html)Testing and coverage:python setup.py test (calculates coverage)orcd testspython test_all.pyUsage of virtual environment:pip install virtualenvvirtualenv venv_rxnconsource venv_rxncon/bin/activate(venv_rxncon) pip install xlrd(venv_rxncon) pip install pyscaffold(venv_rxncon) pip install sphinx(venv_rxncon) pip freeze(venv_rxncon) cd rxnconcompiler(venv_rxncon) python setup.py test
Package: rxn-metrics
RXN package for the calculation of metrics for OpenNMT-based modelsThis repository contains a Python package and associated scripts for training reaction models based on the OpenNMT library.
This repository is closely related torxn-onmt-models, which handles the training pipelines for these models.
The repository also relies on other RXN packages; seerxn-utilities,rxn-chemutils, andrxn-onmt-utils.Links:GitHub repositoryDocumentationPyPI packageThis repository was produced through a collaborative project involving IBM Research Europe and Syngenta.System RequirementsThis package is supported on all operating systems.
It has been tested on the following systems:macOS: Big Sur (11.1)Linux: Ubuntu 18.04.4A Python version of 3.6, 3.7, or 3.8 is recommended.
Python versions 3.9 and above are not expe`cted to work due to compatibility with the selected version of OpenNMT.Installation guideThe package can be installed from Pypi:pipinstallrxn-metrics[rdkit,rxnmapper]You can leave out the extra dependencyrdkitif RDKit is already available in your environment.
Also, you can leave out the extra dependencyrxnmapperif you don't plan on calculating the "true reactant" accuracy.For local development, the package can be installed with:pipinstall-e".[dev,rdkit,rxnmapper]"Calculation of metricsThe metrics are best calculated by launching one of the following scripts:rxn-prepare-context-metricsrxn-prepare-forward-metricsrxn-prepare-retro-metricsNote that these scripts will run the models directly to limit the likelihood of making errors.If the prediction files are available already, the scriptrxn-evaluate-metricswill compute the metrics only.To aggregate all the metrics for different models (typically: after tuning the hyperparameters), you can run the scriptrxn-parse-metrics-into-csv.
Package: rxn-onmt-utils
RXN package for OpenNMT-related utilitiesThis repository contains OpenNMT-related utilities used in the RXN universe.
For general utilities not related to OpenNMT, see our other repositoryrxn-utilities.Links:GitHub repositoryDocumentationPyPI packageSystem RequirementsThis package is supported on all operating systems.
It has been tested on the following systems:macOS: Big Sur (11.1)Linux: Ubuntu 18.04.4A Python version of 3.6, 3.7, or 3.8 is recommended.
Python versions 3.9 and above are not expected to work due to compatibility with the selected version of OpenNMT.Installation guideThe package can be installed from Pypi:pipinstallrxn-onmt-utilsFor local development, the package can be installed with:pipinstall-e".[dev]"Package highlightsTranslate with OpenNMT from Python codeBy importing the following,fromrxn.onmt_utilsimportTranslator,translateyou can do OpenNMT translations directly in Python.
Thetranslatefunction acts on input/output files, while theTranslatorclass gives you flexibility for getting translation results on strings directly.Stripping modelsThe scriptrxn-strip-opennmt-modelinstalled the package allows you to strip ~2/3 of the size of model checkpoints by removing the state of the optimizer.
You can do this safely if you don't need to continue training on these checkpoints.Extending the model vocabularyIf you finetune a model on a dataset with additional tokens compared to the base model, you will need to extend the model weights.
The scriptrxn-extend-model-with-vocabdoes that for you.
Package: rxnpath
rxnpathrxnpath is a python package for generating custom reaction diagrams.Licenserxnpathis licensed under the terms of the MIT license. See the file
“LICENSE” for information on the history of this software, terms & conditions
for usage, and a DISCLAIMER OF ALL WARRANTIES.All trademarks referenced herein are property of their respective holders.Copyright (c) 2019–, Luke D Gibson, The University of Washington
Department of Chemical Engineering.
Package: rxn-utils
RXN utilities packageThis repository contains general Python utilities commonly used in the RXN universe.
For utilities related to chemistry, see our other repositoryrxn-chemutils.Links:GitHub repositoryDocumentationPyPI packageSystem RequirementsThis package is supported on all operating systems.
It has been tested on the following systems:macOS: Big Sur (11.1)Linux: Ubuntu 18.04.4A Python version of 3.6 or greater is recommended.Installation guideThe package can be installed from Pypi:pipinstallrxn-utilsFor local development, the package can be installed with:pipinstall-e".[dev]"Package highlightsFile-related utilitiesload_list_from_file: read a files into a list of strings.iterate_lines_from_file: same asload_list_from_file, but produces an iterator instead of a list. This can be much more memory-efficient.dump_list_to_fileandappend_to_file: Write an iterable of strings to a file (one per line).named_temporary_pathandnamed_temporary_directory: provide a context with a file or directory that will be deleted when the context closes. Useful for unit tests.>>>withnamed_temporary_path()astemporary_path:...# do something on the temporary path....# The file or directory at that path will be deleted at the...# end of the context, except if delete=False.... and others.CSV-related functionalityThe functioniterate_csv_columnand the related executablerxn-extract-csv-columnprovide an easy way to extract one single column from a CSV file.TheStreamingCsvEditorallows for doing a series of operations onto a CSV file without loading it fully in the memory.
This is for instance used inrxn-reaction-preprocessing.
See a few examples in theunit tests.Stable shufflingFor reproducible shuffling, or for shuffling two files of identical length so that the same permutation is obtained, one can use thestable_shufflefunction.
The executablerxn-stable-shuffleis also provided for this purpose.Both also work with CSV files if the appropriate flag is provided.chunkerandremove_duplicatesFor batching an iterable into lists of a specified size,chunkercomes in handy.
It also does so in a memory-efficient way.>>>fromrxn.utilities.containersimportchunker>>>forchunkinchunker(range(1,10),chunk_size=4):...print(chunk)[1, 2, 3, 4][5, 6, 7, 8][9]remove_duplicates(oriterate_unique_values, its memory-efficient variant) removes duplicates from a container, possibly based on a callable instead of the values:>>>fromrxn.utilities.containersimportremove_duplicates>>>remove_duplicates([3,6,9,2,3,1,9])[3, 6, 9, 2, 1]>>>remove_duplicates(["ab","cd","efg","hijk","","lmn"],key=lambdax:len(x))['ab', 'efg', 'hijk', '']Regex utilitiesregex.pyprovides a few functions that make it easier to build regex strings (considering whether segments should be optional, capturing, etc.).OthersA custom, more general enum class,RxnEnum.remove_prefix,remove_postfix.Initialization of loggers, in alogging-compatible way:logging.py.sandboxed_random_contextandtemporary_random_seed, to create a context with a specific random state that will not have side effects.
Especially useful for testing purposes (unit tests).... and others.
Package: rxpipe
RemotelibVarious wrappers for subprocess, ssh, fabric.REX: Remote execute:REX(
target,
user = None,
pass_ = None,
port = None,
audit_file = None,
silent = True
)REX.rex("cmd", audit=True, bg=False, logfilename="deploy1.log")Remotely execute the command specified by cmd. If bg=True, runs with nohup
and returns immediately. If audit = True, writes the stdout of the command
to the specified logfilename on the remote server.REX.rex_push(local_path, remote_path): scp from the user over the active REX connectionREX.rex_pull(remote_path, local_path): scp a file towards the user over an active REX connectionSSHTunnel(object)importimportssh_tunneltun=ssh_tunnel.SSHTunnel(<remote-site>[local_port(4444),remote_port(3306),remoteinterface("localhost"),remote_user=<current_user>,spin=(True,False),foreground=(True,False),immediate=(True,False))RemoteDB(SSHTunnel):-- Execute MySQL queries over a forwarded SSH connectionremote_db = ssh_tunnel.RemoteDB(
    db_hostname, db_user=<current_user>, db_pass=<None>, db_port=4444, database=<None>, **SSHTunnel(*, **)
    )Tunnels(object):-- Registry for SSH Tunnels; also allows iteration (for example, to kill the connection.) Allows iteration.
-- To register a tunnel, use the register()
Package: rxray
RxPy operator to distribute a computation withrayGet StartedThe distribute operator can be used directly in an existing pipeline to
parallelize computations:data=range(200)ray.init()rx.from_(data).pipe(rxray.distribute(lambda:rx.pipe(ops.map(lambdai:i*2)),),).subscribe()When the distributed computation is stateful, items can be pinned to an actor
with a key-based selector:data=[(i,j)foriinrange(17)forjinrange(100)]random.shuffle(data)ray.init()rx.from_(data).pipe(rxray.distribute(lambda:rx.pipe(ops.group_by(lambdai:i[0]),ops.flat_map(lambdag:g.pipe(ops.map(lambdai:i[1]),ops.average(),ops.map(lambdai:(g.key,i)),))),actor_selector=rxray.partition_by_key(lambdai:i[0]),),).subscribe()InstallationRxRay is available on PyPi and can be installed with pip:python3 -m pip install rxray
Package: rxsci
ReactiveX operators for data science and machine learning.RxSci is a set of RxPY operators and observable factories dedicated to data
science. Being reactive, RxSci is especially suited to work on streaming data
and time series.However it can also be used on traditional datasets. Such datasets are processed
as bounded streams by RxSci. So it is possible to use RxSci for both streaming
data and file based datasets. This is especially useful when a
machine learning model is trained with a dataset and deployed on streaming data.Get StartedThis example computes a rolling mean on a window and stride of three elements:importrximportrxsciasrssource=[1,2,3,4,5,6,7]rx.from_(source).pipe(rs.state.with_memory_store([rs.data.roll(window=3,stride=3,pipeline=[rs.math.mean(reduce=True),]),]),).subscribe(on_next=print)2.0
5.0See theMaki Nage documentationfor more information.InstallationRxSci is available on PyPi and can be installed with pip:python3 -m pip install rxsci
Package: rxsci-river
RxSci operators for Scikit River.Get StartedEvaluate and train a Hoeffding Tree Classifier from a stream of events:importrximportrxsci_riverasrsrfromriverimportsynthfromriver.treeimportHoeffdingTreeClassifiergen=synth.Agrawal(classification_function=0,seed=42)rx.from_(gen.take(1000)).pipe(rsr.evaluate.prequential(model=HoeffdingTreeClassifier(grace_period=100,split_confidence=1e-5,nominal_attributes=['elevel','car','zipcode'],),pretrain_size=100),).subscribe(on_next=print,)See theMaki Nage documentationfor more information.InstallationRxSci River is available on PyPi and can be installed with pip:python3 -m pip install rxsci-river
Package: rxt-backend-base
# RxTender Base backendThis is the base backend of [RxTender](http://rxtender.org). It contains
implementations of common programming languages for various serialization and
framing protocols.The current implementation supports:python3:serialization:jsonstream: sourceframing:json-lineses2015:serialization:jsonstream: sinkframing:json-lines## Running tests### es2015cd test/es2015
npm run test
Package: rxtender
# RxTenderRxTender is framework to implement code generators of remote reactive streams.
With RxTender, inter-process and inter-machine communication with reactive
streams is very easy.See the [documentation](http://rxtender.org/doc/latest/index.html) for more
information.Try the [getting
started](http://rxtender.org/doc/latest/get_started/index.html) tutorial to see
how to use it.
Package: rxwidgets
GeneralThis package adds functionality useful for makingReactiveXpoweredipywidgets.Note that this package is in its Beta stage and may change interfaces slightly before a 1.0 release.InstallationRunpoetry add rxwidgetsUsageimportrxwidgets.ipythonasrxi@rxi.interact_manualdefb(a=(1,5)):returna*5@rxi.interactdefc(b=b,c=(10,20)):c=b+cprint(f"C:{c}")Corresponds roughly to native ipywidgets:fromipywidgetsimportinteract,interact_manual@interact_manualdefb(a=(1,5)):b=a*5@interactdefc(c=(10,20)):c=b+cprint(f"C:{c}")An incomprehensive feature list is provided in theexamplesfolder.StreamsA function stream consists of these steps:@rxi.stream_defaultsConvert parameter defaults into observables - may display ipywidgets.Convert function into a stream of its results from input streams.In stream: Curry the function and make wrap into aValueBox.Object in stream:ValueBox(partial(fn, ...))@rxi.defer,@rxi.pre_load, ...If desired, apply operators to the call-ready function@rxi.applyCreate and display anrxi.Screen.In stream: Run the function inside the screen and return results as aValueBox.Object in stream:ValueBox(fn(...))@rxi.AutomapIf desired, pack the final stream into anAutomapobject. This object maps all operators to operators applied inside the stream.
Package: ryaml
ryamlQuickly and safely parse yamlWhat is ryaml?ryaml is a Python library that wraps a Rust yaml parser,serde-yaml, to quickly and safely parse and dump yaml to and from Python objects.It isnotcompatible with PyYAML, but has a similar design to thejsonmodule.The hope is this will be used as a safe and fast yaml parser in lieu of PyYAML.InstallationWe ship binary wheels for Windows, Linux, and macOS, so as long as you are using Python 3.7+,
you can run:$ python -m pip install ryamlOtherwise, you will need to build from source. To do so, first install Rust 1.41 stable.Then you should be able to just$gitclonehttps://github.com/ethanhs/ryaml
$cdryaml
$python-mpipinstall.Or if you want to build a wheel:$gitclonehttps://github.com/ethanhs/ryaml
$cdryaml
$python-mpipinstallmaturin
$maturinbuild--release--no-sdist# OR if you want an abi3 wheel (compatible with Python 3.7+)$maturinbuild--release--no-sdist--cargo-extra-args="--features=abi3"And a wheel will be created intarget/wheelswhich you can install.UsageThe API ofryamlis very similar to that ofjsonin the standard library:You can useryaml.loadsto read from astr:importryamlobj=ryaml.loads('key: [10, "hi"]')assertisinstance(obj,dict)# Trueassertobj['key'][1]=="hi"# TrueAndryaml.dumpsto dump an object into a yaml file:importryamls=ryaml.dumps({'key':None})print(s)# prints:# ---# key: ~There are alsoryaml.loadandryaml.load_allto read yaml document(s) from files:importryamlobj={'a':[{'b':1}]}withopen('test.yaml','w')asw:ryaml.dump(w,obj)withopen('test.yaml','r')asr:assertryaml.load(r)==objwithopen('multidoc.yaml','w')asmulti:multi.write('''---a:key:...---b:key:''')withopen('multidoc.yaml','r')asmulti:docs=ryaml.load_all(multi)assertlen(docs)==2assertdocs[0]['a']['key']isNoneryaml.load_allwill, as seen above, load multiple documents from a single file.ThanksThis project is standing on the shoulders of giants, and would not be possible without:pyo3serde-yamlyaml-rustpyo3-filepythonize