Typing fixes

Some things the CI is complaining about.

Contributes to issue CURA-8609.
This commit is contained in:
Ghostkeeper 2021-10-13 10:00:22 +02:00
parent a703e6b882
commit af54316690
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A
3 changed files with 11 additions and 8 deletions

View file

@ -18,7 +18,7 @@ from UM.Signal import Signal
from UM.TaskManagement.HttpRequestManager import HttpRequestManager # To call the API.
from UM.TaskManagement.HttpRequestScope import JsonDecoratorScope
from typing import Dict, Optional, TYPE_CHECKING
from typing import Any, Dict, Optional, TYPE_CHECKING
if TYPE_CHECKING:
from PyQt5.QtNetwork import QNetworkReply
from cura.UltimakerCloud.CloudMaterialSync import CloudMaterialSync
@ -42,7 +42,7 @@ class UploadMaterialsJob(Job):
UPLOAD_CONFIRM_URL = UltimakerCloudConstants.CuraCloudAPIRoot + "/connect/v1/clusters/{cluster_id}/printers/{cluster_printer_id}/action/confirm_material_upload"
class Result(enum.IntEnum):
SUCCCESS = 0
SUCCESS = 0
FAILED = 1
def __init__(self, material_sync: "CloudMaterialSync"):
@ -51,8 +51,8 @@ class UploadMaterialsJob(Job):
self._scope = JsonDecoratorScope(UltimakerCloudScope(cura.CuraApplication.CuraApplication.getInstance())) # type: JsonDecoratorScope
self._archive_filename = None # type: Optional[str]
self._archive_remote_id = None # type: Optional[str] # ID that the server gives to this archive. Used to communicate about the archive to the server.
self._printer_sync_status = {}
self._printer_metadata = {}
self._printer_sync_status = {} # type: Dict[str, str]
self._printer_metadata = {} # type: Dict[str, Any]
self.processProgressChanged.connect(self._onProcessProgressChanged)
uploadCompleted = Signal()
@ -113,7 +113,8 @@ class UploadMaterialsJob(Job):
upload_url = response_data["upload_url"]
self._archive_remote_id = response_data["material_profile_id"]
file_data = open(self._archive_filename, "rb").read()
with open(self._archive_filename, "rb") as f:
file_data = f.read()
http = HttpRequestManager.getInstance()
http.put(
url = upload_url,