diff --git a/devlib/collector/dmesg.py b/devlib/collector/dmesg.py index 799a965..4d4ee60 100644 --- a/devlib/collector/dmesg.py +++ b/devlib/collector/dmesg.py @@ -1,4 +1,4 @@ -# Copyright 2019 ARM Limited +# Copyright 2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ from datetime import timedelta from devlib.collector import (CollectorBase, CollectorOutput, CollectorOutputEntry) -from devlib.target import KernelConfigTristate from devlib.exception import TargetStableError from devlib.utils.misc import memoized diff --git a/devlib/collector/logcat.py b/devlib/collector/logcat.py index 4485e5c..770c905 100644 --- a/devlib/collector/logcat.py +++ b/devlib/collector/logcat.py @@ -1,4 +1,4 @@ -# Copyright 2018 ARM Limited +# Copyright 2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,6 @@ # import os -import shutil from devlib.collector import (CollectorBase, CollectorOutput, CollectorOutputEntry) diff --git a/devlib/collector/serial_trace.py b/devlib/collector/serial_trace.py index 5b538e7..7df9ab3 100644 --- a/devlib/collector/serial_trace.py +++ b/devlib/collector/serial_trace.py @@ -1,4 +1,4 @@ -# Copyright 2018 ARM Limited +# Copyright 2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,8 +13,6 @@ # limitations under the License. # -import shutil -from tempfile import NamedTemporaryFile from pexpect.exceptions import TIMEOUT from devlib.collector import (CollectorBase, CollectorOutput, diff --git a/devlib/collector/systrace.py b/devlib/collector/systrace.py index 538542e..4e29cf1 100644 --- a/devlib/collector/systrace.py +++ b/devlib/collector/systrace.py @@ -1,4 +1,4 @@ -# Copyright 2018 ARM Limited +# Copyright 2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,9 +16,6 @@ import os import subprocess -from shutil import copyfile -from tempfile import NamedTemporaryFile - from devlib.collector import (CollectorBase, CollectorOutput, CollectorOutputEntry) from devlib.exception import TargetStableError, HostError diff --git a/devlib/connection.py b/devlib/connection.py index a857a57..4609975 100644 --- a/devlib/connection.py +++ b/devlib/connection.py @@ -1,4 +1,4 @@ -# Copyright 2019 ARM Limited +# Copyright 2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,13 +15,9 @@ from abc import ABC, abstractmethod from contextlib import contextmanager, nullcontext -from datetime import datetime -from functools import partial -from weakref import WeakSet from shlex import quote import os import signal -import socket import subprocess import threading import time diff --git a/devlib/host.py b/devlib/host.py index ff8546c..f202fcc 100644 --- a/devlib/host.py +++ b/devlib/host.py @@ -1,4 +1,4 @@ -# Copyright 2015-2017 ARM Limited +# Copyright 2015-2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import glob import os import signal import shutil @@ -23,8 +22,7 @@ from getpass import getpass from shlex import quote from devlib.exception import ( - TargetTransientError, TargetStableError, - TargetTransientCalledProcessError, TargetStableCalledProcessError + TargetStableError, TargetTransientCalledProcessError, TargetStableCalledProcessError ) from devlib.utils.misc import check_output from devlib.connection import ConnectionBase, PopenBackgroundCommand diff --git a/devlib/module/cpufreq.py b/devlib/module/cpufreq.py index cf4d11d..2640a9a 100644 --- a/devlib/module/cpufreq.py +++ b/devlib/module/cpufreq.py @@ -1,4 +1,4 @@ -# Copyright 2014-2018 ARM Limited +# Copyright 2014-2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from contextlib import contextmanager -from operator import itemgetter from devlib.module import Module from devlib.exception import TargetStableError diff --git a/devlib/platform/arm.py b/devlib/platform/arm.py index fbe81af..6499ec8 100644 --- a/devlib/platform/arm.py +++ b/devlib/platform/arm.py @@ -1,4 +1,4 @@ -# Copyright 2015-2018 ARM Limited +# Copyright 2015-2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ # limitations under the License. # import os -import sys import tempfile import time import pexpect diff --git a/devlib/target.py b/devlib/target.py index 5662186..7d17fe2 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -1,4 +1,4 @@ -# Copyright 2018 ARM Limited +# Copyright 2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ import time import logging import posixpath import subprocess -import sys import tarfile import tempfile import threading @@ -35,7 +34,6 @@ import copy import inspect import itertools from collections import namedtuple, defaultdict -from contextlib import contextmanager from past.builtins import long from past.types import basestring from numbers import Number @@ -54,15 +52,14 @@ from devlib.platform import Platform from devlib.exception import (DevlibTransientError, TargetStableError, TargetNotRespondingError, TimeoutError, TargetTransientError, KernelConfigKeyError, - TargetError, HostError, TargetCalledProcessError, - TargetStableCalledProcessError) # pylint: disable=redefined-builtin + TargetError, HostError, TargetCalledProcessError) from devlib.utils.ssh import SshConnection -from devlib.utils.android import AdbConnection, AndroidProperties, LogcatMonitor, adb_command, adb_disconnect, INTENT_FLAGS +from devlib.utils.android import AdbConnection, AndroidProperties, LogcatMonitor, adb_command, INTENT_FLAGS from devlib.utils.misc import memoized, isiterable, convert_new_lines, groupby_value from devlib.utils.misc import commonprefix, merge_lists from devlib.utils.misc import ABI_MAP, get_cpu_name, ranges_to_list from devlib.utils.misc import batch_contextmanager, tls_property, _BoundTLSProperty, nullcontext -from devlib.utils.misc import strip_bash_colors, safe_extract +from devlib.utils.misc import safe_extract from devlib.utils.types import integer, boolean, bitmask, identifier, caseless_string, bytes_regex import devlib.utils.asyn as asyn diff --git a/devlib/utils/csvutil.py b/devlib/utils/csvutil.py index b696449..81818e1 100644 --- a/devlib/utils/csvutil.py +++ b/devlib/utils/csvutil.py @@ -1,4 +1,4 @@ -# Copyright 2018 ARM Limited +# Copyright 2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -54,7 +54,6 @@ responsibility of the calling code to ensure that the file is closed properly. ''' import csv -import sys from contextlib import contextmanager diff --git a/devlib/utils/misc.py b/devlib/utils/misc.py index 58cf6ec..3657885 100644 --- a/devlib/utils/misc.py +++ b/devlib/utils/misc.py @@ -1,4 +1,4 @@ -# Copyright 2013-2018 ARM Limited +# Copyright 2013-2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,23 +22,21 @@ from contextlib import contextmanager from functools import partial, reduce, wraps from itertools import groupby from operator import itemgetter -from weakref import WeakKeyDictionary, WeakSet +from weakref import WeakSet import ctypes -import functools import logging import os import pkgutil import random import re -import signal import string import subprocess import sys import threading import types -import wrapt import warnings +import wrapt try: diff --git a/devlib/utils/serial_port.py b/devlib/utils/serial_port.py index e827e98..c4915a9 100644 --- a/devlib/utils/serial_port.py +++ b/devlib/utils/serial_port.py @@ -1,4 +1,4 @@ -# Copyright 2013-2018 ARM Limited +# Copyright 2013-2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,16 +13,13 @@ # limitations under the License. # - import time from contextlib import contextmanager from logging import Logger import serial -# pylint: disable=import-error,wrong-import-position,ungrouped-imports,wrong-import-order -import pexpect - +# pylint: disable=ungrouped-imports try: from pexpect import fdpexpect # pexpect < 4.0.0 does not have fdpexpect module diff --git a/devlib/utils/ssh.py b/devlib/utils/ssh.py index 45d629c..d05bb25 100644 --- a/devlib/utils/ssh.py +++ b/devlib/utils/ssh.py @@ -1,4 +1,4 @@ -# Copyright 2014-2018 ARM Limited +# Copyright 2014-2024 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,6 @@ # -import glob import os import stat import logging @@ -22,13 +21,11 @@ import subprocess import re import threading import tempfile -import shutil import socket import sys import time import atexit import contextlib -import weakref import select import copy import functools @@ -60,8 +57,7 @@ from devlib.exception import (HostError, TargetStableError, TargetNotRespondingE from devlib.utils.misc import (which, strip_bash_colors, check_output, sanitize_cmd_template, memoized, redirect_streams) from devlib.utils.types import boolean -from devlib.connection import (ConnectionBase, ParamikoBackgroundCommand, PopenBackgroundCommand, - SSHTransferHandle) +from devlib.connection import ConnectionBase, ParamikoBackgroundCommand, SSHTransferHandle DEFAULT_SSH_SUDO_COMMAND = "sudo -k -p ' ' -S -- sh -c {}"