From 0054d0f7b50a4f533a266bf342231bd96c3aaa2d Mon Sep 17 00:00:00 2001 From: dgelessus Date: Thu, 23 Jul 2020 13:17:02 +0200 Subject: [PATCH] Fix variable naming conflict in show_filtered_resources mypy does not like it when the same variable name is used for different types, even if it is in unrelated if branches and could never actually cause any problems. --- rsrcfork/__main__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rsrcfork/__main__.py b/rsrcfork/__main__.py index c59109b..cc23580 100644 --- a/rsrcfork/__main__.py +++ b/rsrcfork/__main__.py @@ -335,22 +335,22 @@ def show_filtered_resources(resources: typing.Sequence[api.Resource], format: st quoted_restype = bytes_quote(res.type, "'") print(f"data {quoted_restype} ({', '.join(parts)}{attrs_comment}) {{") - line = f.read(16) - while line: + bytes_line = f.read(16) + while bytes_line: # Two-byte grouping is really annoying to implement. groups = [] for j in range(0, 16, 2): - if j >= len(line): + if j >= len(bytes_line): break - elif j+1 >= len(line): - groups.append(f"{line[j]:02X}") + elif j+1 >= len(bytes_line): + groups.append(f"{bytes_line[j]:02X}") else: - groups.append(f"{line[j]:02X}{line[j+1]:02X}") + groups.append(f"{bytes_line[j]:02X}{bytes_line[j+1]:02X}") s = f'$"{" ".join(groups)}"' - comment = "/* " + line.decode(_TEXT_ENCODING).translate(_TRANSLATE_NONPRINTABLES) + " */" + comment = "/* " + bytes_line.decode(_TEXT_ENCODING).translate(_TRANSLATE_NONPRINTABLES) + " */" print(f"\t{s:<54s}{comment}") - line = f.read(16) + bytes_line = f.read(16) print("};") print()