Skip to content

Commit

Permalink
Merge pull request #850 from bartsanchez/bart/fix-ruff-rule-RUF100
Browse files Browse the repository at this point in the history
fix: Ruff rule RUF100 (unused-qa)
  • Loading branch information
boriel authored Oct 31, 2024
2 parents de79e62 + 5351484 commit be4cf58
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 17 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ ignore = [
"RUF005",
"RUF012",
"RUF013",
"RUF100",
"UP008",
"UP015", # KEEP: redundant-open-modes
"UP024",
Expand Down
2 changes: 1 addition & 1 deletion src/arch/z80/backend/_float.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] == "_":
Expand Down
2 changes: 1 addition & 1 deletion src/arch/zxnext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
2 changes: 1 addition & 1 deletion src/arch/zxnext/backend/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/zxbc/zxbparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
14 changes: 7 additions & 7 deletions tests/arch/zx48k/peephole/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_parse_string(self):
WITH {{
}}
'''
) # noqa
)

self.maxDiff = None
self.assertIsInstance(result, dict)
Expand Down Expand Up @@ -66,7 +66,7 @@ def test_parse_call(self):
WITH {{
}}
"""
) # noqa
)
self.assertDictEqual(
result,
{
Expand All @@ -93,7 +93,7 @@ def test_parse_chain_plus(self):
WITH {{
}}
"""
) # noqa
)
self.assertDictEqual(
result,
{
Expand All @@ -120,7 +120,7 @@ def test_parse_chain_parent(self):
WITH {{
}}
"""
) # noqa
)
self.assertDictEqual(
result,
{
Expand Down Expand Up @@ -151,7 +151,7 @@ def test_parse_len(self):
WITH {{
}}
"""
) # noqa
)
self.assertDictEqual(
result,
{
Expand Down Expand Up @@ -182,7 +182,7 @@ def test_parse_len_2(self):
WITH {{
}}
"""
) # noqa
)
self.assertDictEqual(
result,
{
Expand Down Expand Up @@ -213,7 +213,7 @@ def test_define_concat(self):
WITH {{
}}
"""
) # noqa
)
self.assertDictEqual(
result,
{
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion zxb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion zxbasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
2 changes: 1 addition & 1 deletion zxbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion zxbpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

0 comments on commit be4cf58

Please sign in to comment.