This file contains 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
diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py | |
index aa2a5e8..6a6f868 100644 | |
--- a/Lib/test/test_coroutines.py | |
+++ b/Lib/test/test_coroutines.py | |
@@ -497,17 +497,133 @@ class CoroutineTest(unittest.TestCase): | |
return self | |
def __aexit__(self, *e): | |
+ return 444 | |
+ |
This file contains 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 | |
async def worker(): | |
fut = asyncio.Future() | |
def setval(): | |
print('setval') | |
fut.set_result(123) | |
print('setup') |
This file contains 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 | |
async def http_get(domain): | |
reader, writer = await asyncio.open_connection(domain, 80) | |
writer.write(b'\r\n'.join([ | |
b'GET / HTTP/1.1', | |
b'Host: %b' % domain.encode('latin-1'), | |
b'Connection: close', | |
b'', b'' |
This file contains 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
## | |
# Copyright (c) 2011 Sprymix Inc. | |
# All rights reserved. | |
# | |
# See LICENSE for details. | |
## | |
import inspect | |
import collections |
This file contains 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
def render_signature(signature): | |
'''Renders function definition by its signature. | |
Example: | |
>>> def test(a:'foo', *, b:'bar', c=True, **kwargs:None) -> 'spam': | |
... pass | |
>>> render_signature(inspect.signature(test)) | |
test(a:'foo', *, b:'bar', c=True, **kwargs:None) -> 'spam' |
This file contains 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
class _RedisPool(aioredis.RedisPool): | |
@asyncio.coroutine | |
def acquire(self): | |
# XXX | |
with (yield from self._cond): | |
while True: | |
yield from self._fill_free(override_min=True) | |
if self.freesize: | |
conn = self._pool.popleft() | |
if conn.closed: |
This file contains 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
# client.py | |
# | |
# Common client. Measure the response rate of the echo server | |
from socket import * | |
import time | |
from threading import Thread | |
import atexit | |
import sys |
This file contains 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 uvloop | |
from socket import * | |
from uvloop.futures import Future as CFuture | |
import cProfile | |
import sys | |
import time |
This file contains 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
## | |
# Copyright 2013 Yury Selivanov <yselivanov@sprymix.com> | |
# License: MIT | |
## | |
import code | |
import subprocess | |
import os | |
import sys |
This file contains 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 | |
I = 0 | |
def test2(): | |
yield from () | |
global I | |
I += 1 |