mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-22 20:42:03 +00:00
transport: fix typing after autoflake treatment
autoflake will remove all unused imports when `make style` is invoked, but can't recognize typing names that are only used in comments. this fixes it.
This commit is contained in:
parent
bfb56451e8
commit
d3534a15c9
@ -16,10 +16,14 @@
|
|||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
import logging
|
import logging
|
||||||
from typing import Iterable, Type
|
from typing import Iterable, List, Set, Type
|
||||||
|
|
||||||
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__)
|
||||||
|
|
||||||
|
|
||||||
@ -106,7 +110,7 @@ def enumerate_devices() -> Iterable[Transport]:
|
|||||||
for transport in all_transports():
|
for transport in all_transports():
|
||||||
name = transport.__name__
|
name = transport.__name__
|
||||||
try:
|
try:
|
||||||
found = transport.enumerate()
|
found = list(transport.enumerate())
|
||||||
LOG.info("Enumerating {}: found {} devices".format(name, len(found)))
|
LOG.info("Enumerating {}: found {} devices".format(name, len(found)))
|
||||||
devices.extend(found)
|
devices.extend(found)
|
||||||
except NotImplementedError:
|
except NotImplementedError:
|
||||||
|
@ -17,13 +17,17 @@
|
|||||||
import logging
|
import logging
|
||||||
import struct
|
import struct
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import Any, Dict, Iterable
|
from typing import Any, Dict, Iterable, Optional
|
||||||
|
|
||||||
import requests
|
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"
|
||||||
|
@ -15,11 +15,15 @@
|
|||||||
# 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 socket
|
import socket
|
||||||
from typing import Iterable, cast
|
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):
|
||||||
|
|
||||||
|
@ -17,13 +17,17 @@
|
|||||||
import atexit
|
import atexit
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from typing import Iterable
|
from typing import Iterable, Optional
|
||||||
|
|
||||||
import usb1
|
import usb1
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
DEV_TREZOR1 = (0x534C, 0x0001)
|
DEV_TREZOR1 = (0x534C, 0x0001)
|
||||||
DEV_TREZOR2 = (0x1209, 0x53C1)
|
DEV_TREZOR2 = (0x1209, 0x53C1)
|
||||||
DEV_TREZOR2_BL = (0x1209, 0x53C0)
|
DEV_TREZOR2_BL = (0x1209, 0x53C0)
|
||||||
|
Loading…
Reference in New Issue
Block a user