From be79a8cff441bba6e2e678bb9e6f0fbb35cd13f1 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 27 Feb 2018 00:29:00 +0100 Subject: [PATCH] src+tests: make flake8 happy; explicitly mark E722 ignores (bare excepts) --- .flake8 | 4 ++-- src/apps/fido_u2f/__init__.py | 1 - src/boot.py | 2 +- src/trezor/loop.py | 2 +- tests/common.py | 1 + tests/test_trezor.config.py | 1 - 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.flake8 b/.flake8 index f60663aea..d6c84a48a 100644 --- a/.flake8 +++ b/.flake8 @@ -10,9 +10,9 @@ ignore = E402, # E501: line too long E501, - # F403: star import used, unable to detect undefined names - E741, # E741 ambiguous variable name + E741, + # F403: star import used, unable to detect undefined names F403, # F405: name may be undefined, or defined from star imports F405 diff --git a/src/apps/fido_u2f/__init__.py b/src/apps/fido_u2f/__init__.py index 3848bba96..23e95c35c 100644 --- a/src/apps/fido_u2f/__init__.py +++ b/src/apps/fido_u2f/__init__.py @@ -477,7 +477,6 @@ class ConfirmState: return await dialog == CONFIRMED - _state = None # type: Optional[ConfirmState] # state for msg_register and msg_authenticate _lastreq = None # type: Optional[Msg] # last received register/authenticate request diff --git a/src/boot.py b/src/boot.py index b3e2ed584..2c9d6bb85 100644 --- a/src/boot.py +++ b/src/boot.py @@ -14,7 +14,7 @@ async def bootscreen(): pin = await request_pin() if config.unlock(pin_to_int(pin), show_pin_timeout): return - except: + except: # noqa: E722 pass diff --git a/src/trezor/loop.py b/src/trezor/loop.py index 6bbce18e0..5c796ecf2 100644 --- a/src/trezor/loop.py +++ b/src/trezor/loop.py @@ -264,7 +264,7 @@ class wait(Syscall): def __iter__(self): try: return (yield self) - except: + except: # noqa: E722 # exception was raised on the waiting task externally with # close() or throw(), kill the children tasks and re-raise self.exit() diff --git a/tests/common.py b/tests/common.py index a2f084a16..f6d185a7b 100644 --- a/tests/common.py +++ b/tests/common.py @@ -1,4 +1,5 @@ import sys + sys.path.append('../src') from ubinascii import hexlify, unhexlify diff --git a/tests/test_trezor.config.py b/tests/test_trezor.config.py index 98d38e9d1..aba890529 100644 --- a/tests/test_trezor.config.py +++ b/tests/test_trezor.config.py @@ -82,7 +82,6 @@ class TestConfig(unittest.TestCase): self.assertEqual(v1, bytes()) self.assertEqual(v2, value16) - def test_change_pin(self): config.init() config.wipe()