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 | |
END = b'Bye-bye!\n' | |
async def echo_client(): | |
reader, writer = await asyncio.open_connection('localhost', 8000) | |
writer.write(b'Hello, world\n') | |
writer.write(b'What a fine day it is.\n') | |
writer.write(END) | |
while True: |
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 | |
class CM: | |
async def __aenter__(self): | |
print(1) | |
await asyncio.sleep(0.01) | |
print(2) | |
return self |
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
from inspect import getattr_static | |
class dep: | |
name = None | |
def __init__(self, type): | |
self.type = type |
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
In [1]: import dis | |
In [2]: for i in range(10): | |
...: print(i) | |
...: | |
0 | |
1 | |
2 | |
3 | |
4 |
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
There was an error in the Elpy backend. | |
The following lines were received from Python, and might help identifying | |
the problem. | |
Traceback (most recent call last): | |
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main | |
"__main__", mod_spec) | |
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code | |
exec(code, run_globals) | |
File "/home/andrew/.local/lib/python3.4/site-packages/elpy/__main__.py", line 15, in <module> |
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 functools | |
handles = set() | |
def call_later(delay, cb, *args, loop=None): | |
if loop is None: |
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 | |
@asyncio.coroutine | |
def sender(queue): | |
print('sender started') | |
try: | |
yield from asyncio.sleep(3) | |
while True: | |
data = yield from queue.get() |
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 | |
class A: | |
def __init__(self, reader, writter): | |
self.reader, self.writer = reader, writter | |
@asyncio.coroutine | |
def read_packet(self): | |
bsize = yield from self.reader.readexactly(4) |
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
[user] | |
name = Andrew Svetlov | |
email = [email protected] | |
[color] | |
ui = true | |
[alias] | |
lg = log --graph --pretty=format:'%Cred%h%Creset%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
st = status -sb | |
co = checkout | |
ci = commit |
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
from asyncio import * | |
@coroutine | |
def coro(): | |
proc = yield from create_subprocess_exec('true') | |
yield from proc.wait() | |
print('subprocess returncode', proc.returncode) | |
def thr(): |