mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
CURA-5330 Add typing checks to the MachineManager
This commit is contained in:
parent
2dfedf3ae4
commit
2e174e75fa
2 changed files with 68 additions and 22 deletions
|
@ -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
|
||||
from typing import Optional, Any, Dict
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
|
@ -23,11 +23,17 @@ from UM.Settings.InstanceContainer import InstanceContainer
|
|||
class ContainerNode:
|
||||
__slots__ = ("metadata", "container", "children_map")
|
||||
|
||||
def __init__(self, metadata: Optional[dict] = None):
|
||||
def __init__(self, metadata: Optional[Dict[str, Any]] = None):
|
||||
self.metadata = metadata
|
||||
self.container = None
|
||||
self.children_map = OrderedDict()
|
||||
|
||||
## Get an entry value from the metadata
|
||||
def getMetaDataEntry(self, entry: str, default: Any = None) -> Any:
|
||||
if self.metadata is None:
|
||||
return default
|
||||
return self.metadata.get(entry, default)
|
||||
|
||||
def getChildNode(self, child_key: str) -> Optional["ContainerNode"]:
|
||||
return self.children_map.get(child_key)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue