From 5005936780665c8f88bbf745a005d2daa4eee766 Mon Sep 17 00:00:00 2001 From: Jiri Podivin Date: Sun, 19 Mar 2023 10:42:06 +0100 Subject: [PATCH] Removing unused imports Signed-off-by: Jiri Podivin --- mtkclient/Library/Connection/devicehandler.py | 2 -- mtkclient/Library/Connection/seriallib.py | 3 --- mtkclient/Library/Connection/usblib.py | 5 +---- mtkclient/Library/daconfig.py | 2 +- mtkclient/Library/gpt.py | 2 +- mtkclient/Library/hwcrypto.py | 2 -- mtkclient/Library/hwcrypto_dxcc.py | 2 +- mtkclient/Library/hwcrypto_sej.py | 2 -- mtkclient/Library/kamakiri.py | 2 +- mtkclient/Library/legacy_ext.py | 2 +- mtkclient/Library/meta.py | 4 ---- mtkclient/Library/mtk_dalegacy.py | 3 +-- mtkclient/Library/mtk_daxflash.py | 5 ++--- mtkclient/Library/mtk_main.py | 1 - mtkclient/Library/mtk_preloader.py | 2 -- mtkclient/Library/partition.py | 1 - mtkclient/Library/xflash_ext.py | 2 -- mtkclient/config/mtk_config.py | 1 - mtkclient/gui/main_gui.py | 17 ++++++----------- mtkclient/gui/readFlashPartitions.py | 3 +-- mtkclient/gui/toolsMenu.py | 2 +- mtkclient/gui/writeFlashPartitions.py | 3 +-- setup.py | 1 - 23 files changed, 18 insertions(+), 51 deletions(-) diff --git a/mtkclient/Library/Connection/devicehandler.py b/mtkclient/Library/Connection/devicehandler.py index e71501d..6f3be29 100644 --- a/mtkclient/Library/Connection/devicehandler.py +++ b/mtkclient/Library/Connection/devicehandler.py @@ -1,8 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- # (c) B.Kerler 2018-2021 -import serial -import serial.tools.list_ports import inspect import traceback from binascii import hexlify diff --git a/mtkclient/Library/Connection/seriallib.py b/mtkclient/Library/Connection/seriallib.py index 80c92c2..357e5e6 100755 --- a/mtkclient/Library/Connection/seriallib.py +++ b/mtkclient/Library/Connection/seriallib.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- # (c) B.Kerler 2018-2022 -import os.path import time import sys if sys.platform != "win32": @@ -17,8 +16,6 @@ def _reset_input_buffer_org(self): import serial import serial.tools.list_ports import inspect -import traceback -from binascii import hexlify from mtkclient.Library.utils import * from mtkclient.Library.Connection.devicehandler import DeviceClass diff --git a/mtkclient/Library/Connection/usblib.py b/mtkclient/Library/Connection/usblib.py index bf4d7b5..8284289 100755 --- a/mtkclient/Library/Connection/usblib.py +++ b/mtkclient/Library/Connection/usblib.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- # (c) B.Kerler 2018-2021 GPLv3 License -import io import logging import usb.core # pyusb @@ -12,13 +11,11 @@ import traceback import array import usb.backend.libusb0 import usb.backend.libusb1 -from struct import calcsize +from struct import pack, calcsize from enum import Enum from binascii import hexlify from ctypes import c_void_p, c_int from mtkclient.Library.utils import * -from struct import pack, calcsize -import traceback from mtkclient.Library.Connection.devicehandler import DeviceClass USB_DIR_OUT = 0 # to device USB_DIR_IN = 0x80 # to host diff --git a/mtkclient/Library/daconfig.py b/mtkclient/Library/daconfig.py index 853e0d5..ead43fd 100755 --- a/mtkclient/Library/daconfig.py +++ b/mtkclient/Library/daconfig.py @@ -4,7 +4,7 @@ import logging import os from struct import unpack -from mtkclient.Library.utils import LogBase, read_object, logsetup +from mtkclient.Library.utils import LogBase, logsetup from mtkclient.config.payloads import pathconfig from mtkclient.config.brom_config import damodes from mtkclient.Library.utils import structhelper diff --git a/mtkclient/Library/gpt.py b/mtkclient/Library/gpt.py index e994e26..fb23512 100755 --- a/mtkclient/Library/gpt.py +++ b/mtkclient/Library/gpt.py @@ -6,7 +6,7 @@ import os import sys import logging from enum import Enum -from struct import unpack, pack +from struct import unpack from binascii import hexlify try: diff --git a/mtkclient/Library/hwcrypto.py b/mtkclient/Library/hwcrypto.py index 0125c5c..8466c55 100755 --- a/mtkclient/Library/hwcrypto.py +++ b/mtkclient/Library/hwcrypto.py @@ -2,14 +2,12 @@ # -*- coding: utf-8 -*- # (c) B.Kerler 2018-2021 GPLv3 License import logging -import time from mtkclient.Library.utils import LogBase, logsetup from mtkclient.Library.hwcrypto_gcpu import GCpu from mtkclient.Library.hwcrypto_dxcc import dxcc from mtkclient.Library.hwcrypto_sej import sej from mtkclient.Library.cqdma import cqdma -from struct import unpack class crypto_setup: diff --git a/mtkclient/Library/hwcrypto_dxcc.py b/mtkclient/Library/hwcrypto_dxcc.py index 00176d0..c2c1322 100755 --- a/mtkclient/Library/hwcrypto_dxcc.py +++ b/mtkclient/Library/hwcrypto_dxcc.py @@ -4,7 +4,7 @@ # DXCC = Discretix CryptoCell -import logging, os +import logging import hashlib from struct import pack from Cryptodome.Util.number import bytes_to_long diff --git a/mtkclient/Library/hwcrypto_sej.py b/mtkclient/Library/hwcrypto_sej.py index 31a211b..c3488c5 100755 --- a/mtkclient/Library/hwcrypto_sej.py +++ b/mtkclient/Library/hwcrypto_sej.py @@ -4,7 +4,6 @@ import logging, os from struct import pack, unpack from mtkclient.Library.utils import LogBase -from binascii import hexlify CustomSeed = bytearray(b"12abcdef") @@ -524,7 +523,6 @@ class sej(metaclass=LogBase): self.sej_set_mode(AES_CBC_MODE) self.sej_set_key(AES_HW_KEY, AES_KEY_128) hw_key = self.sej_do_aes(True, iv, swkey, 32) - # print(hexlify(hw_key)) self.sej_set_key(AES_HW_WRAP_KEY, AES_KEY_256, hw_key) def sej_sec_cfg_sw(self, data, encrypt=True): diff --git a/mtkclient/Library/kamakiri.py b/mtkclient/Library/kamakiri.py index ae038ed..a10b23b 100755 --- a/mtkclient/Library/kamakiri.py +++ b/mtkclient/Library/kamakiri.py @@ -6,7 +6,7 @@ import array import time import os from struct import pack, unpack -from mtkclient.Library.utils import LogBase, print_progress, revdword, logsetup, getint +from mtkclient.Library.utils import LogBase, print_progress, revdword, logsetup from mtkclient.Library.Connection.usblib import usb from mtkclient.config.payloads import pathconfig diff --git a/mtkclient/Library/legacy_ext.py b/mtkclient/Library/legacy_ext.py index f875816..b696f93 100644 --- a/mtkclient/Library/legacy_ext.py +++ b/mtkclient/Library/legacy_ext.py @@ -5,7 +5,7 @@ from mtkclient.Library.settings import hwparam from mtkclient.config.payloads import pathconfig from mtkclient.Library.error import ErrorHandler from mtkclient.Library.hwcrypto import crypto_setup, hwcrypto -from mtkclient.Library.utils import LogBase, progress, logsetup, find_binary +from mtkclient.Library.utils import LogBase, logsetup, find_binary from mtkclient.Library.seccfg import seccfg from binascii import hexlify from mtkclient.Library.utils import mtktee diff --git a/mtkclient/Library/meta.py b/mtkclient/Library/meta.py index f64f0cc..44cc341 100644 --- a/mtkclient/Library/meta.py +++ b/mtkclient/Library/meta.py @@ -1,15 +1,11 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- # (c) B.Kerler 2018-2021 GPLv3 License -import os import time import sys import logging from enum import Enum -from struct import unpack, pack -from binascii import hexlify from mtkclient.Library.utils import LogBase, logsetup -from mtkclient.Library.error import ErrorHandler class META(metaclass=LogBase): class Mode(Enum): diff --git a/mtkclient/Library/mtk_dalegacy.py b/mtkclient/Library/mtk_dalegacy.py index e729f6d..1214821 100755 --- a/mtkclient/Library/mtk_dalegacy.py +++ b/mtkclient/Library/mtk_dalegacy.py @@ -1,7 +1,6 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- # (c) B.Kerler 2018-2021 GPLv3 License -import sys import logging import os import time @@ -15,7 +14,7 @@ from mtkclient.config.payloads import pathconfig from mtkclient.Library.legacy_ext import legacyext from mtkclient.config.mtk_config import Mtk_Config from queue import Queue -from threading import Thread, Event +from threading import Thread rq = Queue() diff --git a/mtkclient/Library/mtk_daxflash.py b/mtkclient/Library/mtk_daxflash.py index 1ad7231..4db6171 100755 --- a/mtkclient/Library/mtk_daxflash.py +++ b/mtkclient/Library/mtk_daxflash.py @@ -4,10 +4,9 @@ import logging import time import os -import hashlib from binascii import hexlify from struct import pack, unpack -from mtkclient.Library.utils import LogBase, progress, logsetup +from mtkclient.Library.utils import LogBase, logsetup from mtkclient.Library.error import ErrorHandler from mtkclient.Library.daconfig import EMMC_PartitionType, UFS_PartitionType, DaStorage from mtkclient.Library.partition import Partition @@ -15,7 +14,7 @@ from mtkclient.config.payloads import pathconfig from mtkclient.Library.xflash_ext import xflashext, XCmd from mtkclient.Library.settings import hwparam from queue import Queue -from threading import Thread, Event +from threading import Thread rq = Queue() diff --git a/mtkclient/Library/mtk_main.py b/mtkclient/Library/mtk_main.py index 1c40e33..973bbdb 100644 --- a/mtkclient/Library/mtk_main.py +++ b/mtkclient/Library/mtk_main.py @@ -17,7 +17,6 @@ from mtkclient.Library.utils import print_progress from mtkclient.Library.error import ErrorHandler from mtkclient.Library.mtk_da_cmd import DA_handler from mtkclient.Library.gpt import gpt_settings -import argparse metamodes = "[FASTBOOT, FACTFACT, METAMETA, FACTORYM, ADVEMETA, AT+NBOOT]" class ArgHandler(metaclass=LogBase): diff --git a/mtkclient/Library/mtk_preloader.py b/mtkclient/Library/mtk_preloader.py index 01d3d94..e0b0691 100755 --- a/mtkclient/Library/mtk_preloader.py +++ b/mtkclient/Library/mtk_preloader.py @@ -3,13 +3,11 @@ # (c) B.Kerler 2018-2021 GPLv3 License import os import logging -import shutil from enum import Enum from struct import unpack, pack from binascii import hexlify from mtkclient.Library.utils import LogBase, logsetup from mtkclient.Library.error import ErrorHandler -import time USBDL_BIT_EN = 0x00000001 # 1: download bit enabled USBDL_BROM = 0x00000002 # 0: usbdl by brom; 1: usbdl by bootloader diff --git a/mtkclient/Library/partition.py b/mtkclient/Library/partition.py index d8c3884..d98169e 100755 --- a/mtkclient/Library/partition.py +++ b/mtkclient/Library/partition.py @@ -2,7 +2,6 @@ # -*- coding: utf-8 -*- # (c) B.Kerler 2018-2021 GPLv3 License import logging -import os.path from mtkclient.Library.utils import LogBase, logsetup from mtkclient.Library.gpt import gpt diff --git a/mtkclient/Library/xflash_ext.py b/mtkclient/Library/xflash_ext.py index 0ebe0c0..fc9eb80 100644 --- a/mtkclient/Library/xflash_ext.py +++ b/mtkclient/Library/xflash_ext.py @@ -1,4 +1,3 @@ -import hmac import os from struct import unpack, pack @@ -9,7 +8,6 @@ from mtkclient.Library.hwcrypto import crypto_setup, hwcrypto from mtkclient.Library.utils import LogBase, progress, logsetup, find_binary from mtkclient.Library.seccfg import seccfg from binascii import hexlify -import hashlib from mtkclient.Library.utils import mtktee import json diff --git a/mtkclient/config/mtk_config.py b/mtkclient/config/mtk_config.py index f8186fe..e4deed9 100644 --- a/mtkclient/config/mtk_config.py +++ b/mtkclient/config/mtk_config.py @@ -5,7 +5,6 @@ from binascii import hexlify from mtkclient.Library.utils import LogBase from mtkclient.Library.settings import hwparam from mtkclient.config.brom_config import chipconfig, damodes, hwconfig -from struct import pack try: from PySide6.QtCore import QObject except ImportError: diff --git a/mtkclient/gui/main_gui.py b/mtkclient/gui/main_gui.py index 939a2ec..e92bbaf 100644 --- a/mtkclient/gui/main_gui.py +++ b/mtkclient/gui/main_gui.py @@ -8,17 +8,12 @@ ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ -from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, - QMetaObject, QObject, QPoint, QRect, - QSize, QTime, QUrl, Qt) -from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient, - QCursor, QFont, QFontDatabase, QGradient, - QIcon, QImage, QKeySequence, QLinearGradient, - QPainter, QPalette, QPixmap, QRadialGradient, - QTransform) -from PySide6.QtWidgets import (QAbstractScrollArea, QApplication, QCheckBox, QFrame, - QGridLayout, QHBoxLayout, QHeaderView, QLabel, - QLayout, QMainWindow, QMenu, QMenuBar, +from PySide6.QtCore import (QCoreApplication, QMetaObject, QRect, + QSize, Qt) +from PySide6.QtGui import QAction, QPixmap +from PySide6.QtWidgets import (QAbstractScrollArea, QCheckBox, QFrame, + QGridLayout, QHBoxLayout, QLabel, + QLayout, QMenu, QMenuBar, QPlainTextEdit, QProgressBar, QPushButton, QScrollArea, QSizePolicy, QSpacerItem, QTabWidget, QTableWidget, QTableWidgetItem, QVBoxLayout, QWidget) diff --git a/mtkclient/gui/readFlashPartitions.py b/mtkclient/gui/readFlashPartitions.py index 0ee4166..3a3ae1e 100644 --- a/mtkclient/gui/readFlashPartitions.py +++ b/mtkclient/gui/readFlashPartitions.py @@ -1,8 +1,7 @@ import os import sys import mock -import time -from PySide6.QtCore import Slot, QObject, Signal +from PySide6.QtCore import QObject, Signal from mtkclient.gui.toolkit import convert_size, FDialog, trap_exc_during_debug, asyncThread sys.excepthook = trap_exc_during_debug diff --git a/mtkclient/gui/toolsMenu.py b/mtkclient/gui/toolsMenu.py index 0f067b4..26a094a 100644 --- a/mtkclient/gui/toolsMenu.py +++ b/mtkclient/gui/toolsMenu.py @@ -1,5 +1,5 @@ from PySide6.QtCore import Slot, QObject, Signal -from PySide6.QtWidgets import QTableWidget, QTableWidgetItem +from PySide6.QtWidgets import QTableWidgetItem from mtkclient.gui.toolkit import trap_exc_during_debug, asyncThread, FDialog from mtkclient.Library.mtk_da_cmd import DA_handler import os diff --git a/mtkclient/gui/writeFlashPartitions.py b/mtkclient/gui/writeFlashPartitions.py index e9d039e..fcb39dd 100644 --- a/mtkclient/gui/writeFlashPartitions.py +++ b/mtkclient/gui/writeFlashPartitions.py @@ -1,9 +1,8 @@ import os import sys -import time import mock from PySide6.QtCore import QObject, Signal -from mtkclient.gui.toolkit import trap_exc_during_debug, asyncThread, convert_size, FDialog, CheckBox, TimeEstim +from mtkclient.gui.toolkit import trap_exc_during_debug, asyncThread, FDialog sys.excepthook = trap_exc_during_debug diff --git a/setup.py b/setup.py index 10f7c8b..fb13ea3 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 from setuptools import setup, find_packages -import os setup( name='mtkclient',