View pydantic_typed_dict.py
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 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': |
View pytest_parametrize.py
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 typing import ( | |
Any, | |
Dict, | |
NamedTuple, | |
) | |
import pytest | |
class Case(NamedTuple): |
View paths_eq.py
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 dataclasses import dataclass | |
import pytest | |
from lib.util import paths_eq | |
from collections.abc import Mapping | |
_MISS = object() |
View f.py
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 functools import partial | |
class F: | |
__slots__ = ('fns',) | |
def __init__(self, *fns): | |
self.fns = fns | |
def __call__(self, *args, **kwargs): |
View compose.py
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
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) |
View files.txt
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
t1.lua| box.cfg{ | |
t1.lua| feedback_enabled = false, | |
t1.lua| replication_connect_timeout = 1, | |
t1.lua| replication_connect_quorum = 0, | |
t1.lua| instance_uuid = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa1", | |
t1.lua| replicaset_uuid = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", | |
t1.lua| replication = { | |
t1.lua| "127.0.0.1:3301", | |
t1.lua| "127.0.0.1:3302", | |
t1.lua| "127.0.0.1:3303", |
View docker-compose.yaml
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
version: '3.7' | |
services: | |
t1: | |
image: tarantool/tarantool:1.10.2 | |
ports: | |
- '3301:3301' | |
entrypoint: '' | |
hostname: t1 | |
command: |
View flatten.lua
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
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 |
View Dockerfile
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 progaudi/tarantool:1.10.2 | |
ENV VSHARD_VERSION=fcb05f7609b5a050781fe79829439e9730cee3ae | |
RUN apk add -U --no-cache git \ | |
&& cd /tmp \ | |
&& git clone https://github.com/tarantool/vshard.git \ | |
&& ( cd vshard && git checkout ${VSHARD_VERSION} ) \ | |
&& mv vshard/vshard /opt/tarantool/vshard \ | |
&& rm -rf vshard |
View consul_kv_atomic_bash.bash
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
consul_kv_put_cas() { | |
local key="$1" | |
local value="$2" | |
local cas="$3" | |
test "$(curl -sq -X PUT -d "$value" "http://localhost:8500/v1/kv/${key}?cas=${cas}")" = "true" | |
} | |
consul_kv_put_if_not_exists() { | |
local key="$1" | |
local value="$2" |
NewerOlder