mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-05 06:12:34 +00:00
trezorlib/transport: make flake8 happy
This commit is contained in:
parent
513e6aae08
commit
2f1c15b588
@ -17,6 +17,7 @@
|
|||||||
# You should have received a copy of the GNU Lesser General Public License
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
# along with this library. If not, see <http://www.gnu.org/licenses/>.
|
# along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
class TransportException(Exception):
|
class TransportException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -86,7 +87,7 @@ def get_transport(path=None, prefix_search=False):
|
|||||||
# Find whether B is prefix of A (transport name is part of the path)
|
# Find whether B is prefix of A (transport name is part of the path)
|
||||||
# or A is prefix of B (path is a prefix, or a name, of transport).
|
# or A is prefix of B (path is a prefix, or a name, of transport).
|
||||||
# This naively expects that no two transports have a common prefix.
|
# This naively expects that no two transports have a common prefix.
|
||||||
def match_prefix(a,b):
|
def match_prefix(a, b):
|
||||||
return a.startswith(b) or b.startswith(a)
|
return a.startswith(b) or b.startswith(a)
|
||||||
|
|
||||||
transports = [t for t in all_transports() if match_prefix(path, t.PATH_PREFIX)]
|
transports = [t for t in all_transports() if match_prefix(path, t.PATH_PREFIX)]
|
||||||
|
@ -51,7 +51,7 @@ class UdpTransport(Transport):
|
|||||||
|
|
||||||
def find_debug(self):
|
def find_debug(self):
|
||||||
host, port = self.device
|
host, port = self.device
|
||||||
return UdpTransport('{}:{}'.format(host, port+1), self.protocol)
|
return UdpTransport('{}:{}'.format(host, port + 1), self.protocol)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _try_path(cls, path):
|
def _try_path(cls, path):
|
||||||
|
Loading…
Reference in New Issue
Block a user