CURA-5330 Fix typing and code-style in the ContainerNode and all the

related children, and QualityGroup and its children.
Also fix the related calls in the managers.
This commit is contained in:
Diego Prado Gesto 2018-06-13 10:55:57 +02:00
parent f860b9c99e
commit 6e364f0895
10 changed files with 44 additions and 34 deletions

View file

@ -23,10 +23,10 @@ from UM.Settings.InstanceContainer import InstanceContainer
class ContainerNode:
__slots__ = ("metadata", "container", "children_map")
def __init__(self, metadata: Optional[Dict[str, Any]] = None):
def __init__(self, metadata: Optional[Dict[str, Any]] = None) -> None:
self.metadata = metadata
self.container = None
self.children_map = OrderedDict()
self.children_map = OrderedDict() #type: OrderedDict[str, ContainerNode]
## Get an entry value from the metadata
def getMetaDataEntry(self, entry: str, default: Any = None) -> Any:
@ -56,4 +56,4 @@ class ContainerNode:
return self.container
def __str__(self) -> str:
return "%s[%s]" % (self.__class__.__name__, self.metadata.get("id"))
return "%s[%s]" % (self.__class__.__name__, self.getMetaDataEntry("id"))