mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-26 08:08:51 +00:00
regenerate mocks
This commit is contained in:
parent
97522be434
commit
031550a5ed
@ -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.
|
||||
'''
|
||||
|
@ -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:
|
||||
'''
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user