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.6.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for typeschemalib-0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce105994fda0ece306ed02fea70a17b8bdb555685acb954633e11616cb916d1c |
|
MD5 | 68b45bd19509abc25e3091a6a5d0b26f |
|
BLAKE2b-256 | 7826b359a0155c5c955db522ee0a09f5acc26cc8c824423c2101a7e5da209246 |