This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import erequests | |
| import os | |
| HTTPBIN_URL = os.environ.get('HTTPBIN_URL', 'http://httpbin.org/') | |
| def httpbin(*suffix): | |
| """Returns url for HTTPBIN resource.""" | |
| return HTTPBIN_URL + '/'.join(suffix) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import erequests | |
| URLS = ['http://httpbin.org/get?p=%s' % i for i in range(5)] | |
| result = {} | |
| def hook(r, **kwargs): | |
| print "XXX" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| import time | |
| loop = asyncio.get_event_loop() | |
| def some_work(): | |
| time.sleep(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pyuv | |
| import threading | |
| import time | |
| def cb(handle): | |
| print "x" | |
| def run(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| def rls(path): | |
| for dirname, dirnames, filenames in os.walk(path): | |
| # directories first | |
| for subdirname in dirnames: | |
| yield os.path.join(dirname, subdirname) | |
| # files next | |
| for filename in filenames: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from autobahn.resource import WebSocketResource, WSGIRootResource | |
| from autobahn.websocket import WebSocketServerFactory, WebSocketServerProtocol | |
| from flask import Flask, render_template | |
| from twisted.application import internet, service | |
| from twisted.internet import reactor | |
| from twisted.python.threadpool import ThreadPool | |
| from twisted.web.server import Site |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ tox -c tox.ini.saghul -e py33-caresresolver -vv | |
| /usr/local/bin/tox:5: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.6/site-packages is being added to sys.path | |
| from pkg_resources import load_entry_point | |
| /usr/local/bin/tox:5: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.pyc, but /Library/Python/2.6/site-packages is being added to sys.path | |
| from pkg_resources import load_entry_point | |
| using tox.ini: /Users/saghul/src/tornado/tox.ini.saghul | |
| using tox-1.4.2 from /Library/Python/2.6/site-packages/tox/__init__.pyc | |
| GLOB start: packaging | |
| GLOB sdist-make: /Users/saghul/src/tornado/setup.py | |
| /Users/saghul/src/tornado$ /usr/bin/python /Users/saghul/src/tornado/setup.py sdist --formats=zip --dist-dir /Users/saghul/src/tornado/.tox/dist >/Users/saghul/src/tornado/.tox/log/tox-0.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ python t.py | |
| ping | |
| ping | |
| ping | |
| ping | |
| pingping | |
| stop1 | |
| Task(<_foo>)<PENDING, [<function _raise_stop_error at 0x1010ef440>]>False | |
| ping | |
| pingping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import rose | |
| from tulip import events | |
| from tulip import tasks | |
| #events.set_event_loop_policy(rose.EventLoopPolicy()) | |
| reactor = events.get_event_loop() | |
| def _foo(): |