MCPcopy Index your code
hub / github.com/apache/cassandra-python-driver / validate

Method validate

cassandra/cqlengine/columns.py:653–666  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

651 db_type = 'uuid'
652
653 def validate(self, value):
654 val = super(UUID, self).validate(value)
655 if val is None:
656 return
657 if isinstance(val, _UUID):
658 return val
659 if isinstance(val, str):
660 try:
661 return _UUID(val)
662 except ValueError:
663 # fall-through to error
664 pass
665 raise ValidationError("{0} {1} is not a valid uuid".format(
666 self.column_name, value))
667
668 def to_python(self, value):
669 return self.validate(value)

Callers 2

to_pythonMethod · 0.95
to_databaseMethod · 0.95

Calls 2

ValidationErrorClass · 0.90
validateMethod · 0.45

Tested by

no test coverage detected