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.7.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for typeschemalib-0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b0b33452c480e3c310d2810540bf337d6c10a0f4a6d334b62a261da22a1821b |
|
MD5 | b6a2171ff415e4716ba900ee02f9a9a3 |
|
BLAKE2b-256 | b701b7f6033b6d767dd54194d6e98b969c781fe794664bc8143ecd082ec470f1 |