Skip to content

Commit 5a40cb1

Browse files
committed
implement suggestions from @Raphael-Gazzotti
1 parent b6e45d5 commit 5a40cb1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pipeline/src/additional_methods/by_name.py.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
match (str, optional): either "equals" (exact match - default) or "contains".
2222
all (bool, optional): Whether to return all objects that match the name, or only the first. Defaults to False.
2323
"""
24-
namelike_properties = ("name", "lookup_label", "family_name", "full_name", "short_name", "abbreviation", "synonyms")
24+
namelike_properties = ("name", "lookup_label", "family_name", "full_name", "short_name", "abbreviation")
2525
if cls._instance_lookup is None:
2626
cls._instance_lookup = {}
2727
for instance in cls.instances():
2828
keys = []
29-
for prop_name in namelike_properties[:-1]: # handle 'synonyms' separately
29+
for prop_name in namelike_properties:
3030
if hasattr(instance, prop_name):
3131
keys.append(getattr(instance, prop_name))
3232
if hasattr(instance, "synonyms"):
@@ -45,7 +45,7 @@
4545
if name in key:
4646
matches.extend(instances)
4747
else:
48-
raise ValueError("'match' must be either 'exact' or 'contains'")
48+
raise ValueError("'match' must be either 'equals' or 'contains'")
4949
if all:
5050
return matches
5151
elif len(matches) > 0:

0 commit comments

Comments
 (0)