Skip to main content

datatype - Anonymous datatype validation and coercion

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']

Metadata

Release files for datatype 0.8.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datatype 0.8.5
File Size Uploaded Provenance
datatype-0.8.5.tar.gz 4.6 kB Without provenance Details

Release files / datatype-0.8.5.tar.gz

Download URL datatype-0.8.5.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e010b1cc42a1b42daecdad4c8ef3d1e10ac9d40ff87786a226634888799b7a5f
BLAKE2b-256 checksum
How to use checksums
8b1f7f0de0bdeb4e036962dd052dc62b46895049c4d5ffef2d850cd29daf4f35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for datatype 0.8.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page