I hereby claim:
- I am njsmith on github.
- I am njs (https://keybase.io/njs) on keybase.
- I have a public key ASDPDkjaSUnDcWcxBQEDBot3TR0Oca46Q_p_enJiX_v7BAo
To claim this, I am signing this object:
| import trio | |
| # Process pool based on concurrent.futures | |
| import concurrent.futures | |
| class TrioProcessExecutor(trio.abc.AsyncResource): | |
| def __init__(self, max_workers=None): | |
| self._executor = concurrent.futures.ProcessPoolExecutor(max_workers=max_workers) | |
| async def run_sync(self, fn, *args): | |
| fut = self._executor.submit(fn, *args) |
| from contextlib import contextmanager | |
| import trio | |
| class MultiCancel: | |
| def __init__(self): | |
| self.scopes = set() | |
| self.cancelled = False | |
| @contextmanager | |
| def apply(self): |
| @attr.s | |
| class TrioFuture: | |
| _result = attr.ib(default=None) | |
| _finished = attr.ib(default=attr.Factory(trio.Event)) | |
| def set_result(self, result): | |
| assert not self._finished.is_set() | |
| self._result = result | |
| self._finished.set() | |
| # pip install cryptography | |
| import cryptography | |
| import os | |
| import numpy as np | |
| from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes | |
| from cryptography.hazmat.backends import default_backend | |
| # Cribbing from |
| from collections import deque, OrderedDict | |
| import trio | |
| class MultiGetQueue: | |
| def __init__(self, max_size): | |
| self._max_size = max_size | |
| # {task: abort func} | |
| # probably should make Task._abort_func public, or maybe even change | |
| # the reschedule code to call the abort func in general? | |
| self._get_wait = OrderedDict() |
I hereby claim:
To claim this, I am signing this object:
| # Scenario: | |
| # - TLS connection is set up successfully | |
| # - client sends close_notify then closes socket | |
| # - server receives the close_notify then attempts to send close_notify back | |
| # | |
| # On CPython, the last step raises BrokenPipeError. On PyPy, it raises | |
| # SSLEOFError. | |
| # | |
| # SSLEOFError seems a bit perverse given that it's supposed to mean "EOF | |
| # occurred in violation of protocol", and the client's behavior here is |
| import trio | |
| async def main(): | |
| async with trio.open_nursery() as nursery: | |
| nursery.spawn(f1) | |
| nursery.spawn(f2) | |
| async def f1(): | |
| raise KeyError |
| argparse | |
| atexit | |
| bisect | |
| _bisect | |
| _compat_pickle | |
| difflib | |
| glob | |
| http | |
| http.client | |
| ipaddress |
| import abc | |
| class MyABC(abc.ABC): | |
| @abc.abstractmethod | |
| def foo(self, bar): | |
| pass | |
| def foo(bar): | |
| return bar + 1 |