_parse_attributes(): move prefix declaration near where it is used

This commit is contained in:
Laurent Monin
2023-06-01 14:33:51 +02:00
parent 19cf094084
commit 3d502c8fc8

View File

@@ -128,13 +128,13 @@ def _parse_attributes(attrs, reltype, attr_credits):
prefixes.append(attr)
else:
nouns.append(attr)
prefix = " ".join(prefixes)
if len(nouns) > 1:
result = "%s and %s" % (", ".join(nouns[:-1]), nouns[-1:][0])
elif len(nouns) == 1:
result = nouns[0]
else:
result = _BLANK_SPECIAL_RELTYPES.get(reltype, "")
prefix = " ".join(prefixes)
return " ".join([prefix, result]).strip()