Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
floriankrb committed Sep 8, 2023
1 parent f909da4 commit a4db948
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions climetlab/sources/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ def load(self, *args, **kwargs):
return load_dataset(*args, **kwargs)


class Inherit:
def execute(self, *args, **kwargs):
pass


class LoadConstants(LoadSource):
def execute(self, v, data, last, inherit):
super().execute(
Expand All @@ -62,7 +57,6 @@ def execute(self, v, data, last, inherit):


ACTIONS = {
"inherit": Inherit,
"source": LoadSource,
"dataset": LoadDataset,
"constants": LoadConstants,
Expand Down Expand Up @@ -91,6 +85,8 @@ def __init__(self, config, **kwargs):
config = config["input"]
config = instanciate_values(config, kwargs)

assert isinstance(config, (list, tuple)), config

self.config = config

def mutate(self):
Expand All @@ -102,9 +98,15 @@ def mutate(self):
data = []
inherit = False
last = {}
for k, v in self.config.items():
for input in self.config:
assert len(input) == 1, input
assert isinstance(input, dict), input

k = list(input.keys())[0]
v = input[k]
if k == "inherit":
inherit = v
continue

ACTIONS[k]().execute(v, data, last, inherit)

Expand Down

0 comments on commit a4db948

Please sign in to comment.