Skip to content
Snippets Groups Projects
Commit a1525109 authored by lukas leufen's avatar lukas leufen
Browse files

new method to create an args dictionary from data store

parent d70a6b27
No related branches found
No related tags found
Loading
Pipeline #26747 passed with warnings
......@@ -2,7 +2,7 @@ __author__ = 'Lukas Leufen'
__date__ = '2019-11-22'
from typing import Any, List, Tuple
from typing import Any, List, Tuple, Dict
from abc import ABC
......@@ -36,7 +36,7 @@ class AbstractDataStore(ABC):
"""
def __init__(self):
# empty initialise the data-store variables
self._store = {}
self._store: Dict = {}
def put(self, name: str, obj: Any, scope: str) -> None:
"""
......@@ -89,6 +89,15 @@ class AbstractDataStore(ABC):
def clear_data_store(self) -> None:
self._store = {}
def create_args_dict(self, arg_list: List[str], scope: str = "general"):
args = {}
for arg in arg_list:
try:
args[arg] = self.get(arg, scope)
except (NameNotFoundInDataStore, NameNotFoundInScope):
pass
return args
class DataStoreByVariable(AbstractDataStore):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment