diff --git a/mocks/gc.py b/mocks/gc.py deleted file mode 100644 index 05eb378a31..0000000000 --- a/mocks/gc.py +++ /dev/null @@ -1,14 +0,0 @@ -def enable(): - pass - -def disable(): - pass - -def collect(): - pass - -def mem_alloc(): - pass - -def mem_free(): - pass diff --git a/mocks/gc.pyi b/mocks/gc.pyi new file mode 100644 index 0000000000..b5dba6b751 --- /dev/null +++ b/mocks/gc.pyi @@ -0,0 +1,5 @@ +def enable() -> None: ... +def disable() -> None: ... +def collect() -> None: ... +def mem_alloc() -> int: ... +def mem_free() -> int: ... diff --git a/mocks/machine.py b/mocks/machine.py deleted file mode 100644 index 978816216a..0000000000 --- a/mocks/machine.py +++ /dev/null @@ -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 diff --git a/mocks/micropython.py b/mocks/micropython.py deleted file mode 100644 index 0fac10569a..0000000000 --- a/mocks/micropython.py +++ /dev/null @@ -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 - diff --git a/mocks/micropython.pyi b/mocks/micropython.pyi new file mode 100644 index 0000000000..c034d88110 --- /dev/null +++ b/mocks/micropython.pyi @@ -0,0 +1,5 @@ +def const(c): + return c +def mem_current() -> int: ... +def mem_total() -> int: ... +def mem_peak() -> int: ... diff --git a/mocks/sys.py b/mocks/sys.py deleted file mode 100644 index c387cc7e38..0000000000 --- a/mocks/sys.py +++ /dev/null @@ -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) diff --git a/mocks/sys.pyi b/mocks/sys.pyi new file mode 100644 index 0000000000..05b4673b03 --- /dev/null +++ b/mocks/sys.pyi @@ -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] diff --git a/mocks/ubinascii.py b/mocks/ubinascii.py deleted file mode 100644 index 7dd47dc54e..0000000000 --- a/mocks/ubinascii.py +++ /dev/null @@ -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 diff --git a/mocks/ubinascii.pyi b/mocks/ubinascii.pyi new file mode 100644 index 0000000000..47b1817fbc --- /dev/null +++ b/mocks/ubinascii.pyi @@ -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: ... diff --git a/mocks/uctypes.py b/mocks/uctypes.py deleted file mode 100644 index dac719a6d8..0000000000 --- a/mocks/uctypes.py +++ /dev/null @@ -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 diff --git a/mocks/uctypes.pyi b/mocks/uctypes.pyi new file mode 100644 index 0000000000..792a34daf1 --- /dev/null +++ b/mocks/uctypes.pyi @@ -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: ... diff --git a/mocks/uheapq.py b/mocks/uheapq.py deleted file mode 100644 index e6f0a0f176..0000000000 --- a/mocks/uheapq.py +++ /dev/null @@ -1,8 +0,0 @@ -def heappush(heap, item): - pass - -def heappop(heap): - pass - -def heapify(x): - pass diff --git a/mocks/uio.py b/mocks/uio.py deleted file mode 100644 index 65145b05a5..0000000000 --- a/mocks/uio.py +++ /dev/null @@ -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 diff --git a/mocks/uio.pyi b/mocks/uio.pyi new file mode 100644 index 0000000000..77d1bc4003 --- /dev/null +++ b/mocks/uio.pyi @@ -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 diff --git a/mocks/ustruct.py b/mocks/ustruct.py deleted file mode 100644 index d98dff1796..0000000000 --- a/mocks/ustruct.py +++ /dev/null @@ -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 diff --git a/mocks/ustruct.pyi b/mocks/ustruct.pyi new file mode 100644 index 0000000000..8791909fe8 --- /dev/null +++ b/mocks/ustruct.pyi @@ -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: ... diff --git a/mocks/utime.py b/mocks/utime.py deleted file mode 100644 index 66c2c48cfc..0000000000 --- a/mocks/utime.py +++ /dev/null @@ -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 diff --git a/mocks/utime.pyi b/mocks/utime.pyi new file mode 100644 index 0000000000..ff7f10d29c --- /dev/null +++ b/mocks/utime.pyi @@ -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: ... diff --git a/mocks/uzlib.py b/mocks/uzlib.py deleted file mode 100644 index 7dfce11e33..0000000000 --- a/mocks/uzlib.py +++ /dev/null @@ -1,2 +0,0 @@ -def decompress(data): - pass