diff --git a/lib/lis2mdl/lis2mdl/device.py b/lib/lis2mdl/lis2mdl/device.py index 335ca51..e90ea88 100644 --- a/lib/lis2mdl/lis2mdl/device.py +++ b/lib/lis2mdl/lis2mdl/device.py @@ -558,7 +558,7 @@ def heading_from_vectors(self, x, y, z, calibrated=True): x = (x - self.x_off) / (self.x_scale or 1.0) y = (y - self.y_off) / (self.y_scale or 1.0) # IMPORTANT: atan2(Y, X) - ang = math.degrees(math.atan2(x, y)) # atan2(Y, X) for compass heading (Y is forward, X is right) + ang = math.degrees(math.atan2(x, y)) # atan2(Y, X) for compass heading (Y is forward, X is right) ang = self._apply_heading_offsets(ang) return self._filter_heading(ang) diff --git a/lib/wsen-pads/examples/altitude.py b/lib/wsen-pads/examples/altitude.py index 23d428e..84f0d58 100644 --- a/lib/wsen-pads/examples/altitude.py +++ b/lib/wsen-pads/examples/altitude.py @@ -3,8 +3,8 @@ from machine import I2C from wsen_pads import WSEN_PADS -SEA_LEVEL_PRESSURE = 1013.25 # depends on your location, you can adjust it for better altitude estimation -EXPONENT = 0.1903 # standard atmosphere exponent for altitude calculation +SEA_LEVEL_PRESSURE = 1013.25 # depends on your location, you can adjust it for better altitude estimation +EXPONENT = 0.1903 # standard atmosphere exponent for altitude calculation i2c = I2C(1) diff --git a/lib/wsen-pads/examples/pressure_trend.py b/lib/wsen-pads/examples/pressure_trend.py index 01e0669..6424306 100644 --- a/lib/wsen-pads/examples/pressure_trend.py +++ b/lib/wsen-pads/examples/pressure_trend.py @@ -13,7 +13,7 @@ pressure_history = [] MAX_VALUES = 10 -THRESHOLD = 0.5 # sensitivity (hPa) +THRESHOLD = 0.5 # sensitivity (hPa) def get_trend(values): if len(values) < 2: diff --git a/lib/wsen-pads/examples/threshold_alert.py b/lib/wsen-pads/examples/threshold_alert.py index 1aac09d..7610faa 100644 --- a/lib/wsen-pads/examples/threshold_alert.py +++ b/lib/wsen-pads/examples/threshold_alert.py @@ -6,8 +6,8 @@ from wsen_pads import WSEN_PADS from wsen_pads.const import ODR_10_HZ -PRESSURE_ALERT_HPA = 1000 # Alert threshold -READ_INTERVAL_S = 1 # Time between printed readings +PRESSURE_ALERT_HPA = 1000 # Alert threshold +READ_INTERVAL_S = 1 # Time between printed readings i2c = I2C(1) sensor = WSEN_PADS(i2c) diff --git a/pyproject.toml b/pyproject.toml index efb4e30..bf8a5a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,9 +34,11 @@ markers = [ [tool.ruff] line-length = 99 -target-version = "py37" +target-version = "py310" [tool.ruff.lint] +preview = true +explicit-preview-rules = true select = [ "A", # flake8-builtins: prevent shadowing builtins "ASYNC", # flake8-async @@ -45,6 +47,10 @@ select = [ "C90", # McCabe cyclomatic complexity "DTZ", # flake8-datetimez "E", # pycodestyle + "E225", # (preview) missing whitespace around operator + "E261", # (preview) at least two spaces before inline comment + "E262", # (preview) inline comment must start with '# ' + "E265", # (preview) block comment must start with '# ' "EXE", # flake8-executable "F", # Pyflakes "G", # flake8-logging-format @@ -70,6 +76,7 @@ select = [ "YTT", # flake8-2020 ] ignore = [ + "B905", # zip() strict= not available in micropython "E501", # line length, recommended to disable "E741", # 'l' is currently widely used "ISC001", # conflicts with formatter @@ -108,6 +115,7 @@ max-statements = 65 "**/examples/*.py" = ["T20", "N806"] "lib/mcp23009e/examples/i2c_scan.py" = ["PERF203"] "tests/**/*.py" = ["T20", "PLR0911", "PLR0912", "PLR0915"] +"lib/lis2mdl/**/*.py" = ["RUF001", "RUF002", "RUF003"] # ยต (microtesla) is intentional [tool.ruff.format] quote-style = "double"