mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
mocks: add typing module
This commit is contained in:
parent
803c47dca8
commit
181a2ad8c9
@ -1,3 +1,4 @@
|
||||
from typing import *
|
||||
|
||||
# extmod/modtrezorconfig/modtrezorconfig.c
|
||||
class Config:
|
||||
|
@ -1,3 +1,4 @@
|
||||
from typing import *
|
||||
|
||||
# extmod/modtrezorcrypto/modtrezorcrypto-aes.h
|
||||
class AES:
|
||||
@ -5,7 +6,7 @@ class AES:
|
||||
AES context.
|
||||
'''
|
||||
|
||||
def __init__(self, mode: int, key: bytes, iv: bytes = ...) -> None:
|
||||
def __init__(self, mode: int, key: bytes, iv: bytes = None) -> None:
|
||||
'''
|
||||
Initialize AES context.
|
||||
'''
|
||||
|
@ -1,3 +1,4 @@
|
||||
from typing import *
|
||||
|
||||
# extmod/modtrezorio/modtrezorio-sdcard.h
|
||||
class SDCard:
|
||||
|
@ -1,3 +1,4 @@
|
||||
from typing import *
|
||||
|
||||
# extmod/modtrezormsg/modtrezormsg.c
|
||||
class HID:
|
||||
|
@ -1,3 +1,4 @@
|
||||
from typing import *
|
||||
|
||||
# extmod/modtrezorui/modtrezorui-display.h
|
||||
class Display:
|
||||
|
@ -1,3 +1,4 @@
|
||||
from typing import *
|
||||
|
||||
# extmod/modtrezorutils/modtrezorutils.c
|
||||
def memcpy(dst: bytearray, dst_ofs: int,
|
||||
|
@ -1,3 +1,5 @@
|
||||
from typing import *
|
||||
|
||||
def exit(retval: Any = ...) -> None:
|
||||
raise SystemExit()
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
from typing import *
|
||||
|
||||
def calcsize(fmt: str) -> int: ...
|
||||
def pack(fmt: str, *args: Any) -> bytes: ...
|
||||
def pack_into(fmt: str, buffer: bytearray, offset: int, *args: Any) -> None: ...
|
||||
|
@ -38,15 +38,21 @@ def split_to_parts(line, mod_desc=None):
|
||||
|
||||
def store_to_file(dest, parts):
|
||||
for package, line in parts:
|
||||
dir_path = os.path.abspath(dest)
|
||||
dirpath = os.path.abspath(dest)
|
||||
filename = package
|
||||
|
||||
if not os.path.exists(dir_path):
|
||||
os.makedirs(dir_path)
|
||||
open(os.path.join(dir_path, '__init__.py'), 'w').close()
|
||||
open(os.path.join(dir_path, '.mock-generated'), 'w').close()
|
||||
if not os.path.exists(dirpath):
|
||||
os.makedirs(dirpath)
|
||||
open(os.path.join(dirpath, '__init__.py'), 'w').close()
|
||||
open(os.path.join(dirpath, '.mock-generated'), 'w').close()
|
||||
|
||||
with open(os.path.join(dir_path, filename + '.py'), 'a') as f:
|
||||
filepath = os.path.join(dirpath, filename + '.py')
|
||||
|
||||
if not os.path.exists(filepath):
|
||||
with open(filepath, 'a') as f:
|
||||
f.write('from typing import *\n')
|
||||
|
||||
with open(filepath, 'a') as f:
|
||||
f.write(line)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user