diff --git a/my/bluemaestro.py b/my/bluemaestro.py index 5d0968b..4c33fd1 100644 --- a/my/bluemaestro.py +++ b/my/bluemaestro.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 """ [[https://bluemaestro.com/products/product-details/bluetooth-environmental-monitor-and-logger][Bluemaestro]] temperature/humidity/pressure monitor """ diff --git a/my/coding/commits.py b/my/coding/commits.py index d4e05b7..9661ae5 100644 --- a/my/coding/commits.py +++ b/my/coding/commits.py @@ -136,7 +136,7 @@ def canonical_name(repo: Path) -> str: # else: # rname = r.name # if 'backups/github' in repo: - # pass # TODO + # pass # TODO def _fd_path() -> str: diff --git a/my/core/discovery_pure.py b/my/core/discovery_pure.py index 63d9922..b753de8 100644 --- a/my/core/discovery_pure.py +++ b/my/core/discovery_pure.py @@ -242,7 +242,7 @@ def test_pure() -> None: src = Path(__file__).read_text() # 'import my' is allowed, but # dont allow anything other HPI modules - assert re.findall('import ' + r'my\.\S+', src, re.M) == [] + assert re.findall('import ' + r'my\.\S+', src, re.MULTILINE) == [] assert 'from ' + 'my' not in src diff --git a/my/fbmessenger/android.py b/my/fbmessenger/android.py index bc06114..7e48c78 100644 --- a/my/fbmessenger/android.py +++ b/my/fbmessenger/android.py @@ -228,7 +228,7 @@ def _process_db_threads_db2(db: sqlite3.Connection) -> Iterator[Res[Entity]]: for r in db.execute( ''' - SELECT *, json_extract(sender, "$.user_key") AS user_key FROM messages + SELECT *, json_extract(sender, "$.user_key") AS user_key FROM messages WHERE msg_type NOT IN ( -1, /* these don't have any data at all, likely immediately deleted or something? */ 2 /* these are 'left group' system messages, also a bit annoying since they might reference nonexistent users */ diff --git a/my/jawbone/__init__.py b/my/jawbone/__init__.py index affe230..35112ba 100644 --- a/my/jawbone/__init__.py +++ b/my/jawbone/__init__.py @@ -239,7 +239,7 @@ def plot_one(sleep: SleepEntry, fig, axes, xlims=None, *, showtext=True): # axes.title.set_size(10) if showtext: - axes.text(xlims[1] - timedelta(hours=1.5), 20, str(sleep),) + axes.text(xlims[1] - timedelta(hours=1.5), 20, str(sleep)) # plt.text(sleep.asleep(), 0, hhmm(sleep.asleep())) diff --git a/my/media/imdb.py b/my/media/imdb.py index c66f5dc..df31032 100644 --- a/my/media/imdb.py +++ b/my/media/imdb.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 import csv from datetime import datetime from typing import Iterator, List, NamedTuple diff --git a/my/rtm.py b/my/rtm.py index 22752fe..b559ba4 100644 --- a/my/rtm.py +++ b/my/rtm.py @@ -58,7 +58,7 @@ class MyTodo: def get_status(self) -> str: if 'STATUS' not in self.todo: return None # type: ignore - # TODO 'COMPLETED'? + # TODO 'COMPLETED'? return str(self.todo['STATUS']) # TODO tz? diff --git a/my/telegram/telegram_backup.py b/my/telegram/telegram_backup.py index 0617501..ff4f904 100644 --- a/my/telegram/telegram_backup.py +++ b/my/telegram/telegram_backup.py @@ -18,7 +18,7 @@ from my.config import telegram as user_config class config(user_config.telegram_backup): # path to the export database.sqlite export_path: PathIsh - + @dataclass class Chat: diff --git a/ruff.toml b/ruff.toml index cb9445f..8cbc642 100644 --- a/ruff.toml +++ b/ruff.toml @@ -3,17 +3,22 @@ target-version = "py38" # NOTE: inferred from pyproject.toml if present lint.extend-select = [ "F", # flakes rules -- default, but extend just in case "E", # pycodestyle -- default, but extend just in case - "C4", # flake8-comprehensions -- unnecessary list/map/dict calls - "UP", # detect deprecated python stdlib stuff - "FBT", # detect use of boolean arguments - "RUF", # various ruff-specific rules - "PLR", # 'refactor' rules + "W", # various warnings + "B", # 'bugbear' set -- various possible bugs + "C4", # flake8-comprehensions -- unnecessary list/map/dict calls + "COM", # trailing commas + "EXE", # various checks wrt executable files + "FBT", # detect use of boolean arguments + "FURB", # various rules "PERF", # various potential performance speedups - "RET", # early returns "PIE", # 'misc' lints + "PLR", # 'refactor' rules "PLW", # pylint warnings "PT", # pytest stuff + "RET", # early returns + "RUF", # various ruff-specific rules + "UP", # detect deprecated python stdlib stuff # "FA", # TODO enable later after we make sure cachew works? # "PTH", # pathlib migration -- TODO enable later # "ARG", # TODO useful, but results in some false positives in pytest fixtures... maybe later @@ -97,4 +102,6 @@ lint.ignore = [ "PT004", # deprecated rule, will be removed later "PT011", # pytest raises should is too broad "PT012", # pytest raises should contain a single statement + + "COM812", # trailing comma missing -- TODO maybe use this? ]