mirror of
https://github.com/fergalmoran/picard.git
synced 2026-01-10 02:24:05 +00:00
Simplify _relation_attributes() (#2215)
Use try/except as the key should be always there, and that's the fastest in such case. Except is there to prevent any issue if the API does something weird.
This commit is contained in:
@@ -139,9 +139,10 @@ def _parse_attributes(attrs, reltype, attr_credits):
|
||||
|
||||
|
||||
def _relation_attributes(relation):
|
||||
if 'attributes' in relation:
|
||||
return tuple(a for a in relation['attributes'])
|
||||
return tuple()
|
||||
try:
|
||||
return tuple(relation['attributes'])
|
||||
except KeyError:
|
||||
return tuple()
|
||||
|
||||
|
||||
def _relations_to_metadata_target_type_artist(relation, m, context):
|
||||
|
||||
Reference in New Issue
Block a user