From 7d6b3084ae015fc6731a60c6d8606fc5bcfb9cb7 Mon Sep 17 00:00:00 2001 From: Bert Palm <bert.palm@ufz.de> Date: Thu, 11 Feb 2021 23:24:24 +0100 Subject: [PATCH] CompatFlagger now inherits from BaseFlagger --- saqc/flagger/compatflagger.py | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/saqc/flagger/compatflagger.py b/saqc/flagger/compatflagger.py index 6edc6002a..456a2ec48 100644 --- a/saqc/flagger/compatflagger.py +++ b/saqc/flagger/compatflagger.py @@ -13,27 +13,23 @@ import numpy as np from saqc.common import * from saqc.lib.tools import assertScalar, mergeDios, toSequence, customRoller from saqc.flagger.flags import Flags, init_flags_like, History +from saqc.flagger.baseflagger import ( + BaseFlagger, + COMPARATOR_MAP, + LocT, + FlagT, + PandasT, + FieldsT, +) -COMPARATOR_MAP = { - "!=": op.ne, - "==": op.eq, - ">=": op.ge, - ">": op.gt, - "<=": op.le, - "<": op.lt, -} -LocT = Union[pd.Series, pd.Index, slice] -FlagT = Any -BaseFlaggerT = TypeVar("BaseFlaggerT", bound="BaseFlagger") -PandasT = Union[pd.Series, DictOfSeries] -FieldsT = Union[str, List[str], slice] - - -class CompatFlagger: +class CompatFlagger(BaseFlagger): def __init__(self): - self.dtype = float + super().__init__(float) + + # not supported anymore + delattr(self, 'extra_defaults') # the arguments of setFlags supported from the configuration functions self.signature = ("flag", "force", "flag_after", "flag_before") @@ -375,7 +371,7 @@ class CompatFlagger: return flagged - def copy(self) -> CompatFlagger: + def copy(self, **kwargs) -> CompatFlagger: copy = self._constructor() copy._flags = self._flags.copy(deep=True) return copy -- GitLab