Browse Source

Remove a number of unused variables

Jaime van Kessel 4 years ago
parent
commit
fe27da5e8a

+ 0 - 2
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.

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 4
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

+ 1 - 1
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:

+ 1 - 1
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:

+ 1 - 1
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()
 

+ 1 - 1
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