Ejemplo n.º 1
0
    def check(self, value):
        if self._min_value.startswith('('):
            if to_float(self._min_value[1:]) >= value:
                return False
        elif to_float(self._min_value) > value:
            return False

        if self._max_value.startswith('('):
            if to_float(self._max_value[1:]) <= value:
                return False
        elif to_float(self._max_value) < value:
            return False

        return True
Ejemplo n.º 2
0
def _validate_zset_score(score):
    clean_score = score.strip('(').lower().replace('nan', 'invalid')
    try:
        to_float(clean_score)
    except ValueError:
        raise DredisSyntaxError("min or max is not a float")
Ejemplo n.º 3
0
 def above_max(self, value):
     max_value = self._max_value[1:] if self._max_value.startswith(
         '(') else self._max_value
     return value > to_float(max_value)