from abc import ABC, abstractmethod class NumberComparator(ABC): def __init__(self): ... @abstractmethod def __call__(self, input: int) -> bool: ... class GreaterOrEqualThan(NumberComparator): def __init__(self, value: int): self.value = value def __call__(self, input: int) -> bool: return input >= self.value class LessOrEqualThan(NumberComparator): def __init__(self, value: int): self.value = value def __call__(self, input: int) -> bool: return input <= self.value class GreaterThan(NumberComparator): def __init__(self, value: int): self.value = value def __call__(self, input: int) -> bool: return input > self.value class LessThan(NumberComparator): def __init__(self, value: int): self.value = value def __call__(self, input: int) -> bool: return input < self.value class EqualWithNumber(NumberComparator): def __init__(self, value: int): self.value = value def __call__(self, input: int) -> bool: return input == self.value class TextComparator(ABC): def __init__(self): ... @abstractmethod def __call__(self, input: str) -> bool: ... class TextEqual(TextComparator): def __init__(self, value: str): self.value = value def __call__(self, input: str) -> bool: return input == self.value class TextContains(TextComparator): def __init__(self, value: str): self.value = value def __call__(self, input: str) -> bool: return self.value in input class TextHasPrefix(TextComparator): def __init__(self, value: str): self.value = value def __call__(self, input: str) -> bool: return input.startswith(self.value) class TextHasSuffix(TextComparator): def __init__(self, value: str): self.value = value def __call__(self, input: str) -> bool: return input.endswith(self.value) class ListComparator(ABC): def __init__(self): ... @abstractmethod def __call__(self, input: list) -> bool: ... class ListContains(ListComparator): def __init__(self, value: str): self.value = value def __call__(self, input: list) -> bool: return self.value in input class ListIsEmpty(ListComparator): def __call__(self, input: list) -> bool: return len(input) == 0 class DictComparator(ABC): def __init__(self): ... @abstractmethod def __call__(self, input: dict) -> bool: ... class DictHasKey(DictComparator): def __init__(self, key: str): self.key = key def __call__(self, input: dict) -> bool: return self.key in input