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
| from typing import List, NoReturn | |
| class Uninhabited: | |
| pass | |
| def never(x: Uninhabited) -> NoReturn: | |
| raise RuntimeError() |
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
| from typing import Generic, Optional, TypeVar | |
| T = TypeVar("T") | |
| class A: | |
| pass | |
| class B(Generic[T]): |
This file has been truncated, but you can view the full file.
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
| <?xml version="1.0" standalone="no"?> | |
| <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | |
| <svg version="1.1" width="1200" height="1494" onload="init(evt)" viewBox="0 0 1200 1494" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
| <!-- Flame graph stack visualization. See https://github.com/brendangregg/FlameGraph for latest version, and http://www.brendangregg.com/flamegraphs.html for examples. --> | |
| <!-- NOTES: --> | |
| <defs > | |
| <linearGradient id="background" y1="0" y2="1" x1="0" x2="0" > | |
| <stop stop-color="#eeeeee" offset="5%" /> | |
| <stop stop-color="#eeeeb0" offset="95%" /> | |
| </linearGradient> |
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
| from dataclasses import dataclass, field | |
| @dataclass | |
| class A1: | |
| a: int | |
| @dataclass | |
| class A2: |
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
| from dataclasses import dataclass, field | |
| @dataclass | |
| class A: | |
| a: int = field(repr=False) | |
| @dataclass | |
| class B: |
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
| #define _GNU_SOURCE | |
| #include <fcntl.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| #include <errno.h> | |
| #include <limits.h> | |
| int | |
| main(int argc, char *argv[]) |
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
| from typing import TypeVar, Callable, Tuple, overload, Any | |
| T1 = TypeVar('T1') | |
| T2 = TypeVar('T2') | |
| T3 = TypeVar('T3') | |
| R = TypeVar('R') | |
| @overload | |
| def f(c: Callable[[T1], R], A: Tuple[T1]) -> R: ... |
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
| from itertools import count | |
| import gevent | |
| from gevent.event import AsyncResult | |
| def wait_twice(async_result): | |
| print('wait_twice enter') | |
| gevent.joinall([async_result, async_result], raise_error=True) | |
| print('wait_twice exit') |
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 collections | |
| import inspect | |
| EMPTY = object() | |
| # Goals: | |
| # - Make it easier to write tests: | |
| # - Reduce the number of variables a test needs to manage by introducing hidden state | |
| # - Automate duplicated tasks: | |
| # - Creating topologies |
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
| from eth_utils import to_canonical_address | |
| from raiden.storage import serialize, sqlite | |
| from raiden.storage.wal import WriteAheadLog | |
| from raiden.transfer import node, views | |
| from raiden.transfer.architecture import StateManager | |
| serializer = serialize.JSONSerializer() | |