diff options
Diffstat (limited to 'src/hydrilla/json_instances.py')
-rw-r--r-- | src/hydrilla/json_instances.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/hydrilla/json_instances.py b/src/hydrilla/json_instances.py index fb34d5c..e6cf50f 100644 --- a/src/hydrilla/json_instances.py +++ b/src/hydrilla/json_instances.py @@ -111,7 +111,7 @@ _schema_name_re = re.compile(r''' $ ''', re.VERBOSE) -schema_paths: dict[str, Path] = {} +schema_paths: t.Dict[str, Path] = {} for path in (here / 'schemas').rglob('*.schema.json'): match = _schema_name_re.match(path.name) assert match is not None @@ -126,12 +126,12 @@ for path in (here / 'schemas').rglob('*.schema.json'): schema_paths.update([(f'https://hydrilla.koszko.org/schemas/{name}', path) for name, path in schema_paths.items()]) -schemas: dict[Path, dict[str, t.Any]] = {} +schemas: t.Dict[Path, t.Dict[str, t.Any]] = {} class UnknownSchemaError(HaketiloException): pass -def _get_schema(schema_name: str) -> dict[str, t.Any]: +def _get_schema(schema_name: str) -> t.Dict[str, t.Any]: """Return loaded JSON of the requested schema. Cache results.""" path = schema_paths.get(schema_name) if path is None: @@ -142,7 +142,7 @@ def _get_schema(schema_name: str) -> dict[str, t.Any]: return schemas[path] -def validator_for(schema: t.Union[str, dict[str, t.Any]]) -> Draft7Validator: +def validator_for(schema: t.Union[str, t.Dict[str, t.Any]]) -> Draft7Validator: """ Prepare a validator for the provided schema. @@ -163,7 +163,7 @@ def parse_instance(text: str) -> object: """Parse 'text' as JSON with additional '//' comments support.""" return json.loads(strip_json_comments(text)) -InstanceSource = t.Union[Path, str, io.TextIOBase, dict[str, t.Any], bytes] +InstanceSource = t.Union[Path, str, io.TextIOBase, t.Dict[str, t.Any], bytes] def read_instance(instance_or_path: InstanceSource) -> object: """....""" |