Saravanan666/pypi-org huggingface dataset:
Package: single-linked-list
Singly Linked ListThis is a Python implementation of a singly linked list.UsageSingly Linked ListThis is a Python implementation of a singly linked list.InstallationInstall theSingleLinkedListpackage from PyPI usingpip:pipinstallsingle-linked-list==0.0.3then, import theSingleLinkedListclass orCicruleSingeLinkedListfromslll.slllimportSingleLinkedListfromslll.csllimportCicruleSingeLinkedListInitialize a Singly Linked Listsingle_linked_list=SingleLinkedList()cicrule_single_list=CicruleSingeLinkedList()Methods* Appendinserts a new node at the end of the linked list.Method:append(data)data(any): The data to be stored in the new node.single_linked_list.append(1)single_linked_list.append(2)cicrule_single_list.append(1)cicrule_single_list.append(2)* Preappendinserts a new node at the beginning of the linked list.Method:pre_append(data)data(any): The data to be stored in the new node.single_linked_list.pre_append(0)cicrule_single_list.pre_append(0)* Insertinserts a new node at the specified index in the linked list.Method:insert(data, index)index(int): The index where the new node should be inserted.data(any): The data to be stored in the new node.single_linked_list.insert(2,3)cicrule_single_list.insert(2,3)* Findreturns the index of the first node containing the specified data.Method:find(data)data(any): The data to search for.index=single_linked_list.find(2)index=cicrule_single_list.find(2)print(index)# Output: 1* Getreturns the node at the specified index.Method:get(index)index(int): The index of the desired node.node=single_linked_list.get(2)node=cicrule_single_list.get(2)print(node.data)# Output: 3* Setupdates the data of the node at the specified index.Method:set(index, data)index(int): The index of the node to be updated.data(any): The new data to be stored in the node.single_linked_list.set(0,9000)cicrule_single_list.set(0,9000)* Popremoves and returns the last node in the linked list.Method:pop()last_node=single_linked_list.pop()last_node=cicrule_single_list.pop()print(last_node)# Output: 3* Pop Firstremoves and returns the first node in the linked list.Method:pop_first()first_node=single_linked_list.pop_first()first_node=cicrule_single_list.pop_first()print(first_node)# Output: 0* Removeremoves the node at the specified index from the linked list.Method:remove(index)index(int): The index of the node to be removed.single_linked_list.remove(2)cicrule_single_list.remove(2)* Clearclears all nodes in the linked list.Method:clear()single_linked_list.clear()cicrule_single_list.clear()* Get Lengthreturns the current size (length) of the linked list.Method:len()length=len(single_linked_list)length=len(cicrule_single_list)print(length)# Output: 1* Traverse and printtraverses the linked list and prints the data of each node.Method:traverse()single_linked_list.traverse()cicrule_single_list.traverse()# Output: 0 -> 1 -> 3* String representationreturns a string representation of the linked list.Method:str()linked_list_str
Package: singlem
Welcome.SingleM is a tool for profiling shotgun metagenomes. It has a particular strength in detecting microbial lineages which are not in reference databases. The method it uses also makes it suitable for some related tasks, such as assessing eukaryotic contamination, finding bias in genome recovery, computing ecological diversity metrics, and lineage-targeted MAG recovery.Documentation can be found athttps://wwood.github.io/singlem/
Package: single-mol
single_molA package to accompany the Single Molecule Counting Perspective.Installation$pipinstallsingle_molUsagesingle_molcan be used to recreate figures from the Single Molecule Counting Perspective.See thedocumentationfor examples.FilesBecause some files are too large for GitHub, the files needed to recreate the figures can be found onPanorama.ContributingInterested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.Licensesingle_molwas created by Danielle A. Faivre. It is licensed under the terms of the Apache License 2.0 license.Creditssingle_molwas created withcookiecutterand thepy-pkgs-cookiecuttertemplate.
Package: single_process
READMESETUPpip install -U single_processUSELimit python script just run a single process, support python3Use only need to directly import single_process.init module (no need for any function call)import single_process.initOf course, you can also manually call the single_process functionfrom single_process import single_process

single_process()

def main():
    from time import sleep
    sleep(6000)

if __name__ == "__main__":
    main()中文说明安装pip install -U single_process使用限制一个python脚本只运行一个进程，支持python3
使用只需要直接 import single_process.init 模块(不需要任何函数调用)import single_process.init当然，你也可以手工调用 single_process 函数from single_process import single_process

single_process()

def main():
    from time import sleep
    sleep(6000)

if __name__ == "__main__":
    main()
Package: single-sample-gsea
Single Sample GSEA analysisSingle-sample geneset enrichment analysis (ssGSEA) is a single-sample extension of the GSEA algorithm. It calculates a separate enrichment score for each sample and gene set pairing[1].Install the latest versionpip install single_sample_gseaUsage>>>fromsingle_sample_gseaimportss_gsea>>>gene_sets={"gs1":{"gene2","gene3"},"gs2":{"gene1","gene4"},}>>>data={"gene":["gene1","gene2","gene3","gene4","gene5"],"sample-1":[1,3,4,7,32],"sample-2":[25,4,6,18,1],}>>>data=pd.DataFrame(data).set_index("gene")>>>ss_gsea(data,gene_sets)gs1gs2sample-1-1.333333-0.962974sample-2-1.3333332.543214References[1]Barbie, D., Tamayo, P., Boehm, J. et al. Systematic RNA interference reveals that oncogenic KRAS-driven cancers require TBK1. Nature 462, 108–112 (2009).https://doi.org/10.1038/nature08460
Package: singlesp
The Single Subprocess usage module.Author: Moises P. Senamoisespsena@gmail.comLicense: MITExamplesfromsinglespimport*Instantiatep=Proc('date')# orp=Proc(['echo',__file__])stdoutFor setstdoutcallback, use the>operator.print(p.read())# orprint(p.wait().read())# orprint(p.run().wait().read())defcb_out(proc):forlineinproc.out:print("STDOUT:%r"%line)Proc('date',callbacks=[cb_out]).wait()defcb_outreader(reader):forlineinreader:print("STDOUT:%r"%line)(Proc('date')>cb_outreader).wait()# orp=Proc('date')>cb_outreaderp.wait()bufferdefcb_outreader(reader):fordatainreader(10):print("STDOUT:%r"%data)(Proc('date')>cb_outreader).wait()stderrFor setstderrcallback, use the>>operator.defcb_errreader(reader):fordatainreader:print("ERR:%r"%data)(Proc('date')>>cb_outreader).wait()stdout and stderr callbacksdefcbo(reader):fordatainreader:print("OUT:%r"%data)defcbe(reader):fordatainreader:print("ERR:%r"%data)(Proc('echo out data;echo err data >&2;')>cbo>>cbe).wait()callbacks# async read stdout and stderrdefcb_stdout(proc):forlineinproc.out:print("STDOUT:%r"%line)defcb_stderr(proc):forlineinproc.err:print("STDERR:%r"%line)Proc('seq 1 3 | while read l; do echo "i= $l"; echo "i in err: $l" >&2; done',callbacks=[cb_stdout,cb_stderr]).wait()Many commands asyncProc('echo CMD-1: first command with sleep 1; sleep 1; echo CMD-1: done',callbacks=[cb_stdout,cb_stderr]).run()Proc('echo CMD-2: show date; date; echo CMD-2: done',callbacks=[cb_stdout,cb_stderr]).run()# wait all callbacksprint("before wait")wait()print("done")Get exit statusp=Proc('date').run().wait()# or p = Proc('date').wait()print(p.status)PipesSimple:(Input(['God ','is ','Love!!'])|Proc(['cat'])).read()defcb_stdout(reader):forlineinreader:print("STDOUT:%r"%line)p=Proc('seq 1 3')|Proc('grep 2')>cb_stdout# or p = Proc('seq 1 3').pipe(Proc('grep 2')) > cb_stdoutp.run()wait()print(Input(['God ','is ','Love!!'])|Proc(['cat'])).read()defgen():yield'God 'yield'is 'yield'Love!!'print(Input(gen())|Proc(['cat'])).read()print(Commands(['date'])|Proc(['bash'])).read()print(Commands(['date'])|bash()).read()print(Commands(['date'])|sh()).read()wait()Simple:p=Proc('seq 1 3')|Proc('grep 2')>cb_stdoutp.run()wait()Complex:defcb_stdout(proc):forlineinproc.out:print("STDOUT:%r"%line)defa_stderr(proc):forlineinproc.err:print("A-STDERR:%r"%line)defb_stderr(proc):forlineinproc.err:print("B-STDERR:%r"%line)p=Proc('echo "[A] error message" >&2;seq 1 3',callbacks=[a_stderr])|\Proc('while read l; do echo "i= $l"; echo "[B] i in err: $l" >&2; done',callbacks=[cb_stdout,b_stderr])p.run()wait()
Package: singlestoredb
SingleStoreDB Python SDKThis project contains aDB-API 2.0compatible Python interface to the SingleStore database and workspace management API.InstallThis package can be install from PyPI usingpip:pip install singlestoredbDocumentationhttps://singlestore-labs.github.io/singlestoredb-pythonUsageConnections to the SingleStore database are made using the DB-API parametershost,port,user,password, etc, but they may also be done using
URLs that specify these parameters as well (much like theSQLAlchemypackage).import singlestoredb as s2

# Connect using the default connector
conn = s2.connect('user:password@host:3306/db_name')

# Create a cursor
cur = conn.cursor()

# Execute SQL
cur.execute('select * from foo')

# Fetch the results
print(cur.description)
for item in cur:
    print(item)

# Close the connection
conn.close()Connecting to the HTTP API is done as follows:# Use the HTTP API connector
conn = s2.connect('https://user:password@host:8080/db_name')PerformanceWhile this package is based onPyMySQLwhich is a pure Python-based MySQL connector, it adds various performance
enhancements that make it faster than most other connectors. The performance
improvements come from changes to the data conversion functions, cursor implementations,
and a C extension that is highly optimized to improve row data reading.The package can be used both in a pure Python mode and as well as a C accelerated
mode. Generally speaking, the C accelerated version of the client can read
data 10X faster than PyMySQL, 2X faster than MySQLdb, and 1.5X faster than
mysql.connector. All of this is done without having to install any 3rd party
MySQL libraries!Benchmarking was done with a table of 3,533,286 rows each containing a datetime,
a float, and eight character columns. The data is the same data set used inthis article.
The client and server were running on the same machine and queries were made
usingfetchone,fetchall,fetchmany(1000), and an iterator over the cursor
object (e.g.,iter(cur)). The results are shown below.BufferedPyMySQLMySQLdbmysql.connectorSingleStore (pure Python)SingleStorefetchall37.0s8.7s5.6s29.0s3.7sfetchmany(1000)37.4s9.2s6.2s29.6s3.6sfetchone38.2s10.1s10.2s30.9s4.8siter(cur)38.3s9.1s10.2s30.4s4.4sUnbufferedPyMySQLMySQLdbmysql.connectorSingleStore (pure Python)SingleStorefetchall39.0s6.5s5.5s30.3s5.5sfetchmany(1000)39.4s7.0s6.0s30.4s4.1sfetchone34.5s8.9s10.1s30.8s6.6siter(cur)39.0s9.0s10.2s31.4s6.0sLicenseThis library is licensed under theApache 2.0 License.ResourcesSingleStorePython
Package: singleton-admin
Using singleton-admin will allow users to only add one instance of a model via the django admin site. Once created, the instance can be updated and deleted, but additional instances cannot be created.This is useful if you’d like to store a page content in the database for example.I found myself using this package (https://github.com/tttallis/django-singletons) a lot, but some of the code has now been depreciated through newer releases of Django.I originally had the intention of forking the package and making the fixes, but in the end I ended up re-writing from scratch. The end goal is the same, but with a different approach.I appreciate that there are probably plenty of packages out there that offer similar functionality, but as I’ve put this together and have used in my own projects, I thought I’d get it out there.Quick startInstall singleton-admin.Add “singleton_admin” to your INSTALLED_APPS:INSTALLED_APPS = [
    ...
    'singleton_admin',
]In your apps admin.py file to make your model a singleton-admin you can either do:from singleton_admin.admin import SingletonAdmin

admin.site.register(your_model, SingletonAdmin)Or if you’d like to add your own admin class:from singleton_admin.admin import SingletonAdmin

class your_model_admin(SingletonAdmin):
    ...

admin.site.register(your_model, your_model_admin)
Package: singleton-decorator
singleton-decoratorA testable singleton decorator allows easily create a singleton objects
just adding a decorator to class definition but also allows easily write
unit tests for those classes.A problemIf you use a simple singleton pattern based on a decorator function that
wraps a class with inner wrapper function like this:def singleton(cls):
    instances = {}
    def wrapper(*args, **kwargs):
        if cls not in instances:
          instances[cls] = cls(*args, **kwargs)
        return instances[cls]
    return wrapperit works fine with your classes, but it makes impossible a direct access
to the class object without decorator. So you cannot call methods using
a class name in unit tests:@singleton
class YourClass:
    def method(self):
        ...
YourClass.method(...)this code would not work becauseYouClassactually contains a wrapper function
but not your class object. Also this approach causes another problem if your
tests require separate instances of the objects, so a singleton pattern could
break an isolation of different tests.SolutionThesingleton-decoratoroffers a simple solution to avoid both of these
problems. It uses a separate wrapper object for each decorated class and holds
a class within__wrapped__attribute so you can access the decorated class
directly in your unit tests.InstallationTo install thesingleton-decoratorjust type in the command line:$ pip install singleton-decoratorUsageAt first import the singleton decorator:from singleton_decorator import singletonThen decorate you classes with this decorator:@singleton
class YourClass:
    ...That’s all. Now you could create or get existing instance of your class by
calling it as a simple class object:obj = YourClass()  # creates a new instance
obj2 = YourClass()  # returns the same instance
obj3 = YourClass()  # returns the same instance
...You also could pass args and kwargs into constructor of your class:obj = YourClass(1, "foo", bar="baz")NoteSince the singleton pattern allows to create only one instance from
the class, an__init__method would be called once with args and
kwargs passed at the first call. Arguments of all future calls would
be completely ignored and would not impact the existing instance at all.Unit testingIn your unit tests to run the methods of decorated classes in isolation
without instantiation the object (to avoid running a constructor code),
use the__wrapped__attribute of the wrapper object:# your_module.py
@singleton
class YourClass:
    def your_method(self):
        ...# tests.py
class TestYourClass(TestCase):
    def test_your_method(self):
        obj = mock.MagicMock()
        YourClass.__wrapped__.your_method(obj)
        ...This test runs a code of theyour_methodonly using a mock object
as theselfargument, so the test would be run in complete isolation
and would not depend on another pieces of your code including a constructor
method.
Package: singletondep
singletondepFully typed dependency management library focusing simplicity and flexibility.MotivationThis library aims to provide a simple approach to singleton dependency
management in projects. In modern live systems, there can be many objects that
are expensive and hard to control background tasks, connections, pools
life-cycles.Frameworks either have a very opinionated view on this, or rely on module-level
defined objects which may require dynamic parameters that are injected during
application startup. This causes module structures to access global variables
or importing completely unrelated modules in order to manage singleton
dependencies lifecycles applying anti-patterns all around.This library provides a simple approach to this problem by using simple
abstraction over raw functions.Requirementspython >= 3.10InstallationpipinstallsingletondepUsagefromsingletondepimportsingletondep@singletondepasyncdefget_db(db_url:str):db=Database(settings.db_url)awaitdb.connect()print("connection established")yielddbawaitdb.disconnect()print("disconnected from db")asyncdefmain():db_url="localhost/db_name"awaitget_db.init(db_url)# out: connection establisheddb=get_db()...awaitget_db.cleanup()# out: disconnected from dbThis library can be especially useful to manage dependencies in larger projects.Using as a FastAPI DependencyimportosfromfastapiimportFastAPI,APIRouter,DependsfrompydanticimportBaseSettingsfromsingletondepimportsingletondepfromsingletondep.ext.fastapiimportregister_depclassSettings(BaseSettings):url:str@singletondepasyncdefget_db(settings:Settings):db=awaitcreate_connection(settings.url)print("connected to db")yielddbawaitdb.disconnect()print("closed db connections")router=APIRouter()@router.get("/meaning")defget_meaning(db=Depends(get_db)):meaning=awaitdb.fetch_meaning()returnf"the meaning is{meaning}"defcreate_app()->FastAPI:app=FastAPI()app.include_router(router)settings=Settings(url=os.environ["url"])register_dep(get_db,app,settings)returnapp
Package: singleton-firebase
READMEThis README would normally document whatever steps are necessary to get your application up and running.What is this repository for?Quick summaryVersionLearn MarkdownHow do I get set up?Summary of set upConfigurationDependenciesDatabase configurationHow to run testsDeployment instructionsContribution guidelinesWriting testsCode reviewOther guidelinesWho do I talk to?Repo owner or adminOther community or team contact
Package: singletonify
# singletonify[![Build Status](https://travis-ci.com/Cologler/singletonify-python.svg?branch=master)](https://travis-ci.com/Cologler/singletonify-python)[![PyPI](https://img.shields.io/pypi/v/singletonify.svg)](https://pypi.org/project/singletonify/)## install``` cmdpip install singletonify```## usage``` py@singleton(a=3)class YourClass:def __init__(self, a): ...assert YourClass() is YourClass()```## why not otherThere are many singleton libraries on pypi, but their all has problem:* [singleton](https://pypi.python.org/pypi/singleton) - cannot use `issubclass()` or `__mro__` or ...* [singleton-decorator](https://pypi.python.org/pypi/singleton-decorator) - cannot use `isinstance()` .* [singleton_factory](https://pypi.python.org/pypi/singleton_factory) - wtf, why do people use `dict()[hash(obj)] = obj` ?* [singletonmetaclasss](https://pypi.python.org/pypi/singletonmetaclasss/0.1) - a little like this, but not a decorator.* [singleton3](https://pypi.python.org/pypi/singleton3) - haha* [pysingleton](https://pypi.python.org/pypi/pysingleton) - ABANDONED.
Package: singleton-meta
singleton_meta (v0.1.1)DESCRIPTION_SHORTCreate perfect singletonsDESCRIPTION_LONGdesigned for singletons creationFeaturesperfect singleton (maybe thread safe!)collect all instancescheck correct instantiating singletons in tree projectLicenseSee theLICENSEfile for license rights and limitations (MIT).Release historySee theHISTORY.mdfile for release history.Installationpip install singleton-metaImportfromsingleton_metaimport*USAGE EXAMPLESSee tests and sourcecode for other examples.1. example1.pyfromsingleton_metaimport*classMySingleton(SingletonByCallMeta):passclassMySingleton2(SingletonByCallMeta):passclassMySingleton(metaclass=SingletonMetaCallClass):pass# ===============================# 2. access to created instancesfromsingleton_metaimport*classVictim1(SingletonByCallMeta):attr=1classVictim2(SingletonByCallMeta):attr=2assertSingletonByCallMeta._SINGLETONS==[]Victim1()assertSingletonByCallMeta._SINGLETONS==[Victim1(),]assertVictim1._SINGLETONS==[Victim1(),]assertVictim1()._SINGLETONS==[Victim1(),]Victim2()assertSingletonByCallMeta._SINGLETONS==[Victim1(),Victim2(),]# ===============================# 3. NOTICE: all your Singletons must be only last classes!# don't use nesting from any Your Singletons!fromsingleton_metaimport*classMySingleton(SingletonByCallMeta):# OKpassclassMySingleton2(MySingleton):# WRONGpass
Package: single-variable-expression-parser-ALIEZZAT
SingleVariableExpressionParserPython package for parsing single variable mathmatical expressions.Table of supported math operations:OperationSyntax# of operandsAddition+2Subtractionsub2Multiplication*2Division/2L.Parantheses(>=1R.Parantheses)>=1sinsin1coscos1tantan1seqseq1csccsc1cotcot1power^2square rootsqr1minus-1InstallTo install the package usingpip:pip install single-variable-expression-parser-ALIEZZATUsageImport the module as the following:from math_expression_parser.single_variable_parser import SingleVariableParserThen it should be used as:parser = SingleVariableParser()
parser.set_math_function_text('sqr(16)+1') # For constant expression
result = parser.compute_function_at_value(0) # Here input has no effect on result since it is constant
print(result) # 5 will be printer 

parser = SingleVariableParser()
parser.set_math_function_text('x*2+x^2+5')
result = parser.compute_function_at_value(4) # Value of x will be 4
print(result) # 29 will be printedRunning unit testsRunpython3 -m unittest discoverto execute the unit tests viaunittest.
Package: single-version
Utility to let you have a single source of version in your code base.This utility targets modern Python projects which have layout generated byPoetry, with apyproject.tomlfile in place ofsetup.py. With this layout, the project initially has two places to maintain version string: one inpyproject.tomlfile and one in some*.pyfile (normally__init__.py):# pyproject.toml[tool.poetry]name="your-package"version="0.1.0"# your_package/__init__.py__version__="0.1.0"This duplicity often leads to inconsistency when you, the author, forget to update both.single-versionwas born to solve that headache circumstance. By convention, it chooses thepyproject.tomlfile as original source of version string. Your project’s__version__variable then is computed from it. When your package is already deployed and installed to some system, the version string will be retrieved from that Python environment (thepyproject.tomlis not included in distribution file).Years ago, to retrieve version for an installed package, people often usedpkg_resources, which has well-known issue of causing slow import. Learning from that mistake,single-versionuseimportlib.metadata, which becomes standard from Python 3.8, instead.UsageAddsingle_versionas your project dependency:poetryaddsingle-versionAssume that your package source tree is like this:.
├── awesome_name
│  └── __init__.py
├── pyproject.toml
├── README.rst
└── tests/where the__version__variable is defined inawesome_name/__init__.pyfile. The file content can be like this:frompathlibimportPathfromsingle_versionimportget_version__version__=get_version('awesome_name',Path(__file__).parent.parent)API Referencedefget_version(package_name:str, looked_path:Path) ->strpackage_name:  Your package’s name (same as inpyproject.tomlfile).looked_path(ofpathlib.Pathtype): Folder where your project’spyproject.tomlresides.
Package: singlish
A language processing tool for Singlish.InstallationRun the following command in your virtualenv to install this package.pip install singlishHow to useSinhala 2 Singlishfromsinglish.sinhalaToSinglishimportSinhalaToSinglishif__name__=='__main__':singlish=SinhalaToSinglish()print(singlish.convert('à¶ºà¶­à·”à¶»à·”à¶´à·”à·€à¶»à·”à·€'))Visithere.ContributionsContactcontactasanka9@gmail.comif you would like to contribute to this project.LicenseMIT License
Package: singlue
singlueA CLI tool to resolve function,class codes and integrate them to single file.This program depends onast.unparse()(added inpython3.9).installationpipinstallsinglueexample usagesingluemain.py>output.pysingluegeneratesoutput.pyfrommain.py,library.py.main.pyfromlibraryimportone,two,Threeassertone()+two()==Three().three()library.pydefone()->int:return1deftwo()->int:return2classThree:def__init__(self):self.value=3defthree(self):returnself.valueoutput.pydefone()->int:return1deftwo()->int:return2classThree:def__init__(self):self.value=3defthree(self):returnself.valueassertone()+two()==Three().three()