trezor / trezor-common

:lock: Don't post issues/PRs to here, use the new monorepo:
https://github.com/trezor/trezor-firmware
GNU Lesser General Public License v3.0
91 stars 232 forks source link

pb2py: FIELDS moved to classmethod get_fields() #212

Closed ph4r05 closed 6 years ago

ph4r05 commented 6 years ago
ph4r05 commented 6 years ago

It is also possible to import on demand. Ideally to use on-demand imports only for micropython code.

# Automatically generated by pb2py
# fmt: off
import protobuf as p

class MoneroOutputEntry(p.MessageType):

    def __init__(
        self,
        idx: int = None,
        key: MoneroRctKey = None,  # non-micropython interpreter may be annoyed by this
    ) -> None:
        self.idx = idx
        self.key = key

    @classmethod
    def get_fields(cls):
        from .MoneroRctKey import MoneroRctKey  # change here
        return {
            1: ('idx', p.UVarintType, 0),
            2: ('key', MoneroRctKey, 0),
        }
jpochyla commented 6 years ago

Lets postpone the deferred imports for now, merging!