dapla-toolbelt-metadata 0.4.2__py3-none-any.whl → 0.6.0__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 dapla-toolbelt-metadata might be problematic. Click here for more details.
- dapla_metadata/__init__.py +9 -0
- dapla_metadata/dapla/__init__.py +4 -0
- dapla_metadata/{_shared → dapla}/user_info.py +66 -20
- dapla_metadata/datasets/code_list.py +1 -1
- dapla_metadata/datasets/core.py +1 -1
- dapla_metadata/datasets/dapla_dataset_path_info.py +128 -14
- dapla_metadata/datasets/dataset_parser.py +21 -15
- dapla_metadata/datasets/model_backwards_compatibility.py +6 -6
- dapla_metadata/datasets/model_validation.py +2 -2
- dapla_metadata/datasets/utility/constants.py +1 -0
- dapla_metadata/datasets/utility/enums.py +1 -1
- dapla_metadata/datasets/utility/utils.py +8 -12
- dapla_metadata/standards/__init__.py +4 -0
- dapla_metadata/standards/name_validator.py +250 -0
- dapla_metadata/standards/standard_validators.py +98 -0
- dapla_metadata/standards/utils/__init__.py +1 -0
- dapla_metadata/standards/utils/constants.py +49 -0
- dapla_metadata/variable_definitions/__init__.py +5 -3
- dapla_metadata/variable_definitions/{generated → _generated}/.openapi-generator/FILES +0 -5
- dapla_metadata/variable_definitions/_generated/.openapi-generator/VERSION +1 -0
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/__init__.py +0 -5
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api/__init__.py +0 -1
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api/data_migration_api.py +2 -2
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api/draft_variable_definitions_api.py +14 -14
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api/patches_api.py +15 -15
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api/validity_periods_api.py +8 -281
- dapla_metadata/variable_definitions/{generated/vardef_client/api/public_api.py → _generated/vardef_client/api/variable_definitions_api.py} +73 -358
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/__init__.py +2 -6
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/complete_response.py +8 -32
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/contact.py +2 -2
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/draft.py +8 -23
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/language_string_type.py +7 -6
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/owner.py +2 -2
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/patch.py +16 -61
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/problem.py +2 -2
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/update_draft.py +22 -55
- dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/models/validity_period.py +14 -48
- dapla_metadata/variable_definitions/_generated/vardef_client/models/variable_status.py +33 -0
- dapla_metadata/variable_definitions/_utils/__init__.py +1 -0
- dapla_metadata/variable_definitions/{_client.py → _utils/_client.py} +5 -3
- dapla_metadata/variable_definitions/{config.py → _utils/config.py} +25 -1
- dapla_metadata/variable_definitions/_utils/constants.py +41 -0
- dapla_metadata/variable_definitions/_utils/descriptions.py +89 -0
- dapla_metadata/variable_definitions/_utils/files.py +273 -0
- dapla_metadata/variable_definitions/_utils/template_files.py +112 -0
- dapla_metadata/variable_definitions/_utils/variable_definition_files.py +93 -0
- dapla_metadata/variable_definitions/exceptions.py +141 -11
- dapla_metadata/variable_definitions/resources/vardef_model_descriptions_nb.yaml +63 -0
- dapla_metadata/variable_definitions/vardef.py +131 -10
- dapla_metadata/variable_definitions/variable_definition.py +251 -43
- {dapla_toolbelt_metadata-0.4.2.dist-info → dapla_toolbelt_metadata-0.6.0.dist-info}/METADATA +8 -10
- dapla_toolbelt_metadata-0.6.0.dist-info/RECORD +89 -0
- {dapla_toolbelt_metadata-0.4.2.dist-info → dapla_toolbelt_metadata-0.6.0.dist-info}/WHEEL +1 -1
- dapla_metadata/variable_definitions/generated/.openapi-generator/VERSION +0 -1
- dapla_metadata/variable_definitions/generated/vardef_client/api/variable_definitions_api.py +0 -1205
- dapla_metadata/variable_definitions/generated/vardef_client/models/klass_reference.py +0 -99
- dapla_metadata/variable_definitions/generated/vardef_client/models/rendered_contact.py +0 -92
- dapla_metadata/variable_definitions/generated/vardef_client/models/rendered_variable_definition.py +0 -235
- dapla_metadata/variable_definitions/generated/vardef_client/models/supported_languages.py +0 -33
- dapla_metadata/variable_definitions/generated/vardef_client/models/variable_status.py +0 -33
- dapla_toolbelt_metadata-0.4.2.dist-info/RECORD +0 -81
- /dapla_metadata/variable_definitions/{generated → _generated}/.openapi-generator-ignore +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/README.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/__init__.py +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api_client.py +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api_response.py +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/configuration.py +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/CompleteResponse.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/Contact.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/DataMigrationApi.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/Draft.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/DraftVariableDefinitionsApi.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/LanguageStringType.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/Owner.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/Patch.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/PatchesApi.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/PublicApi.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/SupportedLanguages.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/UpdateDraft.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/ValidityPeriod.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/ValidityPeriodsApi.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/VariableDefinitionsApi.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/docs/VariableStatus.md +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/exceptions.py +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/py.typed +0 -0
- /dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/rest.py +0 -0
- {dapla_toolbelt_metadata-0.4.2.dist-info → dapla_toolbelt_metadata-0.6.0.dist-info}/LICENSE +0 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import logging
|
|
3
|
+
import os
|
|
4
|
+
import re
|
|
5
|
+
from collections.abc import AsyncGenerator
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from dapla_metadata.datasets.dapla_dataset_path_info import DaplaDatasetPathInfo
|
|
9
|
+
from dapla_metadata.datasets.dataset_parser import SUPPORTED_DATASET_FILE_SUFFIXES
|
|
10
|
+
from dapla_metadata.standards.utils.constants import FILE_DOES_NOT_EXIST
|
|
11
|
+
from dapla_metadata.standards.utils.constants import FILE_IGNORED
|
|
12
|
+
from dapla_metadata.standards.utils.constants import IGNORED_FOLDERS
|
|
13
|
+
from dapla_metadata.standards.utils.constants import INVALID_SYMBOLS
|
|
14
|
+
from dapla_metadata.standards.utils.constants import MISSING_DATA_STATE
|
|
15
|
+
from dapla_metadata.standards.utils.constants import MISSING_DATASET_SHORT_NAME
|
|
16
|
+
from dapla_metadata.standards.utils.constants import MISSING_PERIOD
|
|
17
|
+
from dapla_metadata.standards.utils.constants import MISSING_SHORT_NAME
|
|
18
|
+
from dapla_metadata.standards.utils.constants import MISSING_VERSION
|
|
19
|
+
from dapla_metadata.standards.utils.constants import NAME_STANDARD_SUCCESS
|
|
20
|
+
from dapla_metadata.standards.utils.constants import NAME_STANDARD_VIOLATION
|
|
21
|
+
from dapla_metadata.standards.utils.constants import PATH_IGNORED
|
|
22
|
+
from dapla_metadata.standards.utils.constants import SSB_NAMING_STANDARD_REPORT
|
|
23
|
+
from dapla_metadata.standards.utils.constants import SSB_NAMING_STANDARD_REPORT_FILES
|
|
24
|
+
from dapla_metadata.standards.utils.constants import (
|
|
25
|
+
SSB_NAMING_STANDARD_REPORT_RESULT_AVERAGE,
|
|
26
|
+
)
|
|
27
|
+
from dapla_metadata.standards.utils.constants import (
|
|
28
|
+
SSB_NAMING_STANDARD_REPORT_RESULT_BEST,
|
|
29
|
+
)
|
|
30
|
+
from dapla_metadata.standards.utils.constants import (
|
|
31
|
+
SSB_NAMING_STANDARD_REPORT_RESULT_GOOD,
|
|
32
|
+
)
|
|
33
|
+
from dapla_metadata.standards.utils.constants import (
|
|
34
|
+
SSB_NAMING_STANDARD_REPORT_RESULT_LOW,
|
|
35
|
+
)
|
|
36
|
+
from dapla_metadata.standards.utils.constants import (
|
|
37
|
+
SSB_NAMING_STANDARD_REPORT_RESULT_NO_SCORE,
|
|
38
|
+
)
|
|
39
|
+
from dapla_metadata.standards.utils.constants import SSB_NAMING_STANDARD_REPORT_SUCCESS
|
|
40
|
+
from dapla_metadata.standards.utils.constants import (
|
|
41
|
+
SSB_NAMING_STANDARD_REPORT_SUCCESS_RATE,
|
|
42
|
+
)
|
|
43
|
+
from dapla_metadata.standards.utils.constants import (
|
|
44
|
+
SSB_NAMING_STANDARD_REPORT_VIOLATIONS,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
logger = logging.getLogger(__name__)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class ValidationResult:
|
|
51
|
+
"""Result object for name standard validation."""
|
|
52
|
+
|
|
53
|
+
def __init__(
|
|
54
|
+
self,
|
|
55
|
+
success: bool,
|
|
56
|
+
file_path: str,
|
|
57
|
+
) -> None:
|
|
58
|
+
"""Initialize the validatation result."""
|
|
59
|
+
self.success = success
|
|
60
|
+
self.file_path = file_path
|
|
61
|
+
self.messages: list[str] = []
|
|
62
|
+
self.violations: list[str] = []
|
|
63
|
+
|
|
64
|
+
def add_message(self, message: str) -> None:
|
|
65
|
+
"""Add message to list."""
|
|
66
|
+
if message not in self.messages:
|
|
67
|
+
self.messages.append(message)
|
|
68
|
+
|
|
69
|
+
def add_violation(self, violation: str) -> None:
|
|
70
|
+
"""Add violation to list."""
|
|
71
|
+
if violation not in self.violations:
|
|
72
|
+
self.violations.append(violation)
|
|
73
|
+
if self.success:
|
|
74
|
+
self.success = False
|
|
75
|
+
|
|
76
|
+
def __repr__(self) -> str:
|
|
77
|
+
"""Representation for debugging."""
|
|
78
|
+
return f"ValidationResult(success={self.success}, file_path={self.file_path}, messages={self.messages}, violations={self.violations})"
|
|
79
|
+
|
|
80
|
+
def to_dict(self) -> dict:
|
|
81
|
+
"""Return result as a dictionary."""
|
|
82
|
+
return {
|
|
83
|
+
"success": self.success,
|
|
84
|
+
"file_path": self.file_path,
|
|
85
|
+
"messages": self.messages,
|
|
86
|
+
"violations": self.violations,
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class NamingStandardReport:
|
|
91
|
+
"""Report object for name standard validation."""
|
|
92
|
+
|
|
93
|
+
def __init__(self, validation_results: list[ValidationResult]) -> None:
|
|
94
|
+
"""Initialize the naming standard report."""
|
|
95
|
+
self.validation_results = validation_results
|
|
96
|
+
self.num_files_validated = len(validation_results)
|
|
97
|
+
self.num_success = len(
|
|
98
|
+
[result for result in validation_results if result.success is True],
|
|
99
|
+
)
|
|
100
|
+
self.num_failures = len(
|
|
101
|
+
[result for result in validation_results if result.success is False],
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
def generate_report(self) -> str:
|
|
105
|
+
"""Format the report as a string."""
|
|
106
|
+
return (
|
|
107
|
+
f"{SSB_NAMING_STANDARD_REPORT}\n"
|
|
108
|
+
f"=============================\n"
|
|
109
|
+
f"{self.evaluate_result()}"
|
|
110
|
+
f"{SSB_NAMING_STANDARD_REPORT_SUCCESS_RATE}: {self.success_rate():.2f}%\n"
|
|
111
|
+
f"{SSB_NAMING_STANDARD_REPORT_FILES}: {self.num_files_validated}\n"
|
|
112
|
+
f"{SSB_NAMING_STANDARD_REPORT_SUCCESS}: {self.num_success}\n"
|
|
113
|
+
f"{SSB_NAMING_STANDARD_REPORT_VIOLATIONS}s: {self.num_failures}\n"
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
def success_rate(self) -> int | float | None:
|
|
117
|
+
"""Calculate the success rate as a percentage.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
int | float | None: The success rate as a percentage, or None if
|
|
121
|
+
no files were validated.
|
|
122
|
+
"""
|
|
123
|
+
if self.num_files_validated == 0:
|
|
124
|
+
return None
|
|
125
|
+
return self.num_success / self.num_files_validated * 100
|
|
126
|
+
|
|
127
|
+
def evaluate_result(self) -> str:
|
|
128
|
+
"""Returns an appropriate message based on the success rate."""
|
|
129
|
+
rate = self.success_rate()
|
|
130
|
+
if rate is not None:
|
|
131
|
+
if rate == 100:
|
|
132
|
+
return SSB_NAMING_STANDARD_REPORT_RESULT_BEST
|
|
133
|
+
if 70 < rate < 100:
|
|
134
|
+
return SSB_NAMING_STANDARD_REPORT_RESULT_GOOD
|
|
135
|
+
if 40 <= rate <= 70:
|
|
136
|
+
return SSB_NAMING_STANDARD_REPORT_RESULT_AVERAGE
|
|
137
|
+
if rate < 40:
|
|
138
|
+
return SSB_NAMING_STANDARD_REPORT_RESULT_LOW
|
|
139
|
+
return SSB_NAMING_STANDARD_REPORT_RESULT_NO_SCORE
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def _has_invalid_symbols(path: os.PathLike[str]) -> bool:
|
|
143
|
+
"""Return True if string contains illegal symbols.
|
|
144
|
+
|
|
145
|
+
Examples:
|
|
146
|
+
>>> _has_invalid_symbols("åregang-øre")
|
|
147
|
+
True
|
|
148
|
+
|
|
149
|
+
>>> _has_invalid_symbols("Azor89")
|
|
150
|
+
False
|
|
151
|
+
|
|
152
|
+
>>> _has_invalid_symbols("ssbÆ-dapla-example-data-produkt-prod/ledstill/oppdrag/skjema_p2018_p2020_v1")
|
|
153
|
+
True
|
|
154
|
+
|
|
155
|
+
>>> _has_invalid_symbols("ssb-dapla-example-data-produkt-prod/ledstill/oppdrag/skjema_p2018_p2020_v1")
|
|
156
|
+
False
|
|
157
|
+
|
|
158
|
+
>>> _has_invalid_symbols("ssb-dapla-example-data-produkt-prod/ledstill/inndata/skjema_p2018_p202_v1/aar=2018/data.parquet")
|
|
159
|
+
False
|
|
160
|
+
"""
|
|
161
|
+
# TODO @mmwinther: The = symbol is allowed to avoid failures on subdirectories of partioned parquet datasets.
|
|
162
|
+
# DPMETA-824
|
|
163
|
+
return bool(re.search(r"[^a-zA-Z0-9\./:_\-=]", str(path).strip()))
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def _check_violations(
|
|
167
|
+
file: Path,
|
|
168
|
+
) -> list[str]:
|
|
169
|
+
"""Check for missing attributes and invalid symbols."""
|
|
170
|
+
path_info = DaplaDatasetPathInfo(file)
|
|
171
|
+
checks = {
|
|
172
|
+
MISSING_SHORT_NAME: path_info.statistic_short_name,
|
|
173
|
+
MISSING_DATA_STATE: path_info.dataset_state,
|
|
174
|
+
MISSING_PERIOD: path_info.contains_data_from,
|
|
175
|
+
MISSING_DATASET_SHORT_NAME: path_info.dataset_short_name,
|
|
176
|
+
MISSING_VERSION: path_info.dataset_version,
|
|
177
|
+
INVALID_SYMBOLS: not _has_invalid_symbols(file),
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return [message for message, value in checks.items() if not value]
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
async def _validate_file(
|
|
184
|
+
file: Path,
|
|
185
|
+
check_file_exists: bool = False,
|
|
186
|
+
) -> ValidationResult:
|
|
187
|
+
"""Check for naming standard violations.
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
A ValidationResult object containing messages and violations
|
|
191
|
+
"""
|
|
192
|
+
logger.info("Validating file: %s", file)
|
|
193
|
+
if file.suffix not in SUPPORTED_DATASET_FILE_SUFFIXES:
|
|
194
|
+
logger.info("Skipping validation on non-dataset file: %s", file)
|
|
195
|
+
return await _ignored_file_type_result(file)
|
|
196
|
+
|
|
197
|
+
result = ValidationResult(success=True, file_path=str(file))
|
|
198
|
+
|
|
199
|
+
if check_file_exists and not file.exists():
|
|
200
|
+
result.add_message(
|
|
201
|
+
FILE_DOES_NOT_EXIST,
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
result.violations = await asyncio.get_running_loop().run_in_executor(
|
|
205
|
+
None,
|
|
206
|
+
lambda: _check_violations(file),
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
if result.violations:
|
|
210
|
+
result.success = False
|
|
211
|
+
result.add_message(NAME_STANDARD_VIOLATION)
|
|
212
|
+
else:
|
|
213
|
+
result.success = True
|
|
214
|
+
result.add_message(
|
|
215
|
+
NAME_STANDARD_SUCCESS,
|
|
216
|
+
)
|
|
217
|
+
return result
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
async def _ignored_folder_result(file: Path) -> ValidationResult:
|
|
221
|
+
r = ValidationResult(success=True, file_path=str(file))
|
|
222
|
+
r.add_message(PATH_IGNORED)
|
|
223
|
+
return r
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
async def _ignored_file_type_result(file: Path) -> ValidationResult:
|
|
227
|
+
r = ValidationResult(success=True, file_path=str(file))
|
|
228
|
+
r.add_message(FILE_IGNORED)
|
|
229
|
+
return r
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
async def validate_directory(
|
|
233
|
+
path: Path,
|
|
234
|
+
) -> AsyncGenerator[AsyncGenerator | asyncio.Task]:
|
|
235
|
+
"""Validate a file or recursively validate all files in a directory."""
|
|
236
|
+
if set(path.parts).intersection(IGNORED_FOLDERS):
|
|
237
|
+
logger.info("File path ignored: %s", path)
|
|
238
|
+
yield asyncio.create_task(_ignored_folder_result(path))
|
|
239
|
+
elif path.suffix:
|
|
240
|
+
yield asyncio.create_task(_validate_file(path, check_file_exists=True))
|
|
241
|
+
else:
|
|
242
|
+
for obj in await asyncio.get_running_loop().run_in_executor(
|
|
243
|
+
None,
|
|
244
|
+
lambda: path.glob("*"),
|
|
245
|
+
):
|
|
246
|
+
if obj.suffix:
|
|
247
|
+
yield asyncio.create_task(_validate_file(obj), name=obj.name)
|
|
248
|
+
else:
|
|
249
|
+
logger.debug("Recursing into: %s", obj)
|
|
250
|
+
yield validate_directory(obj)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import logging
|
|
3
|
+
import os
|
|
4
|
+
import time
|
|
5
|
+
from collections.abc import AsyncGenerator
|
|
6
|
+
|
|
7
|
+
from dapla_metadata.datasets.utility.utils import normalize_path
|
|
8
|
+
from dapla_metadata.standards.name_validator import NamingStandardReport
|
|
9
|
+
from dapla_metadata.standards.name_validator import ValidationResult
|
|
10
|
+
from dapla_metadata.standards.name_validator import validate_directory
|
|
11
|
+
|
|
12
|
+
logger = logging.getLogger(__name__)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
async def check_naming_standard(
|
|
16
|
+
file_path: str | os.PathLike[str],
|
|
17
|
+
) -> list[ValidationResult]:
|
|
18
|
+
"""Check whether a given path follows the SSB naming standard.
|
|
19
|
+
|
|
20
|
+
This function checks whether the provided `file_path` and subdirectories thereof comply
|
|
21
|
+
with the naming standard. Currently we only examine '.parquet' files. Other files are ignored.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
file_path: The path to a bucket, directory, or specific file to validate.
|
|
25
|
+
This can be in the following forms:
|
|
26
|
+
- A bucket URL in the form 'gs://ssb-dapla-felles-data-produkt-test'
|
|
27
|
+
- An absolute path to a mounted bucket in the form '/buckets/produkt'
|
|
28
|
+
- Any subdirectory or file thereof
|
|
29
|
+
We also accept paths which don't yet exist so that you can test if a path will comply.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
list[ValidationResult]: A list of validation results,
|
|
33
|
+
including success status, checked file path, messages, and any detected violations.
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
>>> check_naming_standard("/data/example_file.parquet").success
|
|
37
|
+
False
|
|
38
|
+
|
|
39
|
+
>>> check_naming_standard("/buckets/produkt/datadoc/utdata/person_data_p2021_v2.parquet").success
|
|
40
|
+
True
|
|
41
|
+
"""
|
|
42
|
+
results = []
|
|
43
|
+
|
|
44
|
+
# Begin validation.
|
|
45
|
+
# For each file this returns a task which we can wait on to complete.
|
|
46
|
+
# For each directory this returns another AsyncGenerator which must be unpacked below
|
|
47
|
+
tasks = [t async for t in validate_directory(normalize_path(str(file_path)))] # type:ignore [arg-type]
|
|
48
|
+
|
|
49
|
+
# 5 minute timeout for safety
|
|
50
|
+
start_time = time.time()
|
|
51
|
+
while time.time() < start_time + (5 * 60):
|
|
52
|
+
for item in tasks:
|
|
53
|
+
if isinstance(item, AsyncGenerator):
|
|
54
|
+
# Drill down into lower directories to get the validation tasks from them
|
|
55
|
+
tasks.remove(item)
|
|
56
|
+
new_tasks = [t async for t in item]
|
|
57
|
+
logger.debug("New Tasks: %s %s", len(new_tasks), new_tasks)
|
|
58
|
+
tasks.extend(
|
|
59
|
+
new_tasks,
|
|
60
|
+
)
|
|
61
|
+
elif isinstance(item, asyncio.Task):
|
|
62
|
+
if item.done():
|
|
63
|
+
logger.info("Validated %s", item.get_name())
|
|
64
|
+
tasks.remove(item)
|
|
65
|
+
results.append(item.result())
|
|
66
|
+
|
|
67
|
+
logger.debug("Tasks: %s %s", len(tasks), tasks)
|
|
68
|
+
logger.debug("Results: %s", len(results))
|
|
69
|
+
|
|
70
|
+
if len(tasks) == 0:
|
|
71
|
+
logger.info("Completed validation")
|
|
72
|
+
break
|
|
73
|
+
|
|
74
|
+
# Allow time for other processing to be performed
|
|
75
|
+
await asyncio.sleep(0.001)
|
|
76
|
+
|
|
77
|
+
return results
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def generate_validation_report(
|
|
81
|
+
validation_results: list[ValidationResult],
|
|
82
|
+
) -> NamingStandardReport:
|
|
83
|
+
"""Generate and print a formatted naming standard validation report.
|
|
84
|
+
|
|
85
|
+
This function takes a list of `ValidationResult` objects, creates a
|
|
86
|
+
`NamingStandardReport` instance, and prints the generated report.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
validation_results: A list of ValidationResult objects that
|
|
90
|
+
contain the outcomes of the name standard checks.
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
NamingStandardReport: An instance of `NamingStandardReport` containing
|
|
94
|
+
the validation results.
|
|
95
|
+
"""
|
|
96
|
+
report = NamingStandardReport(validation_results=validation_results)
|
|
97
|
+
print(report.generate_report()) # noqa: T201
|
|
98
|
+
return report
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Utils for validating ssb standards."""
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Constants used in validate ssb name standard."""
|
|
2
|
+
|
|
3
|
+
from dapla_metadata.datasets.dataset_parser import SUPPORTED_DATASET_FILE_SUFFIXES
|
|
4
|
+
|
|
5
|
+
SUCCESS = "Suksess"
|
|
6
|
+
|
|
7
|
+
NAME_STANDARD_SUCCESS = "Filene dine er i samsvar med SSB-navnestandarden"
|
|
8
|
+
|
|
9
|
+
NAME_STANDARD_VIOLATION = "Det er oppdaget brudd på SSB-navnestandard:"
|
|
10
|
+
|
|
11
|
+
MISSING_BUCKET_NAME = "Filnavn mangler bøttenavn ref: https://manual.dapla.ssb.no/statistikkere/navnestandard.html#obligatoriske-mapper"
|
|
12
|
+
MISSING_VERSION = "Filnavn mangler versjon ref: https://manual.dapla.ssb.no/statistikkere/navnestandard.html#filnavn"
|
|
13
|
+
MISSING_PERIOD = "Filnavn mangler gyldighetsperiode ref: https://manual.dapla.ssb.no/statistikkere/navnestandard.html#filnavn"
|
|
14
|
+
MISSING_SHORT_NAME = "Kortnavn for statistikk mangler ref: https://manual.dapla.ssb.no/statistikkere/navnestandard.html#obligatoriske-mapper"
|
|
15
|
+
MISSING_DATA_STATE = "Mappe for datatilstand mangler ref: https://manual.dapla.ssb.no/statistikkere/navnestandard.html#obligatoriske-mapper"
|
|
16
|
+
MISSING_DATASET_SHORT_NAME = "Filnavn mangler datasett kortnavn ref: https://manual.dapla.ssb.no/statistikkere/navnestandard.html#filnavn"
|
|
17
|
+
|
|
18
|
+
INVALID_SYMBOLS = "Filnavn inneholder ulovlige tegn ref: https://manual.dapla.ssb.no/statistikkere/navnestandard.html#filnavn"
|
|
19
|
+
|
|
20
|
+
PATH_IGNORED = "Ignorert, mappen er ikke underlagt krav til navnestandard."
|
|
21
|
+
FILE_IGNORED = f"Ignorert, kun datasett med {', '.join(SUPPORTED_DATASET_FILE_SUFFIXES.keys())} filendelser valideres foreløpig."
|
|
22
|
+
|
|
23
|
+
FILE_DOES_NOT_EXIST = "Filen eksisterer ikke. Validerer uansett."
|
|
24
|
+
|
|
25
|
+
BUCKET_NAME_UNKNOWN = "Kan ikke validere bøttenavn"
|
|
26
|
+
|
|
27
|
+
SSB_NAMING_STANDARD_REPORT = "SSB navnestandard rapport"
|
|
28
|
+
SSB_NAMING_STANDARD_REPORT_SUCCESS_RATE = "Suksess rate"
|
|
29
|
+
SSB_NAMING_STANDARD_REPORT_RESULT_BEST = "🚀 Fantastisk! Alt bestått! 🎉\n"
|
|
30
|
+
SSB_NAMING_STANDARD_REPORT_RESULT_GOOD = (
|
|
31
|
+
"✅ Bra jobba! Fortsatt litt rom for forbedring. 😊\n"
|
|
32
|
+
)
|
|
33
|
+
SSB_NAMING_STANDARD_REPORT_RESULT_AVERAGE = (
|
|
34
|
+
"⚠️ Ikke verst! Men det er noen feil å fikse. 🔧\n"
|
|
35
|
+
)
|
|
36
|
+
SSB_NAMING_STANDARD_REPORT_RESULT_LOW = "❌ Mye å forbedre! Ta en grundig sjekk. 🛠️\n"
|
|
37
|
+
SSB_NAMING_STANDARD_REPORT_RESULT_NO_SCORE = "👀 Ingen filer ble validert\n"
|
|
38
|
+
SSB_NAMING_STANDARD_REPORT_FILES = "Antall filer validert"
|
|
39
|
+
SSB_NAMING_STANDARD_REPORT_SUCCESS = "Antall filer som følger SSB navnestandard"
|
|
40
|
+
SSB_NAMING_STANDARD_REPORT_VIOLATIONS = "Antall filer som bryter SSB navnestandard"
|
|
41
|
+
|
|
42
|
+
IGNORED_FOLDERS = [
|
|
43
|
+
"temp",
|
|
44
|
+
"oppdrag",
|
|
45
|
+
"konfigurasjon",
|
|
46
|
+
"logg",
|
|
47
|
+
"tidsserier",
|
|
48
|
+
"migrert",
|
|
49
|
+
]
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"""Client for working with Variable Definitions at Statistics Norway."""
|
|
2
2
|
|
|
3
|
-
from .
|
|
4
|
-
from .
|
|
3
|
+
from ._generated.vardef_client import models
|
|
4
|
+
from ._generated.vardef_client.exceptions import * # noqa: F403
|
|
5
|
+
from .exceptions import VardefClientError
|
|
6
|
+
from .exceptions import VardefFileError
|
|
7
|
+
from .exceptions import VariableNotFoundError
|
|
5
8
|
from .vardef import Vardef
|
|
6
|
-
from .variable_definition import CompletePatchOutput
|
|
7
9
|
from .variable_definition import VariableDefinition
|
|
@@ -2,21 +2,16 @@ vardef_client/api/__init__.py
|
|
|
2
2
|
vardef_client/api/data_migration_api.py
|
|
3
3
|
vardef_client/api/draft_variable_definitions_api.py
|
|
4
4
|
vardef_client/api/patches_api.py
|
|
5
|
-
vardef_client/api/public_api.py
|
|
6
5
|
vardef_client/api/validity_periods_api.py
|
|
7
6
|
vardef_client/api/variable_definitions_api.py
|
|
8
7
|
vardef_client/models/__init__.py
|
|
9
8
|
vardef_client/models/complete_response.py
|
|
10
9
|
vardef_client/models/contact.py
|
|
11
10
|
vardef_client/models/draft.py
|
|
12
|
-
vardef_client/models/klass_reference.py
|
|
13
11
|
vardef_client/models/language_string_type.py
|
|
14
12
|
vardef_client/models/owner.py
|
|
15
13
|
vardef_client/models/patch.py
|
|
16
14
|
vardef_client/models/problem.py
|
|
17
|
-
vardef_client/models/rendered_contact.py
|
|
18
|
-
vardef_client/models/rendered_variable_definition.py
|
|
19
|
-
vardef_client/models/supported_languages.py
|
|
20
15
|
vardef_client/models/update_draft.py
|
|
21
16
|
vardef_client/models/validity_period.py
|
|
22
17
|
vardef_client/models/variable_status.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7.11.0
|
|
@@ -20,7 +20,6 @@ __version__ = "1.0.0"
|
|
|
20
20
|
from .api.data_migration_api import DataMigrationApi
|
|
21
21
|
from .api.draft_variable_definitions_api import DraftVariableDefinitionsApi
|
|
22
22
|
from .api.patches_api import PatchesApi
|
|
23
|
-
from .api.public_api import PublicApi
|
|
24
23
|
from .api.validity_periods_api import ValidityPeriodsApi
|
|
25
24
|
from .api.variable_definitions_api import VariableDefinitionsApi
|
|
26
25
|
|
|
@@ -39,14 +38,10 @@ from .exceptions import ApiException
|
|
|
39
38
|
from .models.complete_response import CompleteResponse
|
|
40
39
|
from .models.contact import Contact
|
|
41
40
|
from .models.draft import Draft
|
|
42
|
-
from .models.klass_reference import KlassReference
|
|
43
41
|
from .models.language_string_type import LanguageStringType
|
|
44
42
|
from .models.owner import Owner
|
|
45
43
|
from .models.patch import Patch
|
|
46
44
|
from .models.problem import Problem
|
|
47
|
-
from .models.rendered_contact import RenderedContact
|
|
48
|
-
from .models.rendered_variable_definition import RenderedVariableDefinition
|
|
49
|
-
from .models.supported_languages import SupportedLanguages
|
|
50
45
|
from .models.update_draft import UpdateDraft
|
|
51
46
|
from .models.validity_period import ValidityPeriod
|
|
52
47
|
from .models.variable_status import VariableStatus
|
|
@@ -4,6 +4,5 @@
|
|
|
4
4
|
from ..api.data_migration_api import DataMigrationApi
|
|
5
5
|
from ..api.draft_variable_definitions_api import DraftVariableDefinitionsApi
|
|
6
6
|
from ..api.patches_api import PatchesApi
|
|
7
|
-
from ..api.public_api import PublicApi
|
|
8
7
|
from ..api.validity_periods_api import ValidityPeriodsApi
|
|
9
8
|
from ..api.variable_definitions_api import VariableDefinitionsApi
|
dapla_metadata/variable_definitions/{generated → _generated}/vardef_client/api/data_migration_api.py
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""Variable Definitions
|
|
1
|
+
"""Internal Variable Definitions Administration API
|
|
2
2
|
|
|
3
|
-
## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`.
|
|
3
|
+
## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
|
|
4
4
|
|
|
5
5
|
The version of the OpenAPI document: 0.1
|
|
6
6
|
Contact: metadata@ssb.no
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""Variable Definitions
|
|
1
|
+
"""Internal Variable Definitions Administration API
|
|
2
2
|
|
|
3
|
-
## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`.
|
|
3
|
+
## Introduction Variable Definitions are centralized definitions of concrete variables which are typically present in multiple datasets. Variable Definitions support standardization of data and metadata and facilitate sharing and joining of data by clarifying when variables have an identical definition. ## Maintenance of Variable Definitions This API allows for creation, maintenance and access of Variable Definitions. ### Ownership Creation and maintenance of variables may only be performed by Statistics Norway employees representing a specific Dapla team, who are defined as the owners of a given Variable Definition. The team an owner represents must be specified when making a request through the `active_group` query parameter. All maintenance is to be performed by the owners, with no intervention from administrators. ### Status All Variable Definitions have an associated status. The possible values for status are `DRAFT`, `PUBLISHED_INTERNAL` and `PUBLISHED_EXTERNAL`. #### Draft When a Variable Definition is created it is assigned the status `DRAFT`. Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Mutable (it may be changed directly without need for versioning). - Not suitable to refer to from other systems. This status may be changed to `PUBLISHED_INTERNAL` or `PUBLISHED_EXTERNAL` with a direct update. #### Published Internal Under this status the Variable Definition is: - Only visible to Statistics Norway employees. - Immutable (all changes are versioned). - Suitable to refer to in internal systems for statistics production. - Not suitable to refer to for external use (for example in Statistikkbanken). This status may be changed to `PUBLISHED_EXTERNAL` by creating a Patch version. #### Published External Under this status the Variable Definition is: - Visible to the general public. - Immutable (all changes are versioned). - Suitable to refer to from any system. This status may not be changed as it would break immutability. If a Variable Definition is no longer relevant then its period of validity should be ended by specifying a `valid_until` date in a Patch version. ### Immutability Variable Definitions are immutable. This means that any changes must be performed in a strict versioning system. Consumers can avoid being exposed to breaking changes by specifying a `date_of_validity` when they request a Variable Definition. #### Patches Patches are for changes which do not affect the fundamental meaning of the Variable Definition. #### Validity Periods Validity Periods are versions with a period defined by a `valid_from` date and optionally a `valid_until` date. If the fundamental meaning of a Variable Definition is to be changed, it should be done by creating a new Validity Period.
|
|
4
4
|
|
|
5
5
|
The version of the OpenAPI document: 0.1
|
|
6
6
|
Contact: metadata@ssb.no
|
|
@@ -46,7 +46,7 @@ class DraftVariableDefinitionsApi:
|
|
|
46
46
|
StrictStr,
|
|
47
47
|
Field(description="The group which the user currently represents."),
|
|
48
48
|
],
|
|
49
|
-
draft: Draft,
|
|
49
|
+
draft: Draft | None = None,
|
|
50
50
|
_request_timeout: None
|
|
51
51
|
| Annotated[StrictFloat, Field(gt=0)]
|
|
52
52
|
| tuple[
|
|
@@ -63,7 +63,7 @@ class DraftVariableDefinitionsApi:
|
|
|
63
63
|
|
|
64
64
|
:param active_group: The group which the user currently represents. (required)
|
|
65
65
|
:type active_group: str
|
|
66
|
-
:param draft:
|
|
66
|
+
:param draft:
|
|
67
67
|
:type draft: Draft
|
|
68
68
|
:param _request_timeout: timeout setting for this request. If one
|
|
69
69
|
number provided, it will be total request
|
|
@@ -117,7 +117,7 @@ class DraftVariableDefinitionsApi:
|
|
|
117
117
|
StrictStr,
|
|
118
118
|
Field(description="The group which the user currently represents."),
|
|
119
119
|
],
|
|
120
|
-
draft: Draft,
|
|
120
|
+
draft: Draft | None = None,
|
|
121
121
|
_request_timeout: None
|
|
122
122
|
| Annotated[StrictFloat, Field(gt=0)]
|
|
123
123
|
| tuple[
|
|
@@ -134,7 +134,7 @@ class DraftVariableDefinitionsApi:
|
|
|
134
134
|
|
|
135
135
|
:param active_group: The group which the user currently represents. (required)
|
|
136
136
|
:type active_group: str
|
|
137
|
-
:param draft:
|
|
137
|
+
:param draft:
|
|
138
138
|
:type draft: Draft
|
|
139
139
|
:param _request_timeout: timeout setting for this request. If one
|
|
140
140
|
number provided, it will be total request
|
|
@@ -188,7 +188,7 @@ class DraftVariableDefinitionsApi:
|
|
|
188
188
|
StrictStr,
|
|
189
189
|
Field(description="The group which the user currently represents."),
|
|
190
190
|
],
|
|
191
|
-
draft: Draft,
|
|
191
|
+
draft: Draft | None = None,
|
|
192
192
|
_request_timeout: None
|
|
193
193
|
| Annotated[StrictFloat, Field(gt=0)]
|
|
194
194
|
| tuple[
|
|
@@ -205,7 +205,7 @@ class DraftVariableDefinitionsApi:
|
|
|
205
205
|
|
|
206
206
|
:param active_group: The group which the user currently represents. (required)
|
|
207
207
|
:type active_group: str
|
|
208
|
-
:param draft:
|
|
208
|
+
:param draft:
|
|
209
209
|
:type draft: Draft
|
|
210
210
|
:param _request_timeout: timeout setting for this request. If one
|
|
211
211
|
number provided, it will be total request
|
|
@@ -615,7 +615,7 @@ class DraftVariableDefinitionsApi:
|
|
|
615
615
|
StrictStr,
|
|
616
616
|
Field(description="The group which the user currently represents."),
|
|
617
617
|
],
|
|
618
|
-
update_draft: UpdateDraft,
|
|
618
|
+
update_draft: UpdateDraft | None = None,
|
|
619
619
|
_request_timeout: None
|
|
620
620
|
| Annotated[StrictFloat, Field(gt=0)]
|
|
621
621
|
| tuple[
|
|
@@ -634,7 +634,7 @@ class DraftVariableDefinitionsApi:
|
|
|
634
634
|
:type variable_definition_id: str
|
|
635
635
|
:param active_group: The group which the user currently represents. (required)
|
|
636
636
|
:type active_group: str
|
|
637
|
-
:param update_draft:
|
|
637
|
+
:param update_draft:
|
|
638
638
|
:type update_draft: UpdateDraft
|
|
639
639
|
:param _request_timeout: timeout setting for this request. If one
|
|
640
640
|
number provided, it will be total request
|
|
@@ -695,7 +695,7 @@ class DraftVariableDefinitionsApi:
|
|
|
695
695
|
StrictStr,
|
|
696
696
|
Field(description="The group which the user currently represents."),
|
|
697
697
|
],
|
|
698
|
-
update_draft: UpdateDraft,
|
|
698
|
+
update_draft: UpdateDraft | None = None,
|
|
699
699
|
_request_timeout: None
|
|
700
700
|
| Annotated[StrictFloat, Field(gt=0)]
|
|
701
701
|
| tuple[
|
|
@@ -714,7 +714,7 @@ class DraftVariableDefinitionsApi:
|
|
|
714
714
|
:type variable_definition_id: str
|
|
715
715
|
:param active_group: The group which the user currently represents. (required)
|
|
716
716
|
:type active_group: str
|
|
717
|
-
:param update_draft:
|
|
717
|
+
:param update_draft:
|
|
718
718
|
:type update_draft: UpdateDraft
|
|
719
719
|
:param _request_timeout: timeout setting for this request. If one
|
|
720
720
|
number provided, it will be total request
|
|
@@ -775,7 +775,7 @@ class DraftVariableDefinitionsApi:
|
|
|
775
775
|
StrictStr,
|
|
776
776
|
Field(description="The group which the user currently represents."),
|
|
777
777
|
],
|
|
778
|
-
update_draft: UpdateDraft,
|
|
778
|
+
update_draft: UpdateDraft | None = None,
|
|
779
779
|
_request_timeout: None
|
|
780
780
|
| Annotated[StrictFloat, Field(gt=0)]
|
|
781
781
|
| tuple[
|
|
@@ -794,7 +794,7 @@ class DraftVariableDefinitionsApi:
|
|
|
794
794
|
:type variable_definition_id: str
|
|
795
795
|
:param active_group: The group which the user currently represents. (required)
|
|
796
796
|
:type active_group: str
|
|
797
|
-
:param update_draft:
|
|
797
|
+
:param update_draft:
|
|
798
798
|
:type update_draft: UpdateDraft
|
|
799
799
|
:param _request_timeout: timeout setting for this request. If one
|
|
800
800
|
number provided, it will be total request
|