Skip to content

Commit

Permalink
all: Fix cases of Python variable assigned but never used.
Browse files Browse the repository at this point in the history
This fixes ruff rule F841.
  • Loading branch information
cclauss authored and dpgeorge committed May 2, 2023
1 parent 79e5747 commit 2a1db77
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 17 deletions.
1 change: 0 additions & 1 deletion examples/network/http_server_simplistic.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def main():
while True:
res = s.accept()
client_s = res[0]
client_addr = res[1]
req = client_s.recv(4096)
print("Request:")
print(req)
Expand Down
4 changes: 2 additions & 2 deletions ports/cc3200/tools/update-wipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def reset_board(args):
finally:
try:
tn.close()
except Exception as e:
except Exception:
pass
return success

Expand Down Expand Up @@ -167,7 +167,7 @@ def find_tag(tag):
finally:
try:
tn.close()
except Exception as e:
except Exception:
pass
return success

Expand Down
1 change: 0 additions & 1 deletion ports/mimxrt/boards/make-pins.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ def parse_af_file(self, filename, iomux_filename):
# Extract indexes from header row
pad_col = header.index("Pad")
adc_col = header.index("ADC")
acmp_col = header.index("ACMP")
#
for idx, row in enumerate(rows):
pad = row[pad_col]
Expand Down
2 changes: 0 additions & 2 deletions ports/nrf/examples/seeed_tft.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ def show(self):

self.write_cmd(0x2C)

num_of_pixels = self.height * self.width

for row in range(0, self.pages):
for pixel_pos in range(0, 8):
for col in range(0, self.width):
Expand Down
4 changes: 2 additions & 2 deletions ports/rp2/boards/make-pins.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def parse_af_file(self, filename, pinname_col, af_col):
for row in rows:
try:
pin_num = parse_pin(row[pinname_col])
except Exception as e:
except Exception:
# import traceback; traceback.print_exc()
continue
pin = Pin(pin_num)
Expand All @@ -228,7 +228,7 @@ def parse_board_file(self, filename):

cpu_pin_name = row[1]
try:
pin_num = parse_pin(cpu_pin_name)
parse_pin(cpu_pin_name)
except:
# import traceback; traceback.print_exc()
continue
Expand Down
1 change: 0 additions & 1 deletion ports/stm32/make-stmconst.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ def main():
reg_defs["GPIO"].append(["BSRRL", 0x18, 16, "legacy register"])
reg_defs["GPIO"].append(["BSRRH", 0x1A, 16, "legacy register"])

modules = []
needed_qstrs = set()
needed_mpzs = set()

Expand Down
2 changes: 1 addition & 1 deletion ports/stm32/mboot/mboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def wait_response(self):
self.i2c.readfrom_into(self.addr, self.buf1)
n = self.buf1[0]
break
except OSError as er:
except OSError:
time.sleep_us(500)
if time.ticks_diff(time.ticks_ms(), start) > 5000:
raise Exception("timeout")
Expand Down
2 changes: 1 addition & 1 deletion tools/mpremote/mpremote/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,5 @@ def set_conout_mode(new_mode, mask=0xFFFFFFFF):
try:
set_conout_mode(mode, mask)
VT_ENABLED = True
except WindowsError as e:
except WindowsError:
VT_ENABLED = False
2 changes: 1 addition & 1 deletion tools/mpremote/mpremote/pyboardextended.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def do_ilistdir_next(self):
try:
stat = os.lstat(self.data_ilistdir[0] + "/" + entry)
mode = stat.st_mode & 0xC000
except OSError as er:
except OSError:
mode = 0
self.wr_str(entry)
self.wr_u32(mode)
Expand Down
7 changes: 3 additions & 4 deletions tools/mpy-tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,6 @@ def freeze(self):

i_top = len(self.fun_data)
i = 0
qi = 0
while i < i_top:
# copy machine code (max 16 bytes)
i16 = min(i + 16, i_top)
Expand Down Expand Up @@ -1276,7 +1275,7 @@ def read_raw_code(reader, parent_name, qstr_table, obj_table, segments):
if native_scope_flags & MP_SCOPE_FLAG_VIPERRODATA:
rodata_size = reader.read_uint()
if native_scope_flags & MP_SCOPE_FLAG_VIPERBSS:
bss_size = reader.read_uint()
reader.read_uint() # bss_size
if native_scope_flags & MP_SCOPE_FLAG_VIPERRODATA:
reader.read_bytes(rodata_size)
if native_scope_flags & MP_SCOPE_FLAG_VIPERRELOC:
Expand All @@ -1285,10 +1284,10 @@ def read_raw_code(reader, parent_name, qstr_table, obj_table, segments):
if op == 0xFF:
break
if op & 1:
addr = reader.read_uint()
reader.read_uint() # addr
op >>= 1
if op <= 5 and op & 1:
n = reader.read_uint()
reader.read_uint() # n
else:
assert kind == MP_CODE_NATIVE_ASM
native_n_pos_args = reader.read_uint()
Expand Down
1 change: 0 additions & 1 deletion tools/mpy_ld.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ def do_relocation_text(env, text_addr, r):
# Extract relevant info about symbol that's being relocated
s = r.sym
s_bind = s.entry["st_info"]["bind"]
s_shndx = s.entry["st_shndx"]
s_type = s.entry["st_info"]["type"]
r_offset = r["r_offset"] + text_addr
r_info_type = r["r_info_type"]
Expand Down

0 comments on commit 2a1db77

Please sign in to comment.