Saravanan666/pypi-org huggingface dataset:
Package: tinyimagenet
torchvision-tinyimagenetDataset class for PyTorch and the TinyImageNet dataset.Installationpip install tinyimagenetHow to usefrom tinyimagenet import TinyImageNet
from pathlib import Path
import logging

logging.basicConfig(level=logging.INFO)

split ="val"
dataset = TinyImageNet(Path("~/.torchvision/tinyimagenet/"),split=split)
n = len(dataset)
print(f"TinyImageNet, split {split}, has  {n} samples.")
n_samples = 5
print(f"Showing info of {n_samples} samples...")
for i in range(0,n,n//n_samples):
    image,klass = dataset[i]
    print(f"Sample of class {klass:3d}, image {image}, words {dataset.idx_to_words[klass]}")You can also check thequickstart notebookto peruse the dataset.Finally, we also provide some example notebooks that use TinyImageNet with PyTorch models:Evaluate a pretrained EfficientNet modelTrain a simple CNN on the datasetFinetune an EfficientNet model pretrained on the full ImageNet to classify only the 200 classes of TinyImageNet
Package: tinyinject
tinyinjectA minimalistic protocol driven dependency injection framework for python.Installationpython -m pip install tinyinjectExamplesRegistering implementation to the DI registry# package/protocols.pyfromtypingimportProtocolclassArithmetic(Protocol):defsum(self,a:int,b:int)->int:...# package/providers.pyfromtinyinjectimportdifromprotocolsimportArithmetic@di.implements(interface=Arithmetic)class_ArithmeticImplementation:defsum(self,a:int,b:int)->int:returna+b# package/__init__.py# IMPORTANT: this ensures provider gets registered in the DIfrom.importproviders# noqaRequesting dependencies viaRequiredescriptor# main.pyfromtinyinjectimportdifrompackage.protocolsimportArithmeticclassApp:_dependency:Arthmetic=di.Require(Arithmetic)defformat_sum(self,a:int,b:int):print(f"Sum of{a}and{b}is{self._dependency.sum(a,b)}")Requesting dependencies viarequest_kwargsdecorator# main.pyfromtinyinjectimportdifrompackage.protocolsimportArithmetic@di.require_kwargs(dependency=Arithmetic)defformat_sum(self,a:int,b:int,*,dependency:Arithmetic):print(f"Sum of{a}and{b}is{dependency.sum(a,b)}")Dependency Injection of functions# package/protocols.pyfromtypingimportProtocolclassSum(Protocol):def__call__(self,a:int,b:int)->int:...# package/providers.pyfromtinyinjectimportdifrom.protocolsimportSum@di.implements(interface=Sum)defsum_func(a:int,b:int)->int:returna+b# package/__init__.pyfrom.importproviders# noqa# main.pyfromtinyinjectimportdifrompackage.protocolsimportSumclassApp:_sum:Sum=di.Require(Sum)defformat_sum(self,a:int,b:int)->int:print(f"Sum of{a}and{b}is{self._sum(a,b)}")Usingoverridecontext managerThis is written with testing in mind, however it will work in any use case where temporary replacement
of the provider is necessary.# test_sum.pyfromunittestimportmockfromtinyinjectimportdifromsrc.package.protocolsimportArithmeticfromsrc.mainimportAppclassTestSum:deftest_app_format_sum_always_call_sum_with_correct_parameters(self):spy=mock.MagicMock()withdi.override(Arithmetic,using=spy):App().format_sum(1,2)spy.sum.assert_called_with(1,2)
Package: tinyioc
tinyIOCA lightweight python library for dependency injection.
It allows service injection using one decorator on top of your function, and service registration in multiple ways:programmaticallythrough decoratorsdeclaratively through modulesInstallInstall it from pypi:pipinstalltinyiocDocumentationRead the docs here:https://tinyioc.readthedocs.io/en/latest/LicenseThis library is licensed under MIT license: more infohere
Package: tinyjambu
A sample Python projectA sample project that exists as an aid to thePython Packaging User
Guide'sTutorial on Packaging and Distributing
Projects.This project does not aim to cover best practices for Python project
development as a whole. For example, it does not provide guidance or tool
recommendations for version control, documentation, or testing.The source for this project is available here.Most of the configuration for a Python project is done in thesetup.pyfile,
an example of which is included in this project. You should edit this file
accordingly to adapt this sample project to your needs.This is the README file for the project.The file should use UTF-8 encoding and can be written usingreStructuredTextormarkdownwith the appropriatekey set. It will be used to generate the project webpage on PyPI and will be
displayed as the project homepage on common code-hosting services, and should be
written for that purpose.Typical contents for this file would include an overview of the project, basic
usage examples, etc. Generally, including the project changelog in here is not a
good idea, although a simple “What's New” section for the most recent version
may be appropriate.
Package: tinykernel
tinykernelA minimal Python kernel, so you can run Python in your Python.All the clever stuff in this library is provided by Python's builtinastmodule and compilation/exec/eval system, along withIPython'sCachingCompilerwhich does somedeep magic.tinykerneljust brings them together with a little glue.InstallWith pip:pip install tinykernelWith conda:conda install -c fastai tinykernelHow to useThis library provides a single class,TinyKernel, which is a tiny persistent kernel for Python code:k=TinyKernel()Call it, passing Python code, to have the code executed in a separate Python environment:k("a=1")Expressions return the value of the expression:k('a')1All variables are persisted across calls:k("a+=1")k('a')2Multi-line inputs are supported. If the last line is an expression, it is returned:k("""import typesb = types.SimpleNamespace(foo=a)b""")namespace(foo=2)The original source code is stored, soinspect.getsourceworks and, tracebacks have full details.k("""def f(): pass # a commentimport inspectinspect.getsource(f)""")'def f(): pass # a comment\n'When creating aTinyKernel, you can pass a dict of globals to initialize the environment:k=TinyKernel(glb={'foo':'bar'})k('foo*2')'barbar'Passnameto customize the string that appears in tracebacks ("kernel" by default):k=TinyKernel(name='myapp')code='''def f():return 1/0print(f())'''try:k(code)exceptExceptionase:print(traceback.format_exc())Traceback (most recent call last):
  File "<ipython-input-37-8b370e64c5cb>", line 5, in <module>
    try: k(code)
  File "/home/jhoward/git/tinykernel/tinykernel/__init__.py", line 20, in __call__
    if expr: return self._run(Expression(expr.value), nm, 'eval')
  File "/home/jhoward/git/tinykernel/tinykernel/__init__.py", line 12, in _run
    def _run(self, p, nm, mode='exec'): return eval(compiler(p, nm, mode), self.glb)
  File "<myapp--1-57331cf14e08>", line 3, in <module>
    print(f())
  File "<myapp--1-57331cf14e08>", line 2, in f
    return 1/0
ZeroDivisionError: division by zeroAcknowledgementsThanks to Christopher Prohm, Matthias Bussonnier, and Aaron Meurer for their helpful insights inthis twitter thread.
Package: tiny-kubernetes
tiny-kubernetestiny-kubernetesprovides a thin wrapper on top ofrequeststo make it
easier to work with Kubernetes APIs.FeaturesAutomatic authentication ($KUBECONFIG)Simplified response traversal (never['do']['this']['again']) thanks toDotMapSane exceptionsNo crazy complex client-side APIs to deal withWhy?The officialkubernetespackage is, uh, complex. While it does support all
the advanced features the Kubernetes API offers (like WebSocket streaming) it is
often non-trivial to work with. tiny-kubernetes aims to provide most of the same
functionality with minimal overhead.Installationpip install tiny-kubernetesUsagefromtiny_kubernetesimportKubernetesAPIClientclient=KubernetesAPIClient()client.load_auto_config()pods=client.get('/api/v1/namespaces/{}/pods','default')forpodinpods['items']:printpod.metadata.nameNotice that you can access (almost) all parts of the Kubernetes API response
using dot accessors (courtesy ofDotMap). As.items()is a reserved name
in dictionaries, it needs to be accessed more traditionally, but most other
member names can use the shortened syntax.The endpoint is formatted usingstr.formatwith the remaining positional
arguments. All keyword arguments are passed through to requests'sSession.request, so you can include a body withjson={...}or URL
parameters withparams={...}.A specialjson_patchmethod exists to help perform patches. It works around
a few potential requests bugs automatically. For example, it can be used to
append labels to a resource:client.json_patch([{'op':'add','path':'/metadata/labels/foo','value':'bar'}],'/api/v1/namespaces/{}/pods/{}','default','some-pod')NotesTemporary files may be created if using a local$KUBECONFIGwith
base64-encoded certificates. Due to limitations in python's SSL library these
must be decoded and written to the filesystem to be used. They should be
cleaned up when the interpreter exits.
Package: tinylang
🦜🔗🔍 TinylangDocumentationMake working with LLMs insanely simpler and easier than ever before.What is tinylang?A hackable and simpler Langchain.Langchain can be very cumbersome and annoying to work with. It's too big, complicated, and shoves pre-made prompts down your throat.With tinylang, everything is intuitive and customizable, following most of the Langchain API.InstallationpipinstalltinylangUsagefromtinylang.chainsimportChainfromtinylang.llmsimportOpenAIfromtinylang.memoryimportConversationMemorymodel="gpt-3.5-turbo"chatGPT=OpenAI(openai_api_key=openai_api_key,openai_organization=openai_organization,model=model,)memory=ConversationMemory()chain=Chain(llm=chatGPT,memory=memory,)prompt="Hello"print(chain.run(prompt))Features🧠 Conversation Memory. Keep all or some aspects of your conversation🛸 OpenAI LLMs. It couldn't be easier to call the OpenAI API.💻 Prompts. Simple and hackable.🤖 Agents. Coming soon!
Package: tinylimit
Tiny LimitWhat is TinyLimit?tinylimit is a python modules that limits and anti-limits the calling rate of a function
与其他的limit库所不同的是，tinylimit在实战中考虑到了这些因素：提供anti-limit的方法为了让client无视被调用函数所做出的limit限制，我们提供将调用结果保存下来，如果达到被调函数已达调用频率上线，client不是直接报错，而是直接返回最近一次的调用缓存，在某些场景下（比如获取某一日的PV），读取缓存数据并不会令程序逻辑紊乱，却避免了client堵塞。这样client可以按自己的需要随意调用受限函数即可，避免client写冗长的容错逻辑根据上下文施加limit大部分的limit库是以函数为单位做limit，实际上很多第三方的API接口的限制单位为token，不同的token不会共享同一个limit额度，所以以函数名为指纹太泛，我们这里取了类实例的上下文、函数名、函数的参数列表三类信息来形成被调对象的指纹，用以应对这类场景Programming Languagepython 2.7python 3.7Installpip install tinylimitQuick Startuse python decorators syntax to wrap the call targetfrom tinylimit import AntiLimit

@AntiLimit(2,1)
def Add(a, b):
    return a + b

class Foo():
    @AntiLimit(2,1)
    def Bar(self, a, b):
        return a - bFunctions ListAntiLimit()
Package: tiny-listener
A lightweight event frameworkDocumentation:https://molto0504.github.io/tiny-listenerSource Code:https://github.com/molto0504/tiny-listenerIntroductionTiny-listener is a lightweight and flexible event framework.RequirementsPython 3.8+Installation$pipinstalltiny-listenerWhy use tiny-listener✔ Pure Python.✔ Lightning-fast, based on native coroutine.✔ 100% test coverage.ExampleConsider we want to write a program keep listening message received from somewhere (e.g. http request or message queue), when message arrived, we want to execute a series of operations in a certain order, e.g.step 1: save user data to databasestep 2: send email to userIn the development process, we often encounter such problems:the source of step 1 and step 2 may be differentstep 2 may depend on the result of step 1, that is to say, step 2 may need to wait for step 1 to completethere are many messages, many events, and it is not easy to maintainTiny-listener may help you solve these problems:Create a fileexample.pywith:fromtiny_listenerimportEvent,Listener,ParamclassApp(Listener):asyncdeflisten(self):ctx=self.new_ctx()ctx.trigger_event("step 2: send email to alice@tl.com")ctx.trigger_event("step 1: save Alice's data to database",data={"age":35})app=App()@app.on_event("step 1: save{username}'s data to database")asyncdefstep_1(event:Event,username:Param):age=event.data["age"]print(f"Step-1: Save data done!,{username=},{age=}")@app.on_event("step 2: send email to{email}")asyncdefstep_2(event:Event,email:Param):awaitevent.wait_event_done("step_1")print(f"Step-2: Send email done!,{email=}")Run it:$tiny-listenerexample:app
>>>Savedatadone!,username='Alice',age=35>>>Sendemaildone!,email='alice@tl.com'How it worksCreate your own Listener and listen something(e.g. port, queue ...):fromtiny_listenerimportEvent,Listener,ParamclassApp(Listener):asyncdeflisten(self):ctx=self.new_ctx()ctx.trigger_event("step 2: send email to alice@tl.com")ctx.trigger_event("step 1: save Alice's data to database",data={"age":35})Add event handler to your listener:app=App()@app.on_event("step 1: save{username}'s data to database")asyncdefstep_1(event:Event,username:Param):age=event.data["age"]print(f"Step-1: Save data done!,{username=},{age=}")@app.on_event("step 2: send email to{email}")asyncdefstep_2(event:Event,email:Param):awaitevent.wait_event_done("step_1")print(f"Step-2: Send email done!,{email=}")Run listener with command:$tiny-listenerexample:appTiny-listener will dispatch every event automatically:>>>Step-1:Savedatadone!,username='Alice',age=35>>>Step-2:Sendemaildone!,email='alice@tl.com'
Package: tinylog
Just a tiny logger. Nothing more, nothing less.InstallationThrough PyPI:$ pip install tinylog…or from the project root directory:$ python setup.py installUsageExample usage:# Basic usage, with console logging

>> from tinylog import Logger
>> log = Logger(console='stdout', info='~/test.log')
>> log.debug('Foo!')
2015-09-09T23:40:42.817421 [DEBUG] Foo!
>>log.info('Bar!')
2015-09-09T23:40:48.865398 [INFO] Bar!
>> log.critical('Situation critical!')
2015-09-09T23:40:58.369778 [CRITICAL] Situation critical!
>> exit()

$ cat ~/test.log
2015-09-09T23:40:48.865398 [INFO] Bar!
2015-09-09T23:40:58.369778 [CRITICAL] Situation critical!

# With separated debug and error logs, and custom format

>> from tinylog import Logger
>> log = Logger(debug='~/debug.log', error='~/error.log', fmt='{unixtimestamp}:{level}:{message}\n')
>> log.debug('Debug message')
>> log.info('Info message')
>> log.warning('Warning message')
>> log.error('Error message!')
>> log.critical('Critical error!')
>> exit()

$ cat ~/debug.log
1441867497:DEBUG:Debug message
1441867501:INFO:Info message
1441867506:WARNING:Warning message
1441867512:ERROR:Error message!
1441867531:CRITICAL:Critical error!

$ cat ~/error.log
1441867512:ERROR:Error message!
1441867531:CRITICAL:Critical error!To disable logging, set the environment variable “NO_LOGGING”, or use a variable
you pick by instanciating Logger with it, like deactivation_var=”NO_LOGGING”:$ cat my_program.py
from tinylog import Logger
log = Logger(deactivation_var='FOOBAR', console='stdout')
log.info('foo')

$ python my_program.py
2015-09-09T23:57:50.008624 [INFO] foo

$ FOOBAR=1 python my_program.py
<empty>Release Notes0.1.4:Remove zip_safe0.1.2:Fixed relative import for python30.1.1:Updated default deactivation_var to NO_LOGGING, but it’s configurable.0.1.0:Released to PyPI with most features0.0.1:Project created
Package: tinylogger
tinyloggerAn easy use and more powerful android style logging utilInstallationTo install tinylogger run this command:pip install tinyloggerordownloadPackage then run this command:pip install tinylogger-1.0.0-py3-none-any.whlUsageBasic UsageThe typical usage of this library is like the following:from tinylogger.log import Log

if __name__ == "__main__":
    Log.d("test")output to stdout and log file in current work dir2019-08-25 07:49:48.780000 - INFO  - log.py    (_get_instance:69): log path: D:\
develop\test\log_20190825_074948.txt
2019-08-25 07:49:48.782000 - DEBUG - test.py   (__main__  :8): testFull UsageOr like this:import os
import logging
from tinylogger.log import Log


if __name__ == "__main__":
    Log.setup(os.path.join(os.getcwd(), "log"), logging.DEBUG)
    Log.d("test")output to stdout and log file in current work dir2019-08-25 07:52:32.514000 - INFO  - log.py    (setup     :78): log path: D:\dev
elop\test\log\log_20190825_075232.txt
2019-08-25 07:52:32.515000 - DEBUG - test.py   (__main__  :8): testQuiet printIf you don't want to print log in stdout, then setup as below:Log.setup(os.path.join(os.getcwd(), "log", True),Custom Configssetup(cls, log_dir=os.path.join(os.getcwd()), log_level=logging.DEBUG, quiet=False)log_dir: the dir to write log file
log_level: control log msg to log file expect stdout
quiet: do not print log in stdoutDistributecd path/to/tinylogger-dist/
python -m venv venv
venv\Scripts\activate.bat
pip install -r requirements.txt
python setup.py bdist_wheel
twine upload dist/*
Package: tinymetabobjloader
tinyobjloader, Wavefront .obj loadertinyobjloaderis a python wrapper for C++ wavefront .obj loader.tinyobjloaderis rather fast and feature rich than other pure python version of .obj loader.Quick tutorialimportsysimporttinyobjloader# Create reader.reader=tinyobjloader.ObjReader()filename="cornellbox.obj"# Load .obj(and .mtl) using default configurationret=reader.ParseFromFile(filename)ifret==False:print("Warn:",reader.Warning())pint("Err:",reader.Error())print("Failed to load : ",filename)sys.exit(-1)ifreader.Warning():print("Warn:",reader.Warning())attrib=reader.GetAttrib()print("attrib.vertices = ",len(attrib.vertices))print("attrib.normals = ",len(attrib.normals))print("attrib.texcoords = ",len(attrib.texcoords))materials=reader.GetMaterials()print("Num materials: ",len(materials))forminmaterials:print(m.name)print(m.diffuse)shapes=reader.GetShapes()print("Num shapes: ",len(shapes))forshapeinshapes:print(shape.name)print("num_indices ={}".format(len(shape.mesh.indices)))More detailed usagePlease take a look atpython/sample.pyfile in tinyobjloader git repo.https://github.com/syoyo/tinyobjloader/blob/master/python/sample.pyLicenseMIT license.TODOWriter saver
Package: tinymodbusrtu
tiny-modbus-rtuModbus RTU Client library for communicating with Modbus RTU Servers over SerialDeveloped as an alternative to the existing modbus libraries that include support for all Modbus Protocols and do not allow custom messages. TinyModbusRTU supports only a single protocol and transmission layer.Designed specifically to allow support for custom function codes and messages.Features:Standard MODBUS-RTU Read RequestsStandard MODBUS-RTU Write RequestsCustom Function Code MODBUS-RTU RequestsRequests containing only a custom function code can be used to trigger certain actions from a serverFully Customizable MODBUS-RTU RequestsOptionally Disable the CRC16 Validity check for Hobbyist DevelopmentNote: Disables CRC16 Check for both requests and responsesRequirements:python >= 3.6.0pySerial >= 3.0Not-Supported:MODBUS-ASCIIMODBUS OVER TCP
Package: tinymon
TinymonUsageTinyMonclassTinyMon(baseimagepath=None, fbdev=None, previewdev=None, brightness=15, sleep_time=0.01, timeout=7)parametersbaseimagepathbackground imagedefault Nonefbdevframe buffer deviceshould use Ssd1362fbdev=Ssd1362()previewdevpreview video deviceexperimentalbrightness0 ~ 15sleep_timesleep for cpu idle timerecommend 0.01timeouttimeout for preview udpdefault 7 secondsmethodsaddctrl(id, ctrl)parametersid : strctrl name for internal dictionaryctrl : ImageCtrl, TextCtrlImageCtrl, TextCtrl instancedelImageCtrl(id)parametersid : strctrl name for internal dictionarydelTextCtrl(id)parametersid : strctrl name for internal dictionaryImageCtrlclassImageCtrl(pos=(0,0), size=(MAX_WIDTH,MAX_HEIGHT), path=None)parameterspos : tuple (x,y)image position top-leftsize : tuple (width, height)image size : max(256, 64)pathimage pathmethodsopen(path, pos=None, size=None)descriptionchange an image in ctrl instanceparameterspos : tuple (x,y)image position top-leftsize : tuple (width, height)image size : max(256, 64)changePos(pos)parameterspos : tuple (x,y)image position top-leftpaste(im, box=(0,0))descriptionpastes another image into this imageparametersimpillow image instancebox : (x,y), (x, y, width, height)(x, y) : top left position(x, y, width, height) : top left and sizeclear(image)descriptionpaste image whole areafor background imageparametersimagepillow imageTextCtrlclassTextCtrl(pos=(10,10) , fontsize=14, font='font/NanumBarunGothicLight.ttf', text=None):parameterspos : tuple (x,y)text position top-leftfontsizefontfont pathtext : strinput textmethodssetText(text)parameterstext : strinput textdraw(im=None, fill=255)descriptionfor internal useparametersimpillow imagefillgray level : 0~255returnspillow imagetext added imagerequirementsg4l (gpio python package)link :https://gitlab.com/telelian/peripheral-library/g4lssd1362-pylink :https://gitlab.com/telelian/peripheral-library/ssd1362.git
Package: tinymovr
Tinymovr Studio PythonThis is the Python client library and application that allows easy interfacing with the Tinymovr motor control board.Installing using pipThis is the most straightforward method to install Tinymovr studio and have access to hardware. We use pip3 to ensure Tinymovr is installed using Python 3 (required).pip3 install tinymovrInstalling using git cloneFirst clone the Tinymovr repo to a local directory:git clone https://github.com/yconst/TinymovrThen cd to the cloned repo directory and install in developer mode:cd Tinymovr/studio/Python
pip3 install -e .Launching the GUI apptinymovrLaunching the command line apptinymovr_cliGetting HelpFull documentation is available at Readthedocs.Please visit theDiscussions Pageand theDiscord Serverto ask any questions. If you are unable to find an answer to your question, you are welcome tostart a new discussionor ask away atour Discord server.If you would like to propose a feature or think you have found a bug,open a new issue.More informationWebsite and StoreDocumentation
Package: tinymr
Experimental Pythonic MapReduce inspired bySpotify’s luigi framework.Canonical Word Count ExampleCurrently there are two MapReduce implementations, one that includes sorting and
one that does not.  The example below would not benefit from sorting so we can
take advantage of the inherent optimization of not sorting.  The API is the same
buttinymr.memory.MRSerial()sorts after partitioning and again between thereducer()andfinal_reducer().importjsonimportreimportsysfromtinymr.memoryimportMRSerialclassWordCount(MRSerial):def__init__(self):self.pattern=re.compile('[\W_]+')defmapper(self,item):forwordinitem.split():word=self.pattern.sub('',word)ifword:yieldword.lower(),1defreducer(self,key,values):yieldkey,sum(values)deffinal_reducer(self,pairs):return{k:tuple(v)[0]fork,vinpairs}wc=WordCount()withopen('LICENSE.txt')asf:out=wc(f)print(json.dumps(out,indent=4,sort_keys=True))Truncated output:{"a":1,"above":2,"advised":1,"all":1,"and":8,"andor":1}Developing$gitclonehttps://github.com/geowurster/tinymr.git$cdtinymr$pipinstall-e.\[dev\]$py.testtests--covtinymr--cov-reportterm-missingLicenseSeeLICENSE.txtChangelogSeeCHANGES.md