Saravanan666/pypi-org huggingface dataset:
Package: single_access
Single access to run a python script.Installation$ pip install single_accessUsagefrom single_access import single_access, lock

@single_access
def main():
    # try to lock this script file
    ...or@single_access(filename='/tmp/single_access_test.loc')
def main():
    ...ordef main():
    if not lock('/tmp/single_access_test.loc'):
        return
    ...Repositoryhttps://github.com/imbolc/single_access
Package: single-body-thermal-equil
Copyright (c) 2019 Matthew VernacchiaPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.Description: UNKNOWN
Keywords: analysis-script engineering thermodynamics
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Provides-Extra: test
Package: single-cartpole-custom-gym-env
This package contains OpenAI Gym environment designed for training RL agents to bring CartPole upright and its further balancing. The environment is automatically registered under id: single-cartpole-custom-v0, so it can be easily used by RL agent training libraries, such as StableBaselines3.At thehttps://github.com/marek-robak/Single-cartpole-custom-gym-env-for-reinforcement-learning.gityou can find a detailed description of the environment, along with a description of the package installation and sample code made to train and evaluate agents in this environment.This environment was created for the needs of my bachelor's thesis, available athttps://www.ap.uj.edu.pl/diplomas/151837/site.
Package: singlecelldata
SingleCellSingleCell is a python class available in the singlecelldata package for managing single-cell RNA-seq data. It contains three pandas dataframes;datafor holding gene expression values (counts/normalized counts),genedatafor holding more information about the genes e.g., gene names, andcelldatawhich contains more information about cells such as cell types, labels etc.InstallationThe singlecelldata package can be easily installed using the following command:pip install singlecelldataDocumentationThe SingleCell class reference manual can be foundhereUsing the SingleCell classBasic ExampleThe SingleCell class can be used to create an object which stores single-cell gene expression data and additional data about genes and cells in their respective dataframes. To create a SingleCell object sc, the following python code can be used:# Import SingleCellfromsinglecelldataimportSingleCell# Create the path and the dataset variablespath='../data/293t_jurkat/'dataset='293t'# Create the SingleCell objectsc=SingleCell(path,dataset,"10X")sc.print()In the above example, a SingleCell object, sc, was ceated by passing the dataset name and the main data, the cell data and gene data as Pandas dataframes.Pandasis a powerpul python library for creating data structures from a variety of sources. Pandas can open and read data from numerous differernt file types such as csv files and creating dataframes from it. This enables the user to create SingleCell objects from a variety of different data file types.Detailed ExampleMore detailed example can be foundhereContactContact the author oninfo@edwinvans.comto give feedback/suggestions for further improvements and to report issues.
Package: singleCellHaystack
singleCellHaystackThis repository contains a Python implementation ofsingleCellHaystack(version >= 1.0.0).This package is currently in beta. The most important functionality in the R package works, but some features are not yet available. Here is a (probably imcomplete) list of missing features. Some will be added in the future.weights.advanced.Q(formerly known asuse.advanced.sampling).seedingmethod for calculating grid points.Hierarchical clustering method forcluster_genes.InstallationYou can install singleCellHaystack frompypi:pip install singleCellHaystackYou can install singleCellHaystack from GitHub with:pip install git+http://github.com/ddiez/singleCellHaystack-pySupport for conda installation will be added in the future.Exampleimport scanpy as sc
import singleCellHaystack as hs

adata = sc.read_h5ad("data.h5ad")

[... process adata object ...]

res = hs.haystack(adata, coord="pca")
res.top_features(n=10)ReferencesOur manuscript describing the updated, more generally applicable version ofsingleCellHaystackincluding this Python implementation is available onbioRxiv.Our manuscript describing the original implementation ofsingleCellHaystackfor R (version 0.3.4) was published inNature Communications.If you usesingleCellHaystackin your research please cite our work using:Vandenbon A, Diez D (2020). “A clustering-independent method for finding differentially expressed genes in single-cell transcriptome data.”Nature Communications,11(1), 4318.doi:10.1038/s41467-020-17900-3.
Package: single-cell-portal
Single-Cell PortalHello and thank you for using the Single-Cell Portal. We hope the portal will contribute to open science by enabling visualizing and sharing scientific insight and data surrounding single-cell RNA-Seq.Thank you for being a part of this open science effort!Site URLTo visit the portal please go to:https://portals.broadinstitute.org/single_cellTutorialsFor tutorials and descriptions of files please go to:https://github.com/broadinstitute/single_cell_portal/wikiConvenience ScriptsScripts to help when working with data files for the portal are made available in this repo and require Python 3. Using these scripts to verify the format of input files can be found athttps://github.com/broadinstitute/single_cell_portal/wiki/File-Definitions.To get set up to use these scripts:git clone https://github.com/broadinstitute/single_cell_portal.git
cd single_cell_portal
python3 -m venv env --copies
source env/bin/activate
pip install -r requirements.txtTheninstall and initialize Google Cloud SDKon your machine; many scripts here require it.Reporting Bugs and ImprovementsTo report a bug or suggest an improvement please create a new issue at:https://github.com/broadinstitute/single_cell_portal/issuesNeed Help?Email us atscp-support@broadinstitute.zendesk.comHappy Science!!!The Single-Cell Portal Team
Package: single-cell-tools
single-cell-toolsA package for pseudotime and dimension reduction by cluster centroidsInstallation$pipinstall-ihttps://test.pypi.org/simple/single-cell-toolsFeaturesTODODependenciesTODOUsageTODODocumentationThe official documentation is hosted on Read the Docs:https://single-cell-tools.readthedocs.io/en/latest/ContributorsWe welcome and recognize all contributions. You can see a list of current contributors in thecontributors tab.CreditsThis package was created with Cookiecutter and the UBC-MDS/cookiecutter-ubc-mds project template, modified from thepyOpenSci/cookiecutter-pyopensciproject template and theaudreyr/cookiecutter-pypackage.
Package: single-char-counter-by-ng
Single char counterInstallationClone this repository to your local machine:pipinstallsingle-char-counter-by-ngUse the package managerpipto install requirements:pipinstall-rrequirements.txtSummaryApplication that takes a string or file and returns the number of all characters in the string or file occurring only once.
The function was tested usingpytest. The function is in thesingle_char_counter_by_ngfolder and the tests are in thetestsfolder. Thetest_count_single_charfolder contains tests and parameterized data. For convenience, some__init__already have modules imported.Usagefromsingle_char_counter_by_ngimport(count_single_char,count_single_char_in_file)count_single_char('HelLo')# ---> 5count_single_char('HelLo',case_insensitive=True)# ---> 3# file.txt ---> 'HelLo'count_single_char_in_file('path_to_file/file.txt')# ---> 5count_single_char_in_file('path_to_file/file.txt',case_insensitive=True)# ---> 3Also implemented command-line interface(CLI):pythoncount_single_char.py--string“yourstring”pythoncount_single_char.py-s“yourstring”orpythoncount_single_char.py--file"path_to_text_file"pythoncount_single_char.py-f"path_to_text_file"There is also a "-i" parameter that can be specified so that the result is case insensitive:pythoncount_single_char.py-s“yourstring”-iIf you passed two parameters, the parameter '--file' havehigherpriority:pythoncollect_framework.py--string“yourstring”--filepath_to_text_fileUsedPytestCoverageArgparsePackaging Python ProjectsLicenseMIT
Package: single-consumer-queue
Single Consumer QueueSingle Consumer Queue is a Python library that provides an alternative to the standard asyncio.Queue for single consumer scenarios. It consists of two classes: SingleConsumerQueue and SingleConsumerPriorityQueue. Both classes implement the AbstractSingleConsumerQueue abstract base class, which provides the basic functionality of a single consumer queue.Why Single Consumer Queue?In some scenarios, the standard asyncio.Queue can be slower than necessary. This is because asyncio.Queue is designed to be used with multiple consumers, which means that it has additional overhead to handle multiple concurrent accesses. If you only have one consumer, you can use SingleConsumerQueue or SingleConsumerPriorityQueue to reduce this overhead and improve performance.How to use Single Consumer QueueInstallation
You can install Single Consumer Queue using pip:pip install single-consumer-queueUsageHere's an example of how to use SingleConsumerQueue:async def consumer(queue: SingleConsumerQueue | SingleConsumerPriorityQueue):
    async for item in queue.start_consuming():
        print(item)SingleConsumerQueue raises exception if you try to add multiple consumers:async def consumer(queue: SingleConsumerQueue | SingleConsumerPriorityQueue):
    async for item in queue.start_consuming():
        print(item)

queue = SingleConsumerQueue()
asyncio.create_task(consumer(queue))
await asyncio sleep(0.1)
await queue.get()  # raises runtime errorLock is checked and acquired when consumer starts and every time that get is awaited.Get has considerate overhead because it has to use lock every time, so it is recommended to usestart_consuminggenerator when you want to consume items in the loop.
Package: singledispatch
PEP 443proposed to expose
a mechanism in thefunctoolsstandard library module in Python 3.4
that provides a simple form of generic programming known as
single-dispatch generic functions.This library is a backport of this functionality and its evolution.Refer to theupstream documentationfor API guidance. To use the backport, simply usefrom singledispatch import singledispatch, singledispatchmethodin place offrom functools import singledispatch, singledispatchmethod.MaintenanceThis backport is maintained on Github by Jason R. Coombs, one of the
members of the core CPython team:repositoryissue trackerFor EnterpriseAvailable as part of the Tidelift Subscription.This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.Learn more.
Package: singledispatchmethod
Backport of@functools.singledispatchmethoddecorator[1]from
Python 3.8 to Python 2.7-3.7. These are merely ~30 lines of code, but
why bother yourself with copypasta?$pipinstallsingledispatchmethodThe decorator transforms a method into a single-dispatch[2]generic
function[3]. Note that since the dispatch happens on the type of the
first non-self or non-cls argument, you have to create your function
accordingly:fromsingledispatchmethodimportsingledispatchmethodclassNegator:@singledispatchmethoddefneg(self,arg):raiseNotImplementedError("Cannot negate a")@neg.registerdef_(self,arg:int):return-arg@neg.registerdef_(self,arg:bool):returnnotarg@singledispatchmethodsupports nesting with other decorators such as@classmethod. However, in order to exposedispatcher.register,@singledispatchmethodmust be theouter mostdecorator. Here is
theNegatorclass with thenegmethods being class bound:fromsingledispatchmethodimportsingledispatchmethodclassNegator:@singledispatchmethod@classmethoddefneg(cls,arg):raiseNotImplementedError("Cannot negate a")@neg.register@classmethoddef_(cls,arg:int):return-arg@neg.register@classmethoddef_(cls,arg:bool):returnnotargThe same pattern can be used for other similar decorators, such as@staticmethodor@abstractmethod. Please note, since@singledispatchmethoddecorator is based on@functools.singledispatch, type annotations are supported bydispatcher.registeronly since Python 3.7.[1]https://docs.python.org/3.8/library/functools.html#functools.singledispatchmethod[2]https://docs.python.org/3.8/glossary.html#term-single-dispatch[3]https://docs.python.org/3.8/glossary.html#term-generic-function
Package: singledispatch-with-type-arg-support
singledispatch-with-type-arg-supportStandalone "preview" ofhttps://github.com/python/cpython/pull/100624Based offcpythoncommit c4c5790120beabed83ce5855f18d209ab8324434InstallationRequires a sufficiently recent Python 3.12 version(some tests fail with
earlier 3.12 versions, although the main functionality might still work - do
your own testing).pip3installsingledispatch-with-type-arg-supportExampleSeeexample.py:fromsingledispatch_with_type_arg_supportimportsingledispatch@singledispatchdefdescribe(x)->str:raiseTypeError(f"no description for{repr(x)}")@describe.registerdef_(x:type[int])->str:return"the integer type"print(describe(int))# should print: the integer typeLicenseSame as CPython (as 99% of it is copied from there), seeLICENSEfile.
Package: single-factor-model
This programme is built for back-testing factors.Dependenciespython 3.5pandas 0.23.0numba 0.38.0empyrical 0.5.0data_boxpicklemultiprocessingjoblibLogicBasic definitionsv_t,s_t,c_t: total value, stock value and cash value at time t after
tradingv^f_t,s^f_t,c^f_t: total value, stock value and cash value at time t
before tradingss,sv: suspended stock value and valid stock valuer_t: return at time tcost_t: cost to trade at time tNote: s,ss,sv are all vectors while others are numbersEquationsv_t = |s_t| + c_ts^f_t = s_{t-1} * (1 + r_t) = ss^f_t + sv^f_t = ss_t + sv^f_tss_t <- suspend, s^f_tc_{t-1} + |sv^f_t| = |sv_t| + c_t + cost_t ( where c_t, cost_t >=
0 )cost_t =|sv_t - sv^f_t| * costRateweight_t <- factor_{t-1},industry_t,suspend_t ( |weight_t| = 1 or 0
if there is no valid stocks or factors or industries)define cost^f_t = (2|sv^f_t| + c_{t-1}) * costRate s.t. cost^f_t >=
cost_t, which is greater than the maximum cost we may have during the
tradedefine available_value^f_t = c_{t-1} + |sv^f_t| - cost^f_t, which
means the value ( = |sv_t| if weight_t != 0) we have in stocks
after tradinglet sv_t = weight_t * available_value^f_t s.t. c_t = c_{t-1} +
|sv^f_t| - |sv_t| - cost_t >=0Thus to update v_t, we would start with calculating s^f_t, ss, sv^f_t,
then cost^f_t, available_value^f_t, then sv_t, cost_t and c_t, and
finally v_tExampleData Box: pre-processfromdata_boximportdata_boxdb=data_box()\.load_indestry(ind)\.load_indexWeight(ind_weight)\.calc_indweight()\.load_suspend(sus)\.load_adjPrice(price)\.add_factor('factor0',factor0)\.add_factor('factor1',factor1)\.set_lag(freq='d',day_lag=1)\.align_data()# freq can be 'd' or 'm', for detail please refer to db.set_lag doc.Whereprice,ind,ind_weight,sus,factor0,factor1are all dataframes
with index as date (yyyymmdd,int) and column as tickers. You can save
and load this data box object bydb.save('path')anddb.load('path'). You can find more in data_box project.Back Testfromsingle_factor_modelimportrun_back_testSingle processorValue,Turnover=run_back_test(data_box=db,back_end=None,n=5,out_path=None,double_side_cost=0.003)Multi processorsValue,Turnover=run_back_test(data_box=db,back_end='loky',n=5,n_jobs=-1,out_path=None,verbose=50)orwith__name__=='__main__':Value,Turnover=run_back_test(data_box=db,back_end='multiprocessing',n=5,n_jobs=-1,out_path=None)To check detailed positions of each portfolio every day, just assignout_path.Back test for specific industriesfromsingle_factor_modelimportrun_back_test_by_industryValue_list,Turnover_list=run_back_test_by_industry(db,industry_list=None,back_end='loky',n_jobs=-1,double_side_cost=0.003,verbose=50)Summary and PlotCalculate return including long short portfolio(and reverse)fromsingle_factor_modelimportcalc_returnReturn=calc_return(Value,Turnover,long_short=True,double_side_cost=0.003)Summaryfromsingle_factor_modelimportsummaryS=summary(Return)Plotfromsingle_factor_modelimportrun_plotrun_plot(Return,show=True)
Package: singleflight
singleflightCoalesce multiple identical call into one, preventing thundering-herd/stampede to database/other backendsIt is a python port ofgolang's groupcache singleflight implementationThis moduledoes notprovide caching mechanism. Rather, this module can used behind a caching abstraction to deduplicate cache-filling callOnly support python 3.5+InstallationpipinstallsingleflightUsageThis modules has 3 implementation, which can be imported as followsfromsingleflight.basicimportSingleFlight# for multi-threaded appsfromsingleflight.geventimportSingleFlightGeventasSingleFlight# for gevent appsfromsingleflight.asynchronousimportSingleFlightAsyncasSingleFlight# for asyncio/curio appsThen you can use it as follows (the example shows the multi-threaded version). Note that,keyis important for the modules to know which call should be de-duplicatedfromtimeimportsleepfromconcurrent.futuresimportThreadPoolExecutorfromfunctoolsimportpartialfromsingleflight.basicimportSingleFlightif__name__=='__main__':sf=SingleFlight()executor=ThreadPoolExecutor(max_workers=10)counter=0result="this is the result"defwork(num):globalcounter,resultsleep(0.1)# emulate bit slower callcounter+=1return(result,num)res=[]foriinrange(10):sfc=partial(sf.call,work,"key",i+1)r=executor.submit(sfc)res.append(r)forrinres:assertr.result()[0]==result# because only the first one can get the lock# and only that one request callassertr.result()[1]==1assertcounter==1For decorator fans, you can also use it to wrap your function.fromtimeimportsleepfromconcurrent.futuresimportThreadPoolExecutorfromfunctoolsimportpartialfromsingleflight.basicimportSingleFlightif__name__=='__main__':sf=SingleFlight()executor=ThreadPoolExecutor(max_workers=10)# success casecounter=0result="this is the result"@sf.wrapdefwork(num):globalcounter,resultsleep(0.1)# emulate bit slower callcounter+=1return(result,num)res=[]foriinrange(10):sfc=partial(work,"key",i+1)r=executor.submit(sfc)res.append(r)forrinres:assertr.result()[0]==result# because only the first one can get the lock# and only that one request callassertr.result()[1]==1assertcounter==1All*argsand**kwargsyour function has is passed directly later. Exceptions are also raised normally.
Package: singleImagesToPDF
singleImagesToPDFThis helps you to convert all the image files in your current working directory (os.getcwd()) to pdf files and merge them (if you want) to be combined in a PDF file format.Specifications:Supported File Formats :- JPEG/JPG/PNGSupported Operating Systems :- Linux/WindowsProgramming Language :- Python3Using this you can convert all your images gathered (either notes or documents) to a single pdf file.How to Use?All you need to do is open your command promt in the required directory(folder) and run:1)pip install singleImagesToPDF2) make a python script and add the following lines of codea) Do the necessaryimport:-from singleImagesToPDF.pdfFromMultiImages import pdfFromMultiImgsb) Make an instance and call the merge functiona = pdfFromMultiImgs()a.merge()Follow along the instructions and your images (usually notes/documents) will be merged into a single pdf or keep the single pdfs corresponding to the images as required.Image Format supported :- JPG/JPEG/PNGPlatform Supported :- Linux/WindowsUse Cases :-a) Can be used for merging the images obtained through whatsapp in your computerb) Can be used to merge the images obtained from mail,or any other place where you can utilize it for
Package: singlejson
singlejsonA very simple set of utilities for working with JSON in Python.Features:Easy loading of JSON filesOnly one instance for each opened fileThis library doesn't feature much more, just the basicsInstallation:Install singlejson using pippipinstallsinglejsonUsage:Loading JSON from file:importsinglejsonfile=singlejson.load('file.json')# Load file.json# Returns a JSONfile object which has the json propertyfile.json["fun"]=True# Edit some values in the JSONfileBut if we try to load the same file from the filesystem again, we get the same object:file2=singlejson.load('file.json')print(file2.json["fun"])# will output TrueTo save the file back to the disk we callfile.save()Maybe you don't want your program to save file contents only upon successful execution, then you just have to callsinglejson.sync()at the end of your program to saveallchanges to the filesystem.If the requested file doesn't exist, the file and its parent directories will be created and the "default" values will be written to the file.
Should the root "node" of your JSON be a List, you may specify that the default to save is an empty list usingsinglejson.load(file, default="[]")Contributing:This is just a fun project of mine mainly to try out python packaging. If you would like to contribute or have a feature-request, pleaseopen an issue or pull request.
Package: single-line-diff
This is a package that allows you to easily diff a single line. The following are some examples (note that in this example underscores are used instead of bullets due to not rendering properly on Pypi):>>> print(diff("This is totally just my opinion.", "This is simply my opinion."))
This is totally just my opinion.
This is simp_ly_____ my opinion.
        ^^^^^  ^^^^^>>> print(diff("I called but no one answered.", "I tried calling, but no one answered."))
I______ called__ but no one answered.
I tried calling, but no one answered.
 ^^^^^^     ^^^^