From 99509df8d8abf1e7b701a4a09cf170a362f6d878 Mon Sep 17 00:00:00 2001 From: capellancitizen Date: Sun, 9 Mar 2025 21:21:48 -0400 Subject: Mypy type correctness (#3199) --- lib/elements/fill_stitch.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/elements/fill_stitch.py') diff --git a/lib/elements/fill_stitch.py b/lib/elements/fill_stitch.py index f8db39d5..ee77cd60 100644 --- a/lib/elements/fill_stitch.py +++ b/lib/elements/fill_stitch.py @@ -808,13 +808,17 @@ class FillStitch(EmbroideryElement): def validation_errors(self): if not self.shape.is_valid: why = explain_validity(self.shape) - message, x, y = re.match(r"(?P.+)\[(?P.+)\s(?P.+)\]", why).groups() + match = re.match(r"(?P.+)\[(?P.+)\s(?P.+)\]", why) + assert match is not None, f"Could not parse validity message '{why}'" + message, x, y = match.groups() yield InvalidShapeError((x, y)) def validation_warnings(self): # noqa: C901 if not self.original_shape.is_valid: why = explain_validity(self.original_shape) - message, x, y = re.match(r"(?P.+)\[(?P.+)\s(?P.+)\]", why).groups() + match = re.match(r"(?P.+)\[(?P.+)\s(?P.+)\]", why) + assert match is not None, f"Could not parse validity message '{why}'" + message, x, y = match.groups() if "Hole lies outside shell" in message: yield UnconnectedWarning((x, y)) else: -- cgit v1.2.3