From 9090e38f443b34861ca3e6bd3d998834a3160909 Mon Sep 17 00:00:00 2001 From: James Stevenson Date: Mon, 2 Feb 2026 21:53:24 -0500 Subject: [PATCH] feat: add extension fetcher method --- src/ga4gh/core/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ga4gh/core/models.py b/src/ga4gh/core/models.py index 55b40a02..aabfb45c 100644 --- a/src/ga4gh/core/models.py +++ b/src/ga4gh/core/models.py @@ -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