Merge pull request #8371 from Robyt3/Scripts-CopyFix-Lint-Fix

Fix `possibly-used-before-assignment` in `copy_fix.py`
This commit is contained in:
archimede67 2024-05-16 21:23:55 +00:00 committed by GitHub
commit 8a3635f243
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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