mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Fix typing issues
CURA-6005
This commit is contained in:
parent
2275e5c71f
commit
8c07a6e89b
4 changed files with 11 additions and 10 deletions
|
@ -3,7 +3,7 @@ import base64
|
|||
import hashlib
|
||||
from datetime import datetime
|
||||
from tempfile import NamedTemporaryFile
|
||||
from typing import Optional, List, Dict
|
||||
from typing import Any, Optional, List, Dict
|
||||
|
||||
import requests
|
||||
|
||||
|
@ -34,7 +34,7 @@ class DriveApiService:
|
|||
"""Create a new instance of the Drive API service and set the cura_api object."""
|
||||
self._cura_api = cura_api
|
||||
|
||||
def getBackups(self) -> List[Dict[str, any]]:
|
||||
def getBackups(self) -> List[Dict[str, Any]]:
|
||||
"""Get all backups from the API."""
|
||||
access_token = self._cura_api.account.accessToken
|
||||
if not access_token:
|
||||
|
@ -85,7 +85,7 @@ class DriveApiService:
|
|||
else:
|
||||
self.onCreatingStateChanged.emit(is_creating=False)
|
||||
|
||||
def restoreBackup(self, backup: Dict[str, any]) -> None:
|
||||
def restoreBackup(self, backup: Dict[str, Any]) -> None:
|
||||
"""
|
||||
Restore a previously exported backup from cloud storage.
|
||||
:param backup: A dict containing an entry from the API list response.
|
||||
|
@ -157,7 +157,7 @@ class DriveApiService:
|
|||
return False
|
||||
return True
|
||||
|
||||
def _requestBackupUpload(self, backup_metadata: Dict[str, any], backup_size: int) -> Optional[str]:
|
||||
def _requestBackupUpload(self, backup_metadata: Dict[str, Any], backup_size: int) -> Optional[str]:
|
||||
"""
|
||||
Request a backup upload slot from the API.
|
||||
:param backup_metadata: A dict containing some meta data about the backup.
|
||||
|
|
|
@ -70,6 +70,7 @@ class DrivePluginExtension(QObject, Extension):
|
|||
if not self._drive_window:
|
||||
self._drive_window = self.createDriveWindow()
|
||||
self.refreshBackups()
|
||||
if self._drive_window:
|
||||
self._drive_window.show()
|
||||
|
||||
def createDriveWindow(self) -> Optional["QObject"]:
|
||||
|
|
|
@ -14,14 +14,14 @@ class UploadBackupJob(Job):
|
|||
As it can take longer than some other tasks, we schedule this using a Cura Job.
|
||||
"""
|
||||
|
||||
def __init__(self, signed_upload_url: str, backup_zip: bytes):
|
||||
def __init__(self, signed_upload_url: str, backup_zip: bytes) -> None:
|
||||
super().__init__()
|
||||
self._signed_upload_url = signed_upload_url
|
||||
self._backup_zip = backup_zip
|
||||
self._upload_success = False
|
||||
self.backup_upload_error_message = ""
|
||||
|
||||
def run(self):
|
||||
def run(self) -> None:
|
||||
Message(Settings.translatable_messages["uploading_backup"], title = Settings.MESSAGE_TITLE,
|
||||
lifetime = 10).show()
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright (c) 2018 Ultimaker B.V.
|
||||
from typing import List, Dict
|
||||
from typing import Any, List, Dict
|
||||
|
||||
from UM.Qt.ListModel import ListModel
|
||||
|
||||
|
@ -11,7 +11,7 @@ class BackupListModel(ListModel):
|
|||
The BackupListModel transforms the backups data that came from the server so it can be served to the Qt UI.
|
||||
"""
|
||||
|
||||
def __init__(self, parent=None):
|
||||
def __init__(self, parent = None) -> None:
|
||||
super().__init__(parent)
|
||||
self.addRoleName(Qt.UserRole + 1, "backup_id")
|
||||
self.addRoleName(Qt.UserRole + 2, "download_url")
|
||||
|
@ -19,7 +19,7 @@ class BackupListModel(ListModel):
|
|||
self.addRoleName(Qt.UserRole + 4, "md5_hash")
|
||||
self.addRoleName(Qt.UserRole + 5, "data")
|
||||
|
||||
def loadBackups(self, data: List[Dict[str, any]]) -> None:
|
||||
def loadBackups(self, data: List[Dict[str, Any]]) -> None:
|
||||
"""
|
||||
Populate the model with server data.
|
||||
:param data:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue