From 5351484904e1921ea0c27e69ac027669582a93ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartolom=C3=A9=20S=C3=A1nchez=20Salado?= Date: Wed, 30 Oct 2024 21:16:43 +0100 Subject: [PATCH] fix: Ruff rule RUF100 (unused-qa) https://docs.astral.sh/ruff/rules/unused-noqa/#unused-noqa-ruf100 --- pyproject.toml | 1 - src/arch/z80/backend/_float.py | 2 +- src/arch/zxnext/__init__.py | 2 +- src/arch/zxnext/backend/generic.py | 2 +- src/zxbc/zxbparser.py | 2 +- tests/arch/zx48k/peephole/test_parser.py | 14 +++++++------- tests/functional/test.py | 2 +- zxb.py | 2 +- zxbasm.py | 2 +- zxbc.py | 2 +- zxbpp.py | 2 +- 11 files changed, 16 insertions(+), 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3cdc29f38..acda03fa3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,7 +114,6 @@ ignore = [ "RUF005", "RUF012", "RUF013", - "RUF100", "UP008", "UP015", # KEEP: redundant-open-modes "UP024", diff --git a/src/arch/z80/backend/_float.py b/src/arch/z80/backend/_float.py index b4f5622ea..fb25d0ea8 100644 --- a/src/arch/z80/backend/_float.py +++ b/src/arch/z80/backend/_float.py @@ -106,7 +106,7 @@ def get_oper(cls, op1: str, op2: str | None = None) -> list[str]: op = op[1:] output.append("exx") # uses alternate set to put it on the stack output.append("ex af, af'") - if is_int(op): # noqa TODO: it will fail + if is_int(op): # TODO: it will fail op = int(op) output.append(f"ld hl, {op}") elif op[0] == "_": diff --git a/src/arch/zxnext/__init__.py b/src/arch/zxnext/__init__.py index 25574273c..884f53a11 100755 --- a/src/arch/zxnext/__init__.py +++ b/src/arch/zxnext/__init__.py @@ -5,7 +5,7 @@ from src.api.constants import TYPE from src.arch.z80 import FunctionTranslator, Translator, VarTranslator, beep from src.arch.zxnext import ( - backend, # noqa + backend, optimizer, # noqa ) diff --git a/src/arch/zxnext/backend/generic.py b/src/arch/zxnext/backend/generic.py index 5e834bde1..688c62852 100644 --- a/src/arch/zxnext/backend/generic.py +++ b/src/arch/zxnext/backend/generic.py @@ -4,7 +4,7 @@ from src.api.config import OPTIONS from src.arch.interface.quad import Quad -from src.arch.z80.backend import Bits16, common # noqa +from src.arch.z80.backend import Bits16, common def _end(ins: Quad): diff --git a/src/zxbc/zxbparser.py b/src/zxbc/zxbparser.py index 2087446f1..ac34b4778 100755 --- a/src/zxbc/zxbparser.py +++ b/src/zxbc/zxbparser.py @@ -3477,7 +3477,7 @@ def asc(x): def p_sgn(p): """bexpr : SGN bexpr %prec UMINUS""" - sgn = lambda x: x < 0 and -1 or x > 0 and 1 or 0 # noqa + sgn = lambda x: x < 0 and -1 or x > 0 and 1 or 0 if p[2].type_ == TYPE.string: error(p.lineno(1), "Expected a numeric expression, got TYPE.string instead") diff --git a/tests/arch/zx48k/peephole/test_parser.py b/tests/arch/zx48k/peephole/test_parser.py index 79db0d735..f70062fdb 100644 --- a/tests/arch/zx48k/peephole/test_parser.py +++ b/tests/arch/zx48k/peephole/test_parser.py @@ -28,7 +28,7 @@ def test_parse_string(self): WITH {{ }} ''' - ) # noqa + ) self.maxDiff = None self.assertIsInstance(result, dict) @@ -66,7 +66,7 @@ def test_parse_call(self): WITH {{ }} """ - ) # noqa + ) self.assertDictEqual( result, { @@ -93,7 +93,7 @@ def test_parse_chain_plus(self): WITH {{ }} """ - ) # noqa + ) self.assertDictEqual( result, { @@ -120,7 +120,7 @@ def test_parse_chain_parent(self): WITH {{ }} """ - ) # noqa + ) self.assertDictEqual( result, { @@ -151,7 +151,7 @@ def test_parse_len(self): WITH {{ }} """ - ) # noqa + ) self.assertDictEqual( result, { @@ -182,7 +182,7 @@ def test_parse_len_2(self): WITH {{ }} """ - ) # noqa + ) self.assertDictEqual( result, { @@ -213,7 +213,7 @@ def test_define_concat(self): WITH {{ }} """ - ) # noqa + ) self.assertDictEqual( result, { diff --git a/tests/functional/test.py b/tests/functional/test.py index 754a440b1..32109f717 100755 --- a/tests/functional/test.py +++ b/tests/functional/test.py @@ -471,7 +471,7 @@ def testFiles(file_list: Iterable[str], cmdline_args=None) -> None: result = testPREPRO(fname, pattern_=FILTER, inline=INLINE, cmdline_args=cmdline_args) else: result = None - except Exception as e: # noqa + except Exception as e: result = False _msg(f"{fname}: *CRASH* {type(e).__name__} exception\n") if RAISE_EXCEPTIONS: diff --git a/zxb.py b/zxb.py index 0235c3eb2..329bd78a4 100755 --- a/zxb.py +++ b/zxb.py @@ -6,7 +6,7 @@ sys.path.append(os.path.dirname(__file__)) -from src import zxbc # noqa: E402 +from src import zxbc if __name__ == "__main__": print("-" * 48 + "\n* WARNING: zxb is deprecated! Use zxbc instead *\n" + "-" * 48, file=sys.stderr) diff --git a/zxbasm.py b/zxbasm.py index 97dcc33f3..5faa79853 100755 --- a/zxbasm.py +++ b/zxbasm.py @@ -15,7 +15,7 @@ sys.path.append(os.path.dirname(__file__)) -from src import zxbasm # noqa: E402 +from src import zxbasm if __name__ == "__main__": sys.exit(zxbasm.main()) diff --git a/zxbc.py b/zxbc.py index a9eab51ff..8db920890 100755 --- a/zxbc.py +++ b/zxbc.py @@ -6,7 +6,7 @@ sys.path.append(os.path.dirname(__file__)) -from src import zxbc # noqa: E402 +from src import zxbc if __name__ == "__main__": sys.exit(zxbc.main()) # Exit diff --git a/zxbpp.py b/zxbpp.py index 30d490e1c..b9bc36204 100755 --- a/zxbpp.py +++ b/zxbpp.py @@ -15,7 +15,7 @@ sys.path.append(os.path.dirname(__file__)) -from src import zxbpp # noqa: E402 +from src import zxbpp if __name__ == "__main__": sys.exit(zxbpp.entry_point())