From 1187e4ddaf21029fb6c06bfbcfd0991edf4d9634 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 19 Oct 2020 12:17:43 +0200 Subject: [PATCH] style(common): use new syntax for typing in autogenerated protobuf enums --- common/protob/pb2py | 9 +- core/src/trezor/messages/BackupType.py | 13 +- core/src/trezor/messages/BinanceOrderSide.py | 13 +- core/src/trezor/messages/BinanceOrderType.py | 15 +- .../src/trezor/messages/BinanceTimeInForce.py | 15 +- core/src/trezor/messages/ButtonRequestType.py | 47 +- core/src/trezor/messages/Capability.py | 41 +- .../src/trezor/messages/CardanoAddressType.py | 29 +- .../trezor/messages/CardanoCertificateType.py | 15 +- .../trezor/messages/CardanoPoolRelayType.py | 13 +- .../trezor/messages/DebugLinkShowTextStyle.py | 19 +- .../trezor/messages/DebugSwipeDirection.py | 15 +- core/src/trezor/messages/FailureType.py | 37 +- core/src/trezor/messages/InputScriptType.py | 17 +- .../trezor/messages/LiskTransactionType.py | 23 +- core/src/trezor/messages/MessageType.py | 403 +++++++++--------- .../messages/NEMImportanceTransferMode.py | 11 +- .../trezor/messages/NEMModificationType.py | 11 +- core/src/trezor/messages/NEMMosaicLevy.py | 11 +- .../trezor/messages/NEMSupplyChangeType.py | 11 +- core/src/trezor/messages/OutputScriptType.py | 19 +- .../src/trezor/messages/RecoveryDeviceType.py | 11 +- core/src/trezor/messages/RequestType.py | 21 +- core/src/trezor/messages/SafetyCheckLevel.py | 13 +- .../trezor/messages/SdProtectOperationType.py | 13 +- core/src/trezor/messages/TezosBallotType.py | 13 +- core/src/trezor/messages/TezosContractType.py | 11 +- python/src/trezorlib/mapping.py | 4 + python/src/trezorlib/messages/BackupType.py | 13 +- .../trezorlib/messages/BinanceOrderSide.py | 13 +- .../trezorlib/messages/BinanceOrderType.py | 15 +- .../trezorlib/messages/BinanceTimeInForce.py | 15 +- .../trezorlib/messages/ButtonRequestType.py | 47 +- python/src/trezorlib/messages/Capability.py | 41 +- .../trezorlib/messages/CardanoAddressType.py | 29 +- .../messages/CardanoCertificateType.py | 15 +- .../messages/CardanoPoolRelayType.py | 13 +- .../messages/DebugLinkShowTextStyle.py | 19 +- .../trezorlib/messages/DebugSwipeDirection.py | 15 +- python/src/trezorlib/messages/FailureType.py | 37 +- .../src/trezorlib/messages/InputScriptType.py | 17 +- .../trezorlib/messages/LiskTransactionType.py | 23 +- python/src/trezorlib/messages/MessageType.py | 403 +++++++++--------- .../messages/NEMImportanceTransferMode.py | 11 +- .../trezorlib/messages/NEMModificationType.py | 11 +- .../src/trezorlib/messages/NEMMosaicLevy.py | 11 +- .../trezorlib/messages/NEMSupplyChangeType.py | 11 +- .../trezorlib/messages/OutputScriptType.py | 19 +- .../messages/PinMatrixRequestType.py | 17 +- .../trezorlib/messages/RecoveryDeviceType.py | 11 +- python/src/trezorlib/messages/RequestType.py | 21 +- .../trezorlib/messages/SafetyCheckLevel.py | 13 +- .../messages/SdProtectOperationType.py | 13 +- .../src/trezorlib/messages/TezosBallotType.py | 13 +- .../trezorlib/messages/TezosContractType.py | 11 +- .../src/trezorlib/messages/WordRequestType.py | 13 +- 56 files changed, 966 insertions(+), 797 deletions(-) diff --git a/common/protob/pb2py b/common/protob/pb2py index 854aea834..5096a04f3 100755 --- a/common/protob/pb2py +++ b/common/protob/pb2py @@ -391,8 +391,11 @@ class Descriptor: logging.debug("Processing enum {}".format(enum.name)) # file header - yield "if False:" - yield " from typing_extensions import Literal" + yield "if __debug__:" + yield " try:" + yield " from typing_extensions import Literal # noqa: F401" + yield " except ImportError:" + yield " pass" yield "" for value in enum.value: @@ -409,7 +412,7 @@ class Descriptor: name = strip_leader(name, enum_prefix) self.enum_types[enum.name][value.name] = value.number - yield f"{name} = {value.number} # type: Literal[{value.number}]" + yield f"{name}: Literal[{value.number}] = {value.number}" def process_messages(self, messages, include_deprecated=False): for message in sorted(messages, key=lambda m: m.name): diff --git a/core/src/trezor/messages/BackupType.py b/core/src/trezor/messages/BackupType.py index 7b3e30a6c..d8ed8002f 100644 --- a/core/src/trezor/messages/BackupType.py +++ b/core/src/trezor/messages/BackupType.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Bip39 = 0 # type: Literal[0] -Slip39_Basic = 1 # type: Literal[1] -Slip39_Advanced = 2 # type: Literal[2] +Bip39: Literal[0] = 0 +Slip39_Basic: Literal[1] = 1 +Slip39_Advanced: Literal[2] = 2 diff --git a/core/src/trezor/messages/BinanceOrderSide.py b/core/src/trezor/messages/BinanceOrderSide.py index 1105b9849..91be3ccdc 100644 --- a/core/src/trezor/messages/BinanceOrderSide.py +++ b/core/src/trezor/messages/BinanceOrderSide.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -SIDE_UNKNOWN = 0 # type: Literal[0] -BUY = 1 # type: Literal[1] -SELL = 2 # type: Literal[2] +SIDE_UNKNOWN: Literal[0] = 0 +BUY: Literal[1] = 1 +SELL: Literal[2] = 2 diff --git a/core/src/trezor/messages/BinanceOrderType.py b/core/src/trezor/messages/BinanceOrderType.py index 6bd753c46..81846bb56 100644 --- a/core/src/trezor/messages/BinanceOrderType.py +++ b/core/src/trezor/messages/BinanceOrderType.py @@ -1,9 +1,12 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -OT_UNKNOWN = 0 # type: Literal[0] -MARKET = 1 # type: Literal[1] -LIMIT = 2 # type: Literal[2] -OT_RESERVED = 3 # type: Literal[3] +OT_UNKNOWN: Literal[0] = 0 +MARKET: Literal[1] = 1 +LIMIT: Literal[2] = 2 +OT_RESERVED: Literal[3] = 3 diff --git a/core/src/trezor/messages/BinanceTimeInForce.py b/core/src/trezor/messages/BinanceTimeInForce.py index d3d596dd1..340135fb2 100644 --- a/core/src/trezor/messages/BinanceTimeInForce.py +++ b/core/src/trezor/messages/BinanceTimeInForce.py @@ -1,9 +1,12 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -TIF_UNKNOWN = 0 # type: Literal[0] -GTE = 1 # type: Literal[1] -TIF_RESERVED = 2 # type: Literal[2] -IOC = 3 # type: Literal[3] +TIF_UNKNOWN: Literal[0] = 0 +GTE: Literal[1] = 1 +TIF_RESERVED: Literal[2] = 2 +IOC: Literal[3] = 3 diff --git a/core/src/trezor/messages/ButtonRequestType.py b/core/src/trezor/messages/ButtonRequestType.py index dadd38a9f..535ec54fb 100644 --- a/core/src/trezor/messages/ButtonRequestType.py +++ b/core/src/trezor/messages/ButtonRequestType.py @@ -1,25 +1,28 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Other = 1 # type: Literal[1] -FeeOverThreshold = 2 # type: Literal[2] -ConfirmOutput = 3 # type: Literal[3] -ResetDevice = 4 # type: Literal[4] -ConfirmWord = 5 # type: Literal[5] -WipeDevice = 6 # type: Literal[6] -ProtectCall = 7 # type: Literal[7] -SignTx = 8 # type: Literal[8] -FirmwareCheck = 9 # type: Literal[9] -Address = 10 # type: Literal[10] -PublicKey = 11 # type: Literal[11] -MnemonicWordCount = 12 # type: Literal[12] -MnemonicInput = 13 # type: Literal[13] -_Deprecated_ButtonRequest_PassphraseType = 14 # type: Literal[14] -UnknownDerivationPath = 15 # type: Literal[15] -RecoveryHomepage = 16 # type: Literal[16] -Success = 17 # type: Literal[17] -Warning = 18 # type: Literal[18] -PassphraseEntry = 19 # type: Literal[19] -PinEntry = 20 # type: Literal[20] +Other: Literal[1] = 1 +FeeOverThreshold: Literal[2] = 2 +ConfirmOutput: Literal[3] = 3 +ResetDevice: Literal[4] = 4 +ConfirmWord: Literal[5] = 5 +WipeDevice: Literal[6] = 6 +ProtectCall: Literal[7] = 7 +SignTx: Literal[8] = 8 +FirmwareCheck: Literal[9] = 9 +Address: Literal[10] = 10 +PublicKey: Literal[11] = 11 +MnemonicWordCount: Literal[12] = 12 +MnemonicInput: Literal[13] = 13 +_Deprecated_ButtonRequest_PassphraseType: Literal[14] = 14 +UnknownDerivationPath: Literal[15] = 15 +RecoveryHomepage: Literal[16] = 16 +Success: Literal[17] = 17 +Warning: Literal[18] = 18 +PassphraseEntry: Literal[19] = 19 +PinEntry: Literal[20] = 20 diff --git a/core/src/trezor/messages/Capability.py b/core/src/trezor/messages/Capability.py index 848c2aafe..2166277ee 100644 --- a/core/src/trezor/messages/Capability.py +++ b/core/src/trezor/messages/Capability.py @@ -2,25 +2,28 @@ # fmt: off from trezor import utils -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Bitcoin = 1 # type: Literal[1] +Bitcoin: Literal[1] = 1 if not utils.BITCOIN_ONLY: - Bitcoin_like = 2 # type: Literal[2] - Binance = 3 # type: Literal[3] - Cardano = 4 # type: Literal[4] -Crypto = 5 # type: Literal[5] + Bitcoin_like: Literal[2] = 2 + Binance: Literal[3] = 3 + Cardano: Literal[4] = 4 +Crypto: Literal[5] = 5 if not utils.BITCOIN_ONLY: - EOS = 6 # type: Literal[6] - Ethereum = 7 # type: Literal[7] - Lisk = 8 # type: Literal[8] - Monero = 9 # type: Literal[9] - NEM = 10 # type: Literal[10] - Ripple = 11 # type: Literal[11] - Stellar = 12 # type: Literal[12] - Tezos = 13 # type: Literal[13] - U2F = 14 # type: Literal[14] -Shamir = 15 # type: Literal[15] -ShamirGroups = 16 # type: Literal[16] -PassphraseEntry = 17 # type: Literal[17] + EOS: Literal[6] = 6 + Ethereum: Literal[7] = 7 + Lisk: Literal[8] = 8 + Monero: Literal[9] = 9 + NEM: Literal[10] = 10 + Ripple: Literal[11] = 11 + Stellar: Literal[12] = 12 + Tezos: Literal[13] = 13 + U2F: Literal[14] = 14 +Shamir: Literal[15] = 15 +ShamirGroups: Literal[16] = 16 +PassphraseEntry: Literal[17] = 17 diff --git a/core/src/trezor/messages/CardanoAddressType.py b/core/src/trezor/messages/CardanoAddressType.py index 4867b775c..ec7bb4397 100644 --- a/core/src/trezor/messages/CardanoAddressType.py +++ b/core/src/trezor/messages/CardanoAddressType.py @@ -1,16 +1,19 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -BASE = 0 # type: Literal[0] -BASE_SCRIPT_KEY = 1 # type: Literal[1] -BASE_KEY_SCRIPT = 2 # type: Literal[2] -BASE_SCRIPT_SCRIPT = 3 # type: Literal[3] -POINTER = 4 # type: Literal[4] -POINTER_SCRIPT = 5 # type: Literal[5] -ENTERPRISE = 6 # type: Literal[6] -ENTERPRISE_SCRIPT = 7 # type: Literal[7] -BYRON = 8 # type: Literal[8] -REWARD = 14 # type: Literal[14] -REWARD_SCRIPT = 15 # type: Literal[15] +BASE: Literal[0] = 0 +BASE_SCRIPT_KEY: Literal[1] = 1 +BASE_KEY_SCRIPT: Literal[2] = 2 +BASE_SCRIPT_SCRIPT: Literal[3] = 3 +POINTER: Literal[4] = 4 +POINTER_SCRIPT: Literal[5] = 5 +ENTERPRISE: Literal[6] = 6 +ENTERPRISE_SCRIPT: Literal[7] = 7 +BYRON: Literal[8] = 8 +REWARD: Literal[14] = 14 +REWARD_SCRIPT: Literal[15] = 15 diff --git a/core/src/trezor/messages/CardanoCertificateType.py b/core/src/trezor/messages/CardanoCertificateType.py index eb6bc15f4..4f7e4a82d 100644 --- a/core/src/trezor/messages/CardanoCertificateType.py +++ b/core/src/trezor/messages/CardanoCertificateType.py @@ -1,9 +1,12 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -STAKE_REGISTRATION = 0 # type: Literal[0] -STAKE_DEREGISTRATION = 1 # type: Literal[1] -STAKE_DELEGATION = 2 # type: Literal[2] -STAKE_POOL_REGISTRATION = 3 # type: Literal[3] +STAKE_REGISTRATION: Literal[0] = 0 +STAKE_DEREGISTRATION: Literal[1] = 1 +STAKE_DELEGATION: Literal[2] = 2 +STAKE_POOL_REGISTRATION: Literal[3] = 3 diff --git a/core/src/trezor/messages/CardanoPoolRelayType.py b/core/src/trezor/messages/CardanoPoolRelayType.py index 3623702f4..680b29d43 100644 --- a/core/src/trezor/messages/CardanoPoolRelayType.py +++ b/core/src/trezor/messages/CardanoPoolRelayType.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -SINGLE_HOST_IP = 0 # type: Literal[0] -SINGLE_HOST_NAME = 1 # type: Literal[1] -MULTIPLE_HOST_NAME = 2 # type: Literal[2] +SINGLE_HOST_IP: Literal[0] = 0 +SINGLE_HOST_NAME: Literal[1] = 1 +MULTIPLE_HOST_NAME: Literal[2] = 2 diff --git a/core/src/trezor/messages/DebugLinkShowTextStyle.py b/core/src/trezor/messages/DebugLinkShowTextStyle.py index 9df392aa7..8ead39e99 100644 --- a/core/src/trezor/messages/DebugLinkShowTextStyle.py +++ b/core/src/trezor/messages/DebugLinkShowTextStyle.py @@ -1,11 +1,14 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -NORMAL = 0 # type: Literal[0] -BOLD = 1 # type: Literal[1] -MONO = 2 # type: Literal[2] -BR = 4 # type: Literal[4] -BR_HALF = 5 # type: Literal[5] -SET_COLOR = 6 # type: Literal[6] +NORMAL: Literal[0] = 0 +BOLD: Literal[1] = 1 +MONO: Literal[2] = 2 +BR: Literal[4] = 4 +BR_HALF: Literal[5] = 5 +SET_COLOR: Literal[6] = 6 diff --git a/core/src/trezor/messages/DebugSwipeDirection.py b/core/src/trezor/messages/DebugSwipeDirection.py index b53ccc7ff..9e6cbf292 100644 --- a/core/src/trezor/messages/DebugSwipeDirection.py +++ b/core/src/trezor/messages/DebugSwipeDirection.py @@ -1,9 +1,12 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -UP = 0 # type: Literal[0] -DOWN = 1 # type: Literal[1] -LEFT = 2 # type: Literal[2] -RIGHT = 3 # type: Literal[3] +UP: Literal[0] = 0 +DOWN: Literal[1] = 1 +LEFT: Literal[2] = 2 +RIGHT: Literal[3] = 3 diff --git a/core/src/trezor/messages/FailureType.py b/core/src/trezor/messages/FailureType.py index df77d8db9..49dbf8b6f 100644 --- a/core/src/trezor/messages/FailureType.py +++ b/core/src/trezor/messages/FailureType.py @@ -1,20 +1,23 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -UnexpectedMessage = 1 # type: Literal[1] -ButtonExpected = 2 # type: Literal[2] -DataError = 3 # type: Literal[3] -ActionCancelled = 4 # type: Literal[4] -PinExpected = 5 # type: Literal[5] -PinCancelled = 6 # type: Literal[6] -PinInvalid = 7 # type: Literal[7] -InvalidSignature = 8 # type: Literal[8] -ProcessError = 9 # type: Literal[9] -NotEnoughFunds = 10 # type: Literal[10] -NotInitialized = 11 # type: Literal[11] -PinMismatch = 12 # type: Literal[12] -WipeCodeMismatch = 13 # type: Literal[13] -InvalidSession = 14 # type: Literal[14] -FirmwareError = 99 # type: Literal[99] +UnexpectedMessage: Literal[1] = 1 +ButtonExpected: Literal[2] = 2 +DataError: Literal[3] = 3 +ActionCancelled: Literal[4] = 4 +PinExpected: Literal[5] = 5 +PinCancelled: Literal[6] = 6 +PinInvalid: Literal[7] = 7 +InvalidSignature: Literal[8] = 8 +ProcessError: Literal[9] = 9 +NotEnoughFunds: Literal[10] = 10 +NotInitialized: Literal[11] = 11 +PinMismatch: Literal[12] = 12 +WipeCodeMismatch: Literal[13] = 13 +InvalidSession: Literal[14] = 14 +FirmwareError: Literal[99] = 99 diff --git a/core/src/trezor/messages/InputScriptType.py b/core/src/trezor/messages/InputScriptType.py index fc2223e25..26243b1ca 100644 --- a/core/src/trezor/messages/InputScriptType.py +++ b/core/src/trezor/messages/InputScriptType.py @@ -1,10 +1,13 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -SPENDADDRESS = 0 # type: Literal[0] -SPENDMULTISIG = 1 # type: Literal[1] -EXTERNAL = 2 # type: Literal[2] -SPENDWITNESS = 3 # type: Literal[3] -SPENDP2SHWITNESS = 4 # type: Literal[4] +SPENDADDRESS: Literal[0] = 0 +SPENDMULTISIG: Literal[1] = 1 +EXTERNAL: Literal[2] = 2 +SPENDWITNESS: Literal[3] = 3 +SPENDP2SHWITNESS: Literal[4] = 4 diff --git a/core/src/trezor/messages/LiskTransactionType.py b/core/src/trezor/messages/LiskTransactionType.py index 79069c6a9..4056d0af0 100644 --- a/core/src/trezor/messages/LiskTransactionType.py +++ b/core/src/trezor/messages/LiskTransactionType.py @@ -1,13 +1,16 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Transfer = 0 # type: Literal[0] -RegisterSecondPassphrase = 1 # type: Literal[1] -RegisterDelegate = 2 # type: Literal[2] -CastVotes = 3 # type: Literal[3] -RegisterMultisignatureAccount = 4 # type: Literal[4] -CreateDapp = 5 # type: Literal[5] -TransferIntoDapp = 6 # type: Literal[6] -TransferOutOfDapp = 7 # type: Literal[7] +Transfer: Literal[0] = 0 +RegisterSecondPassphrase: Literal[1] = 1 +RegisterDelegate: Literal[2] = 2 +CastVotes: Literal[3] = 3 +RegisterMultisignatureAccount: Literal[4] = 4 +CreateDapp: Literal[5] = 5 +TransferIntoDapp: Literal[6] = 6 +TransferOutOfDapp: Literal[7] = 7 diff --git a/core/src/trezor/messages/MessageType.py b/core/src/trezor/messages/MessageType.py index cbeb374aa..171109de3 100644 --- a/core/src/trezor/messages/MessageType.py +++ b/core/src/trezor/messages/MessageType.py @@ -2,205 +2,208 @@ # fmt: off from trezor import utils -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Initialize = 0 # type: Literal[0] -Ping = 1 # type: Literal[1] -Success = 2 # type: Literal[2] -Failure = 3 # type: Literal[3] -ChangePin = 4 # type: Literal[4] -WipeDevice = 5 # type: Literal[5] -GetEntropy = 9 # type: Literal[9] -Entropy = 10 # type: Literal[10] -LoadDevice = 13 # type: Literal[13] -ResetDevice = 14 # type: Literal[14] -Features = 17 # type: Literal[17] -PinMatrixRequest = 18 # type: Literal[18] -PinMatrixAck = 19 # type: Literal[19] -Cancel = 20 # type: Literal[20] -LockDevice = 24 # type: Literal[24] -ApplySettings = 25 # type: Literal[25] -ButtonRequest = 26 # type: Literal[26] -ButtonAck = 27 # type: Literal[27] -ApplyFlags = 28 # type: Literal[28] -BackupDevice = 34 # type: Literal[34] -EntropyRequest = 35 # type: Literal[35] -EntropyAck = 36 # type: Literal[36] -PassphraseRequest = 41 # type: Literal[41] -PassphraseAck = 42 # type: Literal[42] -RecoveryDevice = 45 # type: Literal[45] -WordRequest = 46 # type: Literal[46] -WordAck = 47 # type: Literal[47] -GetFeatures = 55 # type: Literal[55] -SetU2FCounter = 63 # type: Literal[63] -SdProtect = 79 # type: Literal[79] -GetNextU2FCounter = 80 # type: Literal[80] -NextU2FCounter = 81 # type: Literal[81] -ChangeWipeCode = 82 # type: Literal[82] -EndSession = 83 # type: Literal[83] -DoPreauthorized = 84 # type: Literal[84] -PreauthorizedRequest = 85 # type: Literal[85] -CancelAuthorization = 86 # type: Literal[86] -Deprecated_PassphraseStateRequest = 77 # type: Literal[77] -Deprecated_PassphraseStateAck = 78 # type: Literal[78] -FirmwareErase = 6 # type: Literal[6] -FirmwareUpload = 7 # type: Literal[7] -FirmwareRequest = 8 # type: Literal[8] -SelfTest = 32 # type: Literal[32] -GetPublicKey = 11 # type: Literal[11] -PublicKey = 12 # type: Literal[12] -SignTx = 15 # type: Literal[15] -TxRequest = 21 # type: Literal[21] -TxAck = 22 # type: Literal[22] -GetAddress = 29 # type: Literal[29] -Address = 30 # type: Literal[30] -SignMessage = 38 # type: Literal[38] -VerifyMessage = 39 # type: Literal[39] -MessageSignature = 40 # type: Literal[40] -GetOwnershipId = 43 # type: Literal[43] -OwnershipId = 44 # type: Literal[44] -GetOwnershipProof = 49 # type: Literal[49] -OwnershipProof = 50 # type: Literal[50] -AuthorizeCoinJoin = 51 # type: Literal[51] -CipherKeyValue = 23 # type: Literal[23] -CipheredKeyValue = 48 # type: Literal[48] -SignIdentity = 53 # type: Literal[53] -SignedIdentity = 54 # type: Literal[54] -GetECDHSessionKey = 61 # type: Literal[61] -ECDHSessionKey = 62 # type: Literal[62] -CosiCommit = 71 # type: Literal[71] -CosiCommitment = 72 # type: Literal[72] -CosiSign = 73 # type: Literal[73] -CosiSignature = 74 # type: Literal[74] -DebugLinkDecision = 100 # type: Literal[100] -DebugLinkGetState = 101 # type: Literal[101] -DebugLinkState = 102 # type: Literal[102] -DebugLinkStop = 103 # type: Literal[103] -DebugLinkLog = 104 # type: Literal[104] -DebugLinkMemoryRead = 110 # type: Literal[110] -DebugLinkMemory = 111 # type: Literal[111] -DebugLinkMemoryWrite = 112 # type: Literal[112] -DebugLinkFlashErase = 113 # type: Literal[113] -DebugLinkLayout = 9001 # type: Literal[9001] -DebugLinkReseedRandom = 9002 # type: Literal[9002] -DebugLinkRecordScreen = 9003 # type: Literal[9003] -DebugLinkShowText = 9004 # type: Literal[9004] -DebugLinkEraseSdCard = 9005 # type: Literal[9005] -DebugLinkWatchLayout = 9006 # type: Literal[9006] +Initialize: Literal[0] = 0 +Ping: Literal[1] = 1 +Success: Literal[2] = 2 +Failure: Literal[3] = 3 +ChangePin: Literal[4] = 4 +WipeDevice: Literal[5] = 5 +GetEntropy: Literal[9] = 9 +Entropy: Literal[10] = 10 +LoadDevice: Literal[13] = 13 +ResetDevice: Literal[14] = 14 +Features: Literal[17] = 17 +PinMatrixRequest: Literal[18] = 18 +PinMatrixAck: Literal[19] = 19 +Cancel: Literal[20] = 20 +LockDevice: Literal[24] = 24 +ApplySettings: Literal[25] = 25 +ButtonRequest: Literal[26] = 26 +ButtonAck: Literal[27] = 27 +ApplyFlags: Literal[28] = 28 +BackupDevice: Literal[34] = 34 +EntropyRequest: Literal[35] = 35 +EntropyAck: Literal[36] = 36 +PassphraseRequest: Literal[41] = 41 +PassphraseAck: Literal[42] = 42 +RecoveryDevice: Literal[45] = 45 +WordRequest: Literal[46] = 46 +WordAck: Literal[47] = 47 +GetFeatures: Literal[55] = 55 +SetU2FCounter: Literal[63] = 63 +SdProtect: Literal[79] = 79 +GetNextU2FCounter: Literal[80] = 80 +NextU2FCounter: Literal[81] = 81 +ChangeWipeCode: Literal[82] = 82 +EndSession: Literal[83] = 83 +DoPreauthorized: Literal[84] = 84 +PreauthorizedRequest: Literal[85] = 85 +CancelAuthorization: Literal[86] = 86 +Deprecated_PassphraseStateRequest: Literal[77] = 77 +Deprecated_PassphraseStateAck: Literal[78] = 78 +FirmwareErase: Literal[6] = 6 +FirmwareUpload: Literal[7] = 7 +FirmwareRequest: Literal[8] = 8 +SelfTest: Literal[32] = 32 +GetPublicKey: Literal[11] = 11 +PublicKey: Literal[12] = 12 +SignTx: Literal[15] = 15 +TxRequest: Literal[21] = 21 +TxAck: Literal[22] = 22 +GetAddress: Literal[29] = 29 +Address: Literal[30] = 30 +SignMessage: Literal[38] = 38 +VerifyMessage: Literal[39] = 39 +MessageSignature: Literal[40] = 40 +GetOwnershipId: Literal[43] = 43 +OwnershipId: Literal[44] = 44 +GetOwnershipProof: Literal[49] = 49 +OwnershipProof: Literal[50] = 50 +AuthorizeCoinJoin: Literal[51] = 51 +CipherKeyValue: Literal[23] = 23 +CipheredKeyValue: Literal[48] = 48 +SignIdentity: Literal[53] = 53 +SignedIdentity: Literal[54] = 54 +GetECDHSessionKey: Literal[61] = 61 +ECDHSessionKey: Literal[62] = 62 +CosiCommit: Literal[71] = 71 +CosiCommitment: Literal[72] = 72 +CosiSign: Literal[73] = 73 +CosiSignature: Literal[74] = 74 +DebugLinkDecision: Literal[100] = 100 +DebugLinkGetState: Literal[101] = 101 +DebugLinkState: Literal[102] = 102 +DebugLinkStop: Literal[103] = 103 +DebugLinkLog: Literal[104] = 104 +DebugLinkMemoryRead: Literal[110] = 110 +DebugLinkMemory: Literal[111] = 111 +DebugLinkMemoryWrite: Literal[112] = 112 +DebugLinkFlashErase: Literal[113] = 113 +DebugLinkLayout: Literal[9001] = 9001 +DebugLinkReseedRandom: Literal[9002] = 9002 +DebugLinkRecordScreen: Literal[9003] = 9003 +DebugLinkShowText: Literal[9004] = 9004 +DebugLinkEraseSdCard: Literal[9005] = 9005 +DebugLinkWatchLayout: Literal[9006] = 9006 if not utils.BITCOIN_ONLY: - EthereumGetPublicKey = 450 # type: Literal[450] - EthereumPublicKey = 451 # type: Literal[451] - EthereumGetAddress = 56 # type: Literal[56] - EthereumAddress = 57 # type: Literal[57] - EthereumSignTx = 58 # type: Literal[58] - EthereumTxRequest = 59 # type: Literal[59] - EthereumTxAck = 60 # type: Literal[60] - EthereumSignMessage = 64 # type: Literal[64] - EthereumVerifyMessage = 65 # type: Literal[65] - EthereumMessageSignature = 66 # type: Literal[66] - NEMGetAddress = 67 # type: Literal[67] - NEMAddress = 68 # type: Literal[68] - NEMSignTx = 69 # type: Literal[69] - NEMSignedTx = 70 # type: Literal[70] - NEMDecryptMessage = 75 # type: Literal[75] - NEMDecryptedMessage = 76 # type: Literal[76] - LiskGetAddress = 114 # type: Literal[114] - LiskAddress = 115 # type: Literal[115] - LiskSignTx = 116 # type: Literal[116] - LiskSignedTx = 117 # type: Literal[117] - LiskSignMessage = 118 # type: Literal[118] - LiskMessageSignature = 119 # type: Literal[119] - LiskVerifyMessage = 120 # type: Literal[120] - LiskGetPublicKey = 121 # type: Literal[121] - LiskPublicKey = 122 # type: Literal[122] - TezosGetAddress = 150 # type: Literal[150] - TezosAddress = 151 # type: Literal[151] - TezosSignTx = 152 # type: Literal[152] - TezosSignedTx = 153 # type: Literal[153] - TezosGetPublicKey = 154 # type: Literal[154] - TezosPublicKey = 155 # type: Literal[155] - StellarSignTx = 202 # type: Literal[202] - StellarTxOpRequest = 203 # type: Literal[203] - StellarGetAddress = 207 # type: Literal[207] - StellarAddress = 208 # type: Literal[208] - StellarCreateAccountOp = 210 # type: Literal[210] - StellarPaymentOp = 211 # type: Literal[211] - StellarPathPaymentOp = 212 # type: Literal[212] - StellarManageOfferOp = 213 # type: Literal[213] - StellarCreatePassiveOfferOp = 214 # type: Literal[214] - StellarSetOptionsOp = 215 # type: Literal[215] - StellarChangeTrustOp = 216 # type: Literal[216] - StellarAllowTrustOp = 217 # type: Literal[217] - StellarAccountMergeOp = 218 # type: Literal[218] - StellarManageDataOp = 220 # type: Literal[220] - StellarBumpSequenceOp = 221 # type: Literal[221] - StellarSignedTx = 230 # type: Literal[230] - CardanoSignTx = 303 # type: Literal[303] - CardanoGetPublicKey = 305 # type: Literal[305] - CardanoPublicKey = 306 # type: Literal[306] - CardanoGetAddress = 307 # type: Literal[307] - CardanoAddress = 308 # type: Literal[308] - CardanoSignedTx = 310 # type: Literal[310] - RippleGetAddress = 400 # type: Literal[400] - RippleAddress = 401 # type: Literal[401] - RippleSignTx = 402 # type: Literal[402] - RippleSignedTx = 403 # type: Literal[403] - MoneroTransactionInitRequest = 501 # type: Literal[501] - MoneroTransactionInitAck = 502 # type: Literal[502] - MoneroTransactionSetInputRequest = 503 # type: Literal[503] - MoneroTransactionSetInputAck = 504 # type: Literal[504] - MoneroTransactionInputsPermutationRequest = 505 # type: Literal[505] - MoneroTransactionInputsPermutationAck = 506 # type: Literal[506] - MoneroTransactionInputViniRequest = 507 # type: Literal[507] - MoneroTransactionInputViniAck = 508 # type: Literal[508] - MoneroTransactionAllInputsSetRequest = 509 # type: Literal[509] - MoneroTransactionAllInputsSetAck = 510 # type: Literal[510] - MoneroTransactionSetOutputRequest = 511 # type: Literal[511] - MoneroTransactionSetOutputAck = 512 # type: Literal[512] - MoneroTransactionAllOutSetRequest = 513 # type: Literal[513] - MoneroTransactionAllOutSetAck = 514 # type: Literal[514] - MoneroTransactionSignInputRequest = 515 # type: Literal[515] - MoneroTransactionSignInputAck = 516 # type: Literal[516] - MoneroTransactionFinalRequest = 517 # type: Literal[517] - MoneroTransactionFinalAck = 518 # type: Literal[518] - MoneroKeyImageExportInitRequest = 530 # type: Literal[530] - MoneroKeyImageExportInitAck = 531 # type: Literal[531] - MoneroKeyImageSyncStepRequest = 532 # type: Literal[532] - MoneroKeyImageSyncStepAck = 533 # type: Literal[533] - MoneroKeyImageSyncFinalRequest = 534 # type: Literal[534] - MoneroKeyImageSyncFinalAck = 535 # type: Literal[535] - MoneroGetAddress = 540 # type: Literal[540] - MoneroAddress = 541 # type: Literal[541] - MoneroGetWatchKey = 542 # type: Literal[542] - MoneroWatchKey = 543 # type: Literal[543] - DebugMoneroDiagRequest = 546 # type: Literal[546] - DebugMoneroDiagAck = 547 # type: Literal[547] - MoneroGetTxKeyRequest = 550 # type: Literal[550] - MoneroGetTxKeyAck = 551 # type: Literal[551] - MoneroLiveRefreshStartRequest = 552 # type: Literal[552] - MoneroLiveRefreshStartAck = 553 # type: Literal[553] - MoneroLiveRefreshStepRequest = 554 # type: Literal[554] - MoneroLiveRefreshStepAck = 555 # type: Literal[555] - MoneroLiveRefreshFinalRequest = 556 # type: Literal[556] - MoneroLiveRefreshFinalAck = 557 # type: Literal[557] - EosGetPublicKey = 600 # type: Literal[600] - EosPublicKey = 601 # type: Literal[601] - EosSignTx = 602 # type: Literal[602] - EosTxActionRequest = 603 # type: Literal[603] - EosTxActionAck = 604 # type: Literal[604] - EosSignedTx = 605 # type: Literal[605] - BinanceGetAddress = 700 # type: Literal[700] - BinanceAddress = 701 # type: Literal[701] - BinanceGetPublicKey = 702 # type: Literal[702] - BinancePublicKey = 703 # type: Literal[703] - BinanceSignTx = 704 # type: Literal[704] - BinanceTxRequest = 705 # type: Literal[705] - BinanceTransferMsg = 706 # type: Literal[706] - BinanceOrderMsg = 707 # type: Literal[707] - BinanceCancelMsg = 708 # type: Literal[708] - BinanceSignedTx = 709 # type: Literal[709] - WebAuthnListResidentCredentials = 800 # type: Literal[800] - WebAuthnCredentials = 801 # type: Literal[801] - WebAuthnAddResidentCredential = 802 # type: Literal[802] - WebAuthnRemoveResidentCredential = 803 # type: Literal[803] + EthereumGetPublicKey: Literal[450] = 450 + EthereumPublicKey: Literal[451] = 451 + EthereumGetAddress: Literal[56] = 56 + EthereumAddress: Literal[57] = 57 + EthereumSignTx: Literal[58] = 58 + EthereumTxRequest: Literal[59] = 59 + EthereumTxAck: Literal[60] = 60 + EthereumSignMessage: Literal[64] = 64 + EthereumVerifyMessage: Literal[65] = 65 + EthereumMessageSignature: Literal[66] = 66 + NEMGetAddress: Literal[67] = 67 + NEMAddress: Literal[68] = 68 + NEMSignTx: Literal[69] = 69 + NEMSignedTx: Literal[70] = 70 + NEMDecryptMessage: Literal[75] = 75 + NEMDecryptedMessage: Literal[76] = 76 + LiskGetAddress: Literal[114] = 114 + LiskAddress: Literal[115] = 115 + LiskSignTx: Literal[116] = 116 + LiskSignedTx: Literal[117] = 117 + LiskSignMessage: Literal[118] = 118 + LiskMessageSignature: Literal[119] = 119 + LiskVerifyMessage: Literal[120] = 120 + LiskGetPublicKey: Literal[121] = 121 + LiskPublicKey: Literal[122] = 122 + TezosGetAddress: Literal[150] = 150 + TezosAddress: Literal[151] = 151 + TezosSignTx: Literal[152] = 152 + TezosSignedTx: Literal[153] = 153 + TezosGetPublicKey: Literal[154] = 154 + TezosPublicKey: Literal[155] = 155 + StellarSignTx: Literal[202] = 202 + StellarTxOpRequest: Literal[203] = 203 + StellarGetAddress: Literal[207] = 207 + StellarAddress: Literal[208] = 208 + StellarCreateAccountOp: Literal[210] = 210 + StellarPaymentOp: Literal[211] = 211 + StellarPathPaymentOp: Literal[212] = 212 + StellarManageOfferOp: Literal[213] = 213 + StellarCreatePassiveOfferOp: Literal[214] = 214 + StellarSetOptionsOp: Literal[215] = 215 + StellarChangeTrustOp: Literal[216] = 216 + StellarAllowTrustOp: Literal[217] = 217 + StellarAccountMergeOp: Literal[218] = 218 + StellarManageDataOp: Literal[220] = 220 + StellarBumpSequenceOp: Literal[221] = 221 + StellarSignedTx: Literal[230] = 230 + CardanoSignTx: Literal[303] = 303 + CardanoGetPublicKey: Literal[305] = 305 + CardanoPublicKey: Literal[306] = 306 + CardanoGetAddress: Literal[307] = 307 + CardanoAddress: Literal[308] = 308 + CardanoSignedTx: Literal[310] = 310 + RippleGetAddress: Literal[400] = 400 + RippleAddress: Literal[401] = 401 + RippleSignTx: Literal[402] = 402 + RippleSignedTx: Literal[403] = 403 + MoneroTransactionInitRequest: Literal[501] = 501 + MoneroTransactionInitAck: Literal[502] = 502 + MoneroTransactionSetInputRequest: Literal[503] = 503 + MoneroTransactionSetInputAck: Literal[504] = 504 + MoneroTransactionInputsPermutationRequest: Literal[505] = 505 + MoneroTransactionInputsPermutationAck: Literal[506] = 506 + MoneroTransactionInputViniRequest: Literal[507] = 507 + MoneroTransactionInputViniAck: Literal[508] = 508 + MoneroTransactionAllInputsSetRequest: Literal[509] = 509 + MoneroTransactionAllInputsSetAck: Literal[510] = 510 + MoneroTransactionSetOutputRequest: Literal[511] = 511 + MoneroTransactionSetOutputAck: Literal[512] = 512 + MoneroTransactionAllOutSetRequest: Literal[513] = 513 + MoneroTransactionAllOutSetAck: Literal[514] = 514 + MoneroTransactionSignInputRequest: Literal[515] = 515 + MoneroTransactionSignInputAck: Literal[516] = 516 + MoneroTransactionFinalRequest: Literal[517] = 517 + MoneroTransactionFinalAck: Literal[518] = 518 + MoneroKeyImageExportInitRequest: Literal[530] = 530 + MoneroKeyImageExportInitAck: Literal[531] = 531 + MoneroKeyImageSyncStepRequest: Literal[532] = 532 + MoneroKeyImageSyncStepAck: Literal[533] = 533 + MoneroKeyImageSyncFinalRequest: Literal[534] = 534 + MoneroKeyImageSyncFinalAck: Literal[535] = 535 + MoneroGetAddress: Literal[540] = 540 + MoneroAddress: Literal[541] = 541 + MoneroGetWatchKey: Literal[542] = 542 + MoneroWatchKey: Literal[543] = 543 + DebugMoneroDiagRequest: Literal[546] = 546 + DebugMoneroDiagAck: Literal[547] = 547 + MoneroGetTxKeyRequest: Literal[550] = 550 + MoneroGetTxKeyAck: Literal[551] = 551 + MoneroLiveRefreshStartRequest: Literal[552] = 552 + MoneroLiveRefreshStartAck: Literal[553] = 553 + MoneroLiveRefreshStepRequest: Literal[554] = 554 + MoneroLiveRefreshStepAck: Literal[555] = 555 + MoneroLiveRefreshFinalRequest: Literal[556] = 556 + MoneroLiveRefreshFinalAck: Literal[557] = 557 + EosGetPublicKey: Literal[600] = 600 + EosPublicKey: Literal[601] = 601 + EosSignTx: Literal[602] = 602 + EosTxActionRequest: Literal[603] = 603 + EosTxActionAck: Literal[604] = 604 + EosSignedTx: Literal[605] = 605 + BinanceGetAddress: Literal[700] = 700 + BinanceAddress: Literal[701] = 701 + BinanceGetPublicKey: Literal[702] = 702 + BinancePublicKey: Literal[703] = 703 + BinanceSignTx: Literal[704] = 704 + BinanceTxRequest: Literal[705] = 705 + BinanceTransferMsg: Literal[706] = 706 + BinanceOrderMsg: Literal[707] = 707 + BinanceCancelMsg: Literal[708] = 708 + BinanceSignedTx: Literal[709] = 709 + WebAuthnListResidentCredentials: Literal[800] = 800 + WebAuthnCredentials: Literal[801] = 801 + WebAuthnAddResidentCredential: Literal[802] = 802 + WebAuthnRemoveResidentCredential: Literal[803] = 803 diff --git a/core/src/trezor/messages/NEMImportanceTransferMode.py b/core/src/trezor/messages/NEMImportanceTransferMode.py index 408c47184..13f31fab3 100644 --- a/core/src/trezor/messages/NEMImportanceTransferMode.py +++ b/core/src/trezor/messages/NEMImportanceTransferMode.py @@ -1,7 +1,10 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -ImportanceTransfer_Activate = 1 # type: Literal[1] -ImportanceTransfer_Deactivate = 2 # type: Literal[2] +ImportanceTransfer_Activate: Literal[1] = 1 +ImportanceTransfer_Deactivate: Literal[2] = 2 diff --git a/core/src/trezor/messages/NEMModificationType.py b/core/src/trezor/messages/NEMModificationType.py index d33d2ca4d..f414bd2b0 100644 --- a/core/src/trezor/messages/NEMModificationType.py +++ b/core/src/trezor/messages/NEMModificationType.py @@ -1,7 +1,10 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -CosignatoryModification_Add = 1 # type: Literal[1] -CosignatoryModification_Delete = 2 # type: Literal[2] +CosignatoryModification_Add: Literal[1] = 1 +CosignatoryModification_Delete: Literal[2] = 2 diff --git a/core/src/trezor/messages/NEMMosaicLevy.py b/core/src/trezor/messages/NEMMosaicLevy.py index f5a734579..05e7985d4 100644 --- a/core/src/trezor/messages/NEMMosaicLevy.py +++ b/core/src/trezor/messages/NEMMosaicLevy.py @@ -1,7 +1,10 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -MosaicLevy_Absolute = 1 # type: Literal[1] -MosaicLevy_Percentile = 2 # type: Literal[2] +MosaicLevy_Absolute: Literal[1] = 1 +MosaicLevy_Percentile: Literal[2] = 2 diff --git a/core/src/trezor/messages/NEMSupplyChangeType.py b/core/src/trezor/messages/NEMSupplyChangeType.py index 77f12b16c..86a3d43e1 100644 --- a/core/src/trezor/messages/NEMSupplyChangeType.py +++ b/core/src/trezor/messages/NEMSupplyChangeType.py @@ -1,7 +1,10 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -SupplyChange_Increase = 1 # type: Literal[1] -SupplyChange_Decrease = 2 # type: Literal[2] +SupplyChange_Increase: Literal[1] = 1 +SupplyChange_Decrease: Literal[2] = 2 diff --git a/core/src/trezor/messages/OutputScriptType.py b/core/src/trezor/messages/OutputScriptType.py index bd334789c..94116b236 100644 --- a/core/src/trezor/messages/OutputScriptType.py +++ b/core/src/trezor/messages/OutputScriptType.py @@ -1,11 +1,14 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -PAYTOADDRESS = 0 # type: Literal[0] -PAYTOSCRIPTHASH = 1 # type: Literal[1] -PAYTOMULTISIG = 2 # type: Literal[2] -PAYTOOPRETURN = 3 # type: Literal[3] -PAYTOWITNESS = 4 # type: Literal[4] -PAYTOP2SHWITNESS = 5 # type: Literal[5] +PAYTOADDRESS: Literal[0] = 0 +PAYTOSCRIPTHASH: Literal[1] = 1 +PAYTOMULTISIG: Literal[2] = 2 +PAYTOOPRETURN: Literal[3] = 3 +PAYTOWITNESS: Literal[4] = 4 +PAYTOP2SHWITNESS: Literal[5] = 5 diff --git a/core/src/trezor/messages/RecoveryDeviceType.py b/core/src/trezor/messages/RecoveryDeviceType.py index 6a87da000..965423292 100644 --- a/core/src/trezor/messages/RecoveryDeviceType.py +++ b/core/src/trezor/messages/RecoveryDeviceType.py @@ -1,7 +1,10 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -ScrambledWords = 0 # type: Literal[0] -Matrix = 1 # type: Literal[1] +ScrambledWords: Literal[0] = 0 +Matrix: Literal[1] = 1 diff --git a/core/src/trezor/messages/RequestType.py b/core/src/trezor/messages/RequestType.py index 42899b107..baffc605c 100644 --- a/core/src/trezor/messages/RequestType.py +++ b/core/src/trezor/messages/RequestType.py @@ -1,12 +1,15 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -TXINPUT = 0 # type: Literal[0] -TXOUTPUT = 1 # type: Literal[1] -TXMETA = 2 # type: Literal[2] -TXFINISHED = 3 # type: Literal[3] -TXEXTRADATA = 4 # type: Literal[4] -TXORIGINPUT = 5 # type: Literal[5] -TXORIGOUTPUT = 6 # type: Literal[6] +TXINPUT: Literal[0] = 0 +TXOUTPUT: Literal[1] = 1 +TXMETA: Literal[2] = 2 +TXFINISHED: Literal[3] = 3 +TXEXTRADATA: Literal[4] = 4 +TXORIGINPUT: Literal[5] = 5 +TXORIGOUTPUT: Literal[6] = 6 diff --git a/core/src/trezor/messages/SafetyCheckLevel.py b/core/src/trezor/messages/SafetyCheckLevel.py index fec329fb6..0bc3566c0 100644 --- a/core/src/trezor/messages/SafetyCheckLevel.py +++ b/core/src/trezor/messages/SafetyCheckLevel.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Strict = 0 # type: Literal[0] -PromptAlways = 1 # type: Literal[1] -PromptTemporarily = 2 # type: Literal[2] +Strict: Literal[0] = 0 +PromptAlways: Literal[1] = 1 +PromptTemporarily: Literal[2] = 2 diff --git a/core/src/trezor/messages/SdProtectOperationType.py b/core/src/trezor/messages/SdProtectOperationType.py index 17e1b0d4b..a979dc843 100644 --- a/core/src/trezor/messages/SdProtectOperationType.py +++ b/core/src/trezor/messages/SdProtectOperationType.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -DISABLE = 0 # type: Literal[0] -ENABLE = 1 # type: Literal[1] -REFRESH = 2 # type: Literal[2] +DISABLE: Literal[0] = 0 +ENABLE: Literal[1] = 1 +REFRESH: Literal[2] = 2 diff --git a/core/src/trezor/messages/TezosBallotType.py b/core/src/trezor/messages/TezosBallotType.py index d32901955..cb7c9a096 100644 --- a/core/src/trezor/messages/TezosBallotType.py +++ b/core/src/trezor/messages/TezosBallotType.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Yay = 0 # type: Literal[0] -Nay = 1 # type: Literal[1] -Pass = 2 # type: Literal[2] +Yay: Literal[0] = 0 +Nay: Literal[1] = 1 +Pass: Literal[2] = 2 diff --git a/core/src/trezor/messages/TezosContractType.py b/core/src/trezor/messages/TezosContractType.py index 211f451e2..d6d66a2fa 100644 --- a/core/src/trezor/messages/TezosContractType.py +++ b/core/src/trezor/messages/TezosContractType.py @@ -1,7 +1,10 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Implicit = 0 # type: Literal[0] -Originated = 1 # type: Literal[1] +Implicit: Literal[0] = 0 +Originated: Literal[1] = 1 diff --git a/python/src/trezorlib/mapping.py b/python/src/trezorlib/mapping.py index c37071212..a4e160d21 100644 --- a/python/src/trezorlib/mapping.py +++ b/python/src/trezorlib/mapping.py @@ -28,6 +28,10 @@ def build_map(): if msg_name.startswith("__"): continue + if msg_name == "Literal": + # TODO: remove this when we have a good implementation of enums + continue + try: msg_class = getattr(messages, msg_name) except AttributeError: diff --git a/python/src/trezorlib/messages/BackupType.py b/python/src/trezorlib/messages/BackupType.py index 7b3e30a6c..d8ed8002f 100644 --- a/python/src/trezorlib/messages/BackupType.py +++ b/python/src/trezorlib/messages/BackupType.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Bip39 = 0 # type: Literal[0] -Slip39_Basic = 1 # type: Literal[1] -Slip39_Advanced = 2 # type: Literal[2] +Bip39: Literal[0] = 0 +Slip39_Basic: Literal[1] = 1 +Slip39_Advanced: Literal[2] = 2 diff --git a/python/src/trezorlib/messages/BinanceOrderSide.py b/python/src/trezorlib/messages/BinanceOrderSide.py index 1105b9849..91be3ccdc 100644 --- a/python/src/trezorlib/messages/BinanceOrderSide.py +++ b/python/src/trezorlib/messages/BinanceOrderSide.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -SIDE_UNKNOWN = 0 # type: Literal[0] -BUY = 1 # type: Literal[1] -SELL = 2 # type: Literal[2] +SIDE_UNKNOWN: Literal[0] = 0 +BUY: Literal[1] = 1 +SELL: Literal[2] = 2 diff --git a/python/src/trezorlib/messages/BinanceOrderType.py b/python/src/trezorlib/messages/BinanceOrderType.py index 6bd753c46..81846bb56 100644 --- a/python/src/trezorlib/messages/BinanceOrderType.py +++ b/python/src/trezorlib/messages/BinanceOrderType.py @@ -1,9 +1,12 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -OT_UNKNOWN = 0 # type: Literal[0] -MARKET = 1 # type: Literal[1] -LIMIT = 2 # type: Literal[2] -OT_RESERVED = 3 # type: Literal[3] +OT_UNKNOWN: Literal[0] = 0 +MARKET: Literal[1] = 1 +LIMIT: Literal[2] = 2 +OT_RESERVED: Literal[3] = 3 diff --git a/python/src/trezorlib/messages/BinanceTimeInForce.py b/python/src/trezorlib/messages/BinanceTimeInForce.py index d3d596dd1..340135fb2 100644 --- a/python/src/trezorlib/messages/BinanceTimeInForce.py +++ b/python/src/trezorlib/messages/BinanceTimeInForce.py @@ -1,9 +1,12 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -TIF_UNKNOWN = 0 # type: Literal[0] -GTE = 1 # type: Literal[1] -TIF_RESERVED = 2 # type: Literal[2] -IOC = 3 # type: Literal[3] +TIF_UNKNOWN: Literal[0] = 0 +GTE: Literal[1] = 1 +TIF_RESERVED: Literal[2] = 2 +IOC: Literal[3] = 3 diff --git a/python/src/trezorlib/messages/ButtonRequestType.py b/python/src/trezorlib/messages/ButtonRequestType.py index dadd38a9f..535ec54fb 100644 --- a/python/src/trezorlib/messages/ButtonRequestType.py +++ b/python/src/trezorlib/messages/ButtonRequestType.py @@ -1,25 +1,28 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Other = 1 # type: Literal[1] -FeeOverThreshold = 2 # type: Literal[2] -ConfirmOutput = 3 # type: Literal[3] -ResetDevice = 4 # type: Literal[4] -ConfirmWord = 5 # type: Literal[5] -WipeDevice = 6 # type: Literal[6] -ProtectCall = 7 # type: Literal[7] -SignTx = 8 # type: Literal[8] -FirmwareCheck = 9 # type: Literal[9] -Address = 10 # type: Literal[10] -PublicKey = 11 # type: Literal[11] -MnemonicWordCount = 12 # type: Literal[12] -MnemonicInput = 13 # type: Literal[13] -_Deprecated_ButtonRequest_PassphraseType = 14 # type: Literal[14] -UnknownDerivationPath = 15 # type: Literal[15] -RecoveryHomepage = 16 # type: Literal[16] -Success = 17 # type: Literal[17] -Warning = 18 # type: Literal[18] -PassphraseEntry = 19 # type: Literal[19] -PinEntry = 20 # type: Literal[20] +Other: Literal[1] = 1 +FeeOverThreshold: Literal[2] = 2 +ConfirmOutput: Literal[3] = 3 +ResetDevice: Literal[4] = 4 +ConfirmWord: Literal[5] = 5 +WipeDevice: Literal[6] = 6 +ProtectCall: Literal[7] = 7 +SignTx: Literal[8] = 8 +FirmwareCheck: Literal[9] = 9 +Address: Literal[10] = 10 +PublicKey: Literal[11] = 11 +MnemonicWordCount: Literal[12] = 12 +MnemonicInput: Literal[13] = 13 +_Deprecated_ButtonRequest_PassphraseType: Literal[14] = 14 +UnknownDerivationPath: Literal[15] = 15 +RecoveryHomepage: Literal[16] = 16 +Success: Literal[17] = 17 +Warning: Literal[18] = 18 +PassphraseEntry: Literal[19] = 19 +PinEntry: Literal[20] = 20 diff --git a/python/src/trezorlib/messages/Capability.py b/python/src/trezorlib/messages/Capability.py index 6cf40cd19..8f83aafba 100644 --- a/python/src/trezorlib/messages/Capability.py +++ b/python/src/trezorlib/messages/Capability.py @@ -1,22 +1,25 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Bitcoin = 1 # type: Literal[1] -Bitcoin_like = 2 # type: Literal[2] -Binance = 3 # type: Literal[3] -Cardano = 4 # type: Literal[4] -Crypto = 5 # type: Literal[5] -EOS = 6 # type: Literal[6] -Ethereum = 7 # type: Literal[7] -Lisk = 8 # type: Literal[8] -Monero = 9 # type: Literal[9] -NEM = 10 # type: Literal[10] -Ripple = 11 # type: Literal[11] -Stellar = 12 # type: Literal[12] -Tezos = 13 # type: Literal[13] -U2F = 14 # type: Literal[14] -Shamir = 15 # type: Literal[15] -ShamirGroups = 16 # type: Literal[16] -PassphraseEntry = 17 # type: Literal[17] +Bitcoin: Literal[1] = 1 +Bitcoin_like: Literal[2] = 2 +Binance: Literal[3] = 3 +Cardano: Literal[4] = 4 +Crypto: Literal[5] = 5 +EOS: Literal[6] = 6 +Ethereum: Literal[7] = 7 +Lisk: Literal[8] = 8 +Monero: Literal[9] = 9 +NEM: Literal[10] = 10 +Ripple: Literal[11] = 11 +Stellar: Literal[12] = 12 +Tezos: Literal[13] = 13 +U2F: Literal[14] = 14 +Shamir: Literal[15] = 15 +ShamirGroups: Literal[16] = 16 +PassphraseEntry: Literal[17] = 17 diff --git a/python/src/trezorlib/messages/CardanoAddressType.py b/python/src/trezorlib/messages/CardanoAddressType.py index 4867b775c..ec7bb4397 100644 --- a/python/src/trezorlib/messages/CardanoAddressType.py +++ b/python/src/trezorlib/messages/CardanoAddressType.py @@ -1,16 +1,19 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -BASE = 0 # type: Literal[0] -BASE_SCRIPT_KEY = 1 # type: Literal[1] -BASE_KEY_SCRIPT = 2 # type: Literal[2] -BASE_SCRIPT_SCRIPT = 3 # type: Literal[3] -POINTER = 4 # type: Literal[4] -POINTER_SCRIPT = 5 # type: Literal[5] -ENTERPRISE = 6 # type: Literal[6] -ENTERPRISE_SCRIPT = 7 # type: Literal[7] -BYRON = 8 # type: Literal[8] -REWARD = 14 # type: Literal[14] -REWARD_SCRIPT = 15 # type: Literal[15] +BASE: Literal[0] = 0 +BASE_SCRIPT_KEY: Literal[1] = 1 +BASE_KEY_SCRIPT: Literal[2] = 2 +BASE_SCRIPT_SCRIPT: Literal[3] = 3 +POINTER: Literal[4] = 4 +POINTER_SCRIPT: Literal[5] = 5 +ENTERPRISE: Literal[6] = 6 +ENTERPRISE_SCRIPT: Literal[7] = 7 +BYRON: Literal[8] = 8 +REWARD: Literal[14] = 14 +REWARD_SCRIPT: Literal[15] = 15 diff --git a/python/src/trezorlib/messages/CardanoCertificateType.py b/python/src/trezorlib/messages/CardanoCertificateType.py index eb6bc15f4..4f7e4a82d 100644 --- a/python/src/trezorlib/messages/CardanoCertificateType.py +++ b/python/src/trezorlib/messages/CardanoCertificateType.py @@ -1,9 +1,12 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -STAKE_REGISTRATION = 0 # type: Literal[0] -STAKE_DEREGISTRATION = 1 # type: Literal[1] -STAKE_DELEGATION = 2 # type: Literal[2] -STAKE_POOL_REGISTRATION = 3 # type: Literal[3] +STAKE_REGISTRATION: Literal[0] = 0 +STAKE_DEREGISTRATION: Literal[1] = 1 +STAKE_DELEGATION: Literal[2] = 2 +STAKE_POOL_REGISTRATION: Literal[3] = 3 diff --git a/python/src/trezorlib/messages/CardanoPoolRelayType.py b/python/src/trezorlib/messages/CardanoPoolRelayType.py index 3623702f4..680b29d43 100644 --- a/python/src/trezorlib/messages/CardanoPoolRelayType.py +++ b/python/src/trezorlib/messages/CardanoPoolRelayType.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -SINGLE_HOST_IP = 0 # type: Literal[0] -SINGLE_HOST_NAME = 1 # type: Literal[1] -MULTIPLE_HOST_NAME = 2 # type: Literal[2] +SINGLE_HOST_IP: Literal[0] = 0 +SINGLE_HOST_NAME: Literal[1] = 1 +MULTIPLE_HOST_NAME: Literal[2] = 2 diff --git a/python/src/trezorlib/messages/DebugLinkShowTextStyle.py b/python/src/trezorlib/messages/DebugLinkShowTextStyle.py index 9df392aa7..8ead39e99 100644 --- a/python/src/trezorlib/messages/DebugLinkShowTextStyle.py +++ b/python/src/trezorlib/messages/DebugLinkShowTextStyle.py @@ -1,11 +1,14 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -NORMAL = 0 # type: Literal[0] -BOLD = 1 # type: Literal[1] -MONO = 2 # type: Literal[2] -BR = 4 # type: Literal[4] -BR_HALF = 5 # type: Literal[5] -SET_COLOR = 6 # type: Literal[6] +NORMAL: Literal[0] = 0 +BOLD: Literal[1] = 1 +MONO: Literal[2] = 2 +BR: Literal[4] = 4 +BR_HALF: Literal[5] = 5 +SET_COLOR: Literal[6] = 6 diff --git a/python/src/trezorlib/messages/DebugSwipeDirection.py b/python/src/trezorlib/messages/DebugSwipeDirection.py index b53ccc7ff..9e6cbf292 100644 --- a/python/src/trezorlib/messages/DebugSwipeDirection.py +++ b/python/src/trezorlib/messages/DebugSwipeDirection.py @@ -1,9 +1,12 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -UP = 0 # type: Literal[0] -DOWN = 1 # type: Literal[1] -LEFT = 2 # type: Literal[2] -RIGHT = 3 # type: Literal[3] +UP: Literal[0] = 0 +DOWN: Literal[1] = 1 +LEFT: Literal[2] = 2 +RIGHT: Literal[3] = 3 diff --git a/python/src/trezorlib/messages/FailureType.py b/python/src/trezorlib/messages/FailureType.py index df77d8db9..49dbf8b6f 100644 --- a/python/src/trezorlib/messages/FailureType.py +++ b/python/src/trezorlib/messages/FailureType.py @@ -1,20 +1,23 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -UnexpectedMessage = 1 # type: Literal[1] -ButtonExpected = 2 # type: Literal[2] -DataError = 3 # type: Literal[3] -ActionCancelled = 4 # type: Literal[4] -PinExpected = 5 # type: Literal[5] -PinCancelled = 6 # type: Literal[6] -PinInvalid = 7 # type: Literal[7] -InvalidSignature = 8 # type: Literal[8] -ProcessError = 9 # type: Literal[9] -NotEnoughFunds = 10 # type: Literal[10] -NotInitialized = 11 # type: Literal[11] -PinMismatch = 12 # type: Literal[12] -WipeCodeMismatch = 13 # type: Literal[13] -InvalidSession = 14 # type: Literal[14] -FirmwareError = 99 # type: Literal[99] +UnexpectedMessage: Literal[1] = 1 +ButtonExpected: Literal[2] = 2 +DataError: Literal[3] = 3 +ActionCancelled: Literal[4] = 4 +PinExpected: Literal[5] = 5 +PinCancelled: Literal[6] = 6 +PinInvalid: Literal[7] = 7 +InvalidSignature: Literal[8] = 8 +ProcessError: Literal[9] = 9 +NotEnoughFunds: Literal[10] = 10 +NotInitialized: Literal[11] = 11 +PinMismatch: Literal[12] = 12 +WipeCodeMismatch: Literal[13] = 13 +InvalidSession: Literal[14] = 14 +FirmwareError: Literal[99] = 99 diff --git a/python/src/trezorlib/messages/InputScriptType.py b/python/src/trezorlib/messages/InputScriptType.py index fc2223e25..26243b1ca 100644 --- a/python/src/trezorlib/messages/InputScriptType.py +++ b/python/src/trezorlib/messages/InputScriptType.py @@ -1,10 +1,13 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -SPENDADDRESS = 0 # type: Literal[0] -SPENDMULTISIG = 1 # type: Literal[1] -EXTERNAL = 2 # type: Literal[2] -SPENDWITNESS = 3 # type: Literal[3] -SPENDP2SHWITNESS = 4 # type: Literal[4] +SPENDADDRESS: Literal[0] = 0 +SPENDMULTISIG: Literal[1] = 1 +EXTERNAL: Literal[2] = 2 +SPENDWITNESS: Literal[3] = 3 +SPENDP2SHWITNESS: Literal[4] = 4 diff --git a/python/src/trezorlib/messages/LiskTransactionType.py b/python/src/trezorlib/messages/LiskTransactionType.py index 79069c6a9..4056d0af0 100644 --- a/python/src/trezorlib/messages/LiskTransactionType.py +++ b/python/src/trezorlib/messages/LiskTransactionType.py @@ -1,13 +1,16 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Transfer = 0 # type: Literal[0] -RegisterSecondPassphrase = 1 # type: Literal[1] -RegisterDelegate = 2 # type: Literal[2] -CastVotes = 3 # type: Literal[3] -RegisterMultisignatureAccount = 4 # type: Literal[4] -CreateDapp = 5 # type: Literal[5] -TransferIntoDapp = 6 # type: Literal[6] -TransferOutOfDapp = 7 # type: Literal[7] +Transfer: Literal[0] = 0 +RegisterSecondPassphrase: Literal[1] = 1 +RegisterDelegate: Literal[2] = 2 +CastVotes: Literal[3] = 3 +RegisterMultisignatureAccount: Literal[4] = 4 +CreateDapp: Literal[5] = 5 +TransferIntoDapp: Literal[6] = 6 +TransferOutOfDapp: Literal[7] = 7 diff --git a/python/src/trezorlib/messages/MessageType.py b/python/src/trezorlib/messages/MessageType.py index ac26d2663..8c1dbc3f4 100644 --- a/python/src/trezorlib/messages/MessageType.py +++ b/python/src/trezorlib/messages/MessageType.py @@ -1,203 +1,206 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Initialize = 0 # type: Literal[0] -Ping = 1 # type: Literal[1] -Success = 2 # type: Literal[2] -Failure = 3 # type: Literal[3] -ChangePin = 4 # type: Literal[4] -WipeDevice = 5 # type: Literal[5] -GetEntropy = 9 # type: Literal[9] -Entropy = 10 # type: Literal[10] -LoadDevice = 13 # type: Literal[13] -ResetDevice = 14 # type: Literal[14] -Features = 17 # type: Literal[17] -PinMatrixRequest = 18 # type: Literal[18] -PinMatrixAck = 19 # type: Literal[19] -Cancel = 20 # type: Literal[20] -LockDevice = 24 # type: Literal[24] -ApplySettings = 25 # type: Literal[25] -ButtonRequest = 26 # type: Literal[26] -ButtonAck = 27 # type: Literal[27] -ApplyFlags = 28 # type: Literal[28] -BackupDevice = 34 # type: Literal[34] -EntropyRequest = 35 # type: Literal[35] -EntropyAck = 36 # type: Literal[36] -PassphraseRequest = 41 # type: Literal[41] -PassphraseAck = 42 # type: Literal[42] -RecoveryDevice = 45 # type: Literal[45] -WordRequest = 46 # type: Literal[46] -WordAck = 47 # type: Literal[47] -GetFeatures = 55 # type: Literal[55] -SetU2FCounter = 63 # type: Literal[63] -SdProtect = 79 # type: Literal[79] -GetNextU2FCounter = 80 # type: Literal[80] -NextU2FCounter = 81 # type: Literal[81] -ChangeWipeCode = 82 # type: Literal[82] -EndSession = 83 # type: Literal[83] -DoPreauthorized = 84 # type: Literal[84] -PreauthorizedRequest = 85 # type: Literal[85] -CancelAuthorization = 86 # type: Literal[86] -Deprecated_PassphraseStateRequest = 77 # type: Literal[77] -Deprecated_PassphraseStateAck = 78 # type: Literal[78] -FirmwareErase = 6 # type: Literal[6] -FirmwareUpload = 7 # type: Literal[7] -FirmwareRequest = 8 # type: Literal[8] -SelfTest = 32 # type: Literal[32] -GetPublicKey = 11 # type: Literal[11] -PublicKey = 12 # type: Literal[12] -SignTx = 15 # type: Literal[15] -TxRequest = 21 # type: Literal[21] -TxAck = 22 # type: Literal[22] -GetAddress = 29 # type: Literal[29] -Address = 30 # type: Literal[30] -SignMessage = 38 # type: Literal[38] -VerifyMessage = 39 # type: Literal[39] -MessageSignature = 40 # type: Literal[40] -GetOwnershipId = 43 # type: Literal[43] -OwnershipId = 44 # type: Literal[44] -GetOwnershipProof = 49 # type: Literal[49] -OwnershipProof = 50 # type: Literal[50] -AuthorizeCoinJoin = 51 # type: Literal[51] -CipherKeyValue = 23 # type: Literal[23] -CipheredKeyValue = 48 # type: Literal[48] -SignIdentity = 53 # type: Literal[53] -SignedIdentity = 54 # type: Literal[54] -GetECDHSessionKey = 61 # type: Literal[61] -ECDHSessionKey = 62 # type: Literal[62] -CosiCommit = 71 # type: Literal[71] -CosiCommitment = 72 # type: Literal[72] -CosiSign = 73 # type: Literal[73] -CosiSignature = 74 # type: Literal[74] -DebugLinkDecision = 100 # type: Literal[100] -DebugLinkGetState = 101 # type: Literal[101] -DebugLinkState = 102 # type: Literal[102] -DebugLinkStop = 103 # type: Literal[103] -DebugLinkLog = 104 # type: Literal[104] -DebugLinkMemoryRead = 110 # type: Literal[110] -DebugLinkMemory = 111 # type: Literal[111] -DebugLinkMemoryWrite = 112 # type: Literal[112] -DebugLinkFlashErase = 113 # type: Literal[113] -DebugLinkLayout = 9001 # type: Literal[9001] -DebugLinkReseedRandom = 9002 # type: Literal[9002] -DebugLinkRecordScreen = 9003 # type: Literal[9003] -DebugLinkShowText = 9004 # type: Literal[9004] -DebugLinkEraseSdCard = 9005 # type: Literal[9005] -DebugLinkWatchLayout = 9006 # type: Literal[9006] -EthereumGetPublicKey = 450 # type: Literal[450] -EthereumPublicKey = 451 # type: Literal[451] -EthereumGetAddress = 56 # type: Literal[56] -EthereumAddress = 57 # type: Literal[57] -EthereumSignTx = 58 # type: Literal[58] -EthereumTxRequest = 59 # type: Literal[59] -EthereumTxAck = 60 # type: Literal[60] -EthereumSignMessage = 64 # type: Literal[64] -EthereumVerifyMessage = 65 # type: Literal[65] -EthereumMessageSignature = 66 # type: Literal[66] -NEMGetAddress = 67 # type: Literal[67] -NEMAddress = 68 # type: Literal[68] -NEMSignTx = 69 # type: Literal[69] -NEMSignedTx = 70 # type: Literal[70] -NEMDecryptMessage = 75 # type: Literal[75] -NEMDecryptedMessage = 76 # type: Literal[76] -LiskGetAddress = 114 # type: Literal[114] -LiskAddress = 115 # type: Literal[115] -LiskSignTx = 116 # type: Literal[116] -LiskSignedTx = 117 # type: Literal[117] -LiskSignMessage = 118 # type: Literal[118] -LiskMessageSignature = 119 # type: Literal[119] -LiskVerifyMessage = 120 # type: Literal[120] -LiskGetPublicKey = 121 # type: Literal[121] -LiskPublicKey = 122 # type: Literal[122] -TezosGetAddress = 150 # type: Literal[150] -TezosAddress = 151 # type: Literal[151] -TezosSignTx = 152 # type: Literal[152] -TezosSignedTx = 153 # type: Literal[153] -TezosGetPublicKey = 154 # type: Literal[154] -TezosPublicKey = 155 # type: Literal[155] -StellarSignTx = 202 # type: Literal[202] -StellarTxOpRequest = 203 # type: Literal[203] -StellarGetAddress = 207 # type: Literal[207] -StellarAddress = 208 # type: Literal[208] -StellarCreateAccountOp = 210 # type: Literal[210] -StellarPaymentOp = 211 # type: Literal[211] -StellarPathPaymentOp = 212 # type: Literal[212] -StellarManageOfferOp = 213 # type: Literal[213] -StellarCreatePassiveOfferOp = 214 # type: Literal[214] -StellarSetOptionsOp = 215 # type: Literal[215] -StellarChangeTrustOp = 216 # type: Literal[216] -StellarAllowTrustOp = 217 # type: Literal[217] -StellarAccountMergeOp = 218 # type: Literal[218] -StellarManageDataOp = 220 # type: Literal[220] -StellarBumpSequenceOp = 221 # type: Literal[221] -StellarSignedTx = 230 # type: Literal[230] -CardanoSignTx = 303 # type: Literal[303] -CardanoGetPublicKey = 305 # type: Literal[305] -CardanoPublicKey = 306 # type: Literal[306] -CardanoGetAddress = 307 # type: Literal[307] -CardanoAddress = 308 # type: Literal[308] -CardanoSignedTx = 310 # type: Literal[310] -RippleGetAddress = 400 # type: Literal[400] -RippleAddress = 401 # type: Literal[401] -RippleSignTx = 402 # type: Literal[402] -RippleSignedTx = 403 # type: Literal[403] -MoneroTransactionInitRequest = 501 # type: Literal[501] -MoneroTransactionInitAck = 502 # type: Literal[502] -MoneroTransactionSetInputRequest = 503 # type: Literal[503] -MoneroTransactionSetInputAck = 504 # type: Literal[504] -MoneroTransactionInputsPermutationRequest = 505 # type: Literal[505] -MoneroTransactionInputsPermutationAck = 506 # type: Literal[506] -MoneroTransactionInputViniRequest = 507 # type: Literal[507] -MoneroTransactionInputViniAck = 508 # type: Literal[508] -MoneroTransactionAllInputsSetRequest = 509 # type: Literal[509] -MoneroTransactionAllInputsSetAck = 510 # type: Literal[510] -MoneroTransactionSetOutputRequest = 511 # type: Literal[511] -MoneroTransactionSetOutputAck = 512 # type: Literal[512] -MoneroTransactionAllOutSetRequest = 513 # type: Literal[513] -MoneroTransactionAllOutSetAck = 514 # type: Literal[514] -MoneroTransactionSignInputRequest = 515 # type: Literal[515] -MoneroTransactionSignInputAck = 516 # type: Literal[516] -MoneroTransactionFinalRequest = 517 # type: Literal[517] -MoneroTransactionFinalAck = 518 # type: Literal[518] -MoneroKeyImageExportInitRequest = 530 # type: Literal[530] -MoneroKeyImageExportInitAck = 531 # type: Literal[531] -MoneroKeyImageSyncStepRequest = 532 # type: Literal[532] -MoneroKeyImageSyncStepAck = 533 # type: Literal[533] -MoneroKeyImageSyncFinalRequest = 534 # type: Literal[534] -MoneroKeyImageSyncFinalAck = 535 # type: Literal[535] -MoneroGetAddress = 540 # type: Literal[540] -MoneroAddress = 541 # type: Literal[541] -MoneroGetWatchKey = 542 # type: Literal[542] -MoneroWatchKey = 543 # type: Literal[543] -DebugMoneroDiagRequest = 546 # type: Literal[546] -DebugMoneroDiagAck = 547 # type: Literal[547] -MoneroGetTxKeyRequest = 550 # type: Literal[550] -MoneroGetTxKeyAck = 551 # type: Literal[551] -MoneroLiveRefreshStartRequest = 552 # type: Literal[552] -MoneroLiveRefreshStartAck = 553 # type: Literal[553] -MoneroLiveRefreshStepRequest = 554 # type: Literal[554] -MoneroLiveRefreshStepAck = 555 # type: Literal[555] -MoneroLiveRefreshFinalRequest = 556 # type: Literal[556] -MoneroLiveRefreshFinalAck = 557 # type: Literal[557] -EosGetPublicKey = 600 # type: Literal[600] -EosPublicKey = 601 # type: Literal[601] -EosSignTx = 602 # type: Literal[602] -EosTxActionRequest = 603 # type: Literal[603] -EosTxActionAck = 604 # type: Literal[604] -EosSignedTx = 605 # type: Literal[605] -BinanceGetAddress = 700 # type: Literal[700] -BinanceAddress = 701 # type: Literal[701] -BinanceGetPublicKey = 702 # type: Literal[702] -BinancePublicKey = 703 # type: Literal[703] -BinanceSignTx = 704 # type: Literal[704] -BinanceTxRequest = 705 # type: Literal[705] -BinanceTransferMsg = 706 # type: Literal[706] -BinanceOrderMsg = 707 # type: Literal[707] -BinanceCancelMsg = 708 # type: Literal[708] -BinanceSignedTx = 709 # type: Literal[709] -WebAuthnListResidentCredentials = 800 # type: Literal[800] -WebAuthnCredentials = 801 # type: Literal[801] -WebAuthnAddResidentCredential = 802 # type: Literal[802] -WebAuthnRemoveResidentCredential = 803 # type: Literal[803] +Initialize: Literal[0] = 0 +Ping: Literal[1] = 1 +Success: Literal[2] = 2 +Failure: Literal[3] = 3 +ChangePin: Literal[4] = 4 +WipeDevice: Literal[5] = 5 +GetEntropy: Literal[9] = 9 +Entropy: Literal[10] = 10 +LoadDevice: Literal[13] = 13 +ResetDevice: Literal[14] = 14 +Features: Literal[17] = 17 +PinMatrixRequest: Literal[18] = 18 +PinMatrixAck: Literal[19] = 19 +Cancel: Literal[20] = 20 +LockDevice: Literal[24] = 24 +ApplySettings: Literal[25] = 25 +ButtonRequest: Literal[26] = 26 +ButtonAck: Literal[27] = 27 +ApplyFlags: Literal[28] = 28 +BackupDevice: Literal[34] = 34 +EntropyRequest: Literal[35] = 35 +EntropyAck: Literal[36] = 36 +PassphraseRequest: Literal[41] = 41 +PassphraseAck: Literal[42] = 42 +RecoveryDevice: Literal[45] = 45 +WordRequest: Literal[46] = 46 +WordAck: Literal[47] = 47 +GetFeatures: Literal[55] = 55 +SetU2FCounter: Literal[63] = 63 +SdProtect: Literal[79] = 79 +GetNextU2FCounter: Literal[80] = 80 +NextU2FCounter: Literal[81] = 81 +ChangeWipeCode: Literal[82] = 82 +EndSession: Literal[83] = 83 +DoPreauthorized: Literal[84] = 84 +PreauthorizedRequest: Literal[85] = 85 +CancelAuthorization: Literal[86] = 86 +Deprecated_PassphraseStateRequest: Literal[77] = 77 +Deprecated_PassphraseStateAck: Literal[78] = 78 +FirmwareErase: Literal[6] = 6 +FirmwareUpload: Literal[7] = 7 +FirmwareRequest: Literal[8] = 8 +SelfTest: Literal[32] = 32 +GetPublicKey: Literal[11] = 11 +PublicKey: Literal[12] = 12 +SignTx: Literal[15] = 15 +TxRequest: Literal[21] = 21 +TxAck: Literal[22] = 22 +GetAddress: Literal[29] = 29 +Address: Literal[30] = 30 +SignMessage: Literal[38] = 38 +VerifyMessage: Literal[39] = 39 +MessageSignature: Literal[40] = 40 +GetOwnershipId: Literal[43] = 43 +OwnershipId: Literal[44] = 44 +GetOwnershipProof: Literal[49] = 49 +OwnershipProof: Literal[50] = 50 +AuthorizeCoinJoin: Literal[51] = 51 +CipherKeyValue: Literal[23] = 23 +CipheredKeyValue: Literal[48] = 48 +SignIdentity: Literal[53] = 53 +SignedIdentity: Literal[54] = 54 +GetECDHSessionKey: Literal[61] = 61 +ECDHSessionKey: Literal[62] = 62 +CosiCommit: Literal[71] = 71 +CosiCommitment: Literal[72] = 72 +CosiSign: Literal[73] = 73 +CosiSignature: Literal[74] = 74 +DebugLinkDecision: Literal[100] = 100 +DebugLinkGetState: Literal[101] = 101 +DebugLinkState: Literal[102] = 102 +DebugLinkStop: Literal[103] = 103 +DebugLinkLog: Literal[104] = 104 +DebugLinkMemoryRead: Literal[110] = 110 +DebugLinkMemory: Literal[111] = 111 +DebugLinkMemoryWrite: Literal[112] = 112 +DebugLinkFlashErase: Literal[113] = 113 +DebugLinkLayout: Literal[9001] = 9001 +DebugLinkReseedRandom: Literal[9002] = 9002 +DebugLinkRecordScreen: Literal[9003] = 9003 +DebugLinkShowText: Literal[9004] = 9004 +DebugLinkEraseSdCard: Literal[9005] = 9005 +DebugLinkWatchLayout: Literal[9006] = 9006 +EthereumGetPublicKey: Literal[450] = 450 +EthereumPublicKey: Literal[451] = 451 +EthereumGetAddress: Literal[56] = 56 +EthereumAddress: Literal[57] = 57 +EthereumSignTx: Literal[58] = 58 +EthereumTxRequest: Literal[59] = 59 +EthereumTxAck: Literal[60] = 60 +EthereumSignMessage: Literal[64] = 64 +EthereumVerifyMessage: Literal[65] = 65 +EthereumMessageSignature: Literal[66] = 66 +NEMGetAddress: Literal[67] = 67 +NEMAddress: Literal[68] = 68 +NEMSignTx: Literal[69] = 69 +NEMSignedTx: Literal[70] = 70 +NEMDecryptMessage: Literal[75] = 75 +NEMDecryptedMessage: Literal[76] = 76 +LiskGetAddress: Literal[114] = 114 +LiskAddress: Literal[115] = 115 +LiskSignTx: Literal[116] = 116 +LiskSignedTx: Literal[117] = 117 +LiskSignMessage: Literal[118] = 118 +LiskMessageSignature: Literal[119] = 119 +LiskVerifyMessage: Literal[120] = 120 +LiskGetPublicKey: Literal[121] = 121 +LiskPublicKey: Literal[122] = 122 +TezosGetAddress: Literal[150] = 150 +TezosAddress: Literal[151] = 151 +TezosSignTx: Literal[152] = 152 +TezosSignedTx: Literal[153] = 153 +TezosGetPublicKey: Literal[154] = 154 +TezosPublicKey: Literal[155] = 155 +StellarSignTx: Literal[202] = 202 +StellarTxOpRequest: Literal[203] = 203 +StellarGetAddress: Literal[207] = 207 +StellarAddress: Literal[208] = 208 +StellarCreateAccountOp: Literal[210] = 210 +StellarPaymentOp: Literal[211] = 211 +StellarPathPaymentOp: Literal[212] = 212 +StellarManageOfferOp: Literal[213] = 213 +StellarCreatePassiveOfferOp: Literal[214] = 214 +StellarSetOptionsOp: Literal[215] = 215 +StellarChangeTrustOp: Literal[216] = 216 +StellarAllowTrustOp: Literal[217] = 217 +StellarAccountMergeOp: Literal[218] = 218 +StellarManageDataOp: Literal[220] = 220 +StellarBumpSequenceOp: Literal[221] = 221 +StellarSignedTx: Literal[230] = 230 +CardanoSignTx: Literal[303] = 303 +CardanoGetPublicKey: Literal[305] = 305 +CardanoPublicKey: Literal[306] = 306 +CardanoGetAddress: Literal[307] = 307 +CardanoAddress: Literal[308] = 308 +CardanoSignedTx: Literal[310] = 310 +RippleGetAddress: Literal[400] = 400 +RippleAddress: Literal[401] = 401 +RippleSignTx: Literal[402] = 402 +RippleSignedTx: Literal[403] = 403 +MoneroTransactionInitRequest: Literal[501] = 501 +MoneroTransactionInitAck: Literal[502] = 502 +MoneroTransactionSetInputRequest: Literal[503] = 503 +MoneroTransactionSetInputAck: Literal[504] = 504 +MoneroTransactionInputsPermutationRequest: Literal[505] = 505 +MoneroTransactionInputsPermutationAck: Literal[506] = 506 +MoneroTransactionInputViniRequest: Literal[507] = 507 +MoneroTransactionInputViniAck: Literal[508] = 508 +MoneroTransactionAllInputsSetRequest: Literal[509] = 509 +MoneroTransactionAllInputsSetAck: Literal[510] = 510 +MoneroTransactionSetOutputRequest: Literal[511] = 511 +MoneroTransactionSetOutputAck: Literal[512] = 512 +MoneroTransactionAllOutSetRequest: Literal[513] = 513 +MoneroTransactionAllOutSetAck: Literal[514] = 514 +MoneroTransactionSignInputRequest: Literal[515] = 515 +MoneroTransactionSignInputAck: Literal[516] = 516 +MoneroTransactionFinalRequest: Literal[517] = 517 +MoneroTransactionFinalAck: Literal[518] = 518 +MoneroKeyImageExportInitRequest: Literal[530] = 530 +MoneroKeyImageExportInitAck: Literal[531] = 531 +MoneroKeyImageSyncStepRequest: Literal[532] = 532 +MoneroKeyImageSyncStepAck: Literal[533] = 533 +MoneroKeyImageSyncFinalRequest: Literal[534] = 534 +MoneroKeyImageSyncFinalAck: Literal[535] = 535 +MoneroGetAddress: Literal[540] = 540 +MoneroAddress: Literal[541] = 541 +MoneroGetWatchKey: Literal[542] = 542 +MoneroWatchKey: Literal[543] = 543 +DebugMoneroDiagRequest: Literal[546] = 546 +DebugMoneroDiagAck: Literal[547] = 547 +MoneroGetTxKeyRequest: Literal[550] = 550 +MoneroGetTxKeyAck: Literal[551] = 551 +MoneroLiveRefreshStartRequest: Literal[552] = 552 +MoneroLiveRefreshStartAck: Literal[553] = 553 +MoneroLiveRefreshStepRequest: Literal[554] = 554 +MoneroLiveRefreshStepAck: Literal[555] = 555 +MoneroLiveRefreshFinalRequest: Literal[556] = 556 +MoneroLiveRefreshFinalAck: Literal[557] = 557 +EosGetPublicKey: Literal[600] = 600 +EosPublicKey: Literal[601] = 601 +EosSignTx: Literal[602] = 602 +EosTxActionRequest: Literal[603] = 603 +EosTxActionAck: Literal[604] = 604 +EosSignedTx: Literal[605] = 605 +BinanceGetAddress: Literal[700] = 700 +BinanceAddress: Literal[701] = 701 +BinanceGetPublicKey: Literal[702] = 702 +BinancePublicKey: Literal[703] = 703 +BinanceSignTx: Literal[704] = 704 +BinanceTxRequest: Literal[705] = 705 +BinanceTransferMsg: Literal[706] = 706 +BinanceOrderMsg: Literal[707] = 707 +BinanceCancelMsg: Literal[708] = 708 +BinanceSignedTx: Literal[709] = 709 +WebAuthnListResidentCredentials: Literal[800] = 800 +WebAuthnCredentials: Literal[801] = 801 +WebAuthnAddResidentCredential: Literal[802] = 802 +WebAuthnRemoveResidentCredential: Literal[803] = 803 diff --git a/python/src/trezorlib/messages/NEMImportanceTransferMode.py b/python/src/trezorlib/messages/NEMImportanceTransferMode.py index 408c47184..13f31fab3 100644 --- a/python/src/trezorlib/messages/NEMImportanceTransferMode.py +++ b/python/src/trezorlib/messages/NEMImportanceTransferMode.py @@ -1,7 +1,10 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -ImportanceTransfer_Activate = 1 # type: Literal[1] -ImportanceTransfer_Deactivate = 2 # type: Literal[2] +ImportanceTransfer_Activate: Literal[1] = 1 +ImportanceTransfer_Deactivate: Literal[2] = 2 diff --git a/python/src/trezorlib/messages/NEMModificationType.py b/python/src/trezorlib/messages/NEMModificationType.py index d33d2ca4d..f414bd2b0 100644 --- a/python/src/trezorlib/messages/NEMModificationType.py +++ b/python/src/trezorlib/messages/NEMModificationType.py @@ -1,7 +1,10 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -CosignatoryModification_Add = 1 # type: Literal[1] -CosignatoryModification_Delete = 2 # type: Literal[2] +CosignatoryModification_Add: Literal[1] = 1 +CosignatoryModification_Delete: Literal[2] = 2 diff --git a/python/src/trezorlib/messages/NEMMosaicLevy.py b/python/src/trezorlib/messages/NEMMosaicLevy.py index f5a734579..05e7985d4 100644 --- a/python/src/trezorlib/messages/NEMMosaicLevy.py +++ b/python/src/trezorlib/messages/NEMMosaicLevy.py @@ -1,7 +1,10 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -MosaicLevy_Absolute = 1 # type: Literal[1] -MosaicLevy_Percentile = 2 # type: Literal[2] +MosaicLevy_Absolute: Literal[1] = 1 +MosaicLevy_Percentile: Literal[2] = 2 diff --git a/python/src/trezorlib/messages/NEMSupplyChangeType.py b/python/src/trezorlib/messages/NEMSupplyChangeType.py index 77f12b16c..86a3d43e1 100644 --- a/python/src/trezorlib/messages/NEMSupplyChangeType.py +++ b/python/src/trezorlib/messages/NEMSupplyChangeType.py @@ -1,7 +1,10 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -SupplyChange_Increase = 1 # type: Literal[1] -SupplyChange_Decrease = 2 # type: Literal[2] +SupplyChange_Increase: Literal[1] = 1 +SupplyChange_Decrease: Literal[2] = 2 diff --git a/python/src/trezorlib/messages/OutputScriptType.py b/python/src/trezorlib/messages/OutputScriptType.py index bd334789c..94116b236 100644 --- a/python/src/trezorlib/messages/OutputScriptType.py +++ b/python/src/trezorlib/messages/OutputScriptType.py @@ -1,11 +1,14 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -PAYTOADDRESS = 0 # type: Literal[0] -PAYTOSCRIPTHASH = 1 # type: Literal[1] -PAYTOMULTISIG = 2 # type: Literal[2] -PAYTOOPRETURN = 3 # type: Literal[3] -PAYTOWITNESS = 4 # type: Literal[4] -PAYTOP2SHWITNESS = 5 # type: Literal[5] +PAYTOADDRESS: Literal[0] = 0 +PAYTOSCRIPTHASH: Literal[1] = 1 +PAYTOMULTISIG: Literal[2] = 2 +PAYTOOPRETURN: Literal[3] = 3 +PAYTOWITNESS: Literal[4] = 4 +PAYTOP2SHWITNESS: Literal[5] = 5 diff --git a/python/src/trezorlib/messages/PinMatrixRequestType.py b/python/src/trezorlib/messages/PinMatrixRequestType.py index ec3c6a38d..ded2c04c8 100644 --- a/python/src/trezorlib/messages/PinMatrixRequestType.py +++ b/python/src/trezorlib/messages/PinMatrixRequestType.py @@ -1,10 +1,13 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Current = 1 # type: Literal[1] -NewFirst = 2 # type: Literal[2] -NewSecond = 3 # type: Literal[3] -WipeCodeFirst = 4 # type: Literal[4] -WipeCodeSecond = 5 # type: Literal[5] +Current: Literal[1] = 1 +NewFirst: Literal[2] = 2 +NewSecond: Literal[3] = 3 +WipeCodeFirst: Literal[4] = 4 +WipeCodeSecond: Literal[5] = 5 diff --git a/python/src/trezorlib/messages/RecoveryDeviceType.py b/python/src/trezorlib/messages/RecoveryDeviceType.py index 6a87da000..965423292 100644 --- a/python/src/trezorlib/messages/RecoveryDeviceType.py +++ b/python/src/trezorlib/messages/RecoveryDeviceType.py @@ -1,7 +1,10 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -ScrambledWords = 0 # type: Literal[0] -Matrix = 1 # type: Literal[1] +ScrambledWords: Literal[0] = 0 +Matrix: Literal[1] = 1 diff --git a/python/src/trezorlib/messages/RequestType.py b/python/src/trezorlib/messages/RequestType.py index 42899b107..baffc605c 100644 --- a/python/src/trezorlib/messages/RequestType.py +++ b/python/src/trezorlib/messages/RequestType.py @@ -1,12 +1,15 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -TXINPUT = 0 # type: Literal[0] -TXOUTPUT = 1 # type: Literal[1] -TXMETA = 2 # type: Literal[2] -TXFINISHED = 3 # type: Literal[3] -TXEXTRADATA = 4 # type: Literal[4] -TXORIGINPUT = 5 # type: Literal[5] -TXORIGOUTPUT = 6 # type: Literal[6] +TXINPUT: Literal[0] = 0 +TXOUTPUT: Literal[1] = 1 +TXMETA: Literal[2] = 2 +TXFINISHED: Literal[3] = 3 +TXEXTRADATA: Literal[4] = 4 +TXORIGINPUT: Literal[5] = 5 +TXORIGOUTPUT: Literal[6] = 6 diff --git a/python/src/trezorlib/messages/SafetyCheckLevel.py b/python/src/trezorlib/messages/SafetyCheckLevel.py index fec329fb6..0bc3566c0 100644 --- a/python/src/trezorlib/messages/SafetyCheckLevel.py +++ b/python/src/trezorlib/messages/SafetyCheckLevel.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Strict = 0 # type: Literal[0] -PromptAlways = 1 # type: Literal[1] -PromptTemporarily = 2 # type: Literal[2] +Strict: Literal[0] = 0 +PromptAlways: Literal[1] = 1 +PromptTemporarily: Literal[2] = 2 diff --git a/python/src/trezorlib/messages/SdProtectOperationType.py b/python/src/trezorlib/messages/SdProtectOperationType.py index 17e1b0d4b..a979dc843 100644 --- a/python/src/trezorlib/messages/SdProtectOperationType.py +++ b/python/src/trezorlib/messages/SdProtectOperationType.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -DISABLE = 0 # type: Literal[0] -ENABLE = 1 # type: Literal[1] -REFRESH = 2 # type: Literal[2] +DISABLE: Literal[0] = 0 +ENABLE: Literal[1] = 1 +REFRESH: Literal[2] = 2 diff --git a/python/src/trezorlib/messages/TezosBallotType.py b/python/src/trezorlib/messages/TezosBallotType.py index d32901955..cb7c9a096 100644 --- a/python/src/trezorlib/messages/TezosBallotType.py +++ b/python/src/trezorlib/messages/TezosBallotType.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Yay = 0 # type: Literal[0] -Nay = 1 # type: Literal[1] -Pass = 2 # type: Literal[2] +Yay: Literal[0] = 0 +Nay: Literal[1] = 1 +Pass: Literal[2] = 2 diff --git a/python/src/trezorlib/messages/TezosContractType.py b/python/src/trezorlib/messages/TezosContractType.py index 211f451e2..d6d66a2fa 100644 --- a/python/src/trezorlib/messages/TezosContractType.py +++ b/python/src/trezorlib/messages/TezosContractType.py @@ -1,7 +1,10 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Implicit = 0 # type: Literal[0] -Originated = 1 # type: Literal[1] +Implicit: Literal[0] = 0 +Originated: Literal[1] = 1 diff --git a/python/src/trezorlib/messages/WordRequestType.py b/python/src/trezorlib/messages/WordRequestType.py index 82c953777..4004fb14a 100644 --- a/python/src/trezorlib/messages/WordRequestType.py +++ b/python/src/trezorlib/messages/WordRequestType.py @@ -1,8 +1,11 @@ # Automatically generated by pb2py # fmt: off -if False: - from typing_extensions import Literal +if __debug__: + try: + from typing_extensions import Literal # noqa: F401 + except ImportError: + pass -Plain = 0 # type: Literal[0] -Matrix9 = 1 # type: Literal[1] -Matrix6 = 2 # type: Literal[2] +Plain: Literal[0] = 0 +Matrix9: Literal[1] = 1 +Matrix6: Literal[2] = 2