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
Test parse with stml file
from typeschemalib import typeschemalib
if __name__ == "__main__":
data = {"point": 45, "my_string": "Hey", "grade": 4.5}
# Validate data from schema file
schema = "test.stml"
valid = typeschemalib.schema_check(schema, data)
print(valid)
# Validate data from list of schema
schema = ["point: Int", "my_string: Str", "grade: Int"]
valid = typeschemalib.schema_check(schema, data)
print(valid)
# Validate data from dict of values
schema = {"point": "Int", "my_string": "Str", "grade": "Int"}
valid = typeschemalib.schema_check(schema, data)
print(valid)
Todo
Make schema have regex
Make documentation for stml writer
Add object type and class checker, isinstance issubclass time: DateTimeObject
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-1.7.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file typeschemalib-1.7.tar.gz.
File metadata
- Download URL: typeschemalib-1.7.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/50.3.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34a807df8c5979a942cfebf8910d47645fec5fd62f825659dc5b62b665818cfb
|
|
| MD5 |
18aefd5aa98ef2967e3f0dcacfd137d9
|
|
| BLAKE2b-256 |
02cff8df1ff61bcce9d5667fcab1f52e2ccc263656d86d94ca0af6a7b895b112
|
File details
Details for the file typeschemalib-1.7-py3-none-any.whl.
File metadata
- Download URL: typeschemalib-1.7-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/50.3.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a2f1f7111813a8768c4491f303fd0f85d6c111a8dc1a474c10e87a7015d82b9
|
|
| MD5 |
40b0e768d075704f09974ec17d6c6728
|
|
| BLAKE2b-256 |
ebc20f6b3e3e338707f540e9541dd4e6f0fad8fda0caaf958ae3ffdf1495126d
|