diff options
| author | capellancitizen <thecapellancitizen@gmail.com> | 2025-03-09 21:21:48 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-09 21:21:48 -0400 |
| commit | 99509df8d8abf1e7b701a4a09cf170a362f6d878 (patch) | |
| tree | a461549502fa9f37dc287789b6c7db81dfcd5368 /lib/tartan/svg.py | |
| parent | 0d2fc24f25f87562f0755b53dad6204efad1330d (diff) | |
Mypy type correctness (#3199)
Diffstat (limited to 'lib/tartan/svg.py')
| -rw-r--r-- | lib/tartan/svg.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/tartan/svg.py b/lib/tartan/svg.py index 497d0199..62d737c9 100644 --- a/lib/tartan/svg.py +++ b/lib/tartan/svg.py @@ -7,7 +7,7 @@ import time from collections import defaultdict from copy import copy from itertools import chain -from typing import List, Optional, Tuple +from typing import List, Optional, Tuple, cast from inkex import BaseElement, Group, Path, PathElement from networkx import MultiGraph, is_empty @@ -66,12 +66,12 @@ class TartanSvgGroup: :param outline: the outline to be filled with the tartan pattern """ parent_group = outline.getparent() - if parent_group.get_id().startswith('inkstitch-tartan'): + if parent_group is not None and parent_group.get_id().startswith('inkstitch-tartan'): # remove everything but the tartan outline for child in parent_group.iterchildren(): if child != outline: parent_group.remove(child) - group = parent_group + group = cast(Group, parent_group) else: group = Group() group.set('id', f'inkstitch-tartan-{int(time.time())}') @@ -86,6 +86,7 @@ class TartanSvgGroup: # set outline invisible outline.style['display'] = 'none' group.append(outline) + return group def _generate_tartan_group_elements(self, group, outline_shape, transform): dimensions, rotation_center = self._get_dimensions(outline_shape) |
