Fix possibly-used-before-assignment in copy_fix.py

Always initialize the variables `local` and `supported` instead of initializing them conditionally, to fix the false-positive `possibly-used-before-assignment` pylint detection.

Closes #8369.
This commit is contained in:
Robert Müller 2024-05-16 20:40:32 +02:00
parent 03b13cb9f5
commit e341c56c35

View file

@ -8,10 +8,8 @@ def copy_fix(infile, delete_unused, append_missing, delete_empty):
with open(infile, encoding="utf-8") as f: with open(infile, encoding="utf-8") as f:
content = f.readlines() content = f.readlines()
trans = twlang.translations(infile) trans = twlang.translations(infile)
if delete_unused or append_missing: local = twlang.localizes()
local = twlang.localizes() supported = []
if append_missing:
supported = []
for tran, (start, expr, end) in trans.items(): for tran, (start, expr, end) in trans.items():
if delete_unused and tran not in local: if delete_unused and tran not in local:
content[start:end] = [None]*(end-start) content[start:end] = [None]*(end-start)