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
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.5.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for typeschemalib-0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81f1703bd3d9853fb3c9d992539e3365b39d76a6980fcfb4b439f609174cce0f |
|
MD5 | a075afc2263c68b16af62ffb0e0bac3c |
|
BLAKE2b-256 | 047fb868dfa57c682d811f5b6e91c86f73cd4d1cb31d7970e728034401fedbbc |