From 2e9dca71ce1c506535bffe2d04f79045e5f9a019 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 10 Apr 2020 13:58:10 +0200 Subject: [PATCH] Remove a number of unused imports --- cura/Arranging/Arrange.py | 2 +- cura/Machines/Models/IntentCategoryModel.py | 3 +-- cura/Machines/QualityGroup.py | 2 -- cura/Operations/SetParentOperation.py | 1 - cura/Settings/CuraStackBuilder.py | 1 - cura/Settings/IntentManager.py | 2 +- cura/Settings/SimpleModeSettingsManager.py | 3 +-- cura/UI/ObjectsModel.py | 2 +- plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py | 2 +- plugins/PostProcessingPlugin/scripts/Stretch.py | 7 +++---- plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py | 1 - plugins/XmlMaterialProfile/XmlMaterialProfile.py | 2 -- plugins/XmlMaterialProfile/tests/TestXmlMaterialProfile.py | 2 -- tests/Machines/TestContainerTree.py | 1 - tests/Settings/TestCuraContainerRegistry.py | 1 - tests/TestBuildVolume.py | 1 - tests/TestExtruderManager.py | 2 +- tests/TestPrintInformation.py | 1 - 18 files changed, 10 insertions(+), 26 deletions(-) diff --git a/cura/Arranging/Arrange.py b/cura/Arranging/Arrange.py index 375d2462ff..cebd813b0d 100644 --- a/cura/Arranging/Arrange.py +++ b/cura/Arranging/Arrange.py @@ -1,6 +1,6 @@ # Copyright (c) 2020 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import List, Optional +from typing import Optional from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Logger import Logger diff --git a/cura/Machines/Models/IntentCategoryModel.py b/cura/Machines/Models/IntentCategoryModel.py index 202d79bb15..427e60ec0c 100644 --- a/cura/Machines/Models/IntentCategoryModel.py +++ b/cura/Machines/Models/IntentCategoryModel.py @@ -4,13 +4,12 @@ import collections from PyQt5.QtCore import Qt, QTimer from typing import TYPE_CHECKING, Optional, Dict -from cura.Machines.Models.IntentTranslations import intent_translations from cura.Machines.Models.IntentModel import IntentModel from cura.Settings.IntentManager import IntentManager from UM.Qt.ListModel import ListModel from UM.Settings.ContainerRegistry import ContainerRegistry #To update the list if anything changes. -from PyQt5.QtCore import pyqtProperty, pyqtSignal +from PyQt5.QtCore import pyqtSignal import cura.CuraApplication if TYPE_CHECKING: from UM.Settings.ContainerRegistry import ContainerInterface diff --git a/cura/Machines/QualityGroup.py b/cura/Machines/QualityGroup.py index 58ba3acc63..97b5e28b41 100644 --- a/cura/Machines/QualityGroup.py +++ b/cura/Machines/QualityGroup.py @@ -3,8 +3,6 @@ from typing import Dict, Optional, List, Set -from PyQt5.QtCore import QObject, pyqtSlot - from UM.Logger import Logger from UM.Util import parseBool diff --git a/cura/Operations/SetParentOperation.py b/cura/Operations/SetParentOperation.py index 7d71572a93..6d603c1d82 100644 --- a/cura/Operations/SetParentOperation.py +++ b/cura/Operations/SetParentOperation.py @@ -5,7 +5,6 @@ from typing import Optional from UM.Scene.SceneNode import SceneNode from UM.Operations import Operation -from UM.Math.Vector import Vector ## An operation that parents a scene node to another scene node. diff --git a/cura/Settings/CuraStackBuilder.py b/cura/Settings/CuraStackBuilder.py index c8287696ae..257af78ecc 100644 --- a/cura/Settings/CuraStackBuilder.py +++ b/cura/Settings/CuraStackBuilder.py @@ -9,7 +9,6 @@ from UM.Settings.Interfaces import DefinitionContainerInterface from UM.Settings.InstanceContainer import InstanceContainer from cura.Machines.ContainerTree import ContainerTree -from cura.Machines.MachineNode import MachineNode from .GlobalStack import GlobalStack from .ExtruderStack import ExtruderStack diff --git a/cura/Settings/IntentManager.py b/cura/Settings/IntentManager.py index 5133b401b4..10ea8dff6a 100644 --- a/cura/Settings/IntentManager.py +++ b/cura/Settings/IntentManager.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal, pyqtSlot -from typing import Any, Dict, List, Optional, Set, Tuple, TYPE_CHECKING +from typing import Any, Dict, List, Set, Tuple, TYPE_CHECKING from UM.Logger import Logger from UM.Settings.InstanceContainer import InstanceContainer diff --git a/cura/Settings/SimpleModeSettingsManager.py b/cura/Settings/SimpleModeSettingsManager.py index 3923435e63..6650a9b333 100644 --- a/cura/Settings/SimpleModeSettingsManager.py +++ b/cura/Settings/SimpleModeSettingsManager.py @@ -1,8 +1,7 @@ # Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import Set -from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty, pyqtSlot +from PyQt5.QtCore import QObject, pyqtSignal, pyqtProperty from UM.Application import Application diff --git a/cura/UI/ObjectsModel.py b/cura/UI/ObjectsModel.py index 5526b41098..6378ebcd1b 100644 --- a/cura/UI/ObjectsModel.py +++ b/cura/UI/ObjectsModel.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the LGPLv3 or higher. from UM.Logger import Logger import re -from typing import Any, Dict, List, Optional, Union +from typing import Dict, List, Optional, Union from PyQt5.QtCore import QTimer, Qt diff --git a/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py b/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py index c8a0b7d797..279b397777 100644 --- a/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py +++ b/plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py @@ -9,7 +9,7 @@ from UM.Version import Version import urllib.request from urllib.error import URLError -from typing import Dict, Optional +from typing import Dict import ssl import certifi diff --git a/plugins/PostProcessingPlugin/scripts/Stretch.py b/plugins/PostProcessingPlugin/scripts/Stretch.py index 3899bd2c50..480ba60606 100644 --- a/plugins/PostProcessingPlugin/scripts/Stretch.py +++ b/plugins/PostProcessingPlugin/scripts/Stretch.py @@ -10,10 +10,10 @@ WARNING This script has never been tested with several extruders from ..Script import Script import numpy as np from UM.Logger import Logger -from UM.Application import Application import re from cura.Settings.ExtruderManager import ExtruderManager + def _getValue(line, key, default=None): """ Convenience function that finds the value in a line of g-code. @@ -30,6 +30,7 @@ def _getValue(line, key, default=None): return default return float(number.group(0)) + class GCodeStep(): """ Class to store the current value of each G_Code parameter @@ -85,7 +86,7 @@ class GCodeStep(): # Execution part of the stretch plugin -class Stretcher(): +class Stretcher: """ Execution part of the stretch algorithm """ @@ -207,7 +208,6 @@ class Stretcher(): return False return True # New sequence - def processLayer(self, layer_steps): """ Computes the new coordinates of g-code steps @@ -291,7 +291,6 @@ class Stretcher(): else: self.layergcode = self.layergcode + layer_steps[i].comment + "\n" - def workOnSequence(self, orig_seq, modif_seq): """ Computes new coordinates for a sequence diff --git a/plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py b/plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py index 09949ed37e..5abc3cfde4 100644 --- a/plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py +++ b/plugins/UM3NetworkPrinting/src/Network/SendMaterialJob.py @@ -6,7 +6,6 @@ from PyQt5.QtNetwork import QNetworkReply, QNetworkRequest from UM.Job import Job from UM.Logger import Logger -from UM.Settings import ContainerRegistry from cura.CuraApplication import CuraApplication from ..Models.Http.ClusterMaterial import ClusterMaterial diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 30bbecc86e..4e0d1e09f5 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -5,7 +5,6 @@ import copy import io import json #To parse the product-to-id mapping file. import os.path #To find the product-to-id mapping. -import sys from typing import Any, Dict, List, Optional, Tuple, cast, Set, Union import xml.etree.ElementTree as ET @@ -18,7 +17,6 @@ from UM.Settings.ContainerRegistry import ContainerRegistry from UM.ConfigurationErrorMessage import ConfigurationErrorMessage from cura.CuraApplication import CuraApplication -from cura.Machines.ContainerTree import ContainerTree from cura.Machines.VariantType import VariantType try: diff --git a/plugins/XmlMaterialProfile/tests/TestXmlMaterialProfile.py b/plugins/XmlMaterialProfile/tests/TestXmlMaterialProfile.py index 1bc19f773a..ef1587a70b 100644 --- a/plugins/XmlMaterialProfile/tests/TestXmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/tests/TestXmlMaterialProfile.py @@ -1,6 +1,4 @@ from unittest.mock import patch, MagicMock -import sys -import os # Prevents error: "PyCapsule_GetPointer called with incorrect name" with conflicting SIP configurations between Arcus and PyQt: Import Arcus and Savitar first! import Savitar # Dont remove this line diff --git a/tests/Machines/TestContainerTree.py b/tests/Machines/TestContainerTree.py index 6a6ccda0f7..071f2620b4 100644 --- a/tests/Machines/TestContainerTree.py +++ b/tests/Machines/TestContainerTree.py @@ -3,7 +3,6 @@ from unittest.mock import patch, MagicMock import pytest -from UM.Settings.DefinitionContainer import DefinitionContainer from cura.Machines.ContainerTree import ContainerTree from cura.Settings.GlobalStack import GlobalStack diff --git a/tests/Settings/TestCuraContainerRegistry.py b/tests/Settings/TestCuraContainerRegistry.py index 6918329397..8bd6fe0ccb 100644 --- a/tests/Settings/TestCuraContainerRegistry.py +++ b/tests/Settings/TestCuraContainerRegistry.py @@ -5,7 +5,6 @@ import os #To find the directory with test files and find the test files. import pytest #To parameterize tests. import unittest.mock #To mock and monkeypatch stuff. -from UM.Settings.DefinitionContainer import DefinitionContainer from cura.ReaderWriters.ProfileReader import NoProfileException from cura.Settings.ExtruderStack import ExtruderStack #Testing for returning the correct types of stacks. from cura.Settings.GlobalStack import GlobalStack #Testing for returning the correct types of stacks. diff --git a/tests/TestBuildVolume.py b/tests/TestBuildVolume.py index 6ccb3d0fb7..11de412592 100644 --- a/tests/TestBuildVolume.py +++ b/tests/TestBuildVolume.py @@ -1,5 +1,4 @@ from unittest.mock import MagicMock, patch -from UM.Math.AxisAlignedBox import AxisAlignedBox import pytest from UM.Math.Polygon import Polygon diff --git a/tests/TestExtruderManager.py b/tests/TestExtruderManager.py index 4ad75989de..f732278e83 100644 --- a/tests/TestExtruderManager.py +++ b/tests/TestExtruderManager.py @@ -1,5 +1,5 @@ -from unittest.mock import MagicMock, patch +from unittest.mock import MagicMock def createMockedExtruder(extruder_id): diff --git a/tests/TestPrintInformation.py b/tests/TestPrintInformation.py index 20c304c2ca..27934a91d8 100644 --- a/tests/TestPrintInformation.py +++ b/tests/TestPrintInformation.py @@ -5,7 +5,6 @@ from cura.UI import PrintInformation from cura.Settings.MachineManager import MachineManager from unittest.mock import MagicMock, patch -from UM.Application import Application from UM.MimeTypeDatabase import MimeTypeDatabase, MimeType