Saravanan666/pypi-org huggingface dataset:
Package: readPos
readPos Package usagereadPos is a package built to work with data files by positions.
So we gonna need some text plain data file and some definition files (csv) to read that data.With some methods we can directly work with dataframe objetc (pandas) and a
definition file to construct the dat file output.IMPORT PACKAGE IN OUT SCRIPTSThe statement to import some objects and methos from readPos Package is like this:fromreadPos.readPosimport{{METHOD}}Where {{METHOD}} we must indicate which object we gonna import. The most used is:fromreadPos.readPosimportReadPosReadPos class need two params to create an instance:file_name= this param will be a string containing the absolute or relative path to data file we wanna work with (if we gonna write some dat file, this gonna be the output name)csv_file= this param will be a string containing the absolute or relative path to csv file that contains the definition for each variable we wanna work with. This file must contain 3 fields at least (order not matter but exact column name does):variable: string field that have a value (without spaces and non number starting) used to set column names in read method or to match dataframe columns in write method.initial: integer field. Initial position (not index) where data will be read from input file or where will be writted in output file.end: integer field. Final position (not index) where data will be read from input file or where will be writted in output file.Other self information columns (descriptions, length) can be added to csv file, them not gonna do a crash error but can overcharge process time.
Initial position of the variables could not be in ascending order. The read/write method will order it internally.HOW TO READ DAT FILES INTO STRUCTURED DATA FRAMEfromreadPos.readPosimportReadPosreadpos_instance=ReadPos(file_name='C:/Users/MyUser/dummy.dat',csv_file='definition.csv')dataframe=readpos_instance.read()# dataframe objetct will be a pandas core dataframe with as many columns as rows you have in your csv file and as many rows as lines you have in yourOptional "encoding" param with string like 'latin-1' is allowed. Default value = 'UTF-8'HOW TO ERITE DAT FILES FROM STRUCTURED DATA FRAMEfromreadPos.readPosimportReadPosreadpos_instance=ReadPos(file_name='C:/Users/MyUser/dummy.dat',csv_file='definition.csv')readpos_instance.write(df)# df is a dataframe object with at least all de columns that we have defined in csv file. df can contain more columns than csv, so these columns will be not written in output dat file.*Optional"encoding"paramwithstringlike'latin-1'isallowed.Defaultvalue='UTF-8'*
Package: read-protobuf
read-protobufSmall library to read serialized protobuf(s) directly into Pandas DataFrame.This is intended to be a simple shortcut for translating serialized
protobuf bytes / files directly to a dataframe.InstallAvailable via pip:$pipinstallread-protobufUsageRun thedemo-notebookfor an interactive demo.importdemo_pb2# compiled protobuf message modulefromread_protobufimportread_protobufMessageType=demo_pb2.MessageType()# instantiate a new message typedf=read_protobuf(b'\x00\x00',MessageType)# create a dataframe from serialized protobuf bytesdf=read_protobuf([b'\x00\x00',b'x00\x00']MessageType)# read multiple protobuf bytesdf=read_protobuf('demo.pb',MessageType)# use file instead of bytesdf=read_protobuf(['demo.pb','demo2.pb'],MessageType)# read multiple files# optionsdf=read_protobuf('demo.pb',MessageType,flatten=False)# don't flatten pb messagesdf=read_protobuf('demo.pb',MessageType,prefix_nested=True)# prefix nested messages with parent keys (like pandas.io.json.json_normalize)To compile a protobuf Message class from python, use:$protoc--python_out="."demo.protoAlternativesprotobuf-to-dicthttps://github.com/benhodgson/protobuf-to-dictThis library was developed earlier to convert protobufs to JSON via a dict.MessageToDict, MessageToJsonThe google protobuf library comes with utilities to convert messages to adictor JSON,
then loaded by Pandas.fromgoogle.protobuf.json_formatimportMessageToJsonfromgoogle.protobuf.json_formatimportMessageToDictIn brief tests, theread_protobufpackage is about 2x as fast
as usingMessageToDictand 3x as fast asMessageToJson.DevelopTo install a development version of the package, run from the root directory:$pipinstall-e.To install development dependencies, use the optional[dev]dependencies:$pipinstall-e".[dev]"FormatUsesblackandisortto format files.$makeblack
$makeisortLintUsesruffto lint application.$makeruffTestUsespytestto run unit tests. From the root of the repository, run:$makepytest# specify test$pytest-k"TestRead::test_read_bytes"Code CoverageUsecoverageto monitor code coverage during tests.
To record coverage while running tests, run:$makepytest-covLicenseMIT License
Package: readpw
# PasswordsI have been working with password leaks for a while, and dealing with them isnot always fun due to multiple reasons. They are often large, takes a lot of timeto load in memory, and have mix of strings in different format, such as `UTF-8`,`UTF-16`, `ASCII`.  These make the files very annoying to process. The result is amess of error handling and memory management, instead of quickly compute thestatistics we want to compute.I have to do it for living (at least for now), and so I decided to create thislittle module to efficiently store and process the password leak files. Thislibrary expects a clean password file, and it will not clean it for you.  Itjust makes life easy afterwards to process this file for other purposes.  Notsure how generic is the purpose, as I am the only one who is using it right now.All feedbacks are very welcome.Cleaned password-leak files can be downloaded from https://wiki.skullsecurity.org/Passwords.## How to install?Dependencies:* `numpy`* `marisa_trie`Download the `readpw.py` file into your main code and it should work. Or, install via pip,`pip install readpw`## How to use?```ipythonIn [1]: from readpw import PasswordsIn [2]: ry = Passwords('/home/rahul/passwords/rockyou-withcount.txt.bz2')In [3]: for id_, pw, f in ry.iterpws(10):...:     print id_, pw, f...:3121838 123456 290729.0919221 12345 79076.012769146 123456789 76789.011327966 password 59462.011789229 iloveyou 49952.011389450 princess 33291.06851250 1234567 21725.08034161 rockyou 20901.010680580 12345678 20553.02902439 abc123 16648.0In [5]: ry.sumvalues(10) # sums the frequency of most frequent 10 passwords.Out[5]: 669126.0In [6]: list(ry.sample_pws(10))Out[6]:[u'lilmarvin09',u'evan*love',u'mylove',u'mmmsss',u'whudafxup?',u'123456',u'123456',u'beautiful',u'james123',u'foodie123']```
Package: readpy-P-Y-R-O-B-O-T
READPYPROJECT LINK GITHUBPROJECT LINK PYPIA mini redis server written in python using CYPHER-PROTOCOLFor many purposes, 4GB 8GB RAM is not enough, we need services like REDIS, or what we RAM/MEMORY servers, this project makes using that task very easy.COMPATIBLITYREADPY works with Linux, OS-X, and Windows (OS INDEPENDENT).Supported on python 3.10 and aboveINSTALLATIONInstall it using pip.GotoPYPIUSAGECONFIGURATIONFor configuration of server and client need a configuration file named readpy_conf.jsonCONFIG PARAMETERSRECV_BUFFER and TRANSMISSION_BUFFER are parameters both should have same corresponding value for both server and client configuration.ENCRYPTION_KEY and DECRYPTION_KEY are parameters which ensure encryption of data sent over connection, see CYPHER-PROTOCOL documentation for more information.TIMEOUT is the time after which a connection is closed or reset from client side or server side.READPY_NODE defines the interface address at which the server will be running (IP).READPY_PORT defines port number on which server runs.Example readpy_conf is given in CONF_FILES folder, consider that for more details.CLIENT USAGEPut the readpy_conf.json and TEST_SCRIPT/client.py in same folder and run in same directory space.Consider the following code :fromREADPY.CLIENT.clientimportREADPY_CLIENTif__name__=="__main__":# INITIALISING THE READPY_CLIENTCLIENT=READPY_CLIENT()# WRITING THE DATA {"VAR1": "Hello from VAR1"} ON LOCATION ["CONSTANTS"] IN SERVERprint(CLIENT.write(["CONSTANTS"],{"VAR1":"Hello from VAR1"}))# WRITING THE DATA {"PI": 3.14} ON LOCATION ["CONSTANTS", "MATH"] IN SERVERprint(CLIENT.write(["CONSTANTS","MATH"],{"PI":3.14}))# UPDATING THE DATA {"PI": 3.14} TO {"PI": 3.1428} ON LOCATION ["CONSTANTS", "MATH"]print(CLIENT.write(["CONSTANTS","MATH"],{"PI":3.14}))# READING FROM THE LOCATION ["CONSTANTS"] FROM THE SERVERprint(CLIENT.read(["CONSTANTS"]))# READING FROM THE LOCATION ["CONSTANTS", "MATH"] FROM THE SERVERprint(CLIENT.read(["CONSTANTS","MATH"]))SERVER USAGEPut the readpy_conf.json and TEST_SCRIPT/server.py in same folder and run in same directory space.Consider the following code :fromREADPY.SERVER.serverimportREADPY_SERVERif__name__=="__main__":# INITIALISING THE READPY_SERVERSERVER=READPY_SERVER()# STARTING THE SERVERSERVER.start_node()input()# STOPPING THE SERVER AS SOON AS FILE INPUT FACES NEWLINE CHARACTERSERVER.stop_node()
Package: readQR
Read QR codeDescriptionThis is a simple python script that reads a QR code from an image and prints the result.
It uses the WeChat QR code reader API in openCV to read the QR code from a CV2 image.InstallationInstall using pip:pipinstallreadQRUsagefromreadQRimportReadQRimportreadQR.wechat_artefactsasartefactsimportcv2art_dir=artefacts.__path__[0]img=cv2.imread('test.png')reader=ReadQR(artefact_path=art_dir)show=None# Set to "single" or "continuous" to show the image with the QR code highlighted for single or continuous frames (video)result=reader.decode(img,show=show)[print(r)forrinresult]Sample input and output imagesInput imagesOutput imagesContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.LicenseNone
Package: readquant
## readquantThis package contains helper functions for parsing both expression valuesand technical features from common RNA-seq quantification tools.The goal is to simplify going from a collection of quantification results toexpression table, as well as sample meta data.A minimal example could look something like this:In [1]: from readquant import read_quants, read_qcsIn [2]: tpm = read_quants('salmon/*E4_salmon_out', version='0.4.0')In [3]: tpm.head()Out[3]:salmon/1771-026-195-E4_salmon_out  \NameERCC-00158                                0.0ERCC-00154                                0.0ERCC-00150                                0.0ERCC-00143                                0.0ERCC-00142                                0.0salmon/1771-026-190-E4_salmon_out  \NameERCC-00158                                0.0ERCC-00154                                0.0ERCC-00150                                0.0ERCC-00143                                0.0ERCC-00142                                0.0salmon/1771-026-196-E4_salmon_out  \NameERCC-00158                              0.000ERCC-00154                            906.236ERCC-00150                              0.000ERCC-00143                              0.000ERCC-00142                              0.000salmon/1771-026-198-E4_salmon_out  \NameERCC-00158                                0.0ERCC-00154                                0.0ERCC-00150                                0.0ERCC-00143                                0.0ERCC-00142                                0.0salmon/1771-023-118-E4_salmon_out  \NameERCC-00158                            0.00000ERCC-00154                            9.35988ERCC-00150                            0.00000ERCC-00143                          724.44800ERCC-00142                            0.00000salmon/1771-026-193-E4_salmon_outNameERCC-00158                                0.0ERCC-00154                                0.0ERCC-00150                                0.0ERCC-00143                                0.0ERCC-00142                                0.0In [4]: sample_info = read_qcs('salmon/*_salmon_out', version='0.4.0', flen_lim=(10, 100))In [5]: sample_info.head()Out[5]:percent_mapped  num_processed  \salmon/1771-026-197-G4_salmon_out         71.8270      2665988.0salmon/1771-026-198-D2_salmon_out         67.7853      3841894.0salmon/1771-026-195-H7_salmon_out         73.4492      3875822.0salmon/1771-026-194-E9_salmon_out         47.5425       979446.0salmon/1771-026-195-E4_salmon_out         56.3955      5051277.0global_fl_mode  robust_fl_modesalmon/1771-026-197-G4_salmon_out           103.0           103.0salmon/1771-026-198-D2_salmon_out           122.0           122.0salmon/1771-026-195-H7_salmon_out           110.0           110.0salmon/1771-026-194-E9_salmon_out           111.0           111.0salmon/1771-026-195-E4_salmon_out           111.0           111.0
Package: read-rapidpe
Read Rapid-PEThis is a package to read Rapid-PE outputs.InstallInstall from PyPIThisread-rapidpepackage is available on PyPI:https://pypi.org/project/read-rapidpe/pip install read-rapidpeInstall in dev modegit clone git@git.ligo.org:yu-kuang.chu/read-rapidpe.git
cd read-rapidpe
pip install -e .Example UsageReading filesfromread_rapidpeimportRapidPE_resultrun_dir="path/to/run_dir"result=RapidPE_result.from_run_dir(run_dir)There are three optional arguments:use_ligolw( default =True) : whether to useligo.lwto read XML files.extrinsic_table( default =True) : whether to load extrinsic parameter as well.parallel_n( default =1) : number of parallel jobs when reading XML files.For example, one can do the following to speed up the reading process:result=RapidPE_result.from_run_dir(run_dir,use_ligolw=False,extrinsic_table=False,parallel_n=4)Plot marginalized log-likelihood on m1-m2 grid pointsimportmatplotlib.pyplotasplt# Plot marginalized-log-likelihood over intrinsic parameter (mass_1/mass_2) grid pointsplt.scatter(result.mass_1,result.mass_2,c=result.marg_log_likelihood)plt.xlabel("$m_1$")plt.ylabel("$m_2$")plt.colorbar(label="$\ln(L_{marg})$")Plot interpolated likelihoodimportmatplotlib.pyplotaspltimportnumpyasnp# Create Random m1, m2 samplesm1=np.random.random(10000)*5m2=np.random.random(10000)*5# After calling result.do_interpolate_marg_log_likelihood_m1m2(),# the method result.log_likelihood(m1, m2) will be avalible.result.do_interpolate_marg_log_likelihood_m1m2()# Calculate interpolated log_likelihoodlog_likelihood=result.log_likelihood(m1,m2)# =============== Plotting ===============# Plot interpolated likelihoodplt.scatter(m1,m2,c=np.exp(log_likelihood),marker=".",s=3,alpha=0.1)# Plot marginalized likelihood on grid pointsplt.scatter(result.mass_1,result.mass_2,c=np.exp(result.marg_log_likelihood),marker="+",vmin=0)plt.xlabel("$m_1$")plt.ylabel("$m_2$")plt.colorbar(label=r"$\mathcal{L}$")Convert to Pandas DataFrameimportpandasaspdfromread_rapidpeimportRapidPE_grid_pointgrid_point=RapidPE_grid_point.from_xml("ILE_iteration_xxxxxxxxxx.samples.xml.gz")pd.DataFrame(grid_point.extrinsic_table)
Package: readretro-test1
READRetro: Natural Product Biosynthesis Planning with Retrieval-Augmented Dual-View RetrosynthesisThis is the official code repository for the paperREADRetro: Natural Product Biosynthesis Planning with Retrieval-Augmented Dual-View Retrosynthesis (bioRxiv, 2023).We also providea web versionfor ease of use.InstallationRun the following commands to install the dependencies:condacreate-nreadretropython=3.8
condaactivatereadretro
condainstallpytorch==1.12.0cudatoolkit=11.3-cpytorch
pipinstalleasydictpandastqdmnumpy==1.22OpenNMT-py==2.3.0networkx==2.5# need to fix the miner version of numpy (np.bool was deprecated)condainstall-cconda-forgerdkit=2019.09Model PreparationWe provide the trained models inGoogle Drive.Place the checkpoints under the foldersg2s/saved_modelsandretroformer/saved_models.You can use your own models trained using the official codes (https://github.com/coleygroup/Graph2SMILESandhttps://github.com/yuewan2/Retroformer).Single-step Planning and EvaluationRun the following command to evaluate the single-step performance of the models:CUDA_VISIBLE_DEVICES=${gpu_id}pythoneval_single.py# ensembleCUDA_VISIBLE_DEVICES=${gpu_id}pythoneval_single.py-mretroformer# RetroformerCUDA_VISIBLE_DEVICES=${gpu_id}pythoneval_single.py-mg2s-s200# Graph2SMILESMulti-step PlanningRun the following command to plan paths of multiple products using multiprocessing:CUDA_VISIBLE_DEVICES=${gpu_id}pythonrun_mp.py# e.g., CUDA_VISIBLE_DEVICES=0 python run_mp.pyYou can modify other hyperparameters described inrun_mp.py.Lowernum_threadsif you run out of GPU capacity.Run the following command to plan the retrosynthesis path of your own molecule:CUDA_VISIBLE_DEVICES=${gpu_id}pythonrun.py${product}# e.g., CUDA_VISIBLE_DEVICES=0 python run.py 'O=C1C=C2C=CC(O)CC2O1'You can modify other hyperparameters described inrun.py.Multi-step EvaluationRun the following command to evaluate the planned paths of the test molecules:pythoneval.py${save_file}# e.g., python eval.py result/debug.txt
Package: readretro-test2
READRetro: Natural Product Biosynthesis Planning with Retrieval-Augmented Dual-View RetrosynthesisThis is the official code repository for the paperREADRetro: Natural Product Biosynthesis Planning with Retrieval-Augmented Dual-View Retrosynthesis (bioRxiv, 2023).We also providea web versionfor ease of use.InstallationRun the following commands to install the dependencies:condacreate-nreadretropython=3.8
condaactivatereadretro
condainstallpytorch==1.12.0cudatoolkit=11.3-cpytorch
pipinstalleasydictpandastqdmnumpy==1.22OpenNMT-py==2.3.0networkx==2.5# need to fix the miner version of numpy (np.bool was deprecated)condainstall-cconda-forgerdkit=2019.09Model PreparationWe provide the trained models inGoogle Drive.Place the checkpoints under the foldersg2s/saved_modelsandretroformer/saved_models.You can use your own models trained using the official codes (https://github.com/coleygroup/Graph2SMILESandhttps://github.com/yuewan2/Retroformer).Single-step Planning and EvaluationRun the following command to evaluate the single-step performance of the models:CUDA_VISIBLE_DEVICES=${gpu_id}pythoneval_single.py# ensembleCUDA_VISIBLE_DEVICES=${gpu_id}pythoneval_single.py-mretroformer# RetroformerCUDA_VISIBLE_DEVICES=${gpu_id}pythoneval_single.py-mg2s-s200# Graph2SMILESMulti-step PlanningRun the following command to plan paths of multiple products using multiprocessing:CUDA_VISIBLE_DEVICES=${gpu_id}pythonrun_mp.py# e.g., CUDA_VISIBLE_DEVICES=0 python run_mp.pyYou can modify other hyperparameters described inrun_mp.py.Lowernum_threadsif you run out of GPU capacity.Run the following command to plan the retrosynthesis path of your own molecule:CUDA_VISIBLE_DEVICES=${gpu_id}pythonrun.py${product}# e.g., CUDA_VISIBLE_DEVICES=0 python run.py 'O=C1C=C2C=CC(O)CC2O1'You can modify other hyperparameters described inrun.py.Multi-step EvaluationRun the following command to evaluate the planned paths of the test molecules:pythoneval.py${save_file}# e.g., python eval.py result/debug.txt
Package: readretro-test3
READRetro: Natural Product Biosynthesis Planning with Retrieval-Augmented Dual-View RetrosynthesisThis is the official code repository for the paperREADRetro: Natural Product Biosynthesis Planning with Retrieval-Augmented Dual-View Retrosynthesis (bioRxiv, 2023).We also providea web versionfor ease of use.InstallationRun the following commands to install the dependencies:condacreate-nreadretropython=3.8
condaactivatereadretro
condainstallpytorch==1.12.0cudatoolkit=11.3-cpytorch
pipinstalleasydictpandastqdmnumpy==1.22OpenNMT-py==2.3.0networkx==2.5# need to fix the miner version of numpy (np.bool was deprecated)condainstall-cconda-forgerdkit=2019.09Model PreparationWe provide the trained models inGoogle Drive.Place the checkpoints under the foldersg2s/saved_modelsandretroformer/saved_models.You can use your own models trained using the official codes (https://github.com/coleygroup/Graph2SMILESandhttps://github.com/yuewan2/Retroformer).Single-step Planning and EvaluationRun the following command to evaluate the single-step performance of the models:CUDA_VISIBLE_DEVICES=${gpu_id}pythoneval_single.py# ensembleCUDA_VISIBLE_DEVICES=${gpu_id}pythoneval_single.py-mretroformer# RetroformerCUDA_VISIBLE_DEVICES=${gpu_id}pythoneval_single.py-mg2s-s200# Graph2SMILESMulti-step PlanningRun the following command to plan paths of multiple products using multiprocessing:CUDA_VISIBLE_DEVICES=${gpu_id}pythonrun_mp.py# e.g., CUDA_VISIBLE_DEVICES=0 python run_mp.pyYou can modify other hyperparameters described inrun_mp.py.Lowernum_threadsif you run out of GPU capacity.Run the following command to plan the retrosynthesis path of your own molecule:CUDA_VISIBLE_DEVICES=${gpu_id}pythonrun.py${product}# e.g., CUDA_VISIBLE_DEVICES=0 python run.py 'O=C1C=C2C=CC(O)CC2O1'You can modify other hyperparameters described inrun.py.Multi-step EvaluationRun the following command to evaluate the planned paths of the test molecules:pythoneval.py${save_file}# e.g., python eval.py result/debug.txt
Package: readretro-test4
READRetro: Natural Product Biosynthesis Planning with Retrieval-Augmented Dual-View RetrosynthesisThis is the official code repository for the paperREADRetro: Natural Product Biosynthesis Planning with Retrieval-Augmented Dual-View Retrosynthesis (bioRxiv, 2023).We also providea web versionfor ease of use.InstallationRun the following commands to install the dependencies:condacreate-nreadretropython=3.8
condaactivatereadretro
condainstallpytorch==1.12.0cudatoolkit=11.3-cpytorch
pipinstalleasydictpandastqdmnumpy==1.22OpenNMT-py==2.3.0networkx==2.5# need to fix the miner version of numpy (np.bool was deprecated)condainstall-cconda-forgerdkit=2019.09Model PreparationWe provide the trained models inGoogle Drive.Place the checkpoints under the foldersg2s/saved_modelsandretroformer/saved_models.You can use your own models trained using the official codes (https://github.com/coleygroup/Graph2SMILESandhttps://github.com/yuewan2/Retroformer).Single-step Planning and EvaluationRun the following command to evaluate the single-step performance of the models:CUDA_VISIBLE_DEVICES=${gpu_id}pythoneval_single.py# ensembleCUDA_VISIBLE_DEVICES=${gpu_id}pythoneval_single.py-mretroformer# RetroformerCUDA_VISIBLE_DEVICES=${gpu_id}pythoneval_single.py-mg2s-s200# Graph2SMILESMulti-step PlanningRun the following command to plan paths of multiple products using multiprocessing:CUDA_VISIBLE_DEVICES=${gpu_id}pythonrun_mp.py# e.g., CUDA_VISIBLE_DEVICES=0 python run_mp.pyYou can modify other hyperparameters described inrun_mp.py.Lowernum_threadsif you run out of GPU capacity.Run the following command to plan the retrosynthesis path of your own molecule:CUDA_VISIBLE_DEVICES=${gpu_id}pythonrun.py${product}# e.g., CUDA_VISIBLE_DEVICES=0 python run.py 'O=C1C=C2C=CC(O)CC2O1'You can modify other hyperparameters described inrun.py.Multi-step EvaluationRun the following command to evaluate the planned paths of the test molecules:pythoneval.py${save_file}# e.g., python eval.py result/debug.txt
Package: read-rkf
A script to read the ams.rkf file which contains all the important data from an ams output file. This file generally contains1 Trajectories2 Gradients3 Hessians4 Energies5 Band gaps and structuresand so onHow to1 Convert rkf file to a json objectfrom read_rkf.creat_archive import rkf_to_json
json_data = rkf_to_json(path_to_the_rkf_file)2 Convert rkf file to a python dictionaryfrom read_rkf.creat_archive import rkf_to_dict
python_dict  = rkf_to_dict(path_to_the_rkf_file)3 check the sections in the rkf filefrom read_rkf.parserkf import KFFile
data = KFFile(path_to_the_rkf_file)
all_sections = data.sections()e.g if you want a the first section?section_content =  data.read_section(all_sections[0])