def validate(self, field, row={}): field = json.loads(str(field)) if not field and not self.empty_ok: self.invalid_set.add(field) raise ValidationException() if len(field) != len(set(field)): self.invalid_set.add(field) raise ValidationException()
def validate(self, field, row={}): if not field and not self.empty_ok: self.invalid_set.add(field) raise ValidationException() field = field.split(self.separator) if len(field) != len(set(field)): self.invalid_set.add(field) raise ValidationException()
def validate(self, field, row={}): try: if field or not self.empty_ok: self.cast(field) except ValueError as e: self.invalid_set.add(field) raise ValidationException(e)
def validate(self, field, row={}): if self.unique_with and not self.unique_check: self._precheck_unique_with(row) key = tuple([field] + [row[k] for k in self.unique_with]) if key not in self.unique_values: self.unique_values.add(key) else: self.duplicates.add(key) if self.unique_with: raise ValidationException( "'{}' is already in the column (unique with: {})".format( field, key[1:])) else: raise ValidationException( "'{}' is already in the column".format(field))
def validate(self, field, row={}): if field == "" and self.empty_ok: return try: value = float(field) if not self.low <= value <= self.high: raise ValueError except ValueError: self.outside.add(field) raise ValidationException("'{}' is not in range {} to {}".format( field, self.low, self.high))
def validate(self, field, row={}): if not field == "": self.failed = True raise ValidationException("Row has not empty field in column")
def validate(self, field, row={}): if field != "": self.nonempty.add(field) raise ValidationException("'{}' is not an empty string".format(field))
def validate(self, field, row={}): if not self.regex.match(field) and (field or not self.empty_ok): self.failures.add(field) raise ValidationException( "'{}' does not match pattern /{}/".format(field, self.regex) )
def validate(self, field, row={}): if field not in self.options: self.invalid_set.add(field) raise ValidationException( "'{}' is not in {}".format(field, _stringify_set(self.options, 100)) )
def validate(self, field, row={}): if field not in self.valid_set: self.invalid_set.add(field) raise ValidationException("'{}' is not in {}".format( field, self.valid_set))
def validate(self, field, row={}): if field == '': self.failed = True raise ValidationException("Row has emtpy field in column")
def validate(self, field, row={}): if not self.low <= float(field) <= self.high: self.outside.add(field) raise ValidationException("'{}' is not in range {} to {}".format( field, self.low, self.high))