Removed old type hinting

This commit is contained in:
Alexandre Paillier
2023-11-24 17:02:18 +01:00
parent edad008ed1
commit c65db6f307
6 changed files with 12 additions and 15 deletions

View File

@@ -2,7 +2,7 @@ import rlp
from enum import IntEnum
from ragger.backend import BackendInterface
from ragger.utils import RAPDU
from typing import List, Optional
from typing import Optional
from .command_builder import CommandBuilder
from .eip712 import EIP712FieldType
@@ -53,7 +53,7 @@ class EthAppClient:
field_type: EIP712FieldType,
type_name: str,
type_size: int,
array_levels: List,
array_levels: list,
key_name: str):
return self._send(self._cmd_builder.eip712_send_struct_def_struct_field(
field_type,

View File

@@ -5,7 +5,6 @@ import struct
from enum import IntEnum
from typing import Optional
from ragger.bip import pack_derivation_path
from typing import List
from .eip712 import EIP712FieldType
@@ -76,7 +75,7 @@ class CommandBuilder:
field_type: EIP712FieldType,
type_name: str,
type_size: int,
array_levels: List,
array_levels: list,
key_name: str) -> bytes:
data = bytearray()
typedesc = 0
@@ -116,7 +115,7 @@ class CommandBuilder:
P2Type.ARRAY,
data)
def eip712_send_struct_impl_struct_field(self, data: bytearray) -> List[bytes]:
def eip712_send_struct_impl_struct_field(self, data: bytearray) -> list[bytes]:
chunks = list()
# Add a 16-bit integer with the data's byte length (network byte order)
data_w_length = bytearray()

View File

@@ -4,7 +4,7 @@ import re
import signal
import sys
import copy
from typing import Any, Callable, Dict, List, Optional
from typing import Any, Callable, Optional
from ledger_app_clients.ethereum import keychain
from ledger_app_clients.ethereum.client import EthAppClient, EIP712FieldType
@@ -12,9 +12,9 @@ from ledger_app_clients.ethereum.client import EthAppClient, EIP712FieldType
# global variables
app_client: EthAppClient = None
filtering_paths: Dict = {}
current_path: List[str] = list()
sig_ctx: Dict[str, Any] = {}
filtering_paths: dict = {}
current_path: list[str] = list()
sig_ctx: dict[str, Any] = {}
def default_handler():

View File

@@ -3,7 +3,6 @@ import hashlib
from ecdsa import SigningKey
from ecdsa.util import sigencode_der
from enum import Enum, auto
from typing import Dict
# Private key PEM files have to be named the same (lowercase) as their corresponding enum entries
@@ -15,7 +14,7 @@ class Key(Enum):
NFT = auto()
_keys: Dict[Key, SigningKey] = dict()
_keys: dict[Key, SigningKey] = dict()
# Open the corresponding PEM file and load its key in the global dict

View File

@@ -1,7 +1,7 @@
from enum import Enum, auto
from ragger.firmware import Firmware
from ragger.navigator import Navigator, NavInsID, NavIns
from typing import List, Union
from typing import Union
class SettingID(Enum):
@@ -44,7 +44,7 @@ def get_setting_position(device: str, setting: Union[NavInsID, SettingID]) -> tu
def settings_toggle(fw: Firmware, nav: Navigator, to_toggle: list[SettingID]):
moves: List[Union[NavIns, NavInsID]] = list()
moves: list[Union[NavIns, NavInsID]] = list()
settings = get_device_settings(fw.device)
# Assume the app is on the home page
if fw.device.startswith("nano"):

View File

@@ -8,7 +8,6 @@ from pathlib import Path
from ragger.backend import BackendInterface
from ragger.firmware import Firmware
from ragger.navigator import Navigator, NavInsID
from typing import List
import json
import ledger_app_clients.ethereum.response_parser as ResponseParser
@@ -20,7 +19,7 @@ from ledger_app_clients.ethereum.settings import SettingID, settings_toggle
BIP32_PATH = "m/44'/60'/0'/0/0"
def input_files() -> List[str]:
def input_files() -> list[str]:
files = []
for file in os.scandir("%s/eip712_input_files" % (os.path.dirname(__file__))):
if fnmatch.fnmatch(file, "*-data.json"):