core/typing: fix extmod docs and mocks

pull/320/head
Jan Pochyla 5 years ago
parent 758a1a2528
commit 0f6f05e4b7

@ -141,7 +141,7 @@ STATIC mp_obj_t mod_trezorconfig_change_pin(mp_obj_t pin, mp_obj_t newpin) {
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_trezorconfig_change_pin_obj,
mod_trezorconfig_change_pin);
/// def get(app: int, key: int, public: bool = False) -> bytes:
/// def get(app: int, key: int, public: bool = False) -> Optional[bytes]:
/// """
/// Gets the value of the given key for the given app (or None if not set).
/// Raises a RuntimeError if decryption or authentication of the stored
@ -243,7 +243,9 @@ STATIC mp_obj_t mod_trezorconfig_set_counter(size_t n_args,
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_trezorconfig_set_counter_obj, 3,
4, mod_trezorconfig_set_counter);
/// def next_counter(app: int, key: int, writable_locked: bool = False) -> bool:
/// def next_counter(
/// app: int, key: int, writable_locked: bool = False,
/// ) -> Optional[int]:
/// """
/// Increments the counter stored under the given key of the given app and
/// returns the new value.

@ -52,7 +52,7 @@ typedef struct _mp_obj_secp256k1_context_t {
uint8_t secp256k1_ctx_buf[0]; // to be allocate via m_new_obj_var_maybe().
} mp_obj_secp256k1_context_t;
/// def __init__(self):
/// def __init__(self) -> None:
/// """
/// Allocate and initialize secp256k1_context.
/// """
@ -84,7 +84,7 @@ STATIC mp_obj_t mod_trezorcrypto_secp256k1_context_make_new(
return MP_OBJ_FROM_PTR(o);
}
/// def __del__(self):
/// def __del__(self) -> None:
/// """
/// Destructor.
/// """
@ -98,7 +98,7 @@ STATIC mp_obj_t mod_trezorcrypto_secp256k1_context___del__(mp_obj_t self) {
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_trezorcrypto_secp256k1_context___del___obj,
mod_trezorcrypto_secp256k1_context___del__);
/// def size(self):
/// def size(self) -> int:
/// """
/// Return the size in bytes of the internal secp256k1_ctx_buf buffer.
/// """

@ -55,7 +55,7 @@ def change_pin(pin: int, newpin: int) -> bool:
# extmod/modtrezorconfig/modtrezorconfig.c
def get(app: int, key: int, public: bool = False) -> bytes:
def get(app: int, key: int, public: bool = False) -> Optional[bytes]:
"""
Gets the value of the given key for the given app (or None if not set).
Raises a RuntimeError if decryption or authentication of the stored
@ -87,7 +87,9 @@ def set_counter(
# extmod/modtrezorconfig/modtrezorconfig.c
def next_counter(app: int, key: int, writable_locked: bool = False) -> bool:
def next_counter(
app: int, key: int, writable_locked: bool = False,
) -> Optional[int]:
"""
Increments the counter stored under the given key of the given app and
returns the new value.

@ -8,17 +8,17 @@ class Context:
Can be allocated once and re-used between subsequent operations.
"""
def __init__(self):
def __init__(self) -> None:
"""
Allocate and initialize secp256k1_context.
"""
def __del__(self):
def __del__(self) -> None:
"""
Destructor.
"""
def size(self):
def size(self) -> int:
"""
Return the size in bytes of the internal secp256k1_ctx_buf buffer.
"""

@ -27,4 +27,4 @@ class struct:
def sizeof(struct: struct) -> int: ...
def addressof(obj: bytes) -> int: ...
def bytes_at(addr: int, size: int) -> bytes: ...
def bytearray_at(addr, size) -> bytearray: ...
def bytearray_at(addr: int, size: int) -> bytearray: ...

Loading…
Cancel
Save