mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Updated another set of typing
This commit is contained in:
parent
e7d9f0ce45
commit
729d78e14a
5 changed files with 59 additions and 44 deletions
|
|
@ -2,7 +2,7 @@
|
|||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
from collections import OrderedDict
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING, Dict
|
||||
|
||||
from UM.ConfigurationErrorMessage import ConfigurationErrorMessage
|
||||
from UM.Logger import Logger
|
||||
|
|
@ -36,11 +36,11 @@ if TYPE_CHECKING:
|
|||
#
|
||||
class VariantManager:
|
||||
|
||||
def __init__(self, container_registry):
|
||||
self._container_registry = container_registry # type: ContainerRegistry
|
||||
def __init__(self, container_registry: ContainerRegistry) -> None:
|
||||
self._container_registry = container_registry
|
||||
|
||||
self._machine_to_variant_dict_map = dict() # <machine_type> -> <variant_dict>
|
||||
self._machine_to_buildplate_dict_map = dict()
|
||||
self._machine_to_variant_dict_map = dict() # type: Dict[str, Dict["VariantType", Dict[str, ContainerNode]]]
|
||||
self._machine_to_buildplate_dict_map = dict() # type: Dict[str, Dict[str, ContainerNode]]
|
||||
|
||||
self._exclude_variant_id_list = ["empty_variant"]
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ class VariantManager:
|
|||
# Initializes the VariantManager including:
|
||||
# - initializing the variant lookup table based on the metadata in ContainerRegistry.
|
||||
#
|
||||
def initialize(self):
|
||||
def initialize(self) -> None:
|
||||
self._machine_to_variant_dict_map = OrderedDict()
|
||||
self._machine_to_buildplate_dict_map = OrderedDict()
|
||||
|
||||
|
|
@ -106,10 +106,10 @@ class VariantManager:
|
|||
variant_node = variant_dict[variant_name]
|
||||
break
|
||||
return variant_node
|
||||
|
||||
return self._machine_to_variant_dict_map[machine_definition_id].get(variant_type, {}).get(variant_name)
|
||||
|
||||
def getVariantNodes(self, machine: "GlobalStack",
|
||||
variant_type: Optional["VariantType"] = None) -> dict:
|
||||
def getVariantNodes(self, machine: "GlobalStack", variant_type: "VariantType") -> Dict[str, ContainerNode]:
|
||||
machine_definition_id = machine.definition.getId()
|
||||
return self._machine_to_variant_dict_map.get(machine_definition_id, {}).get(variant_type, {})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue