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 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 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
# 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): |
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 . 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', |
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
type AutoGenerated struct { | |
A struct { | |
B []interface{} `json:"b"` | |
} `json:"a"` | |
} |
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 | |
@dataclass | |
class B: | |
b: List[object] | |
@dataclass | |
class A: | |
a: B |
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, 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 |
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
def turing(function): | |
if not has_infinite_loop(function, function): | |
while True: | |
pass |
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
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(): |
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
dek = _dek(_dek, defer=True) |
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
import dek | |
@dek | |
def print_before(pfunc, label='label'): | |
print(label, pfunc) | |
return pfunc() |
NewerOlder