dcicutils 8.7.0.1b3__py3-none-any.whl → 8.7.0.1b4__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.
- dcicutils/portal_utils.py +17 -0
- {dcicutils-8.7.0.1b3.dist-info → dcicutils-8.7.0.1b4.dist-info}/METADATA +1 -1
- {dcicutils-8.7.0.1b3.dist-info → dcicutils-8.7.0.1b4.dist-info}/RECORD +6 -6
- {dcicutils-8.7.0.1b3.dist-info → dcicutils-8.7.0.1b4.dist-info}/LICENSE.txt +0 -0
- {dcicutils-8.7.0.1b3.dist-info → dcicutils-8.7.0.1b4.dist-info}/WHEEL +0 -0
- {dcicutils-8.7.0.1b3.dist-info → dcicutils-8.7.0.1b4.dist-info}/entry_points.txt +0 -0
dcicutils/portal_utils.py
CHANGED
@@ -257,11 +257,28 @@ class Portal:
|
|
257
257
|
def schema_name(name: str) -> str:
|
258
258
|
return to_camel_case(name if not name.endswith(".json") else name[:-5]) if isinstance(name, str) else ""
|
259
259
|
|
260
|
+
def is_schema_type(self, value: dict, schema_type: str) -> bool:
|
261
|
+
"""
|
262
|
+
Returns True iff the given object isa type of the given schema type.
|
263
|
+
"""
|
264
|
+
if isinstance(value, dict) and (value_types := value.get("@type")):
|
265
|
+
if isinstance(value_types, str):
|
266
|
+
return self.is_specified_schema(value_types, schema_type)
|
267
|
+
elif isinstance(value_types, list):
|
268
|
+
for value_type in value_types:
|
269
|
+
if self.is_specified_schema(value_type, schema_type):
|
270
|
+
return True
|
271
|
+
return False
|
272
|
+
|
260
273
|
def is_specified_schema(self, schema_name: str, schema_type: str) -> bool:
|
261
274
|
"""
|
262
275
|
Returns True iff the given schema name isa type of the given schema type name,
|
263
276
|
i.e. has an ancestor which is of type that given type.
|
264
277
|
"""
|
278
|
+
schema_name = self.schema_name(schema_name)
|
279
|
+
schema_type = self.schema_name(schema_type)
|
280
|
+
if schema_name == schema_type:
|
281
|
+
return True
|
265
282
|
if super_type_map := self.get_schemas_super_type_map():
|
266
283
|
if super_type := super_type_map.get(schema_type):
|
267
284
|
return self.schema_name(schema_name) in super_type
|
@@ -43,7 +43,7 @@ dcicutils/log_utils.py,sha256=7pWMc6vyrorUZQf-V-M3YC6zrPgNhuV_fzm9xqTPph0,10883
|
|
43
43
|
dcicutils/misc_utils.py,sha256=bMRWWxdbhuF3PKdCZEH-H4U1ecgT3Nag3EL92D9XGoY,100973
|
44
44
|
dcicutils/obfuscation_utils.py,sha256=fo2jOmDRC6xWpYX49u80bVNisqRRoPskFNX3ymFAmjw,5963
|
45
45
|
dcicutils/opensearch_utils.py,sha256=V2exmFYW8Xl2_pGFixF4I2Cc549Opwe4PhFi5twC0M8,1017
|
46
|
-
dcicutils/portal_utils.py,sha256=
|
46
|
+
dcicutils/portal_utils.py,sha256=e7MnUbEXNOS-_NiCV4Xod3BT_K1Cy-crsRAqZdG_sXo,22528
|
47
47
|
dcicutils/project_utils.py,sha256=qPdCaFmWUVBJw4rw342iUytwdQC0P-XKpK4mhyIulMM,31250
|
48
48
|
dcicutils/qa_checkers.py,sha256=cdXjeL0jCDFDLT8VR8Px78aS10hwNISOO5G_Zv2TZ6M,20534
|
49
49
|
dcicutils/qa_utils.py,sha256=TT0SiJWiuxYvbsIyhK9VO4uV_suxhB6CpuC4qPacCzQ,160208
|
@@ -64,8 +64,8 @@ dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
|
|
64
64
|
dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
|
65
65
|
dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
|
66
66
|
dcicutils/zip_utils.py,sha256=rnjNv_k6L9jT2SjDSgVXp4BEJYLtz9XN6Cl2Fy-tqnM,2027
|
67
|
-
dcicutils-8.7.0.
|
68
|
-
dcicutils-8.7.0.
|
69
|
-
dcicutils-8.7.0.
|
70
|
-
dcicutils-8.7.0.
|
71
|
-
dcicutils-8.7.0.
|
67
|
+
dcicutils-8.7.0.1b4.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
|
68
|
+
dcicutils-8.7.0.1b4.dist-info/METADATA,sha256=Fc1lyyT3RwFRF93kxrHZ-j8zGImaJktcCUQno5PTXRs,3314
|
69
|
+
dcicutils-8.7.0.1b4.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
70
|
+
dcicutils-8.7.0.1b4.dist-info/entry_points.txt,sha256=8wbw5csMIgBXhkwfgsgJeuFcoUc0WsucUxmOyml2aoA,209
|
71
|
+
dcicutils-8.7.0.1b4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|