Saravanan666/pypi-org huggingface dataset:
Package: tinypubsub
tinypubsubTiny pub-sub (observer) pattern implementation.Usagefromtinypubsub.simpleimportSimplePublisherpublisher=SimplePublisher()subscription=publisher.subscribe(lambdamessage:print(message))publisher.publish("Hello!")publisher.unsubscribe(subscription)Or:fromtinypubsub.simpleimportSimplePublisherpublisher=SimplePublisher()withpublisher.subscribe(lambdamessage:print(message)):publisher.publish("Hello!")Featurestinypubsub.Publisherhas abstract methods:publish,subscribe,unsubscribe,unsubscribe_all.tinypubsub.simple.SimplePublisher: Dict-based implementation ofPublisher.tinypubsub.weakref.WeakrefPublisher: WeakKeyDictionary-based implementation ofPublisher.APIModuletinypubsubabstract classPublisher[Message]Abstract publisher class.type parameterMessageType of message that will be published.abstract methodpublish(message: Message) -> NonePublish message to subscribers.abstract methodsubscribe(subscriber: Callable[[Message], None]) -> SubscriptionAdd subscriber.abstract methodunsubscribe(subscription: Subscription) -> NoneDelete subscriber.abstract methodunsubscribe_all() -> NoneDelete all subscribers.classSubscriptionReturn value ofPublisher.subscribe().
It can be used as a context manager as:withpublisher.subscribe(...)assubscription:...andsubscription.unsubscribe()will be called when exit.methodunsubscribe() -> Nonesubscription.unsubscribe()is the same aspublisher.unsubscribe(subscription), wheresubscription = publisher.subscribe(...).Moduletinypubsub.simpleclassSimplePublisher[Message]Implementation ofPublisher[Message].Moduletinypubsub.weakrefclassWeakrefPublisher[Message]Implementation ofPublisher[Message].This implementation uses WeakKeyDictionary to manage subscribers.
This may prevent a memory leak if subscription loses all strong references before unsubscribed:publisher=WeakrefPublisher()subscription=publisher.subscribe(...)assertlen(publisher._subscribers)==1delsubscriptionassertlen(publisher._subscribers)==0Note that theunsubscribemethod will not be called in the above case,
so normally you should unsubscribe explicitly or use context manager.
Package: tinypy
tinypyTinypy is a collection of small Python functions and classes which make common patterns shorter and faster. All of these can be done by it:convert JSON files to CSV filesconvert CSV files to JSON filesInstallationpipinstalltinypyUsageScriptYou can also convert the JSON file to a CSV file by passing the "src "and "dest" directories to the functionjson2csv(src, dest)importtinypyastp_tp=tp.Tinypy()_tp.json2csv(src="sample.json",dest="new-sample.csv")This will convert the JSON file located atsample.jsonto a CSV file located atnew-sample.csv.Command Line InterfaceTinypy also provides a command line interface for converting JSON files to CSV files.tinypy-ssample.json-dnew-sample.csvjson2csvThis command will convert the JSON file located atsample.jsonto a CSV file located atnew-sample.csv.Advanced UsageTo get more information, use -h or --help in Command Line Interface.>tinypy-h

usage:tinypy[-h][-v]-simport.json-dexport.csv-a

TinypyisacollectionofsmallPythonfunctionsandclasseswhichmakecommonpatternsshorterandfaster.

options:-h,--helpshowthishelpmessageandexit-v,--versionshowprogram'sversionnumberandexit-simport.json,--srcimport.jsonThepathtotheJSONfiletoconvert-dexport.csv,--destexport.csvThepathtotheCSVfiletocreate-a,--actionjson2csv,csv2json

DocumentationisavailableattheGitHubpage:https://github.com/arashyeganeh/tinypyOptionsactionAction nameDescriptionDocsjson2csvconvert JSON files to CSV filesReadcsv2jsonconvert CSV files to JSON filesReadRequirementsPython 3LicenseThis library is released under the MIT License.ContributingThe Tinypy project welcomes contributions.Please submit a pull request or an issue on GitHub if you have any improvements to suggest.SupportIf you have any issues or questions, please feel free to reach out to us onthe GitHub.ReferencesMore information can be found on theGitHub page.
Package: tinyrecord
TinyDB __  _                                   __
      / /_(_)__  __ _________ _______  _______/ /
     / __/ / _ \/ // / __/ -_) __/ _ \/ __/ _  /
     \__/_/_//_/\_, /_/  \__/\__/\___/_/  \_,_/
               /___/Supported Pythons:3.5+Tinyrecord is a library which implements atomic
transaction support for theTinyDBNoSQL database.
It uses a record-first then execute architecture which
allows us to minimize the time that we are within a
thread lock. Usage example:fromtinydbimportTinyDB,wherefromtinyrecordimporttransactiontable=TinyDB('db.json').table('table')withtransaction(table)astr:# insert a new recordtr.insert({'username':'john'})# update records matching a querytr.update({'invalid':True},where('username')=='john')# delete recordstr.remove(where('invalid')==True)# update using a functiontr.update(updater,where(...))# insert many itemstr.insert_multiple(documents)Note that due to performance reasons you cannot view
the data within a transaction unless you’ve comitted.
You will have to call operations on the transaction
object and not the database itself. Since tinyrecord
works with dictionaries and the latest API, it will
only support the latest version (4.x).Installation is as simple aspip install tinyrecord.
Package: tiny-render
Tiny RenderVersion: 0.2.0This is a very simple wrapper forJinja2by providing few built-in variables.Additional variables for theTemplate,{{ _gitsha }}- will be the shortsha forgithash, the value will beNoneifgitis not
installed or the current directory is not a git repo.{{ 'HOME' | getenv }}- the environment variableHOMEwill be renderred. It will raise exception
ifHOMEis not set{{ _date_str }}- the current date inyyyymmddformat{{ _time_str }}- the current date/time inyyyymmddHHMMSSformatInstallationpipinstalltiny-renderSample Codefromtiny_renderimportRenderwithopen(os.path.join("/tmp","test.txt"),'w')asf:f.write("gitsha: {{_gitsha}}, hello {{key}}")params={"key":"world"}r=Render("/tmp")r.go("test.txt",**params)# the output is "gitsha: xxxxxxx, hello world"
Package: tinyrl
TinyRLA Python wrapper for RLtools (https://rl.tools). PyTorch is only used for itsutils that allow convenient wrapping of C++ codeto compile RLtools. The RLtools training code needs to be compiled at runtime because properties like the observation and action dimensions are not known at compile time. One of the fundamental principles of RLtools is that the sizes of all data structures and loops are known at compile-time so that the compiler can maximally reason about the code and heavily optimize it. Hence this wrapper takes an environment (Gymnasiuminterface) factory function as an input to infer the observation and action shapes and compile a bridge environment that is compatible with RLtools.This wrapper is work in progress and for now just exposes the SAC training loop and does not allow much modification of hyperparameters etc. yet. Stay tuned.Installation:pip install tinyrlFor the following example:pip install gymnasiumExample:from tinyrl import SAC
import gymnasium as gym

seed = 0xf00d
def env_factory():
    env = gym.make("Pendulum-v1")
    env.reset(seed=seed)
    return env

sac = SAC(env_factory)
state = sac.State(seed)

finished = False
while not finished:
    finished = state.step()Evaluating the Trained Policypip install gymnasium\[classic-control\]env_replay = gym.make("Pendulum-v1", render_mode="human")

while True:
    observation, _ = env_replay.reset(seed=seed)
    finished = False
    while not finished:
        env_replay.render()
        action = state.action(observation)
        observation, reward, terminated, truncated, _ = env_replay.step(action)
        finished = terminated or truncatedAccelerationOn macOS TinyRL automatically uses Accelerate. To use MKL on linux you can install TinyRL with themkloption:pip install tinyrl[mkl]
Package: tiny-router
tiny-routerTiny HTTP router.Usagefromtiny_routerimportSimpleRouterrouter=SimpleRouter()@router.get("/users/{user_id}")defget_user(params):ifparams.get("user_id")==1:return{"id":1,"name":"Alice"}route=router.resolve("GET","/users/{user_id}")user=route({"user_id":1})assertuser=={"id":1,"name":"Alice"}More examples are inexamples/directory ofrepository.FeaturesSimpleRouter: exact-match routerSimpleRegexRouter: simple regex-based routerAbstractRouter: user can implement their own routersSupport for type hintsAPIModuletiny_routerTODO
Package: tinysa
tinysa is a minimal implementation for constructing a suffix array.Quick StartTo install tinysa, run this command in your terminal:$pipinstalltinysaUsing tinysa, you can construct a suffix array as follows:fromtinysa.tinysaimportTinySAsuffix_array=TinySA()suffix_array.index('banana')Then, you can find a suffix that begins with a substring as follows:position=suffix_array.search('ana')print(position)# => 1
Package: tinyscaf
TinyscafTinyscaf is a micro scaffolder for simple files you produce all the time.
It is an easy way to standardize the basic structure of files you use all the time
in projects.Installationpip install tinyscafConfigurationCreate a directory calledtemplatesCreate a configuration file calledtinyscaf.jsoninside the templates directoryCreate a jinja2 template file using tinyscaf.<variable_name> for the items you want replacedIn tinyscaf.json, create a list of objects, one per jinja templatePopulate the json object with thevariable_nameas the key and the value is the question you want to prompt the user with.Any matching tinyscaf.<variable_name> will be replaced the in output fileExampletemplates/tinyscaf.json[
    {
    "template_name": "view.jinja",
    "file_name": "{view_name}.sql",
    "view_name": "What is the name of this view?"
    }
]templates/view.jinjaCREATE VIEW { tinyscaf.view_name } AS
SELECT order_id, customer_name, total_amount
FROM orders limit 100;Thetemplate_namekey in each json object is required to identify the associated template.
If you want to have a file naming standard based on the answer of one of your
questions, you can use the keyfile_nameand the value pointing to the variable_name
of the question you want to use in jinja templating formatting.[
    {
        "template_name": "function.jinja",
        "function_name": "What is the name of the function?",
        "file_name": "{function_name}.sql"
    }
]Useage:From the parent folder of templates run tinyscaf
Tinyscaf will automatically search the templates directorys for the tinyscaf.json file
and any jinja files in the template directory$> tinyscaf
Choices: 
 
0 - function.jinja 
1 - view.jinja
Choose a template file:  1
What is the name of this view? test_view
File name will be: test_view.sql - Specify the directory to save to. Leave blank for working dir. 
$> 2024-02-02 00:32:42,918 [INFO] [tinyscaf:188] - FinishedIf you are not in the parent folder of templates, you can override the auto search for tinyscaf.json
and specify the path to the config file manually. Tinyscaf will then search the directory
where the config file lives for any jinja template files.$> tinyscaf --config_file ../../templates/tinyscaf.json
Choices: 
 
0 - function.jinja 
1 - view.jinja
Choose a template file:  1
What is the name of this view? test_view
File name will be: test_view.sql - Specify the directory to save to. Leave blank for working dir. 
$> 2024-02-02 00:32:42,918 [INFO] [tinyscaf:188] - Finished
Package: tinyscaler
A small CPU image scaling library with SIMD support on x86_64 and Arm (Neon). This project is aimed to replace OpenCV for image resizing, resolving installation inconveniences and compatibility issues. We developed this for future use in Gymnasium and PettingZoo wrappers.InstallationYou can install from PyPI usingpip install tinyscaler. Linux and macOS with Python 3.7, 3.8, 3.9, 3.10 and 3.11 are supported.UsageTinyscaler contains a single external function,scalethat using a numpy array input for the image and the new resized shape, returns the resized image.importnumpyasnpimporttinyscalerimg=np.random.rand(64,64,4).astype(np.float32)resize_img=tinyscaler.scale(img,(32,32))print(resize_img.shape,resize_img.dtype)# (32, 32) np.float32TinyScaler supports mode='area', mode='bilinear', and mode='nearest' filtering. It also allows one to pass a destination buffer in order to avoid duplicate memory allocations.Area filtering is only really useful for downscaling, bilinear will be used even when area filtering is set if upscaling. Area filtering is also likely not worth it when downscaling less than or equal to 2x.TinyScaler is used through a single function. The full signature is:scale(src:np.ndarray,size:tuple,mode='area',dst:np.ndarray=None)Note that thesizetuple parameter is (width, height). However, the numpy arrays have dimensions ordered as (height, width, channels). This is similar to OpenCV.TinyScaler expects a contiguous numpy array. If it is not contiguous, it will throw an error. You can make a non-contiguous numpy array contiguous by callingnp.ascontiguousarray. Usually a numpy array will already be contiguous.If the final array dimension is not 4 (RGBA), it will automatically convert to it. Further, if the array is uint8, it will be converted to float32. So the prefered array has a shape(height, width, 4)anddtype=np.float32.Finally, downscaling is the focus of TinyScaler. It can also upscale, but it will not be as fast as a more complex separable algorithm in that case.PerformanceIn asimple benchmark, we resized the same image (4928x3279) down to (852x567) 100 times using bilinear filtering with several libraries. Here are the times (in seconds) spent (measured with Python's perf_counter) on a AMD 1950x:Time elapsed for tinyscaler: 0.7968465110002398
Time elapsed for OpenCV: 0.48667862100001
Time elapsed for Pillow: 12.672875003999707
Time elapsed for skimage: 164.45401711399973And with area filtering (just TinyScaler and OpenCV):Time elapsed for tinyscaler: 4.34793155800071
Time elapsed for OpenCV: 8.118138265999733All methods were forced to use a single thread. OpenCV is slightly faster than TinyScaler for bilinear filtering, but TinyScaler remains very fast regardless.Interestingly, for area filtering, TinyScaler is faster (almost 2x).
Package: tinyscpi
tinySCPIA Python library that enables the use of SCPI commands on the tinySA.See theCommandsdocumentation for each command and a description.Table of ContentsGetting StartedDependenciesUnit TestingCoverageContact UsSafetyOutputGetting StartedCreate a new Python file.In your terminal/command line, install the tinySCPI library by typingpip install tinyscpiCopy and paste the below code into your Python file.fromtinyscpiimporttinySCPIprint(tinySCPI.user_input("*IDN?"))Connect the tinySA device to your computer via USB. Your device should have come with said cable.Run the file using the line below. Ensure your command-line/terminal is in the same path as your Python file!python3 <name_of_your_file>.pyThis should return something similar to this, it will usually be specific to your device but in a similar format:Running info 
tinySA v0.3
2019-2022 Copyright @Erik Kaashoek
2016-2020 Copyright @edy555
SW licensed under GPL. See: https://github.com/erikkaashoek/tinySA
Version: tinySA_v1.3-506-g8291e1e
Build Time: Nov 28 2022 - 14:01:16
Kernel: 4.0.0
Compiler: GCC 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]
Architecture: ARMv6-M Core Variant: Cortex-M0
Port Info: Preemption through NMI
Platform: STM32F072xB Entry Level Medium Density devices
ESD protectedNow you're ready to execute any of the commands located in theCommand Tree!If you're looking for a taste of what you're capable of with tinySCPI, see thisExample ScriptTo see what other functions are a part of our library see theClass DocumentationDependency:tinySCPI requires python >= 3.6, pyserial, pytest, and pytest-covpip install pyserialpip install pytestpip install pytest-covUnit Test:pytestis required to execute unit tests.You can install pytest library by typingpip install pytestin your terminal/command lineYou can execute unit tests by typingpytestin your terminal/command line root directoryscpi`Coverage:pytestandpytest-covare required to execute code coverage analysis.You can install pytest andn pytest-ocv library by typingpip install pytest pytest-covin your temrinal/command line.You can execute unit tests by typingpytest --cov-config=.coveragerc --cov=tinyscpi tinyscpi/tests/ --cov-report htmlAfter the execution you will be able to find the coverage report at./htmlcov/index.htmlContact Us:Email:tinyscpi@vt.eduSafety:Like with all RF devices, there involves some risk in operation. For more information, please refer toSafety.Output:On older firmware, output mode control over serial may not be stable and can return the "FATAL ERROR" message on screen.Updating to a newer firmwareseems to resolve this issue.
Package: tinysegmenter
“TinySegmenter in Python” is a Pythonportby Masato Hagiwara ofTinySegmenter, which is an extremely compact Japanese tokenizer originally written in JavaScript by Mr. Taku Kudo.The library has been finally packaged by Jehan. It resulted into this fork because Masako Hagiwara did not answer emails, and packaging patches
could therefore not be committed upstream. But this is a friendly fork, and Masako Hagiwara is welcome to take back maintainance over his
project.
For the time being, I (Jehan) took up the maintenance, so please refer to this newwebsiteas being official, and
direct any newpatchthere. I will follow up on patchs and bug reports, but probably won’t maintain an active development. Anyone wishing to
improve the library is welcome to participate and will be gladly given committer rights.It works on Python 2.6 or above (works on Python 3 too).AuthorsSee all authors and contributors inAUTHORSfile.Download and InstallationThis library can be installed the common ways: with a setup.py, as a pip package…
See theINSTALLfile in the package for more details.If you simply want to download the source package, refer to the pypi repository:http://pypi.python.org/pypi/tinysegmenterDevelopment version can be downloaded anonymously at the Git repository:$ git clone git://git.tuxfamily.org/gitroot/tinysegmente/tinysegmenter.gitor browsed online at:http://git.tuxfamily.org/tinysegmente/tinysegmenter/UsageExample code for direct usage:> import tinysegmenter
> segmenter = tinysegmenter.TinySegmenter()
> print(' | '.join(segmenter.tokenize(u"私の名前は中野です")))
私 | の | 名前 | は | 中野 | ですTinySegmenter‘s interface is compatible withNLTK’sTokenizerIclass, although the distribution does not directly depend on NLTK.
Here is one way to use it as a tokenizer in NLTK (order of the multiple base classes matters):import nltk.tokenize.api

class myTinySegmenter(tinysegmenter.TinySegmenter, nltk.tokenize.api.TokenizerI):
    pass
segmenter = myTinySegmenter()
# This segmenter can be used any place which expects a NLTK's TokenizerI subclass.For more about NLTK (Natural Language Toolkitmodule), see:http://nltk.org/api/nltk.tokenize.html#nltk.tokenize.api.TokenizerIContact, Bugs and ContributingAll bug, patch, question, etc. can be sent totinysegmenteratzemarmotdotnet.LicenseThis package is distributed under a New BSD License (seeCOPYINGfile).
Package: tinysegmenter3
TinySegmenter----------TinySegmenter -- Super compact Japanese tokenizer was originally created by(c) 2008 Taku Kudo for javascript under the terms of a new BSD licence.For details, see [here](http://lilyx.net/pages/tinysegmenter_licence.txt)tinysegmenter for python2.x was written by Masato Hagiwara.for his information see [here](http://lilyx.net/pages/tinysegmenterp.html)This tinysegmenter is modified for python3.x and python2.x for distribution by Tatsuro Yasukawa.Additionaly, this tinysegmenter is modified for being more faster - thanks to@chezou, @cocoatomo and @methane.See info about [tinysegmenter](https://github.com/SamuraiT/tinysegmenter)Installation------------```pip install tinysegmenter3```Usage----------```pyimport tinysegmenterstatement = '私はpython大好きStanding Engineerです．'tokenized_statement = tinysegmenter.tokenize(statement)print(tokenized_statement)# ['私', 'は', 'python', '大好き', 'Standing', ' Engineer', 'です', '．']```Test Text----------The [test text](http://www.genpaku.org/timemachine/timemachineu8j.txt) (in the `tests` directory) was [The Time Machine](https://en.wikipedia.org/wiki/The_Time_Machine) by H.G. Wells, translated to Japanese by Hiroo Yamagata under the CC BY-SA 2.0 License.How to run Test-----------Install requirements from `requirements.txt` by```pypip install -r requirements.txt```then run this:```py./runtests.sh```
Package: tinysets
TinySetsThis project contains different datasets.The main purpose of these sets is to quickly check the performance of
models and algorithms.Table of contentsHow to useInstallationPyPIDatasetsLEGO Minifigures ClassificationUkrainian Descriptions Of WordsHow to useYou can see all available sets and their actual locations using the next code:>>> from tinysets import get_all_sets
>>> get_all_sets()
{'LEGO Minifigures Classification': ['https://www.kaggle.com/ihelon/lego-minifigures-classification']}'InstallationPyPIYou can use pip to install evaluations:pip install tinysetsOr you can clone and install the latest version of the library from GitHub:pip install -U git+https://github.com/yisaienkov/tinysetsDatasetsLEGO Minifigures ClassificationThis dataset contains pictures of various LEGO Minifigures. There are several
images in different poses and with different environments for each Minifigure in
the dataset.Currently, it contains 7 figures (76 images totally) from the LEGO setsYoda's Hut,Spider Mech vs. Venom.This dataset is available inKaggle DatasetsUkrainian Descriptions Of WordsThis dataset contains descriptions of various words in simple terms by different
people. It looks like the Alias game when you need to describe the desired word
using other words so that the other player guesses your word.Currently, it contains descriptions from 8 different people for 15 unique words.This dataset is available inKaggle Datasets
Package: tinyshakespeareloader
TinyShakespeareLoaderA PyTorch DataLoader for the TinyShakespeare DatasetIf you followed Andrej Karparthy's tutorial on GPT, you will notice he used the TinyShakespeare dataset, but not with the PyTorch DataLoader.
This repository fills that gap.The TinyShakespeare dataset is a small dataset of Shakespeare's plays, with each line as a separate sample. To install this package, simply run:pip install TinyShakespeareLoaderThen, to use it, simply import it and use it as a PyTorch DataLoader:fromTinyShakespeareLoader.hamletimportget_datatinyshakespeare=get_data()train_dataloader,test_dataloader=tinyshakespeare.train_dataloader,tinyshakespeare.test_dataloaderforbatchintrain_dataloader:print(batch)You can provide your own encoder function if you want - but it's not required! If you don't, it will just simply use the character level encoding, that Andrej also used in his tutorial.
Package: tinyshap
tinyshapA minimal implementation of the SHAP algorithm using the KernelSHAP method. In less then 100 lines of code, this repo serves as an educational resource to understand how SHAP works without all the complexities of a production-level package.InstallationpipinstalltinyshapExample usagefromtinyshapimportSHAPExplainer# Train modelmodel=GradientBoostingRegressor()model.fit(X_train,y_train)# Explain predictionsexplainer=SHAPExplainer(model.predict,X=X_train.mean().to_frame().T)contributions=explainer.shap_values(X)See completenotebookResourcesA Unified Approach to Interpreting Model Predictions (arXiv)Interpretable Machine LearningLicenceMIT
Package: tinysklearn
tinysklearn仿制了部分sklearn接口，结构简单，容易理解，非常适合机器学习入门项目地址使用方法安装pip install tinysklearn使用使用方法和sklearn是一致的(至少实现了fit,predict,transform,score这四种方法)from tinysklearn.tinysklearn import LinearRegression
from tinysklearn.datasets import load_boston
from tinysklearn.preprocessing import StandardScaler
from tinysklearn.neighbors import KNeighborsClassifier
from tinysklearn.model_selection import train_test_split
from tinysklearn.decomposition import PCA
from tinysklearn.metrics import mean_absolute_error

#读取数据
boston = load_boston()
x = boston.data
y = boston.target

#分割训练集测试集
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=666666)

#构建模型,训练
lr = LinearRegression()
lr.fit(x_train, x_test)

#预测
lr.predict(x_test)

#评估
lr.score(x_test, y_test)