18
18
LABEL_WARNING = 'warning'
19
19
20
20
21
- class ValidationID (Enum ):
21
+ class IssueID (Enum ):
22
22
"""
23
23
IDs identifying registered validation handlers.
24
24
"""
@@ -239,7 +239,7 @@ def object_required_attributes(obj):
239
239
240
240
:param obj: document, section or property.
241
241
"""
242
- validation_id = ValidationID .object_required_attributes
242
+ validation_id = IssueID .object_required_attributes
243
243
244
244
args = obj .format ().arguments
245
245
for arg in args :
@@ -264,7 +264,7 @@ def section_type_must_be_defined(sec):
264
264
265
265
:param sec: odml.Section.
266
266
"""
267
- validation_id = ValidationID .section_type_must_be_defined
267
+ validation_id = IssueID .section_type_must_be_defined
268
268
269
269
if sec .type and sec .type == "n.s." :
270
270
yield ValidationError (sec , "Section type not specified" , LABEL_WARNING , validation_id )
@@ -280,7 +280,7 @@ def section_repository_present(sec):
280
280
1. warn, if a section has no repository or
281
281
2. the section type is not present in the repository
282
282
"""
283
- validation_id = ValidationID .section_repository_present
283
+ validation_id = IssueID .section_repository_present
284
284
285
285
repo = sec .get_repository ()
286
286
if repo is None :
@@ -327,7 +327,7 @@ def section_unique_ids(parent, id_map=None):
327
327
:param parent: odML Document or Section
328
328
:param id_map: "id":"odML object / path" dictionary
329
329
"""
330
- validation_id = ValidationID .section_unique_ids
330
+ validation_id = IssueID .section_unique_ids
331
331
332
332
if not id_map :
333
333
id_map = {}
@@ -358,7 +358,7 @@ def property_unique_ids(section, id_map=None):
358
358
:param section: odML Section
359
359
:param id_map: "id":"odML object / path" dictionary
360
360
"""
361
- validation_id = ValidationID .property_unique_ids
361
+ validation_id = IssueID .property_unique_ids
362
362
363
363
if not id_map :
364
364
id_map = {}
@@ -406,7 +406,7 @@ def section_unique_name_type(obj):
406
406
"""
407
407
for i in object_unique_names (
408
408
obj ,
409
- validation_id = ValidationID .section_unique_name_type ,
409
+ validation_id = IssueID .section_unique_name_type ,
410
410
attr = lambda x : (x .name , x .type ),
411
411
children = lambda x : x .sections ,
412
412
msg = "name/type combination must be unique" ):
@@ -420,7 +420,7 @@ def property_unique_names(obj):
420
420
:param obj: odml class instance the validation is applied on.
421
421
"""
422
422
for i in object_unique_names (obj ,
423
- validation_id = ValidationID .property_unique_name ,
423
+ validation_id = IssueID .property_unique_name ,
424
424
children = lambda x : x .properties ):
425
425
yield i
426
426
@@ -436,7 +436,7 @@ def object_name_readable(obj):
436
436
437
437
:param obj: odml.Section or odml.Property.
438
438
"""
439
- validation_id = ValidationID .object_name_readable
439
+ validation_id = IssueID .object_name_readable
440
440
441
441
if obj .name == obj .id :
442
442
yield ValidationError (obj , "Name not assigned" , LABEL_WARNING , validation_id )
@@ -452,7 +452,7 @@ def property_terminology_check(prop):
452
452
2. warn, if there are multiple values with different units or the unit does
453
453
not match the one in the terminology.
454
454
"""
455
- validation_id = ValidationID .property_terminology_check
455
+ validation_id = IssueID .property_terminology_check
456
456
457
457
if not prop .parent :
458
458
return
@@ -475,7 +475,7 @@ def property_dependency_check(prop):
475
475
Produces a warning if the dependency attribute refers to a non-existent attribute
476
476
or the dependency_value does not match.
477
477
"""
478
- validation_id = ValidationID .property_dependency_check
478
+ validation_id = IssueID .property_dependency_check
479
479
480
480
if not prop .parent :
481
481
return
@@ -506,7 +506,7 @@ def property_values_check(prop):
506
506
507
507
:param prop: property the validation is applied on.
508
508
"""
509
- validation_id = ValidationID .property_values_check
509
+ validation_id = IssueID .property_values_check
510
510
511
511
if prop .dtype is not None and prop .dtype != "" :
512
512
dtype = prop .dtype
@@ -540,7 +540,7 @@ def property_values_string_check(prop):
540
540
541
541
:param prop: property the validation is applied on.
542
542
"""
543
- validation_id = ValidationID .property_values_string_check
543
+ validation_id = IssueID .property_values_string_check
544
544
545
545
if prop .dtype != "string" or not prop .values :
546
546
return
@@ -636,7 +636,7 @@ def section_properties_cardinality(obj):
636
636
637
637
:return: Yields a ValidationError warning, if a set cardinality is not met.
638
638
"""
639
- validation_id = ValidationID .section_properties_cardinality
639
+ validation_id = IssueID .section_properties_cardinality
640
640
641
641
err = _cardinality_validation (obj , obj .prop_cardinality , 'properties' ,
642
642
LABEL_WARNING , validation_id )
@@ -655,7 +655,7 @@ def section_sections_cardinality(obj):
655
655
656
656
:return: Yields a ValidationError warning, if a set cardinality is not met.
657
657
"""
658
- validation_id = ValidationID .section_sections_cardinality
658
+ validation_id = IssueID .section_sections_cardinality
659
659
660
660
err = _cardinality_validation (obj , obj .sec_cardinality , 'sections' ,
661
661
LABEL_WARNING , validation_id )
@@ -674,7 +674,7 @@ def property_values_cardinality(obj):
674
674
675
675
:return: Yields a ValidationError warning, if a set cardinality is not met.
676
676
"""
677
- validation_id = ValidationID .property_values_cardinality
677
+ validation_id = IssueID .property_values_cardinality
678
678
679
679
err = _cardinality_validation (obj , obj .val_cardinality , 'values' ,
680
680
LABEL_WARNING , validation_id )
0 commit comments