parent
c0dfe2d702
commit
9f40362482
@ -1,59 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
import os
|
||||
import re
|
||||
|
||||
def process_file(fn):
|
||||
mod, ext = os.path.splitext(fn)
|
||||
src = open('../%s' % (fn)).readlines()
|
||||
r = []
|
||||
cls = ''
|
||||
if ext in ['.h', '.c']:
|
||||
for l in src:
|
||||
l = l.rstrip()
|
||||
if l.startswith('/// def '):
|
||||
r.append('``` python')
|
||||
r.append(l[4:])
|
||||
r.append('```')
|
||||
elif l.startswith('/// '):
|
||||
r.append(l[4:])
|
||||
elif l == '///':
|
||||
r.append('')
|
||||
elif ext == '.py':
|
||||
mod = mod[4:].replace('/', '.')
|
||||
if mod.endswith('.__init__'):
|
||||
mod = mod[:-9]
|
||||
for l in src:
|
||||
l = l.rstrip()
|
||||
if l.startswith('def '):
|
||||
r.append('``` python')
|
||||
r.append('def %s.' % mod + l[4:-1])
|
||||
r.append('```')
|
||||
elif l.startswith('### '):
|
||||
r.append(l[4:])
|
||||
elif l.startswith('###'):
|
||||
r.append('')
|
||||
elif l.startswith('class '):
|
||||
cls = re.match('class ([A-Za-z0-9_]*)', l).group(1)
|
||||
elif l.startswith(' def ') and not l.startswith(' def __init__'):
|
||||
r.append('``` python')
|
||||
r.append('def %s.' % cls + l[8:-1])
|
||||
r.append('```')
|
||||
elif l.startswith(' ### '):
|
||||
r.append(l[8:])
|
||||
elif l.startswith(' ###'):
|
||||
r.append('')
|
||||
return r
|
||||
|
||||
def main():
|
||||
tpl = open('api.template.md', 'rt').readlines()
|
||||
f = open('api.md', 'wt')
|
||||
for line in tpl:
|
||||
if line.startswith('@'):
|
||||
for l in process_file(line[1:].strip()):
|
||||
f.write(l + '\n')
|
||||
else:
|
||||
f.write(line)
|
||||
f.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -1,77 +0,0 @@
|
||||
#TREZOR Core API
|
||||
|
||||
Syntax used below is a valid Python function declaration with type hints defined in [PEP 0484](https://www.python.org/dev/peps/pep-0484/).
|
||||
|
||||
##trezor.crypto
|
||||
|
||||
###trezor.crypto.base58
|
||||
|
||||
@src/trezor/crypto/base58.py
|
||||
|
||||
###trezor.crypto.bip39
|
||||
|
||||
@extmod/modtrezorcrypto/modtrezorcrypto-bip39.h
|
||||
|
||||
###trezor.crypto.curve
|
||||
|
||||
####trezor.crypto.curve.ed25519
|
||||
|
||||
@extmod/modtrezorcrypto/modtrezorcrypto-ed25519.h
|
||||
|
||||
####trezor.crypto.curve.nist256p1
|
||||
|
||||
@extmod/modtrezorcrypto/modtrezorcrypto-nist256p1.h
|
||||
|
||||
####trezor.crypto.curve.secp256k1
|
||||
|
||||
@extmod/modtrezorcrypto/modtrezorcrypto-secp256k1.h
|
||||
|
||||
###trezor.crypto.hashlib
|
||||
|
||||
####trezor.crypto.hashlib.ripemd160
|
||||
|
||||
@extmod/modtrezorcrypto/modtrezorcrypto-ripemd160.h
|
||||
|
||||
####trezor.crypto.hashlib.sha256
|
||||
|
||||
@extmod/modtrezorcrypto/modtrezorcrypto-sha256.h
|
||||
|
||||
####trezor.crypto.hashlib.sha512
|
||||
|
||||
@extmod/modtrezorcrypto/modtrezorcrypto-sha512.h
|
||||
|
||||
####trezor.crypto.hashlib.sha3_256
|
||||
|
||||
@extmod/modtrezorcrypto/modtrezorcrypto-sha3-256.h
|
||||
|
||||
####trezor.crypto.hashlib.sha3_512
|
||||
|
||||
@extmod/modtrezorcrypto/modtrezorcrypto-sha3-512.h
|
||||
|
||||
####trezor.crypto.random
|
||||
|
||||
@extmod/modtrezorcrypto/modtrezorcrypto-random.h
|
||||
|
||||
####trezor.crypto.ssss
|
||||
|
||||
@extmod/modtrezorcrypto/modtrezorcrypto-ssss.h
|
||||
|
||||
###trezor.crypto.hmac
|
||||
|
||||
@src/trezor/crypto/hmac.py
|
||||
|
||||
##trezor.msg
|
||||
|
||||
@extmod/modtrezormsg/modtrezormsg.c
|
||||
|
||||
##trezor.ui
|
||||
|
||||
@src/trezor/ui/__init__.py
|
||||
|
||||
###trezor.ui.display
|
||||
|
||||
@extmod/modtrezorui/modtrezorui-display.h
|
||||
|
||||
###trezor.utils
|
||||
|
||||
@extmod/modtrezorutils/modtrezorutils.c
|
Loading…
Reference in new issue