(self, comparator: str, left_value, right_value)
return lookup[comparator]()
Utility for performing arbitrary comparisons
Utility for performing arbitrary comparisons
Utility for performing arbitrary comparisons
def compare(self, comparator: str, left_value, right_value):
        """Utility for performing arbitrary comparisons"""
        lookup = {
            "=": lambda: left_value == right_value,
            "!=": lambda: left_value != right_value,
            "<": lambda: left_value < right_value,
            ">": lambda: left_value > right_value,
            "<=": lambda: left_value <= right_value,
            ">=": lambda: left_value >= right_value,
        }

        if comparator not in lookup:
            sys.stderr.write(f"Unknown comparator '{comparator}'\n")
            sys.exit(1)

        return lookup[comparator]()
def compare ( self , comparator : str , left_value , right_value ) : lookup = { "=" : lambda : left_value == right_value , "!=" : lambda : left_value != right_value , "<" : lambda : left_value < right_value , ">" : lambda : left_value > right_value , "<=" : lambda : left_value <= right_value , ">=" : lambda : left_value >= right_value , } if comparator not in lookup : sys . stderr . write ( f"Unknown comparator '{comparator}'\n" ) sys . exit ( 1 ) return lookup [ comparator ] ( )