Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Anonymous datatype validation

Project description

For full package documenation, please see:


>>> from datatype.validation import failures

>>> datatype = {'foo': [{'bar': 'int'}]}
>>> bad_value = {'foo': [{'bar': 'baz'}], 'bif': 'pow!'}

>>> failures(datatype, bad_value)
['unexpected property "bif"', 'foo[0].bar: expected int, got str']

Wildcard dictionary keys:

>>> datatype = {'_any_': ['int']}
>>> good_value = {'foo': [1, 2, 3], 'bar': [3, 4, 5]}

>>> failures(datatype, good_value)


>>> from datatype.coercion import coerce_value

>>> coerce_value(['str'], [1, 2, 3])
['1', '2', '3']

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for datatype, version 0.8.5
Filename, size File type Python version Upload date Hashes
Filename, size datatype-0.8.5.tar.gz (4.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page