Skip to content

Instantly share code, notes, and snippets.

View rec's full-sized avatar
🥝
coding

Tom Ritchford rec

🥝
coding
View GitHub Profile
from engora.misc import dcommand
from typer import Argument, Option, Typer
from typing import Optional
import pytest
command = Typer().command
@command(help='test')
def a_command(
# This has been replaced by the PyPi module https://pypi.org/project/dtyper/
from argparse import Namespace
import dataclasses
import functools
import inspect
@functools.wraps(dataclasses.make_dataclass)
def dcommand(typer_f, **kwargs):
from . import command
from engora import CONFIG
from pathlib import Path
from typer import Argument, Option
from typing import List, Optional
_CFGS = (
'max_items',
'max_requests',
'only',
type AutoGenerated struct {
A struct {
B []interface{} `json:"b"`
} `json:"a"`
}
@rec
rec / dc.py
Last active August 17, 2021 09:33
from dataclasses import dataclass
@dataclass
class B:
b: List[object]
@dataclass
class A:
a: B
from dataclasses import dataclass, field
@dataclass(order=True)
class Action:
name: str = 'test'
_name: str = field(default="undefined", init=False, compare=True, repr=False)
@property
def name(self) -> str: # pylint: disable=function-redefined
def turing(function):
if not has_infinite_loop(function, function):
while True:
pass
def loops_forever(function, *arguments):
# Return True if function(*arguments) loops forever
# Let's try it out
def loops_forever():
while True:
print()
def loops_once():
dek = _dek(_dek, defer=True)
import dek
@dek
def print_before(pfunc, label='label'):
print(label, pfunc)
return pfunc()