A yaml like schema that can be used to check dictionaries for correct schema
Project description
typeschemalib
A yaml like schema that can be used to check dictionaries for correct schema
Schema file
schema example
point: Int
my_string: Str
grade: Float
data example
{"point": 45, "my_string": "Hey", "grade": 4.5}
Checking data for correct schema
from typeschemalib import typeschemalib
# Set schema file
schema_file = "test.stml"
# Set Data dictionary that corresponds to schema file
data = {"point": 45, "my_string": "Hey", "grade": 4.5}
# Check data for correct schema_file
data_checker = typeschemalib.DataChecker(schema_file, data)
# Run type check to see if data corresponds
# valid will be True if schema is correct, it will throw errors otherwise
valid = data_checker.check_type()
Todo
Make schema have regex Make schema have functions or options to validate data
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
typeschemalib-0.8.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for typeschemalib-0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f34e75c4090b1e64ca232b519b3a6f91f8b506f9e51454637f5333422fc9ceeb |
|
MD5 | 65ff111fdc7bfe9a7f9a661fdfcb3f8c |
|
BLAKE2b-256 | ece91b138cff5aa9eb28144a4882d733f7fbebd46d200ddbcf40bc4085e82a5e |