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 CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  __author__ = """NCI"""
4
4
  __email__ = "nci-cidc-tools-admin@mail.nih.gov"
5
- __version__ = "0.27.09"
5
+ __version__ = "0.27.11"
@@ -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
- exec(f"ref_path_pattern = {path}", scope)
110
- ref_path_pattern = scope["ref_path_pattern"]
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nci_cidc_schemas
3
- Version: 0.27.9
3
+ Version: 0.27.11
4
4
  Summary: The CIDC data model and tools for working with it.
5
5
  Home-page: https://github.com/NCI-CIDC/cidc-schemas
6
6
  Author: NCI
@@ -1,7 +1,7 @@
1
- cidc_schemas/__init__.py,sha256=MeM_c2q3soiProYuRKkz2LXkVeABgnSd8bmKvCUheOQ,136
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=nHkSfTmBN7EeTrZVdbb8h6A64lWrJe5z0AIHiIy-YB0,22552
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.9.dist-info/licenses/LICENSE,sha256=zK77-w4rYCZBHAYJEGkcFuPXwKIsP7jMPZ2iQOXjzko,1072
158
- nci_cidc_schemas-0.27.9.dist-info/METADATA,sha256=NUnDS-D4-ulcj0l6fpp2VPhdjOraCbx2h92kOYcuxU4,4553
159
- nci_cidc_schemas-0.27.9.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
160
- nci_cidc_schemas-0.27.9.dist-info/entry_points.txt,sha256=kSyTzXeJQrJp_2ZX0GS_NnbJR8ceQKLBSgER46PM0hs,55
161
- nci_cidc_schemas-0.27.9.dist-info/top_level.txt,sha256=Wwb5Cu7QrnbmSJxI2d00e3-Mir36t0jTRnSulmfhi30,13
162
- nci_cidc_schemas-0.27.9.dist-info/RECORD,,
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,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (79.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any