[bug] [factorisation] removed remaining validity checks is_valid

This commit is contained in:
Noe Brucy
2020-12-15 15:56:24 +01:00
parent 9864ba97b8
commit 157f84e994
3 changed files with 12 additions and 23 deletions
+12 -17
View File
@@ -23,14 +23,12 @@ class Rule:
description="",
group="",
dependencies=[],
is_valid=lambda arg: True,
kind="classic",
unit=U.none,
):
self.postproc = postproc
self.process_fn = process
self.dependencies = dependencies
self.is_valid_add = is_valid
self.group = group
self.description = description
self.unit = unit
@@ -144,21 +142,18 @@ class BaseProcessor:
else:
name_full = rule.group + "/" + name
if rule.is_valid(arg):
if name_full not in self.just_done:
if self._needs_computation(overwrite, name_full):
self._log("Processing {}".format(name_full))
data = rule.process(arg, **kwargs)
self._save_data(name_full, data, rule.description, rule.unit)
self._log("Data for {} computed".format(name_full), "SUCCESS")
self.just_done.append(name_full)
return data
else:
self._log(
"Data for {} is already computed, skipping...".format(name_full)
)
else:
self._log("{} is not valid in this context".format(name_full), "ERROR")
if name_full not in self.just_done:
if self._needs_computation(overwrite, name_full):
self._log("Processing {}".format(name_full))
data = rule.process(arg, **kwargs)
self._save_data(name_full, data, rule.description, rule.unit)
self._log("Data for {} computed".format(name_full), "SUCCESS")
self.just_done.append(name_full)
return data
else:
self._log(
"Data for {} is already computed, skipping...".format(name_full)
)
def def_rules(self):
for rule in self.rules: