otlmow-template 0.11rc2__py3-none-any.whl → 0.11rc4__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.
- otlmow_template/SubsetTemplateCreator.py +79 -49
- {otlmow_template-0.11rc2.dist-info → otlmow_template-0.11rc4.dist-info}/METADATA +1 -1
- {otlmow_template-0.11rc2.dist-info → otlmow_template-0.11rc4.dist-info}/RECORD +6 -6
- {otlmow_template-0.11rc2.dist-info → otlmow_template-0.11rc4.dist-info}/LICENSE +0 -0
- {otlmow_template-0.11rc2.dist-info → otlmow_template-0.11rc4.dist-info}/WHEEL +0 -0
- {otlmow_template-0.11rc2.dist-info → otlmow_template-0.11rc4.dist-info}/top_level.txt +0 -0
|
@@ -97,6 +97,7 @@ class SubsetTemplateCreator:
|
|
|
97
97
|
continue
|
|
98
98
|
for _ in range(generate_dummy_records):
|
|
99
99
|
instance = dynamic_create_instance_from_uri(class_object.objectUri, model_directory=model_directory)
|
|
100
|
+
await sleep(0)
|
|
100
101
|
if instance is None:
|
|
101
102
|
continue
|
|
102
103
|
attributen = collector.find_attributes_by_class(class_object)
|
|
@@ -112,6 +113,7 @@ class SubsetTemplateCreator:
|
|
|
112
113
|
|
|
113
114
|
DotnotationHelper.clear_list_of_list_attributes(instance)
|
|
114
115
|
|
|
116
|
+
await sleep(0)
|
|
115
117
|
converter = OtlmowConverter()
|
|
116
118
|
await converter.from_objects_to_file(file_path=temporary_path,
|
|
117
119
|
sequence_of_objects=otl_objects, **kwargs)
|
|
@@ -146,10 +148,13 @@ class SubsetTemplateCreator:
|
|
|
146
148
|
if generate_choice_list:
|
|
147
149
|
await sleep(0)
|
|
148
150
|
await cls.add_choice_list_excel(workbook=wb, instantiated_attributes=instantiated_attributes,
|
|
149
|
-
path_to_subset=path_to_subset)
|
|
151
|
+
path_to_subset=path_to_subset, add_attribute_info=add_attribute_info)
|
|
152
|
+
await sleep(0)
|
|
153
|
+
cls.add_mock_data_excel(workbook=wb, rows_of_examples=amount_of_examples) # remove dummy rows if needed
|
|
154
|
+
|
|
155
|
+
await cls.custom_exel_fixes(workbook=wb, instantiated_attributes=instantiated_attributes,
|
|
156
|
+
add_attribute_info=add_attribute_info)
|
|
150
157
|
await sleep(0)
|
|
151
|
-
cls.add_mock_data_excel(workbook=wb, rows_of_examples=amount_of_examples)
|
|
152
|
-
await cls.add_type_uri_choice_list_in_excel(workbook=wb, instantiated_attributes=instantiated_attributes)
|
|
153
158
|
if highlight_deprecated_attributes:
|
|
154
159
|
await sleep(0)
|
|
155
160
|
cls.check_for_deprecated_attributes(workbook=wb, instantiated_attributes=instantiated_attributes)
|
|
@@ -157,8 +162,6 @@ class SubsetTemplateCreator:
|
|
|
157
162
|
await sleep(0)
|
|
158
163
|
await cls.add_attribute_info_excel(workbook=wb, instantiated_attributes=instantiated_attributes)
|
|
159
164
|
await sleep(0)
|
|
160
|
-
await cls.design_workbook_excel(workbook=wb)
|
|
161
|
-
await sleep(0)
|
|
162
165
|
wb.save(path_to_template_file_and_extension)
|
|
163
166
|
file_location = os.path.dirname(temporary_path)
|
|
164
167
|
[f.unlink() for f in Path(file_location).glob("*") if f.is_file()]
|
|
@@ -196,55 +199,78 @@ class SubsetTemplateCreator:
|
|
|
196
199
|
|
|
197
200
|
@classmethod
|
|
198
201
|
@async_to_sync_wraps
|
|
199
|
-
async def add_type_uri_choice_list_in_excel(cls,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
break
|
|
210
|
-
if type_uri_found:
|
|
202
|
+
async def add_type_uri_choice_list_in_excel(cls, sheet, instantiated_attributes, add_attribute_info: bool):
|
|
203
|
+
starting_row = '3' if add_attribute_info else '2'
|
|
204
|
+
await sleep(0)
|
|
205
|
+
if sheet.title == 'Keuzelijsten':
|
|
206
|
+
return
|
|
207
|
+
type_uri_found = False
|
|
208
|
+
for row in sheet.iter_rows(min_row=1, max_row=1):
|
|
209
|
+
for cell in row:
|
|
210
|
+
if cell.value == 'typeURI':
|
|
211
|
+
type_uri_found = True
|
|
211
212
|
break
|
|
212
|
-
if
|
|
213
|
-
|
|
213
|
+
if type_uri_found:
|
|
214
|
+
break
|
|
215
|
+
if not type_uri_found:
|
|
216
|
+
return
|
|
214
217
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
possible_classes = [x for x in instantiated_attributes if x.typeURI.endswith(subclass_name)]
|
|
225
|
-
if len(possible_classes) == 1:
|
|
226
|
-
type_uri = possible_classes[0].typeURI
|
|
227
|
-
|
|
228
|
-
if type_uri == '':
|
|
229
|
-
continue
|
|
218
|
+
await sleep(0)
|
|
219
|
+
sheet_name = sheet.title
|
|
220
|
+
type_uri = ''
|
|
221
|
+
if sheet_name.startswith('http'):
|
|
222
|
+
type_uri = sheet_name
|
|
223
|
+
else:
|
|
224
|
+
split_name = sheet_name.split("#")
|
|
225
|
+
subclass_name = split_name[1]
|
|
230
226
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
227
|
+
possible_classes = [x for x in instantiated_attributes if x.typeURI.endswith(subclass_name)]
|
|
228
|
+
if len(possible_classes) == 1:
|
|
229
|
+
type_uri = possible_classes[0].typeURI
|
|
230
|
+
|
|
231
|
+
if type_uri == '':
|
|
232
|
+
return
|
|
233
|
+
|
|
234
|
+
data_validation = DataValidation(type="list", formula1=f'"{type_uri}"', allow_blank=True)
|
|
235
|
+
await sleep(0)
|
|
236
|
+
for rows in sheet.iter_rows(min_row=1, max_row=1, min_col=1, max_col=1):
|
|
237
|
+
for cell in rows:
|
|
238
|
+
await sleep(0)
|
|
239
|
+
column = cell.column
|
|
240
|
+
sheet.add_data_validation(data_validation)
|
|
241
|
+
data_validation.add(f'{get_column_letter(column)}{starting_row}:{get_column_letter(column)}1000')
|
|
238
242
|
|
|
239
243
|
@classmethod
|
|
240
244
|
@async_to_sync_wraps
|
|
241
|
-
async def
|
|
245
|
+
async def custom_exel_fixes(cls, workbook, instantiated_attributes, add_attribute_info: bool):
|
|
242
246
|
for sheet in workbook:
|
|
243
|
-
|
|
244
|
-
|
|
247
|
+
await sleep(0)
|
|
248
|
+
await cls.set_fixed_column_width(sheet=sheet, width=25)
|
|
249
|
+
await cls.add_type_uri_choice_list_in_excel(sheet=sheet, instantiated_attributes=instantiated_attributes,
|
|
250
|
+
add_attribute_info=add_attribute_info)
|
|
251
|
+
await cls.remove_asset_versie(sheet=sheet)
|
|
252
|
+
|
|
253
|
+
@classmethod
|
|
254
|
+
@async_to_sync_wraps
|
|
255
|
+
async def remove_asset_versie(cls, sheet):
|
|
256
|
+
for row in sheet.iter_rows(min_row=1, max_row=1, min_col=4):
|
|
257
|
+
for cell in row:
|
|
245
258
|
await sleep(0)
|
|
246
|
-
|
|
247
|
-
|
|
259
|
+
if cell.value is None or not cell.value.startswith('assetVersie'):
|
|
260
|
+
continue
|
|
261
|
+
for rows in sheet.iter_rows(min_col=cell.column, max_col=cell.column, min_row=2, max_row=1000):
|
|
262
|
+
for c in rows:
|
|
263
|
+
await sleep(0)
|
|
264
|
+
c.value = ''
|
|
265
|
+
|
|
266
|
+
@classmethod
|
|
267
|
+
@async_to_sync_wraps
|
|
268
|
+
async def set_fixed_column_width(cls, sheet, width: int):
|
|
269
|
+
dim_holder = DimensionHolder(worksheet=sheet)
|
|
270
|
+
for col in range(sheet.min_column, sheet.max_column + 1):
|
|
271
|
+
await sleep(0)
|
|
272
|
+
dim_holder[get_column_letter(col)] = ColumnDimension(sheet, min=col, max=col, width=width)
|
|
273
|
+
sheet.column_dimensions = dim_holder
|
|
248
274
|
|
|
249
275
|
@classmethod
|
|
250
276
|
@async_to_sync_wraps
|
|
@@ -323,8 +349,10 @@ class SubsetTemplateCreator:
|
|
|
323
349
|
|
|
324
350
|
@classmethod
|
|
325
351
|
@async_to_sync_wraps
|
|
326
|
-
async def add_choice_list_excel(cls, workbook, instantiated_attributes: list, path_to_subset: Path
|
|
352
|
+
async def add_choice_list_excel(cls, workbook, instantiated_attributes: list, path_to_subset: Path,
|
|
353
|
+
add_attribute_info: bool=False):
|
|
327
354
|
choice_list_dict = {}
|
|
355
|
+
starting_row = '3' if add_attribute_info else '2'
|
|
328
356
|
dotnotation_module = DotnotationHelper()
|
|
329
357
|
for sheet in workbook:
|
|
330
358
|
await sleep(0)
|
|
@@ -356,14 +384,16 @@ class SubsetTemplateCreator:
|
|
|
356
384
|
data_val = DataValidation(type="list", formula1=f"Keuzelijsten!{start_range}:{end_range}",
|
|
357
385
|
allowBlank=True)
|
|
358
386
|
sheet.add_data_validation(data_val)
|
|
359
|
-
data_val.add(f'{get_column_letter(cell.column)}
|
|
387
|
+
data_val.add(f'{get_column_letter(cell.column)}{starting_row}:'
|
|
388
|
+
f'{get_column_letter(cell.column)}1000')
|
|
360
389
|
|
|
361
390
|
await sleep(0)
|
|
362
391
|
if issubclass(dotnotation_attribute.field, BooleanField):
|
|
363
392
|
data_validation = DataValidation(type="list", formula1='"TRUE,FALSE,"', allow_blank=True)
|
|
364
393
|
column = cell.column
|
|
365
394
|
sheet.add_data_validation(data_validation)
|
|
366
|
-
data_validation.add(f'{get_column_letter(column)}
|
|
395
|
+
data_validation.add(f'{get_column_letter(column)}{starting_row}:'
|
|
396
|
+
f'{get_column_letter(column)}1000')
|
|
367
397
|
|
|
368
398
|
|
|
369
399
|
@classmethod
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
otlmow_template/CsvTemplateCreator.py,sha256=PQq2zGmliWk0N9bhYNB7ZEa8PWV16OTbvoHh3--qCMs,7538
|
|
2
2
|
otlmow_template/ExcelTemplateCreator.py,sha256=wW-7Uq2Gzr1vHYMO1I7TtqZSBTVFFSWotHvjwzCelV4,10853
|
|
3
|
-
otlmow_template/SubsetTemplateCreator.py,sha256=
|
|
3
|
+
otlmow_template/SubsetTemplateCreator.py,sha256=mKF5Hd9mF8_POgSYBF3zOqU614xF8okA7MJjF_4O74c,29202
|
|
4
4
|
otlmow_template/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
otlmow_template/Exceptions/MissingTypeUriException.py,sha256=DSKwywmP9Bq8n7rzBoDcEPlxvC1IChx18QIHFUCTtdA,51
|
|
6
|
-
otlmow_template-0.
|
|
7
|
-
otlmow_template-0.
|
|
8
|
-
otlmow_template-0.
|
|
9
|
-
otlmow_template-0.
|
|
10
|
-
otlmow_template-0.
|
|
6
|
+
otlmow_template-0.11rc4.dist-info/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
|
|
7
|
+
otlmow_template-0.11rc4.dist-info/METADATA,sha256=UioegMcVO4fUaXmifC7V_rxUCoH-XxxY1Y-D6GJH7D8,44040
|
|
8
|
+
otlmow_template-0.11rc4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
9
|
+
otlmow_template-0.11rc4.dist-info/top_level.txt,sha256=zPgBoaTLG-avoOLySlwOUEtHaFyA5Vc5wJqkSeX1l6A,16
|
|
10
|
+
otlmow_template-0.11rc4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|