Fix typing for cluster list

This commit is contained in:
ChrisTerBeke 2018-11-26 14:54:24 +01:00
parent 856276d8b7
commit 269d596f5d
2 changed files with 4 additions and 4 deletions

View file

@ -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):