Fix use of _ as local variable and gettext in same scope

This commit is contained in:
Kovid Goyal 2023-05-25 08:33:02 +05:30
parent b7795f989e
commit fd207da67c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -822,11 +822,11 @@ class BuiltinIdentifierInList(BuiltinFormatterFunction):
raise ValueError(_("{} requires 2 or 4 arguments").format(self.name)) raise ValueError(_("{} requires 2 or 4 arguments").format(self.name))
l = [v.strip() for v in val.split(',') if v.strip()] l = [v.strip() for v in val.split(',') if v.strip()]
(id_, _, regexp) = ident.partition(':') (id_, __, regexp) = ident.partition(':')
if not id_: if not id_:
return nfv return nfv
for candidate in l: for candidate in l:
i, _, v = candidate.partition(':') i, __, v = candidate.partition(':')
if v and i == id_: if v and i == id_:
if not regexp or re.search(regexp, v, flags=re.I): if not regexp or re.search(regexp, v, flags=re.I):
return candidate if fv_is_id else fv return candidate if fv_is_id else fv