diff --git a/cura/NetworkClient.py b/cura/NetworkClient.py index 20c026f4e6..eeedfeaa79 100644 --- a/cura/NetworkClient.py +++ b/cura/NetworkClient.py @@ -15,10 +15,10 @@ from cura.CuraApplication import CuraApplication # This was originally part of NetworkedPrinterOutputDevice but was moved out for re-use in other classes. class NetworkClient: - def __init__(self, application: CuraApplication = None): + def __init__(self) -> None: # Use the given application instance or get the singleton instance. - self._application = application or CuraApplication.getInstance() + self._application = CuraApplication.getInstance() # Network manager instance to use for this client. self._manager = None # type: Optional[QNetworkAccessManager] @@ -89,7 +89,7 @@ class NetworkClient: def _validateManager(self) -> None: if self._manager is None: self._createNetworkManager() - assert (self._manager is not None) + assert self._manager is not None ## Callback for when the network manager detects that authentication is required but was not given. @staticmethod diff --git a/cura/PrinterOutput/NetworkedPrinterOutputDevice.py b/cura/PrinterOutput/NetworkedPrinterOutputDevice.py index b5bb1a5452..12769208f4 100644 --- a/cura/PrinterOutput/NetworkedPrinterOutputDevice.py +++ b/cura/PrinterOutput/NetworkedPrinterOutputDevice.py @@ -1,22 +1,18 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. - -from UM.FileHandler.FileHandler import FileHandler #For typing. -from UM.Logger import Logger -from UM.Scene.SceneNode import SceneNode #For typing. -from cura.CuraApplication import CuraApplication -from cura.NetworkClient import NetworkClient - -from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState - -from PyQt5.QtNetwork import QHttpMultiPart, QHttpPart, QNetworkRequest, QNetworkAccessManager, QNetworkReply, QAuthenticator -from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QUrl, QCoreApplication +import os +import gzip from time import time -from typing import Any, Callable, Dict, List, Optional +from typing import Dict, List, Optional from enum import IntEnum -import os # To get the username -import gzip +from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply +from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject, QCoreApplication + +from UM.FileHandler.FileHandler import FileHandler +from UM.Scene.SceneNode import SceneNode +from cura.NetworkClient import NetworkClient +from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState class AuthState(IntEnum):