Skip to main content

For full package documenation, please see: http://datatype.readthedocs.org/

Examples

>>> 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)
[]

Coercion:

>>> from datatype.coercion import coerce_value

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

Download files

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

Source Distribution

datatype-0.8.5.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file datatype-0.8.5.tar.gz.

File metadata

  • Download URL: datatype-0.8.5.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for datatype-0.8.5.tar.gz
Algorithm Hash digest
SHA256 e010b1cc42a1b42daecdad4c8ef3d1e10ac9d40ff87786a226634888799b7a5f
MD5 b790a7609fa7025bd8e2c4b1a645b639
BLAKE2b-256 8b1f7f0de0bdeb4e036962dd052dc62b46895049c4d5ffef2d850cd29daf4f35

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.8.5 This release

1 file

0.8.4

1 file

0.8.3

1 file

0.8.2

1 file

0.8.1

1 file

0.8.0

1 file

0.7.0

1 file

0.6.3

1 file

0.6.2

1 file

0.6.1

1 file

0.6

1 file

0.5.2

1 file

0.5.1

1 file

0.5

1 file

0.4.1

1 file

0.4

1 file

0.3

1 file

0.2

1 file

0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page