Skip to content

Commit fed6b52

Browse files
committed
Enable flake8 pie in ruff.
1 parent c4fd0cf commit fed6b52

11 files changed

Lines changed: 16 additions & 16 deletions

File tree

ppci/arch/arm/vfp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Info:
1111
size = 32
1212

1313
cond = bit_range(28, 32)
14-
x2 = bit_range(24, 28)
14+
x1 = bit_range(24, 28)
1515
opc1 = bit_range(20, 24)
1616
opc2 = bit_range(16, 20)
1717
x2 = bit_range(8, 16)

ppci/arch/avr/instructions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,14 +1107,14 @@ def pattern_ldr8_offset(context, tree, c0):
11071107
"LDRI8(FPRELU16)",
11081108
size=4,
11091109
cycles=2,
1110-
condition=lambda t: t[0].value.offset in range(0, 64),
1110+
condition=lambda t: t[0].value.offset in range(64),
11111111
)
11121112
@avr_isa.pattern(
11131113
"reg",
11141114
"LDRU8(FPRELU16)",
11151115
size=4,
11161116
cycles=2,
1117-
condition=lambda t: t[0].value.offset in range(0, 64),
1117+
condition=lambda t: t[0].value.offset in range(64),
11181118
)
11191119
def pattern_ldr8_fprel(context, tree):
11201120
d = context.new_reg(AvrRegister)

ppci/arch/or1k/instructions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,31 +662,31 @@ def pattern_const32(context, tree):
662662
size=4,
663663
cycles=1,
664664
energy=1,
665-
condition=lambda t: t.value in range(0, 0x10000),
665+
condition=lambda t: t.value in range(0x10000),
666666
)
667667
@orbis32.pattern(
668668
"reg",
669669
"CONSTU16",
670670
size=4,
671671
cycles=1,
672672
energy=1,
673-
condition=lambda t: t.value in range(0, 0x10000),
673+
condition=lambda t: t.value in range(0x10000),
674674
)
675675
@orbis32.pattern(
676676
"reg",
677677
"CONSTU32",
678678
size=4,
679679
cycles=1,
680680
energy=1,
681-
condition=lambda t: t.value in range(0, 0x10000),
681+
condition=lambda t: t.value in range(0x10000),
682682
)
683683
@orbis32.pattern(
684684
"reg",
685685
"CONSTI32",
686686
size=4,
687687
cycles=1,
688688
energy=1,
689-
condition=lambda t: t.value in range(0, 0x10000),
689+
condition=lambda t: t.value in range(0x10000),
690690
)
691691
def pattern_const16(context, tree):
692692
# Play clever with the r0 register (always assumed 0)

ppci/arch/riscv/rvc_instructions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ def render(self):
554554
if (
555555
self.rd.num in range(8, 16)
556556
and self.rs1.num in range(8, 16)
557-
and self.offset in range(0, 128)
557+
and self.offset in range(128)
558558
):
559559
yield CLw(self.rd, self.offset, self.rs1)
560560
elif self.rs1.num == 2 and self.offset >= 0 and self.offset < 256:

ppci/arch/token.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __init__(self, initial_bit_value=0):
119119
def set_bit(self, i, value):
120120
"""Sets a specific bit in this token"""
121121
value = bool(value)
122-
assert i in range(0, self.Info.size)
122+
assert 0 <= i < self.Info.size
123123
mask = 1 << i
124124
if value:
125125
self.bit_value |= mask

ppci/arch/x86_64/instructions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@ def pattern_add64_const_2(context, tree, c0, c1):
16731673
"con32",
16741674
"CONSTU64",
16751675
size=4,
1676-
condition=lambda x: x.value in range(0, 4294967296),
1676+
condition=lambda x: x.value in range(4294967296),
16771677
)
16781678
def pattern_const32(context, tree):
16791679
"""Small 64 bit constants as a constant"""

ppci/arch/xtensa/instructions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@ def pattern_shr_u32(context, tree, c0, c1):
12661266
size=0,
12671267
cycles=0,
12681268
energy=0,
1269-
condition=lambda t: t.value.offset in range(0, 127),
1269+
condition=lambda t: t.value.offset in range(127),
12701270
)
12711271
def pattern_mem_fprel(context, tree):
12721272
fp = a15

ppci/lang/c/lexer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def continued_lines_filter(chunks):
7474
else:
7575
if text.endswith("\\"):
7676
backslash = row, column, text
77-
elif text.endswith("\\\r") or text.endswith("\\\n"):
77+
elif text.endswith(("\\\r", "\\\n")):
7878
yield row, column, text[:-2]
7979
else:
8080
yield row, column, text

ppci/lang/fortran/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ def __init__(self):
1313
self.parser = FortranParser()
1414

1515
def build(self, src):
16-
_ast = self.parser.parse(src)
16+
self.parser.parse(src)
1717
mods = []
18-
# ast
1918
return mods
2019

2120

ppci/utils/bitfun.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def bits_to_bytes(bits):
127127

128128
def encode_imm32(v):
129129
"""Bundle 32 bit value into 4 bits rotation and 8 bits value"""
130-
for i in range(0, 16):
130+
for i in range(16):
131131
v2 = rotate_left(v, i * 2)
132132
if (v2 & 0xFFFFFF00) == 0:
133133
rotation = i

0 commit comments

Comments
 (0)