diff --git a/cura/API/Account.py b/cura/API/Account.py index fa42c3c44d..9f1184a0a0 100644 --- a/cura/API/Account.py +++ b/cura/API/Account.py @@ -74,14 +74,14 @@ class Account(QObject): self._application = application self._new_cloud_printers_detected = False - self._error_message = None # type: Optional[Message] + self._error_message: Optional[Message] = None self._logged_in = False - self._user_profile = None # type: Optional[UserProfile] + self._user_profile: Optional[UserProfile] = None self._additional_rights: Dict[str, Any] = {} self._sync_state = SyncState.IDLE self._manual_sync_enabled = False self._update_packages_enabled = False - self._update_packages_action = None # type: Optional[Callable] + self._update_packages_action: Optional[Callable] = None self._last_sync_str = "-" self._callback_port = 32118 @@ -107,7 +107,7 @@ class Account(QObject): self._update_timer.setSingleShot(True) self._update_timer.timeout.connect(self.sync) - self._sync_services = {} # type: Dict[str, int] + self._sync_services: Dict[str, int] = {} """contains entries "service_name" : SyncState""" def initialize(self) -> None: diff --git a/cura/OAuth2/AuthorizationRequestHandler.py b/cura/OAuth2/AuthorizationRequestHandler.py index ff01969c50..59b3bafa98 100644 --- a/cura/OAuth2/AuthorizationRequestHandler.py +++ b/cura/OAuth2/AuthorizationRequestHandler.py @@ -25,11 +25,11 @@ class AuthorizationRequestHandler(BaseHTTPRequestHandler): super().__init__(request, client_address, server) # These values will be injected by the HTTPServer that this handler belongs to. - self.authorization_helpers = None # type: Optional[AuthorizationHelpers] - self.authorization_callback = None # type: Optional[Callable[[AuthenticationResponse], None]] - self.verification_code = None # type: Optional[str] + self.authorization_helpers: Optional[AuthorizationHelpers] = None + self.authorization_callback: Optional[Callable[[AuthenticationResponse], None]] = None + self.verification_code: Optional[str] = None - self.state = None # type: Optional[str] + self.state: Optional[str] = None # CURA-6609: Some browser seems to issue a HEAD instead of GET request as the callback. def do_HEAD(self) -> None: diff --git a/cura/OAuth2/AuthorizationService.py b/cura/OAuth2/AuthorizationService.py index 0884ec8901..03d1640659 100644 --- a/cura/OAuth2/AuthorizationService.py +++ b/cura/OAuth2/AuthorizationService.py @@ -42,13 +42,13 @@ class AuthorizationService: self._settings = settings self._auth_helpers = AuthorizationHelpers(settings) self._auth_url = "{}/authorize".format(self._settings.OAUTH_SERVER_URL) - self._auth_data = None # type: Optional[AuthenticationResponse] - self._user_profile = None # type: Optional["UserProfile"] + self._auth_data: Optional[AuthenticationResponse] = None + self._user_profile: Optional["UserProfile"] = None self._preferences = preferences self._server = LocalAuthorizationServer(self._auth_helpers, self._onAuthStateChanged, daemon=True) self._currently_refreshing_token = False # Whether we are currently in the process of refreshing auth. Don't make new requests while busy. - self._unable_to_get_data_message = None # type: Optional[Message] + self._unable_to_get_data_message: Optional[Message] = None self.onAuthStateChanged.connect(self._authChanged)