Cleanup: suppress pylint/ruff warnings in Python scripts

This commit is contained in:
Campbell Barton
2025-01-06 12:57:09 +11:00
parent c27bf6bef8
commit 4425acf946
3 changed files with 14 additions and 17 deletions

View File

@@ -109,16 +109,15 @@ def convert_tabs_to_spaces(files: Sequence[str]) -> None:
# Complex 2 space
# because some comments have tabs for alignment.
def handle(l: str) -> str:
ls = l.lstrip("\t")
d = len(l) - len(ls)
def handle(line: str) -> str:
line_strip = line.lstrip("\t")
d = len(line) - len(line_strip)
if d != 0:
return (" " * d) + ls.expandtabs(4)
else:
return l.expandtabs(4)
return (" " * d) + line_strip.expandtabs(4)
return line.expandtabs(4)
lines = data.splitlines(keepends=True)
lines = [handle(l) for l in lines]
lines = [handle(line) for line in lines]
data = "".join(lines)
with open(f, 'w', encoding="utf-8") as fh:
fh.write(data)