1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-03 22:58:46 +00:00

flake8: add typing imports where missing

also remove autoflake workarounds from some files, apparently newer
autoflake can recognize them properly
This commit is contained in:
matejcik 2019-01-31 15:34:37 +01:00
parent 68da6881b5
commit f236eb9cf2
7 changed files with 4 additions and 20 deletions

View File

@ -5,4 +5,4 @@ flake8
protobuf protobuf
isort isort
black; python_version >= "3.6" black; python_version >= "3.6"
autoflake autoflake>=1.2

View File

@ -32,7 +32,7 @@ arithmetic, so we cannot handle secrets without risking their disclosure.
""" """
import hashlib import hashlib
from typing import NewType, Tuple from typing import List, NewType, Tuple
Point = NewType("Point", Tuple[int, int, int, int]) Point = NewType("Point", Tuple[int, int, int, int])

View File

@ -15,7 +15,7 @@
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>. # If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
import logging import logging
from typing import Optional from typing import Optional, Set, Type
from . import protobuf from . import protobuf

View File

@ -15,15 +15,11 @@
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>. # If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
import logging import logging
from typing import Iterable, List, Set, Type from typing import Iterable, List, Type
from ..exceptions import TrezorException from ..exceptions import TrezorException
from ..protobuf import MessageType from ..protobuf import MessageType
if False:
# mark Set and List as used, otherwise they only exist in comments
List, Set
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
# USB vendor/product IDs for Trezors # USB vendor/product IDs for Trezors

View File

@ -24,10 +24,6 @@ import requests
from . import Transport, TransportException from . import Transport, TransportException
from .. import mapping, protobuf from .. import mapping, protobuf
if False:
# mark Optional as used, otherwise it only exists in comments
Optional
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
TREZORD_HOST = "http://127.0.0.1:21325" TREZORD_HOST = "http://127.0.0.1:21325"

View File

@ -20,10 +20,6 @@ from typing import Iterable, Optional, cast
from . import TransportException from . import TransportException
from .protocol import ProtocolBasedTransport, get_protocol from .protocol import ProtocolBasedTransport, get_protocol
if False:
# mark Optional as used, otherwise it only exists in comments
Optional
class UdpTransport(ProtocolBasedTransport): class UdpTransport(ProtocolBasedTransport):

View File

@ -31,10 +31,6 @@ except Exception as e:
LOG.warning("WebUSB transport is disabled: {}".format(e)) LOG.warning("WebUSB transport is disabled: {}".format(e))
usb1 = None usb1 = None
if False:
# mark Optional as used, otherwise it only exists in comments
Optional
INTERFACE = 0 INTERFACE = 0
ENDPOINT = 1 ENDPOINT = 1
DEBUG_INTERFACE = 1 DEBUG_INTERFACE = 1