Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/ga4gh/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ class Element(BaseModel, ABC):
description="A list of extensions to the Entity, that allow for capture of information not directly supported by elements defined in the model.",
)

def get_extensions_by_name(self, name: str) -> list[Extension]:
"""Fetch all contained extension exactly matching the provided name

:param name: name of extension to fetch
:return: a list of all matching extensions, empty if no matches found (or if instance contains no extensions)
"""
if not self.extensions:
return []
return [e for e in self.extensions if e.name == name]


#########################################
# General-purpose data classes
Expand Down