diff --git a/mocks/trezor/crypto/.mock-generated b/mocks/trezor/crypto/.mock-generated deleted file mode 100644 index e69de29bb..000000000 diff --git a/mocks/trezor/crypto/__init__.py b/mocks/trezor/crypto/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/mocks/trezor/crypto/hashlib.py b/mocks/trezor/crypto/hashlib.py index 12b76db0b..97fe9c0ce 100644 --- a/mocks/trezor/crypto/hashlib.py +++ b/mocks/trezor/crypto/hashlib.py @@ -5,18 +5,6 @@ def ripemd160(data: bytes=None) -> Ripemd160: Creates a hash context object. ''' -# ../extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h -def sha3_512(data: bytes=None) -> Sha3_512: - ''' - Creates a hash context object. - ''' - -# ../extmod/modtrezorcrypto/modtrezorcrypto-sha512.h -def sha512(data: bytes=None) -> Sha512: - ''' - Creates a hash context object. - ''' - # ../extmod/modtrezorcrypto/modtrezorcrypto-sha256.h def sha256(data: bytes=None) -> Sha256: ''' @@ -28,3 +16,15 @@ def sha3_256(data: bytes=None) -> Sha3_256: ''' Creates a hash context object. ''' + +# ../extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h +def sha3_512(data: bytes=None) -> Sha3_512: + ''' + Creates a hash context object. + ''' + +# ../extmod/modtrezorcrypto/modtrezorcrypto-sha512.h +def sha512(data: bytes=None) -> Sha512: + ''' + Creates a hash context object. + ''' diff --git a/mocks/trezor/ui/display.py b/mocks/trezor/ui/display.py index 9225549e9..63540dde4 100644 --- a/mocks/trezor/ui/display.py +++ b/mocks/trezor/ui/display.py @@ -1,4 +1,16 @@ +# ../extmod/modtrezorui/modtrezorui-display.h +def clear() -> None + ''' + Clear display (with black color) + ''' + +# ../extmod/modtrezorui/modtrezorui-display.h +def refresh() -> None + ''' + Refresh display (update screen) + ''' + # ../extmod/modtrezorui/modtrezorui-display.h def bar(x: int, y: int, w: int, h: int, fgcolor: int, bgcolor: int=None, radius: int=None) -> None: ''' diff --git a/tools/build_mocks b/tools/build_mocks index 625a59a02..15dd1c6b1 100755 --- a/tools/build_mocks +++ b/tools/build_mocks @@ -14,13 +14,13 @@ def split_to_parts(line, mod_file=None): # Parse name of method from line like 'def trezor.config.get():' current_method = line[4:].split('(')[0] #print("Current method", current_method) - + *current_package, method_name = current_method.split('.') yield (current_package, "\n") yield (current_package, '# ' + mod_file + "\n") line = line.replace(current_method, method_name) - + yield (current_package, line) def store_to_file(dest, parts): @@ -29,15 +29,15 @@ def store_to_file(dest, parts): (package, line) = parts.__next__() except StopIteration: return - + dir_path = os.path.abspath(os.path.join(dest, *package[:-1])) filename = package[-1] - + 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() - + f = open(os.path.join(dir_path, filename + '.py'), 'a') f.write(line) f.close() @@ -50,10 +50,10 @@ def build_module(mod_file, dest): for l in open(mod_file): if not l.startswith(COMMENT_PREFIX): continue - + l = l[len(COMMENT_PREFIX):]#.strip() store_to_file(dest, split_to_parts(l, mod_file)) - + def build_directory(dir, dest): print("Building mocks for", dir, "to", dest) for pkg in os.listdir(dir): @@ -77,7 +77,7 @@ def clear_directory(top_dir): pass os.rmdir(root) - + if __name__ == '__main__': clear_directory('../mocks') build_directory('../extmod', '../mocks')