Download src/common/validation.py from Shorx/DCA-01: direct link, hf CLI and curl.
- Browser
- Download file 313 Bytes
-
https://huggingface.co/Shorx/DCA-01/resolve/main/src/common/validation.py
- Command line
-
hf download hf://Shorx/DCA-01/src/common/validation.py
-
curl -L -o validation.py https://huggingface.co/Shorx/DCA-01/resolve/main/src/common/validation.py
313 Bytes
| import json, jsonschema | |
| from pathlib import Path | |
| def validate_against_schema(instance: dict, schema_name: str): | |
| schema_path = Path(__file__).parent.parent.parent / "schemas" / schema_name | |
| with open(schema_path) as f: | |
| schema = json.load(f) | |
| jsonschema.validate(instance, schema) | |
| return True |