Skip to content

Commit c013cb4

Browse files
committed
[validation] ValidationID->IssueID
1 parent 5470f10 commit c013cb4

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

odml/property.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ def _values_cardinality_validation(self):
574574
is respected and prints a warning message otherwise.
575575
"""
576576
valid = validation.Validation(self)
577-
val_id = validation.ValidationID.property_values_cardinality
577+
val_id = validation.IssueID.property_values_cardinality
578578

579579
# Make sure to display only warnings of the current property
580580
for curr in valid.errors:

odml/section.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def _sections_cardinality_validation(self):
421421
is respected and prints a warning message otherwise.
422422
"""
423423
valid = validation.Validation(self)
424-
val_id = validation.ValidationID.section_sections_cardinality
424+
val_id = validation.IssueID.section_sections_cardinality
425425

426426
# Make sure to display only warnings of the current section
427427
for curr in valid.errors:
@@ -476,7 +476,7 @@ def _properties_cardinality_validation(self):
476476
is respected and prints a warning message otherwise.
477477
"""
478478
valid = validation.Validation(self)
479-
val_id = validation.ValidationID.section_properties_cardinality
479+
val_id = validation.IssueID.section_properties_cardinality
480480

481481
# Make sure to display only warnings of the current section
482482
for curr in valid.errors:

odml/validation.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
LABEL_WARNING = 'warning'
1919

2020

21-
class ValidationID(Enum):
21+
class IssueID(Enum):
2222
"""
2323
IDs identifying registered validation handlers.
2424
"""
@@ -239,7 +239,7 @@ def object_required_attributes(obj):
239239
240240
:param obj: document, section or property.
241241
"""
242-
validation_id = ValidationID.object_required_attributes
242+
validation_id = IssueID.object_required_attributes
243243

244244
args = obj.format().arguments
245245
for arg in args:
@@ -264,7 +264,7 @@ def section_type_must_be_defined(sec):
264264
265265
:param sec: odml.Section.
266266
"""
267-
validation_id = ValidationID.section_type_must_be_defined
267+
validation_id = IssueID.section_type_must_be_defined
268268

269269
if sec.type and sec.type == "n.s.":
270270
yield ValidationError(sec, "Section type not specified", LABEL_WARNING, validation_id)
@@ -280,7 +280,7 @@ def section_repository_present(sec):
280280
1. warn, if a section has no repository or
281281
2. the section type is not present in the repository
282282
"""
283-
validation_id = ValidationID.section_repository_present
283+
validation_id = IssueID.section_repository_present
284284

285285
repo = sec.get_repository()
286286
if repo is None:
@@ -327,7 +327,7 @@ def section_unique_ids(parent, id_map=None):
327327
:param parent: odML Document or Section
328328
:param id_map: "id":"odML object / path" dictionary
329329
"""
330-
validation_id = ValidationID.section_unique_ids
330+
validation_id = IssueID.section_unique_ids
331331

332332
if not id_map:
333333
id_map = {}
@@ -358,7 +358,7 @@ def property_unique_ids(section, id_map=None):
358358
:param section: odML Section
359359
:param id_map: "id":"odML object / path" dictionary
360360
"""
361-
validation_id = ValidationID.property_unique_ids
361+
validation_id = IssueID.property_unique_ids
362362

363363
if not id_map:
364364
id_map = {}
@@ -406,7 +406,7 @@ def section_unique_name_type(obj):
406406
"""
407407
for i in object_unique_names(
408408
obj,
409-
validation_id=ValidationID.section_unique_name_type,
409+
validation_id=IssueID.section_unique_name_type,
410410
attr=lambda x: (x.name, x.type),
411411
children=lambda x: x.sections,
412412
msg="name/type combination must be unique"):
@@ -420,7 +420,7 @@ def property_unique_names(obj):
420420
:param obj: odml class instance the validation is applied on.
421421
"""
422422
for i in object_unique_names(obj,
423-
validation_id=ValidationID.property_unique_name,
423+
validation_id=IssueID.property_unique_name,
424424
children=lambda x: x.properties):
425425
yield i
426426

@@ -436,7 +436,7 @@ def object_name_readable(obj):
436436
437437
:param obj: odml.Section or odml.Property.
438438
"""
439-
validation_id = ValidationID.object_name_readable
439+
validation_id = IssueID.object_name_readable
440440

441441
if obj.name == obj.id:
442442
yield ValidationError(obj, "Name not assigned", LABEL_WARNING, validation_id)
@@ -452,7 +452,7 @@ def property_terminology_check(prop):
452452
2. warn, if there are multiple values with different units or the unit does
453453
not match the one in the terminology.
454454
"""
455-
validation_id = ValidationID.property_terminology_check
455+
validation_id = IssueID.property_terminology_check
456456

457457
if not prop.parent:
458458
return
@@ -475,7 +475,7 @@ def property_dependency_check(prop):
475475
Produces a warning if the dependency attribute refers to a non-existent attribute
476476
or the dependency_value does not match.
477477
"""
478-
validation_id = ValidationID.property_dependency_check
478+
validation_id = IssueID.property_dependency_check
479479

480480
if not prop.parent:
481481
return
@@ -506,7 +506,7 @@ def property_values_check(prop):
506506
507507
:param prop: property the validation is applied on.
508508
"""
509-
validation_id = ValidationID.property_values_check
509+
validation_id = IssueID.property_values_check
510510

511511
if prop.dtype is not None and prop.dtype != "":
512512
dtype = prop.dtype
@@ -540,7 +540,7 @@ def property_values_string_check(prop):
540540
541541
:param prop: property the validation is applied on.
542542
"""
543-
validation_id = ValidationID.property_values_string_check
543+
validation_id = IssueID.property_values_string_check
544544

545545
if prop.dtype != "string" or not prop.values:
546546
return
@@ -636,7 +636,7 @@ def section_properties_cardinality(obj):
636636
637637
:return: Yields a ValidationError warning, if a set cardinality is not met.
638638
"""
639-
validation_id = ValidationID.section_properties_cardinality
639+
validation_id = IssueID.section_properties_cardinality
640640

641641
err = _cardinality_validation(obj, obj.prop_cardinality, 'properties',
642642
LABEL_WARNING, validation_id)
@@ -655,7 +655,7 @@ def section_sections_cardinality(obj):
655655
656656
:return: Yields a ValidationError warning, if a set cardinality is not met.
657657
"""
658-
validation_id = ValidationID.section_sections_cardinality
658+
validation_id = IssueID.section_sections_cardinality
659659

660660
err = _cardinality_validation(obj, obj.sec_cardinality, 'sections',
661661
LABEL_WARNING, validation_id)
@@ -674,7 +674,7 @@ def property_values_cardinality(obj):
674674
675675
:return: Yields a ValidationError warning, if a set cardinality is not met.
676676
"""
677-
validation_id = ValidationID.property_values_cardinality
677+
validation_id = IssueID.property_values_cardinality
678678

679679
err = _cardinality_validation(obj, obj.val_cardinality, 'values',
680680
LABEL_WARNING, validation_id)

0 commit comments

Comments
 (0)