diff --git a/cura/Machines/Models/DiscoveredPrintersModel.py b/cura/Machines/Models/DiscoveredPrintersModel.py index 67d9c19d7e..6d1bbdb698 100644 --- a/cura/Machines/Models/DiscoveredPrintersModel.py +++ b/cura/Machines/Models/DiscoveredPrintersModel.py @@ -72,8 +72,6 @@ class DiscoveredPrinter(QObject): # Human readable machine type string @pyqtProperty(str, notify = machineTypeChanged) def readableMachineType(self) -> str: - from cura.CuraApplication import CuraApplication - machine_manager = CuraApplication.getInstance().getMachineManager() # In NetworkOutputDevice, when it updates a printer information, it updates the machine type using the field # "machine_variant", and for some reason, it's not the machine type ID/codename/... but a human-readable string # like "Ultimaker 3". The code below handles this case. diff --git a/cura/PrinterOutput/NetworkMJPGImage.py b/cura/PrinterOutput/NetworkMJPGImage.py index 522d684085..42132a7880 100644 --- a/cura/PrinterOutput/NetworkMJPGImage.py +++ b/cura/PrinterOutput/NetworkMJPGImage.py @@ -111,7 +111,7 @@ class NetworkMJPGImage(QQuickPaintedItem): if not self._image_reply.isFinished(): self._image_reply.close() - except Exception as e: # RuntimeError + except Exception: # RuntimeError pass # It can happen that the wrapped c++ object is already deleted. self._image_reply = None diff --git a/plugins/ModelChecker/ModelChecker.py b/plugins/ModelChecker/ModelChecker.py index 00e87139d5..5472a96809 100644 --- a/plugins/ModelChecker/ModelChecker.py +++ b/plugins/ModelChecker/ModelChecker.py @@ -79,7 +79,7 @@ class ModelChecker(QObject, Extension): # This function can be triggered in the middle of a machine change, so do not proceed if the machine change # has not done yet. try: - extruder = global_container_stack.extruderList[int(node_extruder_position)] + global_container_stack.extruderList[int(node_extruder_position)] except IndexError: Application.getInstance().callLater(lambda: self.onChanged.emit()) return False diff --git a/plugins/PostProcessingPlugin/scripts/BQ_PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/BQ_PauseAtHeight.py index fb59378206..0b542f2ce7 100644 --- a/plugins/PostProcessingPlugin/scripts/BQ_PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/BQ_PauseAtHeight.py @@ -23,16 +23,13 @@ class BQ_PauseAtHeight(Script): }""" def execute(self, data): - x = 0. - y = 0. - current_z = 0. pause_z = self.getSettingValueByKey("pause_height") for layer in data: lines = layer.split("\n") for line in lines: if self.getValue(line, 'G') == 1 or self.getValue(line, 'G') == 0: current_z = self.getValue(line, 'Z') - if current_z != None: + if current_z is not None: if current_z >= pause_z: prepend_gcode = ";TYPE:CUSTOM\n" prepend_gcode += "; -- Pause at height (%.2f mm) --\n" % pause_z diff --git a/plugins/RemovableDriveOutputDevice/OSXRemovableDrivePlugin.py b/plugins/RemovableDriveOutputDevice/OSXRemovableDrivePlugin.py index 5ad2caed0b..0d2c474e42 100644 --- a/plugins/RemovableDriveOutputDevice/OSXRemovableDrivePlugin.py +++ b/plugins/RemovableDriveOutputDevice/OSXRemovableDrivePlugin.py @@ -49,7 +49,7 @@ class OSXRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin): def performEjectDevice(self, device): p = subprocess.Popen(["diskutil", "eject", device.getId()], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE) - output = p.communicate() + p.communicate() return_code = p.wait() if return_code != 0: diff --git a/plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py index 73b5b456f9..c0d9029c52 100644 --- a/plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/UltimakerNetworkedPrinterOutputDevice.py @@ -299,7 +299,7 @@ class UltimakerNetworkedPrinterOutputDevice(NetworkedPrinterOutputDevice): new_print_jobs = [] # Check which print jobs need to be created or updated. - for index, print_job_data in enumerate(remote_jobs): + for print_job_data in remote_jobs: print_job = next( iter(print_job for print_job in self._print_jobs if print_job.key == print_job_data.uuid), None) if not print_job: diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index 56f53145b0..a0585adf51 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -50,7 +50,7 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin): # The method updates/reset the USB settings for all connected USB devices def updateUSBPrinterOutputDevices(self): - for key, device in self._usb_output_devices.items(): + for device in self._usb_output_devices.values(): if isinstance(device, USBPrinterOutputDevice.USBPrinterOutputDevice): device.resetDeviceSettings() diff --git a/tests/TestMachineAction.py b/tests/TestMachineAction.py index 9b0cb0a4a0..7dbc6b1270 100755 --- a/tests/TestMachineAction.py +++ b/tests/TestMachineAction.py @@ -108,9 +108,9 @@ def test_addMachineAction(machine_action_manager): # Adding unknown action should not crash. machine_action_manager.addFirstStartAction(test_machine, "key_that_doesnt_exists") + def test_removeMachineAction(machine_action_manager): test_action = MachineAction(key="test_action") - test_machine = Machine("test_machine") machine_action_manager.addMachineAction(test_action) # Remove the machine action