Skip to content

Commit

Permalink
Removed old type hinting
Browse files Browse the repository at this point in the history
  • Loading branch information
apaillier-ledger committed Nov 27, 2023
1 parent ca1aef6 commit f500e29
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
4 changes: 2 additions & 2 deletions client/src/ledger_app_clients/ethereum/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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
Expand Down Expand Up @@ -53,7 +53,7 @@ def eip712_send_struct_def_struct_field(self,
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,
Expand Down
5 changes: 2 additions & 3 deletions client/src/ledger_app_clients/ethereum/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from enum import IntEnum
from typing import Optional
from ragger.bip import pack_derivation_path
from typing import List

from .eip712 import EIP712FieldType

Expand Down Expand Up @@ -76,7 +75,7 @@ def eip712_send_struct_def_struct_field(self,
field_type: EIP712FieldType,
type_name: str,
type_size: int,
array_levels: List,
array_levels: list,
key_name: str) -> bytes:
data = bytearray()
typedesc = 0
Expand Down Expand Up @@ -116,7 +115,7 @@ def eip712_send_struct_impl_array(self, size: int) -> bytes:
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()
Expand Down
8 changes: 4 additions & 4 deletions client/src/ledger_app_clients/ethereum/eip712/InputData.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
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


# 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():
Expand Down
3 changes: 1 addition & 2 deletions client/src/ledger_app_clients/ethereum/keychain.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions client/src/ledger_app_clients/ethereum/settings.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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"):
Expand Down
3 changes: 1 addition & 2 deletions tests/ragger/test_eip712.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
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
Expand All @@ -20,7 +19,7 @@
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"):
Expand Down

0 comments on commit f500e29

Please sign in to comment.