Skip to content

Commit

Permalink
Use same result code regex over entire code base (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
hf-kklein authored Jun 30, 2023
1 parent 861b025 commit 3f502f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ebdtable2graph/models/ebd_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from networkx import DiGraph # type:ignore[import]

# pylint:disable=too-few-public-methods
from ebdtable2graph.models.ebd_table import MultiStepInstruction
from ebdtable2graph.models.ebd_table import RESULT_CODE_REGEX, MultiStepInstruction


@attrs.define(auto_attribs=True, kw_only=True)
Expand Down Expand Up @@ -85,7 +85,7 @@ class OutcomeNode(EbdGraphNode):
An outcome node is a leaf of the Entscheidungsbaum tree. It has no subsequent steps.
"""

result_code: str = attrs.field(validator=attrs.validators.matches_re(r"^[A-Z]\d+$"))
result_code: str = attrs.field(validator=attrs.validators.matches_re(RESULT_CODE_REGEX))
"""
The outcome of the decision tree check; e.g. 'A55'
"""
Expand Down
5 changes: 4 additions & 1 deletion src/ebdtable2graph/models/ebd_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ class EbdCheckResult:
"""


RESULT_CODE_REGEX = r"^((?:[A-Z]\d+)|(?:A\*{2})|(?:A[A-Z]\d))$"


@attrs.define(auto_attribs=True, kw_only=True)
class EbdTableSubRow:
"""
Expand All @@ -72,7 +75,7 @@ class EbdTableSubRow:
The column 'Prüfergebnis'
"""
result_code: Optional[str] = attrs.field(
validator=attrs.validators.optional(attrs.validators.matches_re(r"^((?:[A-Z]\d+)|(?:A\*{2})|(?:A[A-Z]\d))$"))
validator=attrs.validators.optional(attrs.validators.matches_re(RESULT_CODE_REGEX))
)
"""
The outcome if no subsequent step was defined in the CheckResult.
Expand Down

0 comments on commit 3f502f9

Please sign in to comment.