$ docker network create n1
$ docker run --rm -it --name t1 --net n1 -e TARANTOOL_REPLICATION=t1:3301,t2:3301 progaudi/tarantool:1.10.1-135-g193ef4150
local function noop(...) | |
return ... | |
end | |
-- convert a nested table to a flat table | |
local function flatten(t, sep, key_modifier, res) | |
if type(t) ~= 'table' then | |
return t | |
end |
import threading | |
from queue import Empty, Full | |
class QueueClosed(Exception): | |
pass | |
class MyQueue(): |
""" | |
Calculates test coverage for the new code only, that is for the added and | |
changed lines of code. | |
Usage: | |
pytest --cov --cov-report=xml | |
git diff master..HEAD |python calculate_new_coverage.py --coverage-report coverage.xml | |
""" |
import inspect | |
from argparse import ArgumentParser | |
def argparse_call(fn): | |
sig = inspect.signature(fn) | |
p = ArgumentParser() | |
for param in sig.parameters.values(): | |
kwargs = { | |
'type': param.annotation, |
from functools import wraps | |
from typing import TypedDict | |
from pydantic import BaseModel, validate_arguments | |
def replace_typed_dict_annotations(annotations): | |
new_annotations = {} | |
for k, T in annotations.items(): | |
if type(T).__name__ == '_TypedDictMeta': |
from typing import ( | |
Any, | |
Dict, | |
NamedTuple, | |
) | |
import pytest | |
class Case(NamedTuple): |
from dataclasses import dataclass | |
import pytest | |
from lib.util import paths_eq | |
from collections.abc import Mapping | |
_MISS = object() |
from functools import partial | |
class F: | |
__slots__ = ('fns',) | |
def __init__(self, *fns): | |
self.fns = fns | |
def __call__(self, *args, **kwargs): |
class compose: | |
__slots__ = ('f', 'fs') | |
def __init__(self, *fs): | |
self.f, *self.fs = reversed(fs) | |
def __call__(self, *args, **kwargs): | |
result = self.f(*args, **kwargs) | |
for f in self.fs: | |
result = f(result) |