nci-cidc-schemas 0.27.9__py2.py3-none-any.whl → 0.27.11__py2.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 nci-cidc-schemas might be problematic. Click here for more details.
- cidc_schemas/__init__.py +1 -1
- cidc_schemas/json_validation.py +20 -3
- {nci_cidc_schemas-0.27.9.dist-info → nci_cidc_schemas-0.27.11.dist-info}/METADATA +1 -1
- {nci_cidc_schemas-0.27.9.dist-info → nci_cidc_schemas-0.27.11.dist-info}/RECORD +8 -8
- {nci_cidc_schemas-0.27.9.dist-info → nci_cidc_schemas-0.27.11.dist-info}/WHEEL +1 -1
- {nci_cidc_schemas-0.27.9.dist-info → nci_cidc_schemas-0.27.11.dist-info}/entry_points.txt +0 -0
- {nci_cidc_schemas-0.27.9.dist-info → nci_cidc_schemas-0.27.11.dist-info}/licenses/LICENSE +0 -0
- {nci_cidc_schemas-0.27.9.dist-info → nci_cidc_schemas-0.27.11.dist-info}/top_level.txt +0 -0
cidc_schemas/__init__.py
CHANGED
cidc_schemas/json_validation.py
CHANGED
|
@@ -7,6 +7,7 @@ import copy
|
|
|
7
7
|
import functools
|
|
8
8
|
import json
|
|
9
9
|
import collections.abc
|
|
10
|
+
import logging
|
|
10
11
|
from contextlib import contextmanager
|
|
11
12
|
from typing import Optional, Callable, Union
|
|
12
13
|
|
|
@@ -19,6 +20,8 @@ from jsonpointer import resolve_pointer
|
|
|
19
20
|
from .constants import SCHEMA_DIR, METASCHEMA_PATH
|
|
20
21
|
from .util import JSON
|
|
21
22
|
|
|
23
|
+
logger = logging.getLogger("cidc_schemas.json_validation")
|
|
24
|
+
|
|
22
25
|
|
|
23
26
|
class InDocRefNotFoundError(ValidationError):
|
|
24
27
|
pass
|
|
@@ -106,8 +109,23 @@ class _Validator(jsonschema.Draft7Validator):
|
|
|
106
109
|
if "matched_paths" in search:
|
|
107
110
|
for path in search["matched_paths"]:
|
|
108
111
|
scope = {"root": self.schema}
|
|
109
|
-
|
|
110
|
-
|
|
112
|
+
try:
|
|
113
|
+
ref_path_pattern = eval(path, scope)
|
|
114
|
+
except Exception as e:
|
|
115
|
+
raise RuntimeError(
|
|
116
|
+
f"Failed to evaluate in_doc_ref_pattern at path '{path}': {e}"
|
|
117
|
+
) from e
|
|
118
|
+
|
|
119
|
+
# protect against None cache
|
|
120
|
+
if self._in_doc_refs_cache is None:
|
|
121
|
+
logger.info(f"_in_doc_refs_cache: {self._in_doc_refs_cache}")
|
|
122
|
+
logger.info(f"scope '{scope}'")
|
|
123
|
+
logger.info(
|
|
124
|
+
"Internal error: _in_doc_refs_cache is None when trying to build cache. "
|
|
125
|
+
"This usually means the validation context was improperly set up."
|
|
126
|
+
)
|
|
127
|
+
self._in_doc_refs_cache = dict()
|
|
128
|
+
|
|
111
129
|
# If there are no cached values for this ref path pattern, collect them
|
|
112
130
|
if ref_path_pattern not in self._in_doc_refs_cache:
|
|
113
131
|
self._in_doc_refs_cache[ref_path_pattern] = (
|
|
@@ -116,7 +134,6 @@ class _Validator(jsonschema.Draft7Validator):
|
|
|
116
134
|
)
|
|
117
135
|
)
|
|
118
136
|
|
|
119
|
-
# see: https://docs.python.org/3/library/contextlib.html
|
|
120
137
|
try:
|
|
121
138
|
yield
|
|
122
139
|
finally:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
cidc_schemas/__init__.py,sha256
|
|
1
|
+
cidc_schemas/__init__.py,sha256=-TeAdsv6UvdB1rya3Sr7iATm0GVGUoRZsooOLXQi0Zg,136
|
|
2
2
|
cidc_schemas/cli.py,sha256=gWiktRlraNH8Q0zNUae9dohKjPwBmcY0BJwdcQ_fIic,4099
|
|
3
3
|
cidc_schemas/constants.py,sha256=RULs7pGuBAVq1teXymrfbVsK23ZowJvLuZlv0KcjL-Y,698
|
|
4
|
-
cidc_schemas/json_validation.py,sha256=
|
|
4
|
+
cidc_schemas/json_validation.py,sha256=gH72JylIdFIZ1eNQaKja0nh9playSRVWt3DEeiFnmyc,23298
|
|
5
5
|
cidc_schemas/migrations.py,sha256=Amg_T4cFgMzySD7yNnT_PWpqP7hwlTWGeHlI_RSXuRI,14766
|
|
6
6
|
cidc_schemas/template.py,sha256=uvQNbkvusMq9D_1cnUMxT7j7Rf-iqq7o5nuZUhCaXY0,51428
|
|
7
7
|
cidc_schemas/template_reader.py,sha256=xXtLRKu1y4FrPj8RgyGOmB2hlsCDXcuvMBWami2_jV8,13119
|
|
@@ -154,9 +154,9 @@ cidc_schemas/schemas/templates/manifests/tissue_slide_template.json,sha256=q2GmO
|
|
|
154
154
|
cidc_schemas/schemas/templates/manifests/tumor_normal_pairing_template.json,sha256=lVJrGb28n-vyfjGBzhrzjn1lMKw1b4HXXmWtwA603v0,2797
|
|
155
155
|
cidc_schemas/schemas/templates/manifests/tumor_tissue_dna_template.json,sha256=LpaoDXDS11NCa-Dv37N-tzEGomswQrx5fypkUcG7xJk,18956
|
|
156
156
|
cidc_schemas/schemas/templates/manifests/tumor_tissue_rna_template.json,sha256=-gww6NCHbtbI5z7UmNSmKyPK3IqKCE8F6n4XwTAb_gk,18101
|
|
157
|
-
nci_cidc_schemas-0.27.
|
|
158
|
-
nci_cidc_schemas-0.27.
|
|
159
|
-
nci_cidc_schemas-0.27.
|
|
160
|
-
nci_cidc_schemas-0.27.
|
|
161
|
-
nci_cidc_schemas-0.27.
|
|
162
|
-
nci_cidc_schemas-0.27.
|
|
157
|
+
nci_cidc_schemas-0.27.11.dist-info/licenses/LICENSE,sha256=zK77-w4rYCZBHAYJEGkcFuPXwKIsP7jMPZ2iQOXjzko,1072
|
|
158
|
+
nci_cidc_schemas-0.27.11.dist-info/METADATA,sha256=YdvvEgREhuErbyOhogD-38VvaePlYjTr9SElWiv1WcA,4554
|
|
159
|
+
nci_cidc_schemas-0.27.11.dist-info/WHEEL,sha256=AeO2BvogYWm3eGaHCvhzmUYt8ia7KfURiHzO_1atlys,109
|
|
160
|
+
nci_cidc_schemas-0.27.11.dist-info/entry_points.txt,sha256=kSyTzXeJQrJp_2ZX0GS_NnbJR8ceQKLBSgER46PM0hs,55
|
|
161
|
+
nci_cidc_schemas-0.27.11.dist-info/top_level.txt,sha256=Wwb5Cu7QrnbmSJxI2d00e3-Mir36t0jTRnSulmfhi30,13
|
|
162
|
+
nci_cidc_schemas-0.27.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|