Saravanan666/pypi-org huggingface dataset:
Package: torncoder
TorncoderTornado Utility Library for various features.This library contains a few common classes and helpers that:Make file serving easier.Make file uploads easier.File Server CLIThis also implements a simple tool:file-cache-server.
This CLI tool implements a super simple File server API (with caching headers and so forth).
Simple usage is:file-cache-server-p7070-dmydirectory--readonlyto serve the files atmydirectoryon port 7070.
Note that without the--readonlyflag, this supports PUT and DELETE operations on these files which will create, modify and delete them.TBDAdd an interface that is more S3-compatible.
Package: torndsession
Torndsession SessionTorndsessionis a session extension forTornadoweb framework.
Torndsession support application memory, file, redis or memcached to save session data for request, and it’s easy to extend for developer.Quick linksDocumentationSource (github)Torndsession LicenseExamplesHello, SessionHere is a simple “Hello, Session” example web app for Tornado with Torndsession.:import tornado.web
import tornado.httpserver
import tornado.ioloop
import torndsession


class Application(tornado.web.Application):
    def __init__(self):
        handlers = [
            (r"/", MainHandler),
        ]
        settings = dict(
            debug=True,
        )
        # sid_name, lifetime added in 1.1.5.0
        # sid_name: the name of session id in cookies.
        # lifetime: session default expires seconds.
        session_settings = dict(
            driver='memory',
            driver_settings={'host': self},
            force_persistence=True,
            sid_name='torndsessionID',
            session_lifetime=1800
        ),
        settings.update(session=session_settings)
        tornado.web.Application.__init__(self, handlers, **settings)


class MainHandler(torndsession.sessionhandler.SessionBaseHandler):
    def get(self):
        self.write("Hello, Session.<br/>")
        if 'data' in self.session:
            data = self.session['data']
        else:
            data = 0
        self.write('data=%s' % data)
        self.session["data"] = data + 1


def main():
    http_server = tornado.httpserver.HTTPServer(Application())
    http_server.listen(8000)
    tornado.ioloop.IOLoop.instance().start()


if __name__ == "__main__":
    main()In this example, Request handler obtain memory session feature, it just inherit from SessionBaseHandler. more session example seetorndsession demos.InstallationAutomatic installation:pip install torndsessionTorndsession is listed inPyPIand can be installed withpiporeasy_install. Note that this installation can not install demos applicatinos which be included in source code.The another way is usegit+install torndsession from github.pip install git+https://github.com/mitchellchu/torndsessionManual installation:In this way, you need download the source fromPyPI.:tar xvzf torndsession.tar.gz
cd torndsession
python setup.py build
sudo python setup.py installThe Torndsession source code is hosted onGitHub.UpdatedTorndsession 1.1.5:fixed bug in 1.1.4default session id value generator changed. see#ISSUE 12#.added two custom key in settings.sid_name: session’s cookie name.session_lifetime: default expired seconds for session.Torndsession 1.1.4:fixed bugTorndsession 1.1.3 fixed some bug and supported python 3.x.RequiresTornadoRedis (Optional)Memcached (Optional)LICENSETorndsession is licensed under MIT.
Package: torneira
Torneira is a lightweight web framework build on top ofTornado. It’s name
came from the idea of getting rapid and fluid development (‘torneira’ is the
portuguese word for water tap).InstallationTorrneira is available underPyPI. You can install using pip:$ pip install torneiraQuick startTo build an app using torneira, you just need 3 files: one for your urls
definitions (normally urls.py), one for settings (settings.py) and another for
your handlers (handlers.py). The Application and HTTPServer stuff is already
setup to you.To start the server on por 8888, just run the following command in the base
directory of your app:$ torneiraIn the directorydemos/simple_app/there is a minimal app already configured.
If you want to see a more complex app that uses more available features, take a
look atdemos/more_complex_app.To see all options thattorneiracommand support, run:$ torneira –helpContributingSend a pull request (preferred) or patches usinggitformat-patch. Also,
torneira comes with some tests intests/directory. Make sure you don’t break
anything accidentally and also write some tests for your fix/feature.IssuesPlease report any issues onGitHub issues.DependenciesTornado(tested with 2.3 and 2.4)Optional dependencies:Mako(if you want to use Mako templates instead of built-in tornado.template)SQL Alchemy(only if using torneira.models)On Python 2.5 we also needsimplejsonmodule.
Package: torn-open
TornOpenTornOpen is an extension ofTornadothat relies on both Python's type annotation andpydanticto generateOpenAPIcompliant documentation usingapispecforRedocSupportsFor Python versions 3.6 to 3.9, Tornado versions 4.5 to 6.1 are supportedFor Python version 3.10, Tornado versions 6.0 to 6.1 are supportedInstallationpip install torn-openUsageExample CodefromtypingimportOptionalfromtornado.webimporturlfromtornado.ioloopimportIOLoopfromtorn_openimport(AnnotatedHandler,Application,RequestModel,ResponseModel,ClientError,tags,summary,)classMyRequestModel(RequestModel):"""Docsting here will show up as description of the request model on redoc"""var1:strvar2:intclassMyResponseModel(ResponseModel):"""Docsting here will show up as description of the response on redoc"""path_param:strquery_parm:intreq_body:MyRequestModelclassMyAnnotatedHandler(AnnotatedHandler):@tags("tag_1","tag_2")@summary("this is a summary")defpost(self,*,path_param:str,query_param:Optional[int]=1,req_body:MyRequestModel,)->MyResponseModel:"""Docstrings will show up as descriptions on redoc"""try:"""do something here"""except:raiseClientError(status_code=403,error_type="forbiddon")returnMyResponseModel(path_param=path_param,query_param=query_param,req_body=req_body,)defmake_app():returnApplication([url(r"/annotated/(?P<path_param>[^/]+)",MyAnnotatedHandler),],)if__name__=="__main__":app=make_app()app.listen(8888)IOLoop.current().start()ResultDocumentationDocumentation and links to additional resources can be found here:https://b34nst4lk.github.io/tornopen/AcknowledgementsFastAPIRedocpydantic
Package: tornsmtp
Non-blocking smtp client to work with tornado web framework 4.0 and aboveThis library is a port of Python smtplib to tornado non-blocking IOstream implementation.The below example was taken and modified from Python docs’ example:#!/usr/bin/env python3

from tornado_smtpclient import client

from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

# create SMTP client
s = client.SMTPAsync()
yield s.connect('your.email.host',587)
yield s.starttls()
yield s.login('username', 'password')

# me == my email address
# you == recipient's email address
me = "my@email.com"
you = "your@email.com"

# Create message container - the correct MIME type is multipart/alternative.
msg = MIMEMultipart('alternative')
msg['Subject'] = "Link"
msg['From'] = me
msg['To'] = you

# Create the body of the message (a plain-text and an HTML version).
text = "Hi!\nHow are you?\nHere is the link you wanted:\nhttp://www.python.org"
html = """\
<html>
<head></head>
<body>
<p>Hi!<br>
How are you?<br>
Here is the <a href="http://www.python.org">link</a> you wanted.
</p>
</body>
</html>
"""

# Record the MIME types of both parts - text/plain and text/html.
part1 = MIMEText(text, 'plain')
part2 = MIMEText(html, 'html')

# Attach parts into message container.
# According to RFC 2046, the last part of a multipart message, in this case
# the HTML message, is best and preferred.
msg.attach(part1)
msg.attach(part2)

# sendmail function takes 3 arguments: sender's address, recipient's address
# and message to send - here it is sent as one string.
yield s.sendmail(me, you, msg.as_string())
yield s.quit()
Package: tornwamp
TornWAMPThis Python module implements parts ofWAMP(Web Application Messaging Protocol).TornWAMP provides means of having an API which interacts with WAMP-clients
(e.g.Autobahn).TornWAMP is not a WAMP Client nor a WAMP Router.Although this code was implemented to be used with Websockets andTornado(Web framework),
it can also be used in other ways.How to installUsingpip:pip install tornwampOr from the source-code:git clone https://github.com/ef-ctx/tornwamp.git
cd tornwamp
python setup.py installExample of usageAn example of how to build a server using TornWAMP (wamp.py):import tornado
from tornwamp import handler

class SampleHandler(handler.WAMPHandler):
    pass

application = tornado.web.Application([
    (r"/ws", SampleHandler),
])

if __name__ == "__main__":
    application.listen(8888)
    tornado.ioloop.IOLoop.instance().start()Which can be run:python wamp.pyFrom the client perspective, you’d be able to use Autobahn JavaScript library
to connect to the server using:var connection = new autobahn.Connection({
  url: "ws://0.0.0.0:8888/ws",
  realm: "sample"
});Read moreFor more information on how the library works internally refer todocs
<docs/>directory inside this package.LicenseCopyright 2015, Education FirstLicensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Package: toro
Info:Synchronization primitives for Tornado coroutines.Author:A. Jesse Jiryu DavisDocumentation:http://toro.readthedocs.org/ImportantToro is completed and deprecated; its features have been merged
into Tornado. Development of locks and queues for Tornado coroutines continues
in Tornado itself.AboutA set of locking and synchronizing primitives analogous to those in Python’sthreading moduleor Gevent’scoros, for use with Tornado’sgen.engine.DependenciesTornado>= version 3.0.ExamplesHere’s a basic example (for more see theexamplessection of the docs):fromtornadoimportioloop,genimporttoroq=toro.JoinableQueue(maxsize=3)@gen.coroutinedefconsumer():whileTrue:item=yieldq.get()try:print'Doing work on',itemfinally:q.task_done()@gen.coroutinedefproducer():foriteminrange(10):yieldq.put(item)producer()consumer()loop=ioloop.IOLoop.instance()# block until all tasks are doneq.join().add_done_callback(loop.stop)loop.start()DocumentationYou will needSphinxandGraphVizinstalled to generate the
documentation. Documentation can be generated like:$sphinx-builddocbuildTestingRunpython setup.py testin the root directory.Toro boasts 100% code coverage, including branch-coverage!
Package: torob-integration
Python Torob IntegrationOverviewIntroductionOverviewInstallationUsageLicenseIntroductionA Python module facilitating effortless interaction with the Torob API for seamless access to product suggestions, search results, detailed product information, special offers, and price chart data.
This module utilizes the Torob API available athttps://torob.com/. It is important to note that the usage of this module does not alter any data on the Torob website.InstallationA Python module facilitating effortless interaction with the Torob API for seamless access to product data. in order to use this module you have to install it by pip command or through setup.pipinstalltorob-integrationImport package into your project by:fromtorob_integration.apiimportTorobin order to use the module please consider looking at examples and documentations.Usageimport module and create objectfromtorob_integration.apiimportTorobtorob_instance=Torob()Fetch product suggestions based on a queryfromtorob_integration.apiimportTorobtorob_instance=Torob()suggestion_result=torob_instance.suggestion("laptop")Perform a search for products based on a query and page numberfromtorob_integration.apiimportTorobtorob_instance=Torob()search_result=torob_instance.search("phone",page=0)Get detailed information about a specific product. Note: Before running thedetailsfunction, execute thesearchfunction to obtain the actual values for 'prk' and 'search_id'.fromtorob_integration.apiimportTorobtorob_instance=Torob()details_result=torob_instance.details(prk='sample_prk',search_id='sample_search_id')Fetch special offers for products with optional pagination based on page numberfromtorob_integration.apiimportTorobtorob_instance=Torob()special_offers_result=torob_instance.special_offers(page=0)Get the price chart data for a specific product, Note: Before running theprice_chartfunction, execute thesearchfunction to obtain the actual values for 'prk' and 'search_id'.fromtorob_integration.apiimportTorobtorob_instance=Torob()price_chart_result=torob_instance.price_chart(prk='sample_prk',search_id='sample_search_id')licenseMIT license
Package: toroidal
toroidal - a lightweight transformer library for PyTorchToroidal transformers are of smaller size and lower weight than the more common E-I types. This is the software equivalent.This is a small and educational project, not big and professional like thetransformerslibrary.Simplicity! We only cover very popular transformer types and keep implementations things simple and beautiful.Hightlight similarities. We try not to copy-paste code between almost identical implementations.PyTorch first and only. We do not provide everything for everyone, but focus on PyTorch and use PyTorchy coding style. Ideally, our models work well with TorchScript.Important NoteFor the time being, we will emphasize beautiful code over backward compatibility, so things will break. Don't use it for things you cannot fix.FAQWhy notminGPT? I love minGPT, but I needed BERT.Why nottransformers? I wanted small, but if you have to ask, you should use them instead.
Package: toro-mkdocs-kbd
TORO KBD Markdown ExtensionThe toro-mkdocs-kbd wraps your keyboard shortcut into a KBD tag. The tag will contain three
attributes; linux, macos, and windows. The values in the attributes will be the keyboard shortcut based
on the OS.Installationpip install toro-mkdocs-kbdUsageThe markdown syntax will be the keyboard shortcut between two questions marks. A plus sign will be used
to separate the keys.MODwill be used as a generic symbol for both thectrlandcommandkey.??MOD+A??The produced HTML of the markdown syntax will be:<p><kbd linux="Ctrl + A" macos="⌘A" winodws="Ctrl + A"></kbd></p>ConversionMarkdownWindows/LinuxmacOS??mod??Ctrl⌘??alt??Alt⌥??enter??Enter↩??shift??Shift⇧??ctrl??Ctrl⌃??left??Left←??right??Right→??up??Up↑??down??Down↓??tab??Tab⇥??esc??Esc⎋??space??SpaceSpace
Package: toro-mkdocs-togglers
TORO Toggler Markdown ExtensionContent Toggler Markdown extension for TORO Documentation.Installationpip install toro-mkdocs-togglersUsageTo properly use the toggler extension use the following markdown:||| "TabName1"
    Tab1 content.
||| "TabName2"
    Tab2 content.The produced HTML from the markdown will be:<div class="toro-toggler" data-names="TabName1,TabName2">
    <div data-related-divider="TabName1">
        <p>Tab1 content.</p>
    </div>
    <div data-related-divider="TabName2">
        <p>Tab2 content.</p>
    </div>
</div>To use the toggler extension with a nested toggler use the following markdown:||| "TabName1"
    /// "NestedTabName1"
        Nested Tab1 content.
    /// "NestedTabName2"
        Nested Tab2 content.
||| "TabName2"
    Tab2 content.The produced HTML from the markdown will be:<div class="toro-toggler" data-names="TabName1,TabName2">
    <div data-related-divider="TabName1">
        <div class="toro-toggler" data-names="NestedTabName1,NestedTabName2">
            <div data-related-divider="NestedTabName1">
                <p>Nested Tab1 content.</p>
            </div>
            <div data-related-divider="NestedTabName2">
                <p>Nested Tab2 content.</p>
            </div>
        </div>
    </div>
    <div data-related-divider="TabName2">
        <p>Tab2 content.</p>
    </div>
</div>
Package: toronto-hydro-green-button
toronto-hydro-green-buttonExportGreen Button(ESPI) energy usage data from yourToronto Hydroaccount.Toronto Hydro offers a Green Button XML export through the customer portal, but does not offer programmatic API access.
This script logs into the dashboard withSelenium, then downloads the report withRequests.RequirementsaToronto HydroaccountPython 3.6+Firefox 57+ or Google Chrome and ChromeDriverInstallationInstall with pip:pip install toronto-hydro-green-buttonUsageThe script needs your username and password to log into the dashboard.
It will check, in order of precedence:--username/-uand--password/-pargumentsTORONTO_HYDRO_USERNAMEandTORONTO_HYDRO_PASSWORDenvironment variablesprompt inputUse--start-dateand--end-dateto query data between two dates (inclusive).$ toronto-hydro-green-button --start-date 2019-11-01 --end-date 2019-11-31If ChromeDriver is installed, the script attempts to use it by default.
Otherwise it falls back on headless Firefox.
ChromeDriver was slightly faster in my limited testing.Runtoronto-hydro-green-button --helpfor additional usage information.TipsToronto Hydro usage data lags by 2–3 days.
This script defaults to querying data from two days ago.If you run this script frequently, you may not always see fresh data.
It should be sufficient to run it daily.LicenseMIT
Package: toronto-open-data
TorontoOpenData Python PackageOverviewTheTorontoOpenDatapackage provides a Python interface to interact with the Toronto Open Data portal. It allows users to list, search, and download datasets, as well as load specific resources.InstallationTo install the package, run:pipinstalltoronto-open-dataDependenciespandaswgettqdmckanapiUsageInitializationInitialize theTorontoOpenDataclass:importTorontoOpenDatatod=TorontoOpenData(api_key='your_api_key_here')# API key is optionalList All DatasetsList all available datasets:datasets=tod.list_all_datasets()Search DatasetsSearch datasets by keyword:search_results=tod.search_datasets('parks')Download DatasetDownload a specific dataset:tod.download_dataset('dataset_name')Load DatasetLoad a specific file from a dataset:file_path=tod.load('dataset_name','file_name.csv',smart_return=False)Load a specific file, returning an object if supported (default behaviour):file_object=tod.load('dataset_name','file_name.csv',smart_return=True)Methodslist_all_datasets(as_frame=True): List all datasets.search_datasets(query, as_frame=True): Search datasets by keyword.search_resources_by_name(name, as_frame=True): Get dataset by name.download_dataset(name, file_path='./cache/', overwrite=False): Download resource.load(name, filename, file_path='./cache/', reload=False, smart_return=True): Load a file from the dataset.Smart Return File TypesThe package supports smart return for the following file types:csvdocxgpkggeojsonjpegjsonkmlpdfsavshptxtxlsmxlsxxmlxsdLicenseMIT License
Package: toro-shortcuts
IntroductionThe toro-shortcut converts your keyboard shortcut into a customized tag. The tag will contain three
attributes; linux, macos, and windows. The values in the attributes will be the keyboard shortcut
using the symbols of the corresponding OS.Installationpip install toro-shortcutsUsageThe markdown syntax will be the keyboard shortcut between two questions marks. A plus sign will be used
to separate the keys.MODwill be used as a generic symbol for both thectrlandcommandkey.??MOD+A??The produced HTML of the markdown syntax will be:<p><kbd linux="Ctrl + A" macos="⌘A" winodws="Ctrl + A"></kbd></p>ConversionMarkdownWindows/LinuxmacOS??mod??Ctrl⌘??alt??Alt⌥??enter??Enter↩??shift??Shift⇧??ctrl??Ctrl⌃??left??Left←??right??Right→??up??Up↑??down??Down↓??tab??Tab⇥??esc??Esc⎋??space??SpaceSpace
Package: torpc
ToRPC(Tornado + RPC) is a tiny tcp and duplex RPC implementation in
Python based on Tornado IOLoop. It’s very lightweight and high
performance(especially on PyPy).Notice: ToRPC was only tested onCPython 2.7+andPyPy 2.5+until now.## ExamplesRPC serverfromtornadoimportioloopfromtorpcimportRPCServerserver=RPCServer(('127.0.0.1',5000))@server.service.register()defecho(x):returnxserver.start()ioloop.IOLoop.instance().start()RPC clientfromtornadoimportioloop,genfromtorpcimportRPCClientdefresult_callback(f):print(f.result())@gen.coroutinedefusing_gen_style():want_to_say='way to explore'ret=yieldrc.call('echo',want_to_say)assertret==want_to_sayprint('gen_style complete')rc=RPCClient(('127.0.0.1',5000))rc.call('echo','hello world',callback=result_callback)future=rc.call('echo','code for fun')future.add_done_callback(result_callback)using_gen_style()ioloop.IOLoop.instance().start()See more inexamples.PerformanceOS: CentOS 6.6 x64
CPU: Intel i5-3470 3.20GHz
Memory: 8 GB 1600 MHz DDR3
Python: 2.7.10
PyPy: 4.0.0environmentcall coroutine(qps)callback(qps)Python(with timeout)984211614Python1319216638PyPy(with timeout)4048641225PyPy5325259151PyPy(unix domain)6710074362In this benchmark, Python loops 100k times and PyPy loops 1000k times,
then run 3 times of each, the result is ongist:benchmark_result.txtDocument中文
Package: torpeewee
torpeeweeTornado and asyncio asynchronous ORM by peeweeAbouttorpeewee - Tornado and asyncio asynchronous ORM by peewee.Installationpip install torpeeweeExamples# -*- coding: utf-8 -*-# 16/7/7# create by: snowerimportdatetimeimportasynciofromtorpeeweeimport*db=MySQLDatabase("test",host="127.0.0.1",port=3306,user="root",passwd="123456")classBaseModel(Model):classMeta:database=dbclassTest(BaseModel):id=IntegerField(primary_key=True)data=CharField(max_length=64,null=False)count=IntegerField(default=0)created_at=DateTimeField()updated_at=DateTimeField()@db.transaction()asyncdefrun_transaction(transaction):asyncforiinTest.use(transaction).select().order_by(Test.id.desc()).limit(2):print(i.id,i.data)print("")t=awaitTest.use(transaction).create(data="test",created_at=datetime.datetime.now(),updated_at=datetime.datetime.now())print(t.id,t.data)asyncforiinTest.select().order_by(Test.id.desc()).limit(2):print(i.id,i.data)print("")foriin(awaitTest.use(transaction).select().order_by(Test.id.desc()).limit(2)):print(i.id,i.data)asyncdefrun():t=awaitTest.select().where(Test.id==5).first()print(t)c=awaitTest.select().where(Test.id>5).count()print(c)c=awaitTest.select().where(Test.id>5).group_by(Test.data).count()print(c)foriin(awaitTest.select().where(Test.id>5).where(Test.id<=10)):print(i.id,i.data)asyncforiinTest.select().order_by(Test.id.desc()).limit(2):print(i.id,i.data)t=awaitTest.create(data="test",created_at=datetime.datetime.now(),updated_at=datetime.datetime.now())print(t.id,t.data)asyncforiinTest.select().order_by(Test.id.desc()).limit(2):print(i.id,i.data)print("")print("")t=awaitTest.select().order_by(Test.id.desc()).limit(1)[0]print(t.id,t.data,t.count)t.count+=1awaitt.save()t=awaitTest.select().order_by(Test.id.desc()).limit(1)[0]print(t.id,t.data,t.count)print("")print("")asyncwithawaitdb.transaction()astransaction:t=awaitTest.use(transaction).select().order_by(Test.id.desc()).limit(1)[0]print(t.id,t.data,t.count)t.count+=1awaitt.use(transaction).save()asyncforiinTest.use(transaction).select().order_by(Test.id.desc()).limit(2):print(i.id,i.data)print("")t=awaitTest.use(transaction).create(data="test",created_at=datetime.datetime.now(),updated_at=datetime.datetime.now())print(t.id,t.data)asyncforiinTest.select().order_by(Test.id.desc()).limit(2):print(i.id,i.data)print("")foriin(awaitTest.use(transaction).select().order_by(Test.id.desc()).limit(2)):print(i.id,i.data)print("")print("")awaitrun_transaction()loop=asyncio.get_event_loop()loop.run_until_complete(run())Licensetorpeewee uses the MIT license, see LICENSE file for the details.