otlmow-template 1.9__py3-none-any.whl → 1.10__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 +27 -9
- {otlmow_template-1.9.dist-info → otlmow_template-1.10.dist-info}/METADATA +2 -1
- otlmow_template-1.10.dist-info/RECORD +7 -0
- {otlmow_template-1.9.dist-info → otlmow_template-1.10.dist-info}/WHEEL +1 -1
- otlmow_template-1.9.dist-info/RECORD +0 -7
- {otlmow_template-1.9.dist-info → otlmow_template-1.10.dist-info}/licenses/LICENSE +0 -0
- {otlmow_template-1.9.dist-info → otlmow_template-1.10.dist-info}/top_level.txt +0 -0
|
@@ -20,8 +20,6 @@ from openpyxl.worksheet.worksheet import Worksheet
|
|
|
20
20
|
from otlmow_converter.DotnotationHelper import DotnotationHelper
|
|
21
21
|
from otlmow_converter.Exceptions.UnknownExcelError import UnknownExcelError
|
|
22
22
|
from otlmow_converter.OtlmowConverter import OtlmowConverter
|
|
23
|
-
from otlmow_model.OtlmowModel.BaseClasses.BooleanField import BooleanField
|
|
24
|
-
from otlmow_model.OtlmowModel.BaseClasses.KeuzelijstField import KeuzelijstField
|
|
25
23
|
from otlmow_model.OtlmowModel.BaseClasses.OTLObject import dynamic_create_instance_from_uri, OTLObject, \
|
|
26
24
|
get_attribute_by_name, dynamic_create_type_from_uri
|
|
27
25
|
from otlmow_model.OtlmowModel.Helpers.GenericHelper import get_ns_and_name_from_uri
|
|
@@ -503,18 +501,31 @@ class SubsetTemplateCreator:
|
|
|
503
501
|
sheet.add_data_validation(boolean_validation)
|
|
504
502
|
collected_attribute_info = []
|
|
505
503
|
deprecated_attributes_row = []
|
|
504
|
+
|
|
506
505
|
header_row = next(sheet.iter_rows(min_row=1, max_row=1))
|
|
506
|
+
|
|
507
|
+
first_data_row = 2 # first row is header, first data row is needed for later adjustments of formatting
|
|
508
|
+
if add_attribute_info:
|
|
509
|
+
first_data_row += 1
|
|
510
|
+
if add_deprecated and any(deprecated_attributes_row):
|
|
511
|
+
first_data_row += 1
|
|
512
|
+
|
|
513
|
+
max_row = 1000 # limit to 1000 as we only add validations up to row 1000
|
|
514
|
+
# Collect string columns to format after header processing
|
|
515
|
+
string_col_indices = []
|
|
516
|
+
|
|
507
517
|
for header_cell in header_row:
|
|
508
518
|
header = header_cell.value
|
|
509
|
-
if
|
|
519
|
+
if not header:
|
|
510
520
|
continue
|
|
511
521
|
|
|
512
522
|
if header == 'typeURI':
|
|
513
523
|
data_validation = DataValidation(type="list", formula1=f'"{type_uri}"', allow_blank=True)
|
|
514
524
|
sheet.add_data_validation(data_validation)
|
|
515
|
-
data_validation.add(f'{header_cell.column_letter}
|
|
525
|
+
data_validation.add(f'{header_cell.column_letter}{first_data_row}:{header_cell.column_letter}{max_row}')
|
|
516
526
|
if add_attribute_info:
|
|
517
|
-
collected_attribute_info.append(
|
|
527
|
+
collected_attribute_info.append(
|
|
528
|
+
'De URI van het object volgens https://www.w3.org/2001/XMLSchema#anyURI .')
|
|
518
529
|
if add_deprecated:
|
|
519
530
|
deprecated_attributes_row.append('')
|
|
520
531
|
continue
|
|
@@ -531,16 +542,23 @@ class SubsetTemplateCreator:
|
|
|
531
542
|
deprecated_attributes_row.append('DEPRECATED' if attribute.deprecated_version else '')
|
|
532
543
|
|
|
533
544
|
if generate_choice_list:
|
|
534
|
-
if
|
|
535
|
-
boolean_validation.add(f'{header_cell.column_letter}
|
|
545
|
+
if attribute.field.native_type == bool:
|
|
546
|
+
boolean_validation.add(f'{header_cell.column_letter}{first_data_row}:{header_cell.column_letter}{max_row}')
|
|
536
547
|
cls.color_choice_lists_green(sheet=sheet, header_cell_column=header_cell)
|
|
537
|
-
|
|
538
|
-
elif issubclass(attribute.field, KeuzelijstField):
|
|
548
|
+
elif hasattr(attribute.field, 'options') and attribute.field.options is not None:
|
|
539
549
|
cls.generate_choice_list_in_excel(
|
|
540
550
|
attribute=attribute, choice_list_dict=choice_list_dict, column=header_cell.column,
|
|
541
551
|
row_nr=1, sheet=sheet, workbook=workbook)
|
|
542
552
|
cls.color_choice_lists_green(sheet=sheet, header_cell_column=header_cell)
|
|
543
553
|
|
|
554
|
+
if attribute.field.native_type == str:
|
|
555
|
+
string_col_indices.append(header_cell.column)
|
|
556
|
+
|
|
557
|
+
# Efficiently format all string columns in one pass
|
|
558
|
+
for col_idx in string_col_indices:
|
|
559
|
+
for row_idx in range(first_data_row, max_row + 1):
|
|
560
|
+
sheet.cell(row=row_idx, column=col_idx).number_format = "@"
|
|
561
|
+
|
|
544
562
|
if dummy_data_rows == 0:
|
|
545
563
|
instance_count = len([x for x in instances if x.typeURI == type_uri])
|
|
546
564
|
if instance_count > 0:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: otlmow_template
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.10
|
|
4
4
|
Author-email: David Vlaminck <david.vlaminck@mow.vlaanderen.be>, Jasper Berton <jasperberton1@telenet.be>
|
|
5
5
|
License: GNU GENERAL PUBLIC LICENSE
|
|
6
6
|
Version 3, 29 June 2007
|
|
@@ -684,6 +684,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
684
684
|
Classifier: Programming Language :: Python :: 3.11
|
|
685
685
|
Classifier: Programming Language :: Python :: 3.12
|
|
686
686
|
Classifier: Programming Language :: Python :: 3.13
|
|
687
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
687
688
|
Classifier: Operating System :: OS Independent
|
|
688
689
|
Classifier: Development Status :: 5 - Production/Stable
|
|
689
690
|
Classifier: Environment :: Console
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
otlmow_template/SubsetTemplateCreator.py,sha256=t96Medun2k2zbTCCFSY4vKvIy43Hh4LnB1bYex5ONok,35500
|
|
2
|
+
otlmow_template/Exceptions/MissingTypeUriException.py,sha256=DSKwywmP9Bq8n7rzBoDcEPlxvC1IChx18QIHFUCTtdA,51
|
|
3
|
+
otlmow_template-1.10.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
|
|
4
|
+
otlmow_template-1.10.dist-info/METADATA,sha256=PiAyWmgjyGjipqsjg0UO4MDOISBGeznaM2GmsB3jQzg,44392
|
|
5
|
+
otlmow_template-1.10.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
6
|
+
otlmow_template-1.10.dist-info/top_level.txt,sha256=zPgBoaTLG-avoOLySlwOUEtHaFyA5Vc5wJqkSeX1l6A,16
|
|
7
|
+
otlmow_template-1.10.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
otlmow_template/SubsetTemplateCreator.py,sha256=dWzMZaBmJqK_k2J7ouyZyd_TovVRKPbpco47y6uc7Hk,34777
|
|
2
|
-
otlmow_template/Exceptions/MissingTypeUriException.py,sha256=DSKwywmP9Bq8n7rzBoDcEPlxvC1IChx18QIHFUCTtdA,51
|
|
3
|
-
otlmow_template-1.9.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
|
|
4
|
-
otlmow_template-1.9.dist-info/METADATA,sha256=YK9C8pnQbWaCUge2I_3pCtXVJLt4aW9d8e82wnurCxE,44340
|
|
5
|
-
otlmow_template-1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
-
otlmow_template-1.9.dist-info/top_level.txt,sha256=zPgBoaTLG-avoOLySlwOUEtHaFyA5Vc5wJqkSeX1l6A,16
|
|
7
|
-
otlmow_template-1.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|