mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 06:03:57 -06:00
Fix incorrect type hinting
The type hinting indicated that the property was a dict, but it could also be None. In cases where it was None, it would cause an exception, which was also fixed (since unpacking None will break)
This commit is contained in:
parent
c7350ff579
commit
20ec8828ed
1 changed files with 3 additions and 1 deletions
|
@ -385,7 +385,9 @@ class MachineManager(QObject):
|
||||||
# \param definition_id \type{str} definition id that needs to look for
|
# \param definition_id \type{str} definition id that needs to look for
|
||||||
# \param metadata_filter \type{dict} list of metadata keys and values used for filtering
|
# \param metadata_filter \type{dict} list of metadata keys and values used for filtering
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getMachine(definition_id: str, metadata_filter: Dict[str, str] = None) -> Optional["GlobalStack"]:
|
def getMachine(definition_id: str, metadata_filter: Optional[Dict[str, str]] = None) -> Optional["GlobalStack"]:
|
||||||
|
if metadata_filter is None:
|
||||||
|
metadata_filter = {}
|
||||||
machines = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
|
machines = CuraContainerRegistry.getInstance().findContainerStacks(type = "machine", **metadata_filter)
|
||||||
for machine in machines:
|
for machine in machines:
|
||||||
if machine.definition.getId() == definition_id:
|
if machine.definition.getId() == definition_id:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue