From d1cce9a896d7c3147de33f1dfa852dec6ae7259b Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 22 Apr 2021 14:46:32 -0500 Subject: [PATCH] flake8: add config This adds a flake8 config that is compatible with black. Also fix flake8 complaints outside of the bricks/ev3dev/modules/ directory. Fixes: https://github.com/pybricks/support/issues/309 --- .flake8 | 7 +++++++ tests/pup/hub/status_light.py | 2 +- tests/pup/hub/status_light_animatinon.py | 2 +- tests/pup/motors/gears.py | 2 +- tools/metadata.py | 6 +++--- 5 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..2ad8abc99 --- /dev/null +++ b/.flake8 @@ -0,0 +1,7 @@ + +# https://black.readthedocs.io/en/stable/compatible_configs.html#flake8 + +[flake8] +max-line-length = 99 +extend-ignore = E203, W503 +exclude = .git,.venv,build,micropython,lib,manifest.py diff --git a/tests/pup/hub/status_light.py b/tests/pup/hub/status_light.py index ea0fcdac9..75906e0ef 100644 --- a/tests/pup/hub/status_light.py +++ b/tests/pup/hub/status_light.py @@ -3,7 +3,7 @@ # Press the stop button to advance to the next color -from pybricks.hubs import * +from pybricks.hubs import * # noqa: F401, F403 from pybricks.parameters import Color from pybricks.tools import wait diff --git a/tests/pup/hub/status_light_animatinon.py b/tests/pup/hub/status_light_animatinon.py index 4e8d71481..8dc293ab8 100644 --- a/tests/pup/hub/status_light_animatinon.py +++ b/tests/pup/hub/status_light_animatinon.py @@ -1,6 +1,6 @@ # Should be able to smoothly transition between all colors. -from pybricks.hubs import * +from pybricks.hubs import * # noqa: F401, F403 from pybricks.parameters import Color from pybricks.tools import wait diff --git a/tests/pup/motors/gears.py b/tests/pup/motors/gears.py index 6edf74a20..a71b7082d 100644 --- a/tests/pup/motors/gears.py +++ b/tests/pup/motors/gears.py @@ -8,7 +8,7 @@ """ from pybricks.pupdevices import Motor -from pybricks.parameters import Port, Stop +from pybricks.parameters import Port from pybricks.tools import wait diff --git a/tools/metadata.py b/tools/metadata.py index 7a406148f..eea40f530 100755 --- a/tools/metadata.py +++ b/tools/metadata.py @@ -71,14 +71,14 @@ def generate( flash_length = None # Size of firmware area of flash memory user_start = None # Starting address of user .mpy file - for l in map_file.readlines(): - match = re.match(r"^FLASH\s+(0x[0-9A-Fa-f]{8,16})\s+(0x[0-9A-Fa-f]{8,16})", l) + for line in map_file.readlines(): + match = re.match(r"^FLASH\s+(0x[0-9A-Fa-f]{8,16})\s+(0x[0-9A-Fa-f]{8,16})", line) if match: flash_origin = int(match[1], base=0) flash_length = int(match[2], base=0) continue - match = re.match(r"^\.user\s+(0x[0-9A-Fa-f]{8,16})", l) + match = re.match(r"^\.user\s+(0x[0-9A-Fa-f]{8,16})", line) if match: user_start = int(match[1], base=0) continue