def check_flapping(self):
        """ main function used to check the flapping """
        f = self.flapping

        f.history.append(time.time())
        if len(f.history) >= f.attempts:
            diff = f.history[0] - f.history[-1]
            if diff > f.window:
                f.reset()
                self.flapping = f
            elif f.retries < f.max_retry:
                f.retries = increment(f.retries)
                self.flapping = f
                return False, True
            else:
                f.reset()
                self.flapping = f
                return False, False
        self.flapping = f
        return True, None
dataset/ETHPy150Open benoitc/gaffer/gaffer/state.py/ProcessState.check_flapping/swapped operands of `-`