Typed - a Python data validation library
This library allows type tests and transformation and can be used for data loading, storing and validation.
Usage
Simple type-checking:
import typed
t1 = typed.int | typed.string
assert t1.test('abc')
assert t1.test(u'xyz')
assert t1.test(30)
assert not t1.test(1.2)
assert not t1.test(True)
assert not t1.test(None)
t2 = typed.list(typed.int)
assert t1.test([1, 2, 3])
assert t1.test([])
assert not t1.test(['a', 'b', 'c'])
t3 = typed.list(typed.int | typed.string)
assert t3.test([1, 'a', 2, 'b'])
t4 = typed.list(typed.int) | typed.list(typed.string)
assert t4.test([1, 2, 3])
assert t4.test(['a', 'b', 'c'])
assert not t4.test([1, 'a', 2, 'b'])
t5 = typed.set(1, 2, 3)
assert t5.test(2)
assert not t5.test(4)
t6 = typed.dict({
'a': typed.int,
'b': typed.bool.optional,
'c': (typed.int | typed.none).optional,
})
Metadata
Release files for typed 0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| typed-0.6.tar.gz | 7.0 kB | Without provenance | Details |
Release files / typed-0.6.tar.gz
| Download URL | typed-0.6.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97bb17f283001e6bc893474db4ce0c9712642656c8ecbbca0a1d7f42aeae0b22
|
|
BLAKE2b-256 checksum How to use checksums |
41d26ee091aae2973bd29909089fd119de5221385354b7e35b3a2541bab3d874
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for typed 0.6
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.