diff --git a/saqc/flagger/baseflagger.py b/saqc/flagger/baseflagger.py index edb275bbac2fdcfeb9faf199b741ee2b560f940a..9c6ba4fbe5a34ad11169600be7a4a13c42899495 100644 --- a/saqc/flagger/baseflagger.py +++ b/saqc/flagger/baseflagger.py @@ -36,7 +36,6 @@ class BaseFlagger(ABC): def __init__(self, dtype): # NOTE: the type of the _flags DictOfSeries self.dtype = dtype - self.extra_defaults = dict() # NOTE: the arggumens of setFlags supported from # the configuration functions self.signature = ("flag",) diff --git a/saqc/flagger/dmpflagger.py b/saqc/flagger/dmpflagger.py index 10c83de4aa172da55f929316d06e20cd0633cb6d..bb2eb8ef59807424c1c961aa00cb9d711b0a1b9d 100644 --- a/saqc/flagger/dmpflagger.py +++ b/saqc/flagger/dmpflagger.py @@ -1,7 +1,6 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- -import subprocess import json from copy import deepcopy from typing import TypeVar, Optional, List @@ -36,15 +35,12 @@ FLAGS = ["NIL", "OK", "DOUBTFUL", "BAD"] class DmpFlagger(CategoricalFlagger): - def __init__(self, include_version=True): + def __init__(self, **kwargs): super().__init__(FLAGS) self.flags_fields = [FlagFields.FLAG, FlagFields.CAUSE, FlagFields.COMMENT] - self.extra_defaults = dict(cause=FLAGS[0], comment="") - version = subprocess.run( - "git describe --tags --always --dirty", shell=True, check=False, stdout=subprocess.PIPE, - ).stdout - self.project_version = version.decode().strip() if include_version else "" self.signature = ("flag", "comment", "cause", "force") + + self._global_comments = kwargs self._flags = None self._causes = None self._comments = None @@ -151,8 +147,8 @@ class DmpFlagger(CategoricalFlagger): else: flag = self.BAD if flag is None else flag comment = json.dumps( - {"comment": comment, - "commit": self.project_version, + {**self._global_comments, + "comment": comment, "test": kwargs.get("func_name", "")} ) @@ -240,7 +236,7 @@ class DmpFlagger(CategoricalFlagger): def _construct_new(self, flags, causes, comments) -> DmpFlaggerT: new = DmpFlagger() - new.project_version = self.project_version + new._global_comments = self._global_comments new._flags = flags new._causes = causes new._comments = comments