Saravanan666/pypi-org huggingface dataset:
Package: tornado-coroutines-opentracing
Supporting fire & forget Tornado coroutines in python opentracingOpentracing python libraryprovides nice mechanism for tracing ofTornadocode based on coroutines.Coroutine must be invoked withtracer_stack_contextthat allows to isolate context and using parent scope in child corutines. It works only when you yielding child coroutines inside, but doesn’t work with fire & forget coroutine.
In this case such coroutine can lose parent scope while yielding or take scope of unrelated coroutine (e.g. concurrent coroutines).To avoid it you have to wrap coroutine bytracer_stack_contextmanually, and activate parent scope that you need right inside coroutine:from tornado import gen
from opentracing import global_tracer
from opentracing.scope_managers.tornado import tracer_stack_context

@gen.corotine
def do_someting_in_background(parent):
    with global_tracer().scope_manager.activate(parent, False):
        with global_tracer.start_active_span('do something', True):
            yield gen.sleep(0.5)
            # do something

...


with global_tracer().start_active_span('work in background') as root:
    with tracer_stack_context():
        do_someting_in_background(root.span)ff_coroutineThis library providesff_coroutinedecorator that does it for you:from opentracing import global_tracer
from tornado_coroutines_opentracing import ff_coroutine

@ff_coroutine
def do_someting_in_background():
    with global_tracer.start_active_span('do something', True):
        yield gen.sleep(0.5)
        # do something

...


with global_tracer().start_active_span('work in background'):
    do_someting_in_background()It also works with nested coroutines:from opentracing import global_tracer
from tornado_coroutines_opentracing import ff_coroutine

@ff_coroutine
def bar():
    with global_tracer.start_active_span('bar', True):
        # do something

@ff_coroutine
def foo():
    with global_tracer.start_active_span('foo', True):
        yield gen.sleep(0.5)
        bar()


...

with global_tracer().start_active_span('work in background'):
    foo()ff_coroutineyielded as well as Tornado coroutine (viagen.coroutine):from opentracing import global_tracer
from tornado_coroutines_opentracing import ff_coroutine

@ff_coroutine
def bar():
    with global_tracer.start_active_span('bar', True):
        # do something

@ff_coroutine
def foo():
    with global_tracer.start_active_span('foo', True):
        yield bar()
        yield gen.sleep(0.5)


...

with global_tracer().start_active_span('work in background'):
    yield foo()Sometimes you want to disable tracing in your application. You can disableff_coroutinetoo:from tornado_coroutines_opentracing import State
...

State.enabled = False0.1.0First release.
Package: tornado-crontab
tornado-crontab is a library that can make the task apps like crontab.InstallationAutomatic installation:$ pip install tornado-crontabtorando-crontab is listed inPyPIand can be installed with pip or easy_install.Manual installation:$ git clone https://github.com/gaujin/tornado-crontab.git
$ cd tornado-crontab
$ python setup.py installtornado-crontab source code ishosted on GitHubUsageHere is an example every minute task app:from __future__ import print_function
import functools
import tornado.ioloop
import tornado_crontab

def hello_crontab(value):

    print("Hello, {0}".format(value))

if __name__ == "__main__":

    _func = functools.partial(hello_crontab, *["crontab"])
    tornado_crontab.CronTabCallback(_func, "* * * * *").start()
    tornado.ioloop.IOLoop.current().start()decorator style task app:from __future__ import print_function
import tornado.ioloop
from tornado_crontab import crontab

@crontab("* * * * *")
def hello_crontab(value):

    print("Hello, {0}".format(value))

if __name__ == "__main__":

    hello_crontab("crontab")
    tornado.ioloop.IOLoop.current().start()Prerequisitestornado-crontab 0.4.x or earlier runs on Tornado 4.x or earlier.Future policy of io_loop argumentio_loopargument to function and constructor is deprecated for 0.4.0 and removed for 0.5.0.About this policy is based on the policy already indicated in Tornado, tornado-crontab also made the same policy.UsingTornadocrontabLicensetornado-crontab license under theMIT license.Tornado is licensed under the Apache license.crontab is licensed under the LGPL license version 2.1.See the LICENSE file for specific terms.
Package: tornado-debugger
tornado-debuggerA debugger for Tornado server for a better development experience.Tornado's default exception reporter is very basic and primitive.tornado-debuggeris
a drop-in replacement for the built-in debugger.Install$pipinstalltornado-debuggerUsageUse theDebuggerMixinclass to automatically add the debugger features.
This mixin class overridesRequestHandler.write_errormethod and will display
a detailed error page.fromtornadoimportwebfromtornado_debuggerimportDebuggerMixinclassIndexHandler(DebuggerMixin,web.RequestHandler):# always inherit from mixin class BEFORE the base classdefget(self):1/0Note:TheDebuggerMixinonly works in debug mode (i.e. whendebug=Truein the Application settings).ScreenshotLicenseBSD-3-Clause
Package: tornado-discovery
tornado_discoveryJust a pure python3 module for service discovery.
Include some basic classes for develop distributed services.install# install from pip$pip3install-Utornado_discovery# or install from source code$cd./tornado_discovery
$python3./setup.pyinstalltest & try it# run listener$cd./tornado_discovery/test
$python3./test_discovery_listener.py# run registrant$cd./tornado_discovery/test
$python3./test_discovery_registrant.py
Package: tornado-dynamodb
tornado-dynamodb================An asynchronous DynamoDB client for Tornado|Version| |Downloads| |Status| |Coverage| |License|Installation------------``tornado-dynamodb`` may be installed via the Python package index with the tool ofyour choice. I prefer pip:.. code:: bashpip install tornado-dynamodbExample-------.. code:: pythonDocumentation-------------Documentation is available on `ReadTheDocs <https://tornado-dynamodb.readthedocs.org>`_.Requirements-------------  `Tornado <https://tornadoweb.org>`_Version History---------------Available at https://tornado-dynamodb.readthedocs.org/en/latest/history.html.. |Version| image:: https://img.shields.io/pypi/v/tornado-dynamodb.svg?:target: http://badge.fury.io/py/tornado-dynamodb.. |Status| image:: https://img.shields.io/travis/gmr/tornado-dynamodb.svg?:target: https://travis-ci.org/gmr/tornado-dynamodb.. |Coverage| image:: https://img.shields.io/codecov/c/github/gmr/tornado-dynamodb.svg?:target: https://codecov.io/github/gmr/tornado-dynamodb?branch=master.. |Downloads| image:: https://img.shields.io/pypi/dm/tornado-dynamodb.svg?:target: https://pypi.python.org/pypi/tornado-dynamodb.. |License| image:: https://img.shields.io/pypi/l/tornado-dynamodb.svg?:target: https://tornado-dynamodb.readthedocs.org
Package: tornado_elasticsearch
tornado_elasticsearch=====================Extends the official Elasticsearch Python API adding Tornado AsyncHTTPClientsupport.|Version| |LICENSE|Installation------------tornado_elasticsearch is available on the Python Package Index and can beinstalled using pip or easy_install:.. code-block:: shpip install tornado_elasticsearchExample Request Handlers------------------------.. code-block:: pythonfrom tornado import genfrom tornado import webfrom tornado_elasticsearch import AsyncElasticsearchimport uuidclass Example(web.RequestHandler):def initialize(self):self.es = AsyncElasticsearch()@web.asynchronous@gen.enginedef delete(self, *args, **kwargs):result = yield self.es.delete(index='test-index', doc_type='tweet',id=self.get_argument('id'))self.finish(result)@web.asynchronous@gen.enginedef get(self, *args, **kwargs):if self.get_argument('id', None):result = yield self.es.get(index='test-index', doc_type='tweet',id=self.get_argument('id'))else:result = yield self.es.search(index='test-index')self.finish(result)@web.asynchronous@gen.enginedef post(self, *args, **kwargs):doc = {'author': self.get_current_user() or 'Unknown','text': self.get_argument('text'),'timestamp': datetime.datetime.now()}result = yield self.es.index(index='test-index',doc_type='tweet',body=doc,id=str(uuid.uuid4()))self.finish(result)class Info(web.RequestHandler):@web.asynchronous@gen.enginedef get(self, *args, **kwargs):es = AsyncElasticsearch()info = yield es.info()self.finish(info)Version History---------------- 0.5.0:- Bugfixes:- HTTP Auth- Add timeout support- Allow scroll to use post, since scroll_id can be too long- Fix yield issue- Add max_clients to AsyncElasticSearch constructor- Added get_alias- Added get_mapping- Add cluster health- 0.4.0: Bugfix: Python3 decoding issues- 0.3.0: Bugfix: Add body to log_request_fail call (#1)- 0.2.0: Bugfix: force method to POST if GET and body passed- 0.1.0: Initial version.. |Version| image:: https://img.shields.io/pypi/v/tornado_elasticsearch.svg?:target: http://badge.fury.io/py/tornado_elasticsearch.. |License| image:: https://img.shields.io/pypi/l/tornado_elasticsearch.svg?:target: https://tornado_elasticsearch.readthedocs.org
Package: tornado-encookie
Encrypted cookie support for Tornado Web ServerLicenseThis software is under the MIT LicenseRequirementsPyCryptoTornadoPlease file a bug for version issues.  Tested on Python 3.2.EncryptionEncryption is done using AES256 with a 32 byte block.ExampleHandlerfromtornadoencookie.encookieimportEncookieMixinclassMyHandler(tornado.web.RequestHandler,EncookieMixin):defget(self):#Get a cookieself.encookie.get_cookie('hello')#Get a secure cookieself.encookie.get_secure_cookie('hello')#Set a regular cookieself.encookie.set_cookie('hi','there')#Set a secure cookieself.encookie.set_secure_cookie('hello','Timmy')Configurationapplication=tornado.web.Application([(r'/',MyHandler),],**{'encookie_secret':'iamthecookiemons',},)
Package: tornado-eventsource
tornado-eventsourceA simple EventSource handler for tornado.
With a built-in client for testing.EventSource on MDNHow to useInstall it(duh!):pip install tornado_eventsourceClient/Server exampleOn your handler:class MyAmazingHandler(EventSourceHandler):
    def check_connection(self):
        if youDontFitMyCondition:
            self.error(403, 'forbidden')
            return False
        return True

    def open(self):
        self.write_message('doge_source', 'much connection')

    def close(self):
        # Cleanup after closeUsing the client for test:from tornado_eventsource.event_source_client import eventsource_connect

...

def test_get_message_on_open(self):
    event_source = eventsource_connect(url=self.get_url('/'), callback=self.stop)
    self.wait()
    event = event_source.result().events[0]
    self.assertEqual(event.name, 'doge_source')
    self.assertEqual(event.data, 'much connection')Another example:import uuid

import tornado.ioloop
import tornado.web
import tornado_eventsource.handler


class MainHandler(tornado_eventsource.handler.EventSourceHandler):
    def open(self):
        self.heart_beat = tornado.ioloop.PeriodicCallback(self._simple_callback, 5000)
        self.heart_beat.start()
        self.write_message(msg="Wow much nameless", evt_id=uuid.uuid4())
        print('Connection open')

    def close(self):
        print('Connection closed')

    def _simple_callback(self):
        self.write_message(name="doge", msg="Wow much alive\nSuch message", evt_id=uuid.uuid4())
        self.write_message(msg="Wow much nameless", evt_id=uuid.uuid4())

application = tornado.web.Application([
    (r"/", MainHandler),
], debug=True)

if __name__ == "__main__":
    application.listen(8888)
    tornado.ioloop.IOLoop.instance().start()Contributemake setup

change things

make test

pull request ;)LicenseThe MIT License (MIT)Copyright (c) 2014 Guilherme Souza, A.k.a.: GalinhoPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Package: tornado-expects
Tornado-Expects is a matchers library for theExpectsassertion library. It provides matchers for theTornado web frameworkrequest and response objects.InstallationYou can install the last stable release from PyPI usingpiporeasy_install.$pipinstalltornado-expectsAlso you can install the latest sources fromGithub.$pipinstall-egit+git://github.com/jaimegildesagredo/tornado-expects.git#egg=tornado-expectsUsageJust import theexpectcallable and the Tornado-Expects matchers and start writing assertions for test doubles.fromexpectsimportexpectfromtornado_expectsimport*fromtornado.httpclientimportHTTPClientresponse=http_client.fetch('https://example.com')expect(response).to(be_ok)Matchersbe_okexpect(response).to(be_ok)expect(response).not_to(be_ok)be_jsonexpect(response).to(be_json)expect(response).not_to(be_json)have_headerexpect(response).to(have_header('Content-Type'))expect(response).to(have_header('Content-Type','text/xml'))expect(response).to(have_header('Content-Type',start_with('text/xml')))expect(response).not_to(have_header('ETag'))have_headersexpect(response).to(have_headers('Content-Type','Content-Length'))expect(response).to(have_headers({'Content-Type':'text/html'}))expect(response).not_to(have_headers('Etag','Authorization'))have_statusexpect(response).to(have_status(304))expect(response).not_to(have_status(500))SpecsTo run the specs you should install the testing requirements and then runmamba.$pythonsetup.pydevelop$pipinstall-rtest-requirements.txt$mambaLicenseThe Tornado-Expects is released under theApache2 license.
Package: tornado-facebook-sdk
What is it?The tornado-facebook-sdk is a library that aims
to ease the task of writing non-blocking, server side,
facebook social graph accessing code.
It’s built usingtornado.
This makes tornado-facebook-sdk a perfect fit if you’re
developing an application using tornado.InstallingThe prefered way to install is via pip$ pip install tornado-facebook-sdkFrom github, for the last version$ pip install git+https://github.com/pauloalem/tornado-facebook-sdk.gitOr you can just download it and install via setup.py, it’s up to you.UsingGetting facebook’s public pagefrom tornado import ioloop
from facebook import GraphAPI

ioloop = ioloop.IOLoop.instance()
graph = GraphAPI()

# a simple callback that prints social graph responses
def print_callback(data):
    print data
    ioloop.stop()

graph.get_object('/facebook', callback=print_callback)

ioloop.start()Authenticating with a user auth token and printing it’s namegraph = GraphAPI(access_token)

#do something with the user's data, like print it's first name
def get_first_name(me):
    print me['first_name']
    ioloop.stop()

result = graph.get_object('/me', callback=get_first_name)
ioloop.start()Posting on an user’s walldef callback(response):
    # ...
graph.post_wall("Maoe!", callback=callback)Which is just a shortcut fordef callback(response):
    # ...
graph.put_object('me', 'feed', message="Maoe!!", callback=callback)Deleting an objectdef callback(response):
    # ...
graph.delete_object(obj_id, callback=callback)LicenseRead LICENSE.txtHistoryThis library is based on thefacebook-sdklibrary.
Originaly, I was going to use it as it’s simple and has a nice
interface, but it’s blocking code makes it a no-no.
Package: tornado-fastrpc
WARNINGtornado-fastrpcis deprecated, for XML-RPC usehttps://github.com/seifert/async-rpcinstead of this library.async-rpcis based onasyncio, so it is not only for
Tornado, but forasyncioin generral. Do you needFastRPC? Create an issue, I have library forFastRPCtoo, but it has not been published yet. However, I thint, it
never mind, probably nobody outsite Seznam.cz useFastRPC:-).tornado-fastrpcNon-blocking XML-RPC and FastRPC (seehttps://github.com/seznam/fastrpc)
client for Python’s Tornado. If FastRPC is not available, only XML-RPC
protocol will be supported. Python 2.7 and Python 3.4 (or higher) are
supported.InstalationRequirements:pycurlTornado3.2 or higherOptional requirements:fastrpc(libfastrpc+fastrpcPython’s module)Instalation and tests:python setup.py install
python setup.py testBuild Debian Jessie package (requiresdpkg-buildpackage+lintianand dependencies inBuild-Dependsoption indebian/controlfile.
Before building package, checkout debian-* branch.python setup.py bdist_debUssageproxy = ServerProxy('http://example.com/RPC2:8000',
                    connect_timeout=5.0,
                    timeout=5.0,
                    use_binary=True)


class BazHandler(tornado.web.RequestHandler):

    @tornado.gen.coroutine
    def get(self):
        try:
            res = yield proxy.getData(123)
        except Exception as e:
            self.write('Error: {}'.format(e))
        else:
            self.write('Data: {}'.format(res.value))


class BarHandler(tornado.web.RequestHandler):

    @tornado.gen.coroutine
    def get(self):
        res = yield proxy.getData(123, quiet=True)
        if res.success:
            self.write('Data: {}'.format(res.value))
        else:
            self.write('Error: {}'.format(res.exception))DocumentationServerProxy classclasstornado_fastrpc.client.ServerProxy(uri,
connect_timeout=5.0, timeout=5.0, use_binary=False, user_agent=None,
keep_alive=False, use_http10=True, http_proxy=None, max_clients=10)Async FastRPC client for Tornado, tt usespycurlbackend.
Manages communication with a remote RPC server.url<string>URL addressconnect_timeout<float>Timeout for initial connection in secondsrequest_timeout<float>Timeout for entire request in secondsuse_binary<bool>Force binary protocoluser_agent<string>User-Agent stringkeep_alive<bool>Allow keep-alive connectionuse_http10<bool>Force HTTP/1.0 protocol instead of HTTP/1.1http_proxy<string>HTTP proxy, eg.http://user:pass@example.com:80max_clients<int>Size of the Curl’s connection poolResult objectclasstornado_fastrpc.client.Result(success, value, exception)Return type for FastRPC call. Contains attributes:success<bool>Trueif operation succeeded, elseFalsevaluecontains returning value if operation succeeded, elseNoneexception<bool>contains instance of the exception if operation failed, elseNoneFault objectclasstornado_fastrpc.client.Fault(faultCode, faultString)Exception, indicates an XML-RPC error.faultCode<string>Error codefaultString<string>Error messageLicense3-clause BSD
Package: tornado-file-server
A Tornado-based File ServerFeaturesshow files on multiple pages;page navigation (to prev/up/next);file uploading;show file statistics (how many fils/folders);show file info: type/modification time/size;SceenshotScreenshotPython versionShould work with python>=2.7.Tested Python version:Python 2.7Python 3.9How-toUse 'pip install'install packagepip install git+https://github.com/walkoncross/tornado-file-serverstart serving:python -m tornado_file_server.serving --port 8899 _your_root_dir_or just run ./run_tornado_file_server.shIn your internet browser, for local test, put:http://localhost/8899; for public url, put http://your_binded_public_urlUse source codeinstall tornado:pip install tornado>=4.5;git clone this repo;start serving:python -m tornado_file_server.serving --port 8899 _your_root_dir_or just run ./run_tornado_file_server.shIn your internet browser, for local test, put:http://localhost/8899; for public url, put http://your_binded_public_url
Package: tornado-gcp
Tornadois a Python web framework and
asynchronous networking library, originally developed atFriendFeed.  By using non-blocking network I/O, Tornado
can scale to tens of thousands of open connections, making it ideal forlong polling,WebSockets, and other
applications that require a long-lived connection to each user.Hello, worldHere is a simple “Hello, world” example web app for Tornado:importtornado.ioloopimporttornado.webclassMainHandler(tornado.web.RequestHandler):defget(self):self.write("Hello, world")defmake_app():returntornado.web.Application([(r"/",MainHandler),])if__name__=="__main__":app=make_app()app.listen(8888)tornado.ioloop.IOLoop.current().start()This example does not use any of Tornado’s asynchronous features; for
that see thissimple chat room.DocumentationDocumentation and links to additional resources are available athttps://www.tornadoweb.org
Package: tornado-http-auth
Digest and basic authentication for theTornadoweb framework. Based on code
and ideas from Twisted’scred.InstallationThe latest stable version of tornado-ansi-markup can be installed from pypi:$pipinstalltornado-http-authUsageimporttornado.ioloopfromtornado.webimportRequestHandler,Applicationfromtornado_http_authimportDigestAuthMixin,BasicAuthMixin,auth_requiredcredentials={'user1':'pass1'}# Example 1 (using decorator).classMainHandler(DigestAuthMixin,RequestHandler):@auth_required(realm='Protected',auth_func=credentials.get)defget(self):self.write('Hello%s'%self._current_user)# Example 2 (using prepare and get_authentciated_user).classMainHandler(BasicAuthMixin,RequestHandler):defprepare(self):self.get_authenticated_user(check_credentials_func=credentials.get,realm='Protected')defget(self):self.write('Hello%s'%self._current_user)app=Application([(r'/',MainHandler),])app.listen(8888)tornado.ioloop.IOLoop.current().start()# curl --user user1:pass1 -v http://localhost:8888  -> 200 OK# curl --user user2:pass2 -v http://localhost:8888  -> 401 Unauthorized# Remove or comment second class# curl --digest --user user1:pass1 -v http://localhost:8888  -> 200 OK# curl --digest --user user2:pass2 -v http://localhost:8888  -> 401 UnauthorizedLicenseThis project is released under the terms of theApache License, Version 2.0.
Package: tornado-httpclient-mock
## tornado-httpclient-mockA library for mocking requests in Tornado HTTP client[![Build Status](https://travis-ci.org/SuminAndrew/tornado-httpclient-mock.svg?branch=master)](https://travis-ci.org/SuminAndrew/tornado-httpclient-mock)[![codecov](https://codecov.io/gh/SuminAndrew/tornado-httpclient-mock/branch/master/graph/badge.svg)](https://codecov.io/gh/SuminAndrew/tornado-httpclient-mock)This library can be used to patch `AsyncHTTPClient.fetch_impl` method to stub requests to external resources.`tornado_mock.httpclient.patch_http_client` does this patching on `AsyncHTTPClient` instance.After that you can use `tornado_mock.httpclient.set_stub` method to setup an appropriate responses to the requests.```pythonfrom tornado import genfrom tornado.httpclient import AsyncHTTPClientfrom tornado.testing import AsyncHTTPTestCasefrom tornado.web import Application, RequestHandlerfrom tornado_mock.httpclient import get_response_stub, patch_http_client, set_stubclass TestHandler(RequestHandler):@gen.coroutinedef get(self, *args, **kwargs):response1 = yield self.application.http_client.fetch('http://example.com/path?query')self.write(response1.body)response2 = yield self.application.http_client.fetch('http://test.com/path')self.finish(response2.body)class HTTPClientMockTest(AsyncHTTPTestCase):def get_app(self):app = Application([('/test', TestHandler)])self.app_http_client = app.http_client = AsyncHTTPClient(force_instance=True)return appdef test_mock(self):patch_http_client(self.app_http_client)def get_response(request):return get_response_stub(request, buffer='STUB2')set_stub(self.app_http_client, 'http://example.com/path', response_body='STUB1')set_stub(self.app_http_client, 'http://test.com/path', response_function=get_response)self.assertEqual(self.fetch('/test').body, b'STUB1STUB2')```For more information see docstrings in [httpclient.py](tornado_mock/httpclient.py).