ogc-na 0.4.2__py3-none-any.whl → 0.4.3__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.
ogc/na/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.4.2'
32
- __version_tuple__ = version_tuple = (0, 4, 2)
31
+ __version__ = version = '0.4.3'
32
+ __version_tuple__ = version_tuple = (0, 4, 3)
33
33
 
34
34
  __commit_id__ = commit_id = None
ogc/na/annotate_schema.py CHANGED
@@ -609,7 +609,8 @@ class SchemaAnnotator:
609
609
 
610
610
  return used_terms
611
611
 
612
- def process_subschema(subschema, context_stack, from_schema: ReferencedSchema, level=1) -> Iterable[str]:
612
+ def process_subschema(subschema, context_stack, from_schema: ReferencedSchema, level=1,
613
+ in_defs=False) -> Iterable[str]:
613
614
  if not subschema or not isinstance(subschema, dict):
614
615
  return ()
615
616
 
@@ -620,7 +621,8 @@ class SchemaAnnotator:
620
621
  defs = subschema.get(p)
621
622
  if defs and isinstance(defs, dict):
622
623
  for entry in defs.values():
623
- used_terms.update(process_subschema(entry, context_stack, from_schema, level + 1))
624
+ # Do not add to used_terms if only used in $defs
625
+ process_subschema(entry, context_stack, from_schema, level + 1, in_defs=True)
624
626
 
625
627
  if '$ref' in subschema and id(subschema) not in updated_refs:
626
628
  if self._ref_mapper:
@@ -628,8 +630,10 @@ class SchemaAnnotator:
628
630
  if subschema['$ref'].startswith('#/') or subschema['$ref'].startswith(f"{from_schema.location}#/"):
629
631
  target_schema = self.schema_resolver.resolve_schema(subschema['$ref'], from_schema)
630
632
  if target_schema:
631
- used_terms.update(process_subschema(target_schema.subschema, context_stack,
632
- target_schema, level + 1))
633
+ new_terms = process_subschema(target_schema.subschema, context_stack,
634
+ target_schema, level + 1, in_defs=in_defs)
635
+ if not in_defs:
636
+ used_terms.update(new_terms)
633
637
  updated_refs.add(id(subschema))
634
638
 
635
639
  # Annotate oneOf, allOf, anyOf
@@ -637,16 +641,22 @@ class SchemaAnnotator:
637
641
  collection = subschema.get(p)
638
642
  if collection and isinstance(collection, list):
639
643
  for entry in collection:
640
- used_terms.update(process_subschema(entry, context_stack, from_schema, level + 1))
644
+ new_terms = process_subschema(entry, context_stack, from_schema, level + 1, in_defs=in_defs)
645
+ if not in_defs:
646
+ used_terms.update(new_terms)
641
647
 
642
648
  for p in ('then', 'else', 'additionalProperties'):
643
649
  branch = subschema.get(p)
644
650
  if branch and isinstance(branch, dict):
645
- used_terms.update(process_subschema(branch, context_stack, from_schema, level))
651
+ new_terms = process_subschema(branch, context_stack, from_schema, level, in_defs=in_defs)
652
+ if not in_defs:
653
+ used_terms.update(new_terms)
646
654
 
647
655
  for pp in subschema.get('patternProperties', {}).values():
648
656
  if pp and isinstance(pp, dict):
649
- used_terms.update(process_subschema(pp, context_stack, from_schema, level + 1))
657
+ new_terms = process_subschema(pp, context_stack, from_schema, level + 1, in_defs=in_defs)
658
+ if not in_defs:
659
+ used_terms.update(new_terms)
650
660
 
651
661
  # Annotate main schema
652
662
  schema_type = subschema.get('type')
@@ -657,7 +667,10 @@ class SchemaAnnotator:
657
667
  used_terms.update(process_properties(subschema, context_stack, from_schema, level + 1))
658
668
  elif schema_type == 'array':
659
669
  for k in ('prefixItems', 'items', 'contains'):
660
- used_terms.update(process_subschema(subschema.get(k), context_stack, from_schema, level + 1))
670
+ new_terms = process_subschema(subschema.get(k), context_stack, from_schema, level + 1,
671
+ in_defs=in_defs)
672
+ if not in_defs:
673
+ used_terms.update(new_terms)
661
674
 
662
675
  # Get prefixes
663
676
  for p, bu in subschema.get(ANNOTATION_PREFIXES, {}).items():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ogc_na
3
- Version: 0.4.2
3
+ Version: 0.4.3
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
  License-Expression: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  ogc/na/__init__.py,sha256=uzcNiJ3uKFNJ1HBfKxIwgAy2HMUFsLAe5RkrUg8ncac,464
2
- ogc/na/_version.py,sha256=A45grTqzrHuDn1CT9K5GVUbY4_Q3OSTcXAl3zdHzcEI,704
3
- ogc/na/annotate_schema.py,sha256=qCQJnm-e-OlLANRc1Tq1lMKmBEYgFLvQqOBz2kNn8c0,43910
2
+ ogc/na/_version.py,sha256=bmI9ViMEsJ1Rjce-6ExwiNh2B7sZKTyBkze4k8NsTrU,704
3
+ ogc/na/annotate_schema.py,sha256=MYXYzmFDua0DjOxccmGTAFHDS3T7U01jNv-u001ytj4,44584
4
4
  ogc/na/domain_config.py,sha256=ORzITa1rTrD1MQdpWYrIVW5SwSa9lJd3hnyHIxNgiIU,13947
5
5
  ogc/na/download.py,sha256=2afrLyl4WsAlxkCgXsl47fs9mNKfDmhVpeT2iwNSoq0,3354
6
6
  ogc/na/exceptions.py,sha256=cwvnq79ih90T9lfwJww0zOx_QwuICaUvlo3Mc8m8ouA,85
@@ -16,8 +16,8 @@ ogc/na/input_filters/__init__.py,sha256=AhE7n_yECwxFKwOM3Jc0ft96TtF5i_Z-fHrS4HYO
16
16
  ogc/na/input_filters/csv.py,sha256=nFfB1XQF_QApcGGzMqEvzD_b3pBtCtsfUECsZ9UGE6s,2616
17
17
  ogc/na/input_filters/xlsx.py,sha256=X9EpFgC9WwHQD8iUJRGdaDYfgiLKjXPdhTVhDmNPAQ0,2730
18
18
  ogc/na/input_filters/xml.py,sha256=9qYjp_w5JLInFM48zB15IYH9eTafjp1Aqd_8kfuW3aA,2074
19
- ogc_na-0.4.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
20
- ogc_na-0.4.2.dist-info/METADATA,sha256=ARd3I_Gq1d9d3wyZw0oPl-9NK_ruTEJsiYWNgFq82OY,3917
21
- ogc_na-0.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- ogc_na-0.4.2.dist-info/top_level.txt,sha256=Kvy3KhzcIhNPT4_nZuJCmS946ptRr_MDyU4IIhZJhCY,4
23
- ogc_na-0.4.2.dist-info/RECORD,,
19
+ ogc_na-0.4.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
20
+ ogc_na-0.4.3.dist-info/METADATA,sha256=kdSKsp_WMZhKj6lKJAg85TnyPf7sXzHVvfuGRij2bPA,3917
21
+ ogc_na-0.4.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
+ ogc_na-0.4.3.dist-info/top_level.txt,sha256=Kvy3KhzcIhNPT4_nZuJCmS946ptRr_MDyU4IIhZJhCY,4
23
+ ogc_na-0.4.3.dist-info/RECORD,,
File without changes