A yaml like schema that can be used to check dictionaries for correct schema
Project description
lib_type_schema
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 file_reader
# 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
dataChecker = file_reader.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 = dataChecker.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.4.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for typeschemalib-0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bb522e5b69c376131533f974c16df00e26e36966dfdd6cc575308af6dd3a1f2 |
|
MD5 | c4dffdcc58e3bc305e37e5609d7d0be5 |
|
BLAKE2b-256 | 903acd36202894ee77669aac076445d9236284cbd7f78c658b885f10152b41d7 |