From 07e620ef43659ad51b6bac0bbc9acd4dbc81231a Mon Sep 17 00:00:00 2001 From: VsevolodX <79542055+VsevolodX@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:08:38 -0700 Subject: [PATCH] wip: coarse idea --- src/py/mat3ra/standata/__init__.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/py/mat3ra/standata/__init__.py b/src/py/mat3ra/standata/__init__.py index 7f11e04..869d872 100644 --- a/src/py/mat3ra/standata/__init__.py +++ b/src/py/mat3ra/standata/__init__.py @@ -1 +1,22 @@ +from typing import List + from .base import Standata +from .materials import materials_data + + +class StandataMaterials: + + def __init__(self): + self.entities = materials_data + + def get_by_name(self, name: str) -> List[dict]: + """Returns entity by name. + + Args: + name: Name of the entity. + """ + matching_entities = [] + for key, entity in self.entities["filesMapByName"].items(): + if name in key: + matching_entities.append(entity) + return matching_entities