Fixed type hinting issues

CURA-3497
This commit is contained in:
Jaime van Kessel 2017-05-02 11:21:17 +02:00
parent 69c3baf87f
commit 4bdbe42dcb

View file

@ -17,6 +17,7 @@ from UM.Settings.Interfaces import ContainerInterface
from . import Exceptions from . import Exceptions
## Base class for Cura related stacks that want to enforce certain containers are available. ## Base class for Cura related stacks that want to enforce certain containers are available.
# #
# This class makes sure that the stack has the following containers set: user changes, quality # This class makes sure that the stack has the following containers set: user changes, quality
@ -306,7 +307,7 @@ class CuraContainerStack(ContainerStack):
# Since we have a fixed order of containers in the stack and this method would modify the container # Since we have a fixed order of containers in the stack and this method would modify the container
# ordering, we disallow this operation. # ordering, we disallow this operation.
@override(ContainerStack) @override(ContainerStack)
def removeContainer(self, index: int) -> None: def removeContainer(self, index: int = 0) -> None:
raise Exceptions.InvalidOperationError("Cannot remove a container from Global stack") raise Exceptions.InvalidOperationError("Cannot remove a container from Global stack")
## Overridden from ContainerStack ## Overridden from ContainerStack
@ -339,7 +340,7 @@ class CuraContainerStack(ContainerStack):
super().deserialize(contents) super().deserialize(contents)
new_containers = self._containers.copy() new_containers = self._containers.copy()
while(len(new_containers) < len(_ContainerIndexes.IndexTypeMap)): while len(new_containers) < len(_ContainerIndexes.IndexTypeMap):
new_containers.append(self._empty_instance_container) new_containers.append(self._empty_instance_container)
# Validate and ensure the list of containers matches with what we expect # Validate and ensure the list of containers matches with what we expect
@ -555,7 +556,7 @@ class CuraContainerStack(ContainerStack):
# Helper that can be overridden to get the "machine" definition, that is, the definition that defines the machine # Helper that can be overridden to get the "machine" definition, that is, the definition that defines the machine
# and its properties rather than, for example, the extruder. Defaults to simply returning the definition property. # and its properties rather than, for example, the extruder. Defaults to simply returning the definition property.
def _getMachineDefinition(self) -> ContainerInterface: def _getMachineDefinition(self) -> DefinitionContainer:
return self.definition return self.definition
## Find the ID that should be used when searching for instance containers for a specified definition. ## Find the ID that should be used when searching for instance containers for a specified definition.