From d89e7f63bd7fe070b2f9126a0c5c8bdafa74f655 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 24 Oct 2026 15:56:46 +0000 Subject: [PATCH] ruff: pyproject.toml, directives --- mmgen_node_tools/Ticker.py | 2 +- pyproject.toml | 36 +++++++++++++++--------------------- test/modtest_d/ut_dep.py | 2 +- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/mmgen_node_tools/Ticker.py b/mmgen_node_tools/Ticker.py index 775f332..d01b2ae 100644 --- a/mmgen_node_tools/Ticker.py +++ b/mmgen_node_tools/Ticker.py @@ -955,7 +955,7 @@ class Ticker: sort_dfl = sort_params[code].sort_dfl sort_func = lambda row: data.get(row.id, {key: sort_dfl})[key] pf_sort_func = lambda row: data.get(row, {key: sort_dfl})[key] - for group in self.rows.keys(): # noqa SIM118 + for group in self.rows.keys(): # noqa: SIM118 if group not in self.hidden_groups: self.rows[group] = sorted(self.rows[group], key=sort_func, reverse=reverse) if cfg.portfolio: diff --git a/pyproject.toml b/pyproject.toml index 25af44f..957b8ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,30 +15,24 @@ indent-style = "tab" [tool.ruff.lint] ignore = [ - "E401", # multiple imports per line - "E701", # multiple statements per line - "E721", # use isinstance() - "E731", # lambda instead of def - "E402", # module import not top of file - "E722", # bare except - "E713", # membership 'not in' - "E741", # ambiguous variable name + "E722", # bare except + "N999", # Invalid module name + "I001", # Import block is un-sorted or un-formatted + "RUF012", # Mutable default value for class attribute + "SIM102", # Use a single `if` statement instead of nested `if` statements + "UP032", # Use f-string instead of `format` call + "B006", # Do not use mutable data structures for argument defaults + "UP031", # Use format specifiers instead of percent format + "BLE001", # Do not catch blind exception: `Exception` + "S110", # `try`-`except`-`pass` detected, consider logging the exception + "ISC004", # Unparenthesized implicit string concatenation in collection ] [tool.ruff.lint.per-file-ignores] -"test/include/common.py" = [ "F821" ] # undefined name 'cfg' -"test/misc/input_func.py" = [ "F401" ] # imported but unused -"test/modtest_d/cashaddr.py" = [ "F841" ] # assigned to but never used -"test/modtest_d/dep.py" = [ "F401" ] # imported but unused -"test/modtest_d/testdep.py" = [ "F401" ] # imported but unused -"test/modtest_d/obj.py" = [ "F841" ] # assigned to but never used -"test/objtest_d/*" = [ "F401" ] # imported but unused -"test/objattrtest_d/*" = [ "F401" ] # imported but unused -"test/overlay/fakemods/*" = [ "F403", "F405" ] # `import *` used -"test/*.py" = [ "F401" ] # imported but unused -"test/colortest.py" = [ "F403", "F405" ] # `import *` used -"test/tooltest2.py" = [ "F403", "F405" ] # `import *` used -"test/overlay/tree/*" = [ "ALL" ] +"test/overlay/tree/*" = [ "ALL" ] +"test/*" = [ + "SIM115", # open() with context manager +] [tool.pylint.format] indent-string = "\t" diff --git a/test/modtest_d/ut_dep.py b/test/modtest_d/ut_dep.py index 039d782..65b3474 100755 --- a/test/modtest_d/ut_dep.py +++ b/test/modtest_d/ut_dep.py @@ -14,7 +14,7 @@ class unit_tests: def yahooquery(self,name,ut): try: - from yahooquery import Ticker # noqa F401 + from yahooquery import Ticker # noqa: F401 return True except ImportError: imsg(yellow('Unable to import Ticker from yahooquery'))