ogc-na 0.3.52__py3-none-any.whl → 0.3.54__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ogc-na might be problematic. Click here for more details.
- ogc/na/_version.py +2 -2
- ogc/na/annotate_schema.py +24 -10
- ogc/na/exceptions.py +6 -0
- {ogc_na-0.3.52.dist-info → ogc_na-0.3.54.dist-info}/METADATA +1 -1
- {ogc_na-0.3.52.dist-info → ogc_na-0.3.54.dist-info}/RECORD +7 -6
- {ogc_na-0.3.52.dist-info → ogc_na-0.3.54.dist-info}/WHEEL +1 -1
- {ogc_na-0.3.52.dist-info → ogc_na-0.3.54.dist-info}/top_level.txt +0 -0
ogc/na/_version.py
CHANGED
ogc/na/annotate_schema.py
CHANGED
|
@@ -132,6 +132,7 @@ import jsonpointer
|
|
|
132
132
|
import jsonschema
|
|
133
133
|
import requests_cache
|
|
134
134
|
|
|
135
|
+
from ogc.na.exceptions import ContextLoadError, SchemaLoadError
|
|
135
136
|
from ogc.na.util import is_url, load_yaml, LRUCache, dump_yaml, \
|
|
136
137
|
merge_contexts, merge_dicts, dict_contains, JSON_LD_KEYWORDS
|
|
137
138
|
|
|
@@ -200,8 +201,11 @@ class SchemaResolver:
|
|
|
200
201
|
"""
|
|
201
202
|
contents = self._schema_cache.get(s)
|
|
202
203
|
if contents is None:
|
|
203
|
-
|
|
204
|
-
|
|
204
|
+
try:
|
|
205
|
+
contents = read_contents(s)[0]
|
|
206
|
+
self._schema_cache[s] = contents
|
|
207
|
+
except Exception as e:
|
|
208
|
+
raise SchemaLoadError(f'Error loading schema from schema source "{s}"') from e
|
|
205
209
|
return load_json_yaml(contents)
|
|
206
210
|
|
|
207
211
|
def resolve_ref(self, ref: str | Path, from_schema: ReferencedSchema | None = None) -> tuple[Path | str, str]:
|
|
@@ -257,7 +261,10 @@ class SchemaResolver:
|
|
|
257
261
|
if force_contents:
|
|
258
262
|
is_json = False
|
|
259
263
|
if isinstance(force_contents, str):
|
|
260
|
-
|
|
264
|
+
try:
|
|
265
|
+
contents = load_yaml(content=force_contents)
|
|
266
|
+
except Exception as e:
|
|
267
|
+
raise SchemaLoadError('Error loading schema from string contents') from e
|
|
261
268
|
else:
|
|
262
269
|
contents = force_contents
|
|
263
270
|
else:
|
|
@@ -394,13 +401,20 @@ def resolve_context(ctx: Path | str | dict | list, expand_uris=True) -> Resolved
|
|
|
394
401
|
def resolve_inner(inner_ctx, ctx_stack=None) -> ResolvedContext | None:
|
|
395
402
|
resolved = None
|
|
396
403
|
if isinstance(inner_ctx, Path) or (isinstance(inner_ctx, str) and not is_url(inner_ctx)):
|
|
397
|
-
|
|
404
|
+
try:
|
|
405
|
+
resolved = resolve_context(load_yaml(filename=ctx).get('@context'))
|
|
406
|
+
except Exception as e:
|
|
407
|
+
raise ContextLoadError(f'Error resolving context document in file "{ctx}"') from e
|
|
398
408
|
elif isinstance(inner_ctx, str):
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
409
|
+
try:
|
|
410
|
+
r = requests_session.get(ctx)
|
|
411
|
+
r.raise_for_status()
|
|
412
|
+
fetched = r.json().get('@context')
|
|
413
|
+
if fetched:
|
|
414
|
+
resolved = resolve_context(fetched)
|
|
415
|
+
except Exception as e:
|
|
416
|
+
raise ContextLoadError(f'Error resolving context document at URL "{ctx}"') from e
|
|
417
|
+
|
|
404
418
|
elif isinstance(inner_ctx, Sequence):
|
|
405
419
|
resolved_ctx = {}
|
|
406
420
|
inner_prefixes = {}
|
|
@@ -740,7 +754,7 @@ class ContextBuilder:
|
|
|
740
754
|
if isinstance(prop_context.get('@id'), str):
|
|
741
755
|
self.visited_properties[full_property_path_str] = prop_context['@id']
|
|
742
756
|
self._missed_properties[full_property_path_str] = False
|
|
743
|
-
if prop_context['@id']
|
|
757
|
+
if prop_context['@id'] in ('@nest', '@graph'):
|
|
744
758
|
merge_contexts(onto_context, process_subschema(prop_val, from_schema, full_property_path))
|
|
745
759
|
else:
|
|
746
760
|
merge_contexts(prop_context['@context'],
|
ogc/na/exceptions.py
ADDED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ogc_na
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.54
|
|
4
4
|
Summary: OGC Naming Authority tools
|
|
5
5
|
Author-email: Rob Atkinson <ratkinson@ogc.org>, Piotr Zaborowski <pzaborowski@ogc.org>, Alejandro Villar <avillar@ogc.org>
|
|
6
6
|
Project-URL: Homepage, https://github.com/opengeospatial/ogc-na-tools/
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
ogc/na/__init__.py,sha256=uzcNiJ3uKFNJ1HBfKxIwgAy2HMUFsLAe5RkrUg8ncac,464
|
|
2
|
-
ogc/na/_version.py,sha256=
|
|
3
|
-
ogc/na/annotate_schema.py,sha256=
|
|
2
|
+
ogc/na/_version.py,sha256=SIFfx0lgwTvAnd4cHgyIUN7PZREZhiGdTDRtpq4_MAM,413
|
|
3
|
+
ogc/na/annotate_schema.py,sha256=cjKZPKNOEUSghcQH9qCOiE2-Evr0VFyYMN2NkUMz5wo,42647
|
|
4
4
|
ogc/na/domain_config.py,sha256=ORzITa1rTrD1MQdpWYrIVW5SwSa9lJd3hnyHIxNgiIU,13947
|
|
5
5
|
ogc/na/download.py,sha256=2afrLyl4WsAlxkCgXsl47fs9mNKfDmhVpeT2iwNSoq0,3354
|
|
6
|
+
ogc/na/exceptions.py,sha256=cwvnq79ih90T9lfwJww0zOx_QwuICaUvlo3Mc8m8ouA,85
|
|
6
7
|
ogc/na/gsp.py,sha256=KGa2G9i8kPefYTHNPUDoXnNyF7Tiwt8K__Ew_Qa7eeg,6048
|
|
7
8
|
ogc/na/ingest_json.py,sha256=OUA9IfSpBbwE6bNE2od64iMzdEg-Q4h5iyowgJsn2M4,35659
|
|
8
9
|
ogc/na/models.py,sha256=nGV8EALtXvmBtkUbu0FA4KOgwNUqQGWIDuMo7UGOKP8,652
|
|
@@ -14,7 +15,7 @@ ogc/na/validation.py,sha256=5xjHH55NZKM8HtUk8XgVzm8W5ZlZY00u_qsWfXK_8dM,3732
|
|
|
14
15
|
ogc/na/input_filters/__init__.py,sha256=AhE7n_yECwxFKwOM3Jc0ft96TtF5i_Z-fHrS4HYOjaE,1179
|
|
15
16
|
ogc/na/input_filters/csv.py,sha256=nFfB1XQF_QApcGGzMqEvzD_b3pBtCtsfUECsZ9UGE6s,2616
|
|
16
17
|
ogc/na/input_filters/xml.py,sha256=9qYjp_w5JLInFM48zB15IYH9eTafjp1Aqd_8kfuW3aA,2074
|
|
17
|
-
ogc_na-0.3.
|
|
18
|
-
ogc_na-0.3.
|
|
19
|
-
ogc_na-0.3.
|
|
20
|
-
ogc_na-0.3.
|
|
18
|
+
ogc_na-0.3.54.dist-info/METADATA,sha256=udHRdqATRi60hCfDejn_rgBXVpp5z76Ln_yJWFto_3s,3829
|
|
19
|
+
ogc_na-0.3.54.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
20
|
+
ogc_na-0.3.54.dist-info/top_level.txt,sha256=Kvy3KhzcIhNPT4_nZuJCmS946ptRr_MDyU4IIhZJhCY,4
|
|
21
|
+
ogc_na-0.3.54.dist-info/RECORD,,
|
|
File without changes
|