summaryrefslogtreecommitdiff
path: root/lib/elements/utils.py
diff options
context:
space:
mode:
authorcapellancitizen <thecapellancitizen@gmail.com>2025-03-09 21:21:48 -0400
committerGitHub <noreply@github.com>2025-03-09 21:21:48 -0400
commit99509df8d8abf1e7b701a4a09cf170a362f6d878 (patch)
treea461549502fa9f37dc287789b6c7db81dfcd5368 /lib/elements/utils.py
parent0d2fc24f25f87562f0755b53dad6204efad1330d (diff)
Mypy type correctness (#3199)
Diffstat (limited to 'lib/elements/utils.py')
-rw-r--r--lib/elements/utils.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/elements/utils.py b/lib/elements/utils.py
index dfe1eb3a..cf770af4 100644
--- a/lib/elements/utils.py
+++ b/lib/elements/utils.py
@@ -3,7 +3,7 @@
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
-from typing import List, Optional
+from typing import List, Optional, Iterable
from inkex import BaseElement
from lxml.etree import Comment
@@ -41,7 +41,7 @@ def node_to_elements(node, clone_to_element=False) -> List[EmbroideryElement]:
return [MarkerObject(node)]
elif node.tag in EMBROIDERABLE_TAGS or is_clone(node):
- elements = []
+ elements: List[EmbroideryElement] = []
from ..sew_stack import SewStack
sew_stack = SewStack(node)
@@ -73,7 +73,7 @@ def node_to_elements(node, clone_to_element=False) -> List[EmbroideryElement]:
return []
-def nodes_to_elements(nodes):
+def nodes_to_elements(nodes: Iterable[BaseElement]) -> List[EmbroideryElement]:
elements = []
for node in nodes:
elements.extend(node_to_elements(node))
@@ -89,7 +89,8 @@ def iterate_nodes(node: BaseElement, # noqa: C901
def walk(node: BaseElement, selected: bool) -> List[BaseElement]:
nodes = []
- if node.tag == Comment:
+ # lxml-stubs types are wrong, node.tag can be Comment.
+ if node.tag is Comment: # type:ignore[comparison-overlap]
return []
element = EmbroideryElement(node)