From 269d596f5da45dc1d61a6002901092e00c0546a1 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Mon, 26 Nov 2018 14:54:24 +0100 Subject: [PATCH] Fix typing for cluster list --- .../src/Cloud/CloudOutputDeviceManager.py | 6 +++--- plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py index e48c06dbe9..9aba01d164 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py @@ -1,7 +1,7 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import json -from typing import Dict, Optional +from typing import Dict, Optional, List from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply @@ -76,7 +76,7 @@ class CloudOutputDeviceManager(NetworkClient): # self._addCloudOutputDevice({ "cluster_id": "LJ0tciiuZZjarrXAvFLEZ6ox4Cvx8FvtXUlQv4vIhV6w" }) @staticmethod - def _parseStatusResponse(reply: QNetworkReply) -> Optional[Cluster]: + def _parseStatusResponse(reply: QNetworkReply) -> List[CloudCluster]: try: return [CloudCluster(**c) for c in json.loads(reply.readAll().data().decode("utf-8"))] except UnicodeDecodeError: @@ -85,7 +85,7 @@ class CloudOutputDeviceManager(NetworkClient): Logger.logException("w", "Unable to decode JSON from reply.") except ValueError: Logger.logException("w", "Response was missing values.") - return None + return [] ## Adds a CloudOutputDevice for each entry in the remote cluster list from the API. def _addCloudOutputDevice(self, cluster: CloudCluster): diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index 47720f3ef8..e4b4c2bb0a 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -34,7 +34,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin): self._zero_conf = None self._zero_conf_browser = None - # Create a cloud output device manager that abstract all cloud connection logic away. + # Create a cloud output device manager that abstracts all cloud connection logic away. self._cloud_output_device_manager = CloudOutputDeviceManager() # Because the model needs to be created in the same thread as the QMLEngine, we use a signal.