diff --git a/cura/Machines/ContainerNode.py b/cura/Machines/ContainerNode.py index 14739eedd8..944579e354 100644 --- a/cura/Machines/ContainerNode.py +++ b/cura/Machines/ContainerNode.py @@ -1,7 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import Optional, Any, Dict +from typing import Optional, Any, Dict, Union, TYPE_CHECKING from collections import OrderedDict @@ -9,6 +9,9 @@ from UM.ConfigurationErrorMessage import ConfigurationErrorMessage from UM.Logger import Logger from UM.Settings.InstanceContainer import InstanceContainer +if TYPE_CHECKING: + from cura.Machines.QualityGroup import QualityGroup + ## # A metadata / container combination. Use getContainer() to get the container corresponding to the metadata. @@ -26,7 +29,7 @@ class ContainerNode: def __init__(self, metadata: Optional[Dict[str, Any]] = None) -> None: self.metadata = metadata self.container = None - self.children_map = OrderedDict() #type: OrderedDict[str, ContainerNode] + self.children_map = OrderedDict() #type: OrderedDict[str, Union[QualityGroup, ContainerNode]] ## Get an entry value from the metadata def getMetaDataEntry(self, entry: str, default: Any = None) -> Any: diff --git a/cura/Machines/MaterialGroup.py b/cura/Machines/MaterialGroup.py index eea9e41d62..b57e0e1808 100644 --- a/cura/Machines/MaterialGroup.py +++ b/cura/Machines/MaterialGroup.py @@ -21,7 +21,7 @@ class MaterialGroup: def __init__(self, name: str, root_material_node: MaterialNode) -> None: self.name = name self.is_read_only = False - self.root_material_node = root_material_node + self.root_material_node = root_material_node # type: MaterialNode self.derived_material_node_list = [] #type: List[MaterialNode] def __str__(self) -> str: diff --git a/cura/Machines/QualityNode.py b/cura/Machines/QualityNode.py index 922227b022..f384ee7825 100644 --- a/cura/Machines/QualityNode.py +++ b/cura/Machines/QualityNode.py @@ -1,7 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import Optional, Dict +from typing import Optional, Dict, cast from .ContainerNode import ContainerNode from .QualityChangesGroup import QualityChangesGroup @@ -32,4 +32,4 @@ class QualityNode(ContainerNode): if name not in quality_type_node.children_map: quality_type_node.children_map[name] = QualityChangesGroup(name, quality_type) quality_changes_group = quality_type_node.children_map[name] - quality_changes_group.addNode(QualityNode(metadata)) + cast(QualityChangesGroup, quality_changes_group).addNode(QualityNode(metadata))