Skip to content

Commit 36f7792

Browse files
dcpleungjhedberg
authored andcommitted
xtensa: fix ruff issues in Python scripts
Fix the issues found by ruff. Signed-off-by: Daniel Leung <[email protected]>
1 parent 0719c9e commit 36f7792

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

.ruff-excludes.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@
2626
"SIM115", # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
2727
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
2828
]
29-
"./arch/xtensa/core/gen_vectors.py" = [
30-
"F541", # https://docs.astral.sh/ruff/rules/f-string-missing-placeholders
31-
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
32-
"UP031", # https://docs.astral.sh/ruff/rules/printf-string-formatting
33-
]
34-
"./arch/xtensa/core/gen_zsr.py" = [
35-
"SIM401", # https://docs.astral.sh/ruff/rules/if-else-block-instead-of-dict-get
36-
]
3729
"./boards/microchip/mec172xevb_assy6906/support/mec172x_remote_flasher.py" = [
3830
"I001", # https://docs.astral.sh/ruff/rules/unsorted-imports
3931
]

arch/xtensa/core/gen_vectors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env python3
22
# Copyright 2023 The ChromiumOS Authors
33
# SPDX-License-Identifier: Apache-2.0
4-
import sys
54
import re
5+
import sys
66

77
# Xtensa Vector Table linker generator
88
#
@@ -99,7 +99,7 @@
9999

100100
if debug_level > 0:
101101
old = f"Level{debug_level}Interrupt"
102-
offsets[f"DebugException"] = offsets[old]
102+
offsets["DebugException"] = offsets[old]
103103
del offsets[old]
104104

105105
sects = list(offsets)
@@ -114,9 +114,9 @@
114114
# bottom bits don't take...
115115
print( " .z_xtensa_vectors : ALIGN(1024) {")
116116
print( " z_xtensa_vecbase = .;")
117-
print(f" KEEP(*(.WindowVectors.text));")
117+
print( " KEEP(*(.WindowVectors.text));")
118118
for s in sects:
119119
print(f" KEEP(*(.{s}Vector.literal));")
120-
print( " . = 0x%3.3x;" % (offsets[s]))
120+
print(f" . = 0x{offsets[s]:x};")
121121
print(f" KEEP(*(.{s}Vector.text));")
122122
print(" }")

arch/xtensa/core/gen_zsr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def parse_args():
4141
syms = {}
4242

4343
def get(s):
44-
return syms[s] if s in syms else 0
44+
return syms.get(s, 0)
4545

4646
with open(coreisa) as infile:
4747
for line in infile.readlines():

0 commit comments

Comments
 (0)