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 Iterable, Iterator, Any | |
def chain_ordered[T]( | |
*seqs: Iterable[T], | |
) -> Iterable[T]: | |
""" | |
Chain ordered sequences into ordered sequence. Complexity of one | |
iteration is O(n), where n is a number of sequences. |
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
# https://gist.github.com/TheArcherST/fd9d924323de6e50cc7794d4a67fffd7 | |
from typing import ClassVar, Type | |
from collections import namedtuple | |
from itertools import chain | |
class Namedtuple( |
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
"""Event generation system | |
Assumes that we have some stream of data, and we want to synchronize | |
it with remote server with minimum network stress. Chosen solution is | |
to convert data stream to stream of data change events. This module | |
describes base units of convert system. | |
Specific features: | |
1. sources of the data are not eternal. when source expires, we must | |
accept the latest revision result. |
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 dataclasses | |
import re | |
import sys | |
from enum import Enum | |
from dataclass_factory import Factory | |
from functools import partial | |
import typing | |
import yaml | |
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 warnings | |
import os | |
from shutil import rmtree | |
class TDException(Exception): | |
pass | |
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 Any | |
from dataclasses import dataclass | |
class FunctionType: | |
const = 'const' | |
call = 'call' | |
@dataclass |
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 timeit import timeit | |
import plotly.express as px | |
import pandas as pd | |
EXPRESSIONS = [ | |
"{v: k for k, v in data.items()}", | |
"dict(zip(data.values(), data.keys()))", | |
"new = {}\nfor k, v in data.items(): new[k] = v", | |
] |
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
class Repr: | |
"""Repr method generator | |
Automatically parse object init-based definition. | |
To include extra fields, list them in `__repr_include__`. | |
>>> class User(Repr): | |
... __repr_include__ = ['uri'] | |
... | |
... def __init__(self, uid: int, uname: str, referral: int = None): |
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 Any, Dict, Union | |
from types import FunctionType | |
from inspect import getargs, getfullargspec | |
import functools | |
import warnings | |
class TypesCompilationWarning(Warning): | |
pass |
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
""" | |
This program helps you to evaluate you test results | |
```input.md | |
1. . | |
2. ? | |
3. | |
4. |