Saravanan666/pypi-org huggingface dataset:
Package: rustplus
Installation:Install the package with:pip install rustplusWhat can you do?Get the MapGet Team InfoGet Team ChatGet Server InfoSend Team MessagesGetting the timeUsing Smart DevicesCamera HandlingFor information on all the above methods, see theWikiSupport:If you need help, or you think that there is a problem feel free to open an issue. If you think you have made some improvements, open a PR!Feel free to chuck some support to Liam atRustPlus.jsas he was the first to really crack this APIYou can also join me on my discord server:GitHub ⭐'s are always welcome :)Have Fun!Special Thanks:Thanks toJetBrainsfor providing me with a free Open Source License for
PyCharm Professional, which is what I use to develop this project.
Package: rustPlusPushReceiver
subscribe to GCM/FCM and receive notificationspython implementation ofhttps://github.com/MatthieuLemoine/push-receivertested on python 2.7.16, 3.4.10 and 3.7.5I put this together in a day or so, it’s still rough around the edges,
especially the listen part, which I don’t really use myself and have just
implemented for fun and only briefly testednote that for the listening part I had to pull in http-ece which depends
on a full blown native crypto library rather than just oscrypto. it is
an optional dependency so you’ll have to install it explicitly by depending
on push_receiver[listen]usagepipinstallpush_receiver[listen,example]basic usage example that stores and loads credentials and persistent ids
and prints new notificationsyou can also run this example with this command (change the sender id)python-m"push_receiver"--sender-id=722915550290--app-id1:722915550290:web:8c409a0923422212c7530frompush_receiverimportPushReceiver,registerimportjsondefon_notification(obj,notification,data_message):idstr=data_message.persistent_id+"\n"# check if we already received the notificationwithopen("persistent_ids.txt","r")asf:ifidstrinf:return# new notification, store id so we don't read it againwithopen("persistent_ids.txt","a")asf:f.write(idstr)# print notificationn=notification["notification"]text=n["title"]ifn["body"]:text+=": "+n["body"]print(text)if__name__=="__main__":SENDER_ID=722915550290# change this to your sender idAPP_ID="my:app:id"# change this to your app idtry:# already registered, load previous credentialswithopen("credentials.json","r")asf:credentials=json.load(f)exceptFileNotFoundError:# first time, register and store credentialscredentials=register(sender_id=SENDER_ID,app_id=APP_ID)withopen("credentials.json","w")asf:json.dump(credentials,f)print("send notifications to{}".format(credentials["fcm"]["token"]))withopen("persistent_ids.txt","a+")asf:received_persistent_ids=[x.strip()forxinf]receiver=PushReceiver(credentials,received_persistent_ids)receiver.listen(on_notification)
Package: rustproj
RustProjSimple rust project generator.Steps to runCreate a new projectuser@programmer~:$rustproj--proj<proj-name>Create a new libraryuser@programmer~:$rustproj--proj<proj-name>--libCreate a project with both main and libuser@programmer~:$rustproj--proj<proj-name>--bothForce creation (used when project already exists)user@programmer~:$rustproj--proj<proj-name>[--lib|--both]Check versionuser@programmer~:$rustproj--versionLicenseLicensed underMITlicense.
Package: rustpy
rustpyIn what followspythonis an alias forpython3.7orpypy3.7or any later version (python3.8,pypy3.8and so on).InstallationInstall the latestpip&setuptoolspackages versionspython-mpipinstall--upgradepipsetuptoolsUserDownload and install the latest stable version fromPyPIrepositorypython-mpipinstall--upgraderustpyDeveloperDownload the latest version fromGitHubrepositorygitclonehttps://github.com/lycantropos/rustpy.gitcdrustpyInstallpythonsetup.pyinstallDevelopmentBumping versionPreparationInstallbump2version.Pre-releaseChoose which version number category to bump followingsemver
specification.Test bumping versionbump2version--dry-run--verbose$CATEGORYwhere$CATEGORYis the target version number category name, possible
values arepatch/minor/major.Bump versionbump2version--verbose$CATEGORYThis will set version tomajor.minor.patch-alpha.ReleaseTest bumping versionbump2version--dry-run--verbosereleaseBump versionbump2version--verbosereleaseThis will set version tomajor.minor.patch.Running testsInstall dependenciespython-mpipinstall-rrequirements-tests.txtPlainpytestInsideDockercontainer:withCPythondocker-compose--filedocker-compose.cpython.ymlupwithPyPydocker-compose--filedocker-compose.pypy.ymlupBashscript:withCPython./run-tests.shor./run-tests.shcpythonwithPyPy./run-tests.shpypyPowerShellscript:withCPython.\run-tests.ps1or.\run-tests.ps1cpythonwithPyPy.\run-tests.ps1pypy
Package: rust-pypi-example
rust_pypi_examplePython Boilerplate contains all the boilerplate you need to create a Python wheel with Rust.Free software: Apache Software License 2.0Documentation:https://rust-pypi-example.readthedocs.io.FeaturesTODOCreditsThis package was created withCookiecutterand themckaymatt/cookiecutter-pypackage-rust-cross-platform-publishproject template.History0.8.7 (2017-07-15)First release on PyPI.
Package: rustpyppr
Personalized PageRank in Rust for PythonThis small library provides efficient functions for Python to computePersonalized PageRankscores in a graph. Personalized PageRank is similar to ordinaryPageRankbut the node where the random surfer will start from (after a teleportation or in the beginning)
is not sampled uniformly from all the nodes, but rather from a smaller subset of them. This subset,
which is called Personalized Set, must contain at least 1 node.The implemented algorithms so far are various versions of Forward Push for single source.
This means that given a source node, it is possible to compute the PPR scores of other ones w.r.t. the source node.Getting StartedAt the moment, we did not publish the wheel on pypi yet.
After cloning this repository, you can manually build the wheel and install it.pip install maturin
maturin build --release
pip install target/wheels/rustpyppr-[ wheel version and parameters here ]After the installation, you can simply import it from python and use it.importrustpypprgraph={3:[5,1],1:[3],5:[3]}source=3ppr=rustpyppr.forward_push(graph,source)print(f'{ppr= }')# ppr = {1: 0.22936248564736167, 3: 0.5412750287052767, 5: 0.22936248564736167}# you can also run PPR on multiple sources in the same graph in parallel with native multithreadingsources=[3,1]ppr=rustpyppr.multiple_forward_push(graph,sources)print(f'{ppr= }')# ppr = {1: {1: 0.34579401171205487, 5: 0.19511406668236952, 3: 0.45909192160557544}, 3: {3: 0.5412750287052767, 5: 0.22936248564736167, 1: 0.22936248564736167}}# and finally, you can run PPR on different graphs with different sources (also using multithreading)graphs=[{2:[0],0:[2]},{3:[5,1],1:[3],5:[3]}]sources=[2,5]ppr=rustpyppr.parallel_forward_push(graphs,sources)print(f'{ppr= }')# ppr = {5: {3: 0.45909192160557544, 1: 0.19511406668236952, 5: 0.34579401171205487}, 2: {0: 0.4587249712947233, 2: 0.5412750287052767}}
Package: rust-python-jaeger-reporter
Rust Jaeger Python ClientA faster reporter for the pythonjaeger-clientthat reports spans in a native background thread.This is relatively untested, so use at your own risk! (You may want to manually wrap this class in python so that calls toreport_spancannot fail).Usage:fromjaeger_clientimportConfigimportopentracingfromrust_python_jaeger_reporterimportReporter# The standard config for jaeger. No need to change anything here.config=Config(config={'sampler':{'type':'const','param':1,},},service_name='your-app-name',)# Create the rust reporter.reporter=Reporter(config={"agent_host_name":"127.0.0.1","agent_port":6831})# Create the tracer and install it as the global tracer.## *Note*: This invocation doesn't support throttling or the remote sampler.tracer=config.create_tracer(reporter,config.sampler)opentracing.set_global_tracer(tracer)BuildingRequires a nightly rust compiler, due to using the PyO3 library.Maturincan be used to develop, test and
publish the library.Publishing to PyPIAs per thematurin docswe use a docker image to build the binary wheels for the various python versions:docker run -it --rm -v $(pwd):/io konstin2/maturin publish -f
Package: rustpy-tools
rustpy-toolsA useful tool Python module implement in rust-lang.Installationpipinstallrustpy-toolsQuick Startimportrustpy_toolsfromrustpy_toolsimportRegexUtil,AESrustpy_tools.version# 0.2.1RegexUtil.is_match(r'^\w+@\w+$','xxx@gamil.com')# Truemessage='hello, world'key='yrbv8qlrGJsfo28C'iv='TcwqrwsShZ2FfUSi'rustpy_tools.AES.encrypt(message,key,iv)# GSk0f16bYJm+SUbd49PBkw==rustpy_tools.AES.decrypt('GSk0f16bYJm+SUbd49PBkw==',key,iv)# 'hello, world'CreditPyO3Licenserustpy-tools is licensed under the BSD 2-Clause license.
Package: rust-py-tools-d
Python tools compiled by rustpip install tust-py-tools-dstringdef edit_distance(word1:str,word2:str)->int计算word1到word2的编辑距离$m=word1.length, n=word2.length$时间复杂度: $O(m*n)$空间复杂度: $O(m*n)$def string_similarity(word1:str,word2:str)->float:计算字符串相似度
$1-range/max(word1.length,word2.length)$$m=word1.length, n=word2.length$时间复杂度: $O(m*n)$空间复杂度: $O(m*n)$class MetchResultAttributes:first(str): 字符1second(str): 字符2ratio:float: 相似度def fuzzy_match(first_workds:List[str],second_words:List[str],cutoff:float)->List[MetchResult]:批量匹配两个列表的内字符的相似度此方法会将将两个数组做一次笛卡尔乘积运算时间复杂度:m=first_workds.length,n=second_words.length.$O(mn(a+b))$.a,b为列表包含字符串的平均长度空间复杂度: $O(m*n)$def num_distinct(source:str,target:str)->int:计算在source序列中,子序列target出现的次数时间复杂度: $O(m*n)$m为source的长度,n为target的长度空间复杂度: $O(m)$ 我们需要两个长度为m的数组来记录状态值
Package: rustrees
Rustrees: Decision Trees & Random Forests in Rust with Python BindingsOverviewRustrees is an efficient decision tree and random forest library written in Rust with Python bindings. It aims to provide speed comparable to Sklearn with the reliability and performance of Rust.Features🏎️Speed: As fast as Sklearn on average.🔗Python Bindings: Effortless integration with Python.🔒Type Safety: Benefit from Rust's strong type system.PythonInstallationpipinstallrustreesQuick Startfromsklearn.metricsimportaccuracy_scorefromsklearnimportdatasetsimportrustrees.decision_treeasrt_dtdf=datasets.load_breast_cancer()model=rt_dt.DecisionTreeClassifier(max_depth=5).fit(df["data"],df["target"])acc=accuracy_score(df["target"],model.predict(df["data"]))print("accuracy",acc)RustInstallationcargoaddrustreesQuick Startuserustrees::{DecisionTree,Dataset,r2};letdataset=Dataset::read_csv("iris.csv",",");letdt=DecisionTree::train_reg(&dataset,5,// max_depthSome(1),// min_samples_leafSome(42),// random_state);letpred=dt.predict(&dataset);println!("r2 score: {}",r2(&dataset.target_vector,&pred));DevelopingFirst, create a virtualenv (this just needs to be done once):python-mvenv.envThen, activate the virtualenv (needs to be done every time):source.env/bin/activateNow, install the requirements (just needs to be done once):pipinstall-rrequirements.txtFinally, install the Python library at the local virtual environment with the following command (needs to be done every time you change the Rust code):maturindevelop--releaseNow, you can import the libraryrustreesin Python. This can be done also from Jupyter notebooks. To do so, run the following command:jupyternotebookAnd then import the library in the notebook:importrustrees.decision_treeasrt_dt
Package: rustsat
rustsat - A Comprehensive SAT Library for Rustrustsatis a collection of interfaces and utilities for working with the boolean satisfiability problem in Rust.
This library aims to provide implementations of elements commonly used in the development of software in the area of satisfiability solving.
The focus of the library is to provide as much ease of use without giving up on performance.Exampleletmutinstance:SatInstance=SatInstance::new();letl1=instance.new_lit();letl2=instance.new_lit();instance.add_binary(l1,l2);instance.add_binary(!l1,l2);instance.add_unit(l1);letmutsolver=rustsat_minisat::core::Minisat::default();solver.add_cnf(instance.as_cnf().0).unwrap();letres=solver.solve().unwrap();assert_eq!(res,SolverResult::Sat);letsol=solver.full_solution().unwrap();assert_eq!(sol[l1.var()],TernaryVal::True);assert_eq!(sol[l2.var()],TernaryVal::True);CratesThe RustSAT project is split up into multiple crates that are all contained inthis repository.
These are the crates the project consists of:CrateDescriptionrustsatThe main library, containing basic types, traits, encodings, parsers, and more.rustsat-toolsA collection of small helpful tools based on RustSAT that can be installed as binaries. For a list of available tools, seethis directorywith short descriptions of the tools in the headers of the files.rustsat-<satsolver>Interfaces to SAT solvers that can be used alongsiderustsat. Currently interfaces are available forcadical,kissat,glucose, andminisat.InstallationTo use the RustSAT library as a dependency in your project, simply runcargo add rustsat.
To use an SAT solver interface in your project, runcargo add rustsat-<satsolver>.
Typically, the version of the SAT solver can be selected via crate features, refer to the documentation of the respective SAT solver crate for details.To install the binary tools inrustsat-toolsruncargo install rustsat-tools.FeaturesFeature nameDescriptioninternalsMake some internal data structures for e.g. encodings public. This is useful when basing a more complex encoding on therustsatimplementation of another encoding. Note that the internal API might change between releases.fxhashUse the faster firefox hash function fromrustc-hashinrustsat.ipasirInclude and link the IPASIR solver interface.optimizationInclude optimization (MaxSAT) data structures etc.multioptInclude data structures etc. for multi-objective optimization.compressionEnable parsing and writing compressed input.benchEnable benchmark tests. Behind feature flag since it requires unstable Rust.randEnable randomization features. (Shuffling clauses etc.)ExamplesFor example usage refer to the small example tools in therustsat-toolscrateattools/src/bin. For a bigger
example you can look at thismulti-objective optimization
solver.For an example of how to use the C-API, seerustsat/examples/capi*.cpp.
Similarly, for an example of using the Python API, seerustsat/examples/pyapi*.py.
Package: rust_sbml
rust_sbmlParser for theSystems Biology Markup Language (SBML):Standalone Rust libraryPython APIGetting startedRustAdd it to your Cargo.toml with no default features to avoid allPyO3nuisances.[dependencies.rust_sbml]version="0.7.0"default_features=falseFor example,userust_sbml::Model;letexample=r#"<?xml version="1.0" encoding="UTF-8"?><sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" level="3" version="2"><model timeUnits="second" extentUnits="mole" substanceUnits="mole"></model></sbml>"#;letresult=Model::parse(example);println!("{:?}",result.unwrap());Seewrite_to_file.rsfor an example on serializing to a file.PythonIt has only been tested on Linux.Using pippipinstallrust_sbmlFrom sourceClone the repository.gitclonehttps://github.com/carrascomj/rust_sbml.gitYou needmaturinfor building it.python-mpipinstallmaturinBuild locallymaturinbuild--release
pipinstall.Build on virtualenv (no pip install required)# --release can be omitted to speed up compilation timematurindevelop--releaseHaving it installed, you can use it as a normal Python package.fromrust_sbmlimportModelsbml=Model("examples/EcoliCore.xml")reaction=sbml.getListOfReactions()[0]print(reaction.getListOfReactants())MilestonesgetListOfSpecies()(id, name)getListOfCompartments()(id, name)getListOfReactions()(id, name).getListOfReactants()(id, name).getListOfProducts()(id, name)Capable of retrieving FBC bounds.Published to pypiKinetic Laws, with naive mathml tailored for SBML.Metadata, with naive rdf tailored for SBML.Test suite with python calls.Test suite with libsbml comparison trough cobrapy.LicenseLicensed under either ofApache License, Version 2.0, (LICENSE-APACHEorhttp://www.apache.org/licenses/LICENSE-2.0)MIT license (LICENSE-MITorhttp://opensource.org/licenses/MIT)at your option.ContributionUnless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
additional terms or conditions.README.md is automatically generated on CI usingcargo-readme. Please, modify README.tpl or lib.rs instead (checkthe github worflowfor more details).
Package: rustshed
rustshedA collection of Rust types in Python with complete type annotations.Supported TypesOptionResultInstallpipinstallrustshedExamplesOptionTheOptiontype represents an optional value: everyOption[T]is eitherSome[T]and contains a value of typeT, orNull(Nonein Rust), and does not.fromtypingimportSupportsIndex,TypeVarfromrustshedimportNull,Option,SomeT=TypeVar("T")classSafeList(list[T]):defget(self,index:SupportsIndex)->Option[T]:try:returnSome(self[index])exceptIndexError:returnNulla_list=SafeList([2,1,3,7])print(a_list.get(1))# Some(value=1)print(a_list.get(420))# NullResultTheResultis the type used for returning and propagating errors: everyResult[T, E]is eitherOk[T], representing success and containing a value of typeT, orErr[E], representing failure and containing an error of typeE.fromrustshedimportto_result,Result@to_result[ValueError]defparse(x:str)->int:returnint(x)defmultiply(a:str,b:str)->Result[int,str]:# try to parse two strings and multiply them# map a possible error to strreturnparse(a).and_then(lambdan:parse(b).map(lambdam:n*m)).map_err(str)print(multiply("21","2"))# Ok(value=42)print(multiply("2!","2"))# Err(error="invalid literal for int() with base 10: '2!'")Rust's question mark (?) operatorThe question mark (?) operator in Rust hides some of the boilerplate of propagating errors up the call stack. Implementing this operator in Python would require changes to the language grammar, hence inrustshedit had to be implemented differently.Q propertyThe question mark's functionality has been implemented via theQproperty (for bothOptionandResulttypes) combined with therustshed.result_shortcutorrustshed.option_shortcutdecorator.fromrustshedimportOk,Result,to_result,result_shortcut@to_result[ValueError]defparse(x:str)->int:returnint(x)# explicit early error return with match statementsdeftry_to_parse_early_return(a:str,b:str)->Result[int,ValueError]:matchparse(a):caseOk(value):x=valuecaseerr:returnerrmatchparse(b):caseOk(value):y=valuecaseerr:returnerrreturnOk(x+y)# early error return using the Q property@result_shortcutdeftry_to_parse(a:str,b:str)->Result[int,ValueError]:x=parse(a).Qy=parse(b).QreturnOk(x+y)
Package: rust-strings
rust-stringsrust-stringsis a Rust library for extracting strings from binary data.It also have Python bindings.InstallationPythonUse the package managerpipto installrust-strings.pipinstallrust-stringsRustrust-stringsis available oncrates.ioand can be included in your Cargo enabled project like this:[dependencies]rust-strings="0.6.0"UsagePythonimportrust_strings# Get all ascii strings from file with minimun length of stringrust_strings.strings(file_path="/bin/ls",min_length=3)# [('ELF', 1),#  ('/lib64/ld-linux-x86-64.so.2', 680),#  ('GNU', 720),#  ('.<O', 725),#  ('GNU', 756),# ...]# You can also set buffer size when reading from file (default is 1mb)rust_strings.strings(file_path="/bin/ls",min_length=5,buffer_size=1024)# You can set encoding if you need (default is 'ascii', options are 'utf-16le', 'utf-16be')rust_strings.strings(file_path=r"C:\Windows\notepad.exe",min_length=5,encodings=["utf-16le"])# You can set multiple encodingrust_strings.strings(file_path=r"C:\Windows\notepad.exe",min_length=5,encodings=["ascii","utf-16le"])# You can also pass bytes instead of file_pathrust_strings.strings(bytes=b"test\x00\x00",min_length=4,encodings=["ascii"])# [("test", 0)]# You can also dump to json filerust_strings.dump_strings("strings.json",bytes=b"test\x00\x00",min_length=4,encodings=["ascii"])# `strings.json` content:# [["test", 0]]RustFull documentation available indocs.rsuserust_strings::{FileConfig,BytesConfig,strings,dump_strings,Encoding};usestd::path::{Path,PathBuf};letconfig=FileConfig::new(Path::new("/bin/ls")).with_min_length(5);letextracted_strings=strings(&config);// Extract utf16le stringsletconfig=FileConfig::new(Path::new("C:\\Windows\\notepad.exe")).with_min_length(15).with_encoding(Encoding::UTF16LE);letextracted_strings=strings(&config);// Extract ascii and utf16le stringsletconfig=FileConfig::new(Path::new("C:\\Windows\\notepad.exe")).with_min_length(15).with_encoding(Encoding::ASCII).with_encoding(Encoding::UTF16LE);letextracted_strings=strings(&config);letconfig=BytesConfig::new(b"test\x00".to_vec());letextracted_strings=strings(&config);assert_eq!(vec![(String::from("test"),0)],extracted_strings.unwrap());// Dump strings into `strings.json` file.letconfig=BytesConfig::new(b"test\x00".to_vec());dump_strings(&config,PathBuf::from("strings.json"));ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.LicenseMIT
Package: rust-x3dh
Rust-X3DHEmbeded thexxxdh, which iplementation of the Extended Triple Diffie-Hellman key exchange protocol written in Rust, on Python.xxxdhis written byOlexander Yermakov.Implementation is close to theSignal Spec, but Ristretto point Curve25519 used as acurvefor the default implementation. Though underlying algorithms could be changed fairly easily.Usage//!Basicexample.fromrust_x3dhimportx3dh_seru1_shared_secret_key,u2_shared_secret_key=x3dh_ser.gen_3xdh_secrets_key_pairs()print(f"[u1_shared_secret_key]:{u1_shared_secret_key}")print(f"[u2_shared_secret_key]:{u2_shared_secret_key}")
Package: rustxes
rustxesA Python package to efficiently import XES event logs using Rust.It supports parsing data both from.xesXML files and.xes.gzarchives (and also from strings directly if needed).OptionsThe following parameters can be passed to theimport_xes_rsor the python wrapper:path- The filepath of the .xes or .xes.gz file to importdate_format- Optional date format to use for parsing<date>tags (Seehttps://docs.rs/chrono/latest/chrono/format/strftime/index.html)print_debug- Optional flag to enable debug print outputsDevelopmentThis package was scaffolded usingmaturin.
The most important commands are:maturin build --releaseBuilds the Rust code and python package (in release mode), producing the build artificats (wheels)maturin develop --releaseBuilds the Rust code and python package (in release mode) and automatically installs/updates it in the corresponding (virtual) python envBuilding this package requiresRust, which can be installed using Rustup (seehttps://www.rust-lang.org/learn/get-started).
The Rust part on its own can be build usingcargo build --release.LICENSEThis package is licensed under either Apache License Version 2.0 or MIT License at your option.