dcicutils 8.6.0.1b3__tar.gz → 8.7.0.1b1__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/PKG-INFO +1 -1
- dcicutils-8.7.0.1b1/dcicutils/schema_utils.py +185 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/pyproject.toml +1 -1
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/LICENSE.txt +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/README.rst +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/__init__.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/base.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/beanstalk_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/bundle_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/cloudformation_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/codebuild_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/command_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/common.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/contribution_scripts.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/contribution_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/creds_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/data_readers.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/data_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/deployment_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/diff_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/docker_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/ecr_scripts.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/ecr_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/ecs_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/env_base.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/env_manager.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/env_scripts.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/env_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/env_utils_legacy.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/es_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/exceptions.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/ff_mocks.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/ff_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/function_cache_decorator.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/glacier_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/jh_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/kibana/dashboards.json +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/kibana/readme.md +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/lang_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/license_policies/c4-infrastructure.jsonc +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/license_policies/c4-python-infrastructure.jsonc +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/license_policies/park-lab-common-server.jsonc +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/license_policies/park-lab-common.jsonc +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/license_policies/park-lab-pipeline.jsonc +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/license_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/log_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/misc_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/obfuscation_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/opensearch_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/portal_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/project_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/qa_checkers.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/qa_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/redis_tools.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/redis_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/s3_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/scripts/publish_to_pypi.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/scripts/run_license_checker.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/secrets_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/sheet_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/snapshot_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/ssl_certificate_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/structured_data.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/task_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/tmpfile_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/trace_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/validation_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/variant_utils.py +0 -0
- {dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/zip_utils.py +0 -0
@@ -0,0 +1,185 @@
|
|
1
|
+
from typing import Any, Dict, List
|
2
|
+
|
3
|
+
|
4
|
+
class JsonSchemaConstants:
|
5
|
+
ANY_OF = "anyOf"
|
6
|
+
ARRAY = "array"
|
7
|
+
BOOLEAN = "boolean"
|
8
|
+
DEFAULT = "default"
|
9
|
+
ENUM = "enum"
|
10
|
+
FORMAT = "format"
|
11
|
+
INTEGER = "integer"
|
12
|
+
ITEMS = "items"
|
13
|
+
NUMBER = "number"
|
14
|
+
OBJECT = "object"
|
15
|
+
ONE_OF = "oneOf"
|
16
|
+
PATTERN = "pattern"
|
17
|
+
PROPERTIES = "properties"
|
18
|
+
REF = "$ref"
|
19
|
+
REQUIRED = "required"
|
20
|
+
STRING = "string"
|
21
|
+
TYPE = "type"
|
22
|
+
|
23
|
+
|
24
|
+
class EncodedSchemaConstants:
|
25
|
+
IDENTIFYING_PROPERTIES = "identifyingProperties"
|
26
|
+
LINK_TO = "linkTo"
|
27
|
+
MERGE_REF = "$merge"
|
28
|
+
MIXIN_PROPERTIES = "mixinProperties"
|
29
|
+
UNIQUE_KEY = "uniqueKey"
|
30
|
+
|
31
|
+
|
32
|
+
class SchemaConstants(JsonSchemaConstants, EncodedSchemaConstants):
|
33
|
+
pass
|
34
|
+
|
35
|
+
|
36
|
+
def get_properties(schema: Dict[str, Any]) -> Dict[str, Any]:
|
37
|
+
"""Return the properties of a schema."""
|
38
|
+
return schema.get(SchemaConstants.PROPERTIES, {})
|
39
|
+
|
40
|
+
|
41
|
+
def get_property(schema: Dict[str, Any], property_name: str) -> Dict[str, Any]:
|
42
|
+
"""Return property in properties, if found."""
|
43
|
+
return get_properties(schema).get(property_name, {})
|
44
|
+
|
45
|
+
|
46
|
+
def has_property(schema: Dict[str, Any], property_name: str) -> bool:
|
47
|
+
"""Return True if the schema has the given property."""
|
48
|
+
return property_name in get_properties(schema)
|
49
|
+
|
50
|
+
|
51
|
+
def get_required(schema: Dict[str, Any]) -> List[str]:
|
52
|
+
"""Return the required properties of a schema."""
|
53
|
+
return schema.get(SchemaConstants.REQUIRED, [])
|
54
|
+
|
55
|
+
|
56
|
+
def get_pattern(schema: Dict[str, Any]) -> str:
|
57
|
+
"""Return the pattern property of a schema."""
|
58
|
+
return schema.get(SchemaConstants.PATTERN, "")
|
59
|
+
|
60
|
+
|
61
|
+
def get_any_of(schema: Dict[str, Any]) -> List[Dict[str, Any]]:
|
62
|
+
"""Return the anyOf properties of a schema."""
|
63
|
+
return schema.get(SchemaConstants.ANY_OF, [])
|
64
|
+
|
65
|
+
|
66
|
+
def get_one_of(schema: Dict[str, Any]) -> List[Dict[str, Any]]:
|
67
|
+
"""Return the oneOf properties of a schema."""
|
68
|
+
return schema.get(SchemaConstants.ONE_OF, [])
|
69
|
+
|
70
|
+
|
71
|
+
def get_conditional_required(schema: Dict[str, Any]) -> List[str]:
|
72
|
+
"""Get required + possibly required properties.
|
73
|
+
|
74
|
+
Using heuristics here; update as needed.
|
75
|
+
"""
|
76
|
+
return sorted(
|
77
|
+
list(
|
78
|
+
set(
|
79
|
+
get_required(schema)
|
80
|
+
+ get_any_of_required(schema)
|
81
|
+
+ get_one_of_required(schema)
|
82
|
+
)
|
83
|
+
)
|
84
|
+
)
|
85
|
+
|
86
|
+
|
87
|
+
def get_any_of_required(schema: Dict[str, Any]) -> List[str]:
|
88
|
+
"""Get required properties from anyOf."""
|
89
|
+
return [
|
90
|
+
property_name
|
91
|
+
for any_of_schema in get_any_of(schema)
|
92
|
+
for property_name in get_required(any_of_schema)
|
93
|
+
]
|
94
|
+
|
95
|
+
|
96
|
+
def get_one_of_required(schema: Dict[str, Any]) -> List[str]:
|
97
|
+
"""Get required properties from oneOf."""
|
98
|
+
return [
|
99
|
+
property_name
|
100
|
+
for one_of_schema in get_one_of(schema)
|
101
|
+
for property_name in get_required(one_of_schema)
|
102
|
+
]
|
103
|
+
|
104
|
+
|
105
|
+
def get_mixin_properties(schema: Dict[str, Any]) -> List[Dict[str, Any]]:
|
106
|
+
"""Return the mixin properties of a schema."""
|
107
|
+
return schema.get(SchemaConstants.MIXIN_PROPERTIES, [])
|
108
|
+
|
109
|
+
|
110
|
+
def get_identifying_properties(schema: Dict[str, Any]) -> List[str]:
|
111
|
+
"""Return the identifying properties of a schema."""
|
112
|
+
return schema.get(SchemaConstants.IDENTIFYING_PROPERTIES, [])
|
113
|
+
|
114
|
+
|
115
|
+
def get_schema_type(schema: Dict[str, Any]) -> str:
|
116
|
+
"""Return the type of a schema."""
|
117
|
+
return schema.get(SchemaConstants.TYPE, "")
|
118
|
+
|
119
|
+
|
120
|
+
def is_array_schema(schema: Dict[str, Any]) -> bool:
|
121
|
+
"""Return True if the schema is an array."""
|
122
|
+
return get_schema_type(schema) == SchemaConstants.ARRAY
|
123
|
+
|
124
|
+
|
125
|
+
def is_object_schema(schema: Dict[str, Any]) -> bool:
|
126
|
+
"""Return True if the schema is an object."""
|
127
|
+
return get_schema_type(schema) == SchemaConstants.OBJECT
|
128
|
+
|
129
|
+
|
130
|
+
def is_string_schema(schema: Dict[str, Any]) -> bool:
|
131
|
+
"""Return True if the schema is a string."""
|
132
|
+
return get_schema_type(schema) == SchemaConstants.STRING
|
133
|
+
|
134
|
+
|
135
|
+
def is_number_schema(schema: Dict[str, Any]) -> bool:
|
136
|
+
"""Return True if the schema is a number."""
|
137
|
+
return get_schema_type(schema) == SchemaConstants.NUMBER
|
138
|
+
|
139
|
+
|
140
|
+
def is_integer_schema(schema: Dict[str, Any]) -> bool:
|
141
|
+
"""Return True if the schema is an integer."""
|
142
|
+
return get_schema_type(schema) == SchemaConstants.INTEGER
|
143
|
+
|
144
|
+
|
145
|
+
def is_boolean_schema(schema: Dict[str, Any]) -> bool:
|
146
|
+
"""Return True if the schema is a boolean."""
|
147
|
+
return get_schema_type(schema) == SchemaConstants.BOOLEAN
|
148
|
+
|
149
|
+
|
150
|
+
def get_items(schema: Dict[str, Any]) -> Dict[str, Any]:
|
151
|
+
"""Return the items of a schema."""
|
152
|
+
return schema.get(SchemaConstants.ITEMS, {})
|
153
|
+
|
154
|
+
|
155
|
+
def get_format(schema: Dict[str, Any]) -> str:
|
156
|
+
"""Return the format of a schema."""
|
157
|
+
return schema.get(SchemaConstants.FORMAT, "")
|
158
|
+
|
159
|
+
|
160
|
+
def get_conditional_formats(schema: Dict[str, Any]) -> List[str]:
|
161
|
+
"""Return the format of a schema, as directly given or as listed
|
162
|
+
as an option via oneOf or anyOf.
|
163
|
+
"""
|
164
|
+
formats = set(
|
165
|
+
get_any_of_formats(schema) + get_one_of_formats(schema) + [get_format(schema)]
|
166
|
+
)
|
167
|
+
return sorted(list([format_ for format_ in formats if format_]))
|
168
|
+
|
169
|
+
|
170
|
+
def get_any_of_formats(schema: Dict[str, Any]) -> List[str]:
|
171
|
+
"""Return the formats of a schema's anyOf properties."""
|
172
|
+
return [
|
173
|
+
get_format(any_of_schema)
|
174
|
+
for any_of_schema in get_any_of(schema)
|
175
|
+
if get_format(any_of_schema)
|
176
|
+
]
|
177
|
+
|
178
|
+
|
179
|
+
def get_one_of_formats(schema: Dict[str, Any]) -> List[str]:
|
180
|
+
"""Return the formats of a schema's oneOf properties."""
|
181
|
+
return [
|
182
|
+
get_format(one_of_schema)
|
183
|
+
for one_of_schema in get_one_of(schema)
|
184
|
+
if get_format(one_of_schema)
|
185
|
+
]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "dcicutils"
|
3
|
-
version = "8.
|
3
|
+
version = "8.7.0.1b1" # TODO: To become 8.7.1
|
4
4
|
description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources"
|
5
5
|
authors = ["4DN-DCIC Team <support@4dnucleome.org>"]
|
6
6
|
license = "MIT"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/license_policies/c4-infrastructure.jsonc
RENAMED
File without changes
|
File without changes
|
{dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/license_policies/park-lab-common-server.jsonc
RENAMED
File without changes
|
{dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/license_policies/park-lab-common.jsonc
RENAMED
File without changes
|
{dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc
RENAMED
File without changes
|
{dcicutils-8.6.0.1b3 → dcicutils-8.7.0.1b1}/dcicutils/license_policies/park-lab-pipeline.jsonc
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|