1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 01:18:28 +00:00

mocks: cleanup, prepare for mypy

This commit is contained in:
Jan Pochyla 2017-06-14 12:26:02 +02:00
parent 596a4227ad
commit a01504ace9
19 changed files with 83 additions and 214 deletions

View File

@ -1,14 +0,0 @@
def enable():
pass
def disable():
pass
def collect():
pass
def mem_alloc():
pass
def mem_free():
pass

5
mocks/gc.pyi Normal file
View File

@ -0,0 +1,5 @@
def enable() -> None: ...
def disable() -> None: ...
def collect() -> None: ...
def mem_alloc() -> int: ...
def mem_free() -> int: ...

View File

@ -1,41 +0,0 @@
def reset():
pass
def reset_cause():
pass
def disable_irq():
pass
def enable_irq(state):
pass
def freq():
pass
def idle():
pass
def sleep():
pass
def deepsleep():
pass
def unique_id():
pass
def time_pulse_us(pin, pulse_level, timeout_us=1000000):
pass
IDLE = 0
SLEEP = 0
DEEPSLEEP = 0
PWRON_RESET = 0
HARD_RESET = 0
WDT_RESET = 0
DEEPSLEEP_RESET = 0
SOFT_RESET = 0
WLAN_WAKE = 0
PIN_WAKE = 0
RTC_WAKE = 0

View File

@ -1,12 +0,0 @@
def const(c):
return c
def mem_info(verbose=None):
pass
def qstr_info(verbose=None):
pass
def alloc_emergency_exception_buf(size):
pass

5
mocks/micropython.pyi Normal file
View File

@ -0,0 +1,5 @@
def const(c):
return c
def mem_current() -> int: ...
def mem_total() -> int: ...
def mem_peak() -> int: ...

View File

@ -1,18 +0,0 @@
def exit(retval=0):
pass
def print_exception(exc, file=None):
pass
argv = []
byteorder = None
implementation = None
maxsize = None
modules = []
path = []
platform = 'mock'
stderr = None
stdin = None
stdout = None
version = 'mock-version'
version_info = (0, 0, 0)

14
mocks/sys.pyi Normal file
View File

@ -0,0 +1,14 @@
def exit(retval: Any = ...) -> None:
raise SystemExit()
def print_exception(exc: BaseException) -> None: ...
path = ... # type: List[str]
argv = ... # type: List[str]
version = ... # type: str
version_info = ... # type: Tuple[int, int, int]
implementation = ... # type: Tuple[str, Tuple[int, int, int]]
platform = ... # type: str
byteorder = ... # type: str
maxsize = ... # type: int
modules = ... # type: Dict[str, Any]

View File

@ -1,14 +0,0 @@
def hexlify(data, sep=None):
return 0
def unhexlify(data):
return 0
def a2b_base64(data):
return 0
def b2a_base64(data):
return 0
def crc32(data, crc=None):
return 0

5
mocks/ubinascii.pyi Normal file
View File

@ -0,0 +1,5 @@
def hexlify(data: bytes, sep: bytes = ...) -> bytes: ...
def unhexlify(data: bytes) -> bytes: ...
def a2b_base64(data: bytes) -> bytes: ...
def b2a_base64(data: bytes) -> bytes: ...
def crc32(data: bytes, crc: int = ...) -> int: ...

View File

@ -1,37 +0,0 @@
ARRAY = 0
NATIVE = 0
LITTLE_ENDIAN = 0
BIG_ENDIAN = 0
VOID = 0
UINT8 = 0
INT8 = 0
UINT16 = 0
INT16 = 0
UINT32 = 0
INT32 = 0
UINT64 = 0
INT64 = 0
BFUINT8 = 0
BFINT8 = 0
BFUINT16 = 0
BFINT16 = 0
BFUINT32 = 0
BFINT32 = 0
BF_POS = 0
BF_LEN = 0
FLOAT32 = 0
def struct(addr, descriptor, layout_type=NATIVE):
return 0
def sizeof(struct):
return 0
def addressof(obj):
return 0
def bytes_at(addr, size):
return 0
def bytearray_at(addr, size):
return 0

30
mocks/uctypes.pyi Normal file
View File

@ -0,0 +1,30 @@
ARRAY = ... # type: int
NATIVE = ... # type: int
LITTLE_ENDIAN = ... # type: int
BIG_ENDIAN = ... # type: int
VOID = ... # type: int
UINT8 = ... # type: int
INT8 = ... # type: int
UINT16 = ... # type: int
INT16 = ... # type: int
UINT32 = ... # type: int
INT32 = ... # type: int
UINT64 = ... # type: int
INT64 = ... # type: int
BFUINT8 = ... # type: int
BFINT8 = ... # type: int
BFUINT16 = ... # type: int
BFINT16 = ... # type: int
BFUINT32 = ... # type: int
BFINT32 = ... # type: int
BF_POS = ... # type: int
BF_LEN = ... # type: int
FLOAT32 = ... # type: int
class struct:
def __init__(self, addr: int, descriptor: dict, layout_type: int = ...) -> None: ...
def sizeof(struct: struct) -> int: ...
def addressof(obj: bytes) -> int: ...
def bytes_at(addr: int, size: int) -> bytes: ...
def bytearray_at(addr, size) -> bytearray: ...

View File

@ -1,8 +0,0 @@
def heappush(heap, item):
pass
def heappop(heap):
pass
def heapify(x):
pass

View File

@ -1,19 +0,0 @@
def open(name, mode='r', **kwargs):
pass
class FileIO:
pass
class TextIOWrapper:
pass
class StringIO:
def __init__(string):
pass
class BytesIO:
def __init__(string):
pass
def getvalue():
pass

11
mocks/uio.pyi Normal file
View File

@ -0,0 +1,11 @@
class FileIO: ...
class StringIO:
def __init__(self, _: Union[int, str]) -> None: ...
class BytesIO:
def __init__(self, _: Union[int, bytes]) -> None: ...
def getvalue(self) -> bytes: ...
def open(name: str, mode: str = ...) -> FileIO:
pass

View File

@ -1,14 +0,0 @@
def calcsize(fmt):
return 0
def pack(fmt, *args):
return 0
def pack_info(fmt, buffer, offset, *args):
return 0
def unpack(fmt, data):
return 0
def unpack_from(fmt, data, offset=0):
return 0

5
mocks/ustruct.pyi Normal file
View File

@ -0,0 +1,5 @@
def calcsize(fmt: str) -> int: ...
def pack(fmt: str, *args: Any) -> bytes: ...
def pack_into(fmt: str, buffer: bytearray, offset: int, *args: Any) -> None: ...
def unpack(fmt: str, data: bytes) -> Tuple: ...
def unpack_from(fmt: str, data: bytes, offset: int = ...) -> Tuple: ...

View File

@ -1,35 +0,0 @@
def localtime(secs=None):
return 0
def ticks_ms():
return 0
def mktime():
return 0
def sleep(seconds):
pass
def sleep_ms(ms):
pass
def sleep_us(us):
pass
def ticks_ms():
return 0
def ticks_us():
return 0
def ticks_cpu():
return 0
def ticks_add(ticks_in, delta_in):
return 0
def ticks_diff(old, new):
return 0
def time():
return 0

8
mocks/utime.pyi Normal file
View File

@ -0,0 +1,8 @@
def sleep(s: int) -> None: ...
def sleep_ms(ms: int) -> None: ...
def sleep_us(us: int) -> None: ...
def ticks_ms() -> int: ...
def ticks_us() -> int: ...
def ticks_cpu() -> int: ...
def ticks_add(ticks_in: int, delta_in: int) -> int: ...
def ticks_diff(old: int, new: int) -> int: ...

View File

@ -1,2 +0,0 @@
def decompress(data):
pass