From 577c4dacfe84add3292f656e368b916e96a24459 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Mon, 20 Mar 2023 13:06:28 +0000 Subject: [PATCH] Bug 1811850 - [lint] Fix ruff errors resulting from new configuration, r=webdriver-reviewers,perftest-reviewers,whimboo,sparky,firefox-build-system-reviewers,ahochheiden # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D172359 --- js/src/gdb/mozilla/ExecutableAllocator.py | 1 + js/src/gdb/mozilla/GCCellPtr.py | 1 + js/src/gdb/mozilla/Interpreter.py | 1 + js/src/gdb/mozilla/IonGraph.py | 1 + js/src/gdb/mozilla/JSObject.py | 1 + js/src/gdb/mozilla/JSString.py | 1 + js/src/gdb/mozilla/autoload.py | 1 + js/src/gdb/mozilla/jsop.py | 1 + js/src/gdb/mozilla/jsval.py | 1 + js/src/gdb/mozilla/unwind.py | 1 + python/gdbpp/gdbpp/enumset.py | 1 + python/gdbpp/gdbpp/owningthread.py | 1 + python/gdbpp/gdbpp/thashtable.py | 1 + python/mach/mach/test/test_site.py | 2 +- python/mozbuild/.ruff.toml | 1 + python/mozbuild/mozbuild/compilation/codecomplete.py | 1 + python/mozbuild/mozbuild/configure/options.py | 2 +- python/mozbuild/mozbuild/mach_commands.py | 7 +++++-- .../mozbuild/test/configure/test_checks_configure.py | 2 +- .../mozbuild/test/configure/test_compile_checks.py | 2 +- .../mozbuild/test/configure/test_moz_configure.py | 2 +- .../test/configure/test_toolchain_configure.py | 2 +- .../test/configure/test_toolkit_moz_configure.py | 2 +- python/mozbuild/mozbuild/test/configure/test_util.py | 2 +- python/mozbuild/mozbuild/util.py | 2 +- python/mozbuild/mozpack/chrome/flags.py | 3 ++- python/mozbuild/mozpack/chrome/manifest.py | 5 +++-- python/mozbuild/mozpack/copier.py | 3 ++- python/mozbuild/mozpack/files.py | 10 +++++----- python/mozbuild/mozpack/manifests.py | 3 ++- python/mozbuild/mozpack/mozjar.py | 2 +- python/mozbuild/mozpack/packager/__init__.py | 6 +++--- python/mozbuild/mozpack/packager/formats.py | 3 ++- python/mozbuild/mozpack/packager/l10n.py | 3 ++- python/mozbuild/mozpack/packager/unpack.py | 3 ++- python/mozbuild/mozpack/test/test_archive.py | 3 ++- python/mozbuild/mozpack/test/test_chrome_flags.py | 1 + python/mozbuild/mozpack/test/test_chrome_manifest.py | 1 + python/mozbuild/mozpack/test/test_copier.py | 3 ++- python/mozbuild/mozpack/test/test_errors.py | 1 + python/mozbuild/mozpack/test/test_files.py | 6 +++--- python/mozbuild/mozpack/test/test_manifests.py | 1 + python/mozbuild/mozpack/test/test_mozjar.py | 3 ++- python/mozbuild/mozpack/test/test_packager.py | 8 ++++---- python/mozbuild/mozpack/test/test_packager_formats.py | 3 ++- python/mozbuild/mozpack/test/test_packager_l10n.py | 1 + python/mozbuild/mozpack/test/test_packager_unpack.py | 1 + python/mozbuild/mozpack/test/test_path.py | 1 + python/mozbuild/mozpack/test/test_pkg.py | 3 ++- python/mozbuild/mozpack/test/test_unify.py | 4 ++-- python/mozbuild/mozpack/unify.py | 4 ++-- python/mozrelease/mozrelease/buglist_creator.py | 1 - python/mozrelease/mozrelease/scriptworker_canary.py | 3 +-- taskcluster/gecko_taskgraph/__init__.py | 2 +- taskcluster/gecko_taskgraph/transforms/task.py | 2 +- taskcluster/gecko_taskgraph/util/taskcluster.py | 3 +-- testing/condprofile/condprof/client.py | 3 ++- testing/condprofile/condprof/scenarii/full.py | 1 + testing/condprofile/condprof/tests/test_client.py | 3 ++- testing/condprofile/condprof/tests/test_runner.py | 1 + testing/condprofile/condprof/util.py | 3 ++- .../harness/firefox_ui_harness/cli_functional.py | 3 ++- testing/mach_commands.py | 2 +- .../harness/marionette_harness/runner/httpd.py | 3 +-- .../marionette/harness/marionette_harness/runtests.py | 1 + .../manifestparser/manifestparser/manifestparser.py | 3 +-- testing/mozbase/mozlog/mozlog/formatters/grouping.py | 1 + testing/mozbase/mozlog/mozlog/handlers/base.py | 1 + testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py | 3 ++- testing/mozbase/mozlog/mozlog/scripts/unstable.py | 1 + .../mozbase/mozproxy/mozproxy/backends/mitm/android.py | 1 + .../mozbase/mozproxy/mozproxy/backends/mitm/desktop.py | 1 + .../mozbase/mozproxy/mozproxy/backends/mitm/mitm.py | 1 + testing/mozbase/mozproxy/mozproxy/utils.py | 1 + testing/mozbase/mozversion/mozversion/mozversion.py | 3 ++- testing/mozharness/mozharness/base/diskutils.py | 3 ++- testing/mozharness/mozharness/base/python.py | 3 ++- testing/mozharness/mozharness/base/script.py | 5 +++-- .../mozharness/mozilla/building/buildbase.py | 3 ++- .../mozharness/mozharness/mozilla/testing/android.py | 1 + .../mozharness/mozilla/testing/codecoverage.py | 1 + .../mozharness/mozharness/mozilla/testing/raptor.py | 3 ++- testing/mozharness/mozharness/mozilla/testing/talos.py | 3 ++- .../mozharness/mozharness/mozilla/testing/testbase.py | 5 +++-- .../mozharness/mozharness/mozilla/testing/try_tools.py | 1 + testing/raptor/mach_commands.py | 3 +-- testing/talos/talos/cmanager_win32.py | 1 + testing/talos/talos/config.py | 1 + testing/talos/talos/ffsetup.py | 1 + testing/talos/talos/output.py | 1 + testing/talos/talos/results.py | 1 + testing/talos/talos/run_tests.py | 5 +++-- testing/talos/talos/talos_process.py | 1 + testing/talos/talos/ttest.py | 1 + testing/talos/talos/unittests/test_config.py | 1 + testing/talos/talos/unittests/test_test.py | 1 + testing/talos/talos/unittests/test_xtalos.py | 1 + .../mozilla/tests/webdriver/support/fixtures.py | 1 + testing/xpcshell/mach_commands.py | 3 +-- .../harness/telemetry_harness/fog_testcase.py | 1 + .../marionette/harness/telemetry_harness/runner.py | 1 + .../marionette/harness/telemetry_harness/runtests.py | 1 + .../marionette/harness/telemetry_harness/testcase.py | 1 + tools/lint/eslint/__init__.py | 3 ++- tools/lint/perfdocs/framework_gatherers.py | 1 + tools/lint/perfdocs/utils.py | 1 + tools/lint/perfdocs/verifier.py | 3 ++- tools/lint/python/black.py | 2 +- tools/moztreedocs/mach_commands.py | 1 + tools/tryselect/selectors/chooser/__init__.py | 1 + tools/tryselect/selectors/compare.py | 1 + xpcom/idl-parser/xpidl/runtests.py | 1 + 112 files changed, 160 insertions(+), 80 deletions(-) diff --git a/js/src/gdb/mozilla/ExecutableAllocator.py b/js/src/gdb/mozilla/ExecutableAllocator.py index e82b1a186da4..5187e2d1f182 100644 --- a/js/src/gdb/mozilla/ExecutableAllocator.py +++ b/js/src/gdb/mozilla/ExecutableAllocator.py @@ -9,6 +9,7 @@ allocated by the Jits. """ import gdb + import mozilla.prettyprinters from mozilla.prettyprinters import pretty_printer, ptr_pretty_printer diff --git a/js/src/gdb/mozilla/GCCellPtr.py b/js/src/gdb/mozilla/GCCellPtr.py index ce02a94dfe8b..e42ecfa8939b 100644 --- a/js/src/gdb/mozilla/GCCellPtr.py +++ b/js/src/gdb/mozilla/GCCellPtr.py @@ -5,6 +5,7 @@ # Pretty-printers for GCCellPtr values. import gdb + import mozilla.prettyprinters from mozilla.prettyprinters import pretty_printer diff --git a/js/src/gdb/mozilla/Interpreter.py b/js/src/gdb/mozilla/Interpreter.py index febf92b86deb..cc7cd7372675 100644 --- a/js/src/gdb/mozilla/Interpreter.py +++ b/js/src/gdb/mozilla/Interpreter.py @@ -5,6 +5,7 @@ # Pretty-printers for InterpreterRegs. import gdb + import mozilla.prettyprinters as prettyprinters prettyprinters.clear_module_printers(__name__) diff --git a/js/src/gdb/mozilla/IonGraph.py b/js/src/gdb/mozilla/IonGraph.py index e5e235c59485..639baf3acee0 100644 --- a/js/src/gdb/mozilla/IonGraph.py +++ b/js/src/gdb/mozilla/IonGraph.py @@ -17,6 +17,7 @@ import tempfile import time import gdb + import mozilla.prettyprinters from mozilla.prettyprinters import pretty_printer diff --git a/js/src/gdb/mozilla/JSObject.py b/js/src/gdb/mozilla/JSObject.py index 006f93a89747..95accc93b957 100644 --- a/js/src/gdb/mozilla/JSObject.py +++ b/js/src/gdb/mozilla/JSObject.py @@ -7,6 +7,7 @@ import re import gdb + import mozilla.prettyprinters as prettyprinters from mozilla.CellHeader import get_header_ptr from mozilla.jsval import JSValue diff --git a/js/src/gdb/mozilla/JSString.py b/js/src/gdb/mozilla/JSString.py index afcd3207408f..3c758e0352e9 100644 --- a/js/src/gdb/mozilla/JSString.py +++ b/js/src/gdb/mozilla/JSString.py @@ -5,6 +5,7 @@ # Pretty-printers for SpiderMonkey strings. import gdb + import mozilla.prettyprinters from mozilla.CellHeader import get_header_length_and_flags from mozilla.prettyprinters import ptr_pretty_printer diff --git a/js/src/gdb/mozilla/autoload.py b/js/src/gdb/mozilla/autoload.py index 5e7347d4e113..bc62e0455584 100644 --- a/js/src/gdb/mozilla/autoload.py +++ b/js/src/gdb/mozilla/autoload.py @@ -8,6 +8,7 @@ print("Loading JavaScript value pretty-printers; see js/src/gdb/README.") print("If they cause trouble, type: disable pretty-printer .* SpiderMonkey") import gdb.printing + import mozilla.ExecutableAllocator # Import the pretty-printer modules. As a side effect, loading these diff --git a/js/src/gdb/mozilla/jsop.py b/js/src/gdb/mozilla/jsop.py index ae21aad5f638..635acb752856 100644 --- a/js/src/gdb/mozilla/jsop.py +++ b/js/src/gdb/mozilla/jsop.py @@ -6,6 +6,7 @@ import gdb import gdb.types + import mozilla.prettyprinters from mozilla.prettyprinters import pretty_printer, ptr_pretty_printer diff --git a/js/src/gdb/mozilla/jsval.py b/js/src/gdb/mozilla/jsval.py index 27a47115915a..d01a5ceacc41 100644 --- a/js/src/gdb/mozilla/jsval.py +++ b/js/src/gdb/mozilla/jsval.py @@ -8,6 +8,7 @@ import struct import gdb import gdb.types + import mozilla.prettyprinters from mozilla.prettyprinters import pretty_printer diff --git a/js/src/gdb/mozilla/unwind.py b/js/src/gdb/mozilla/unwind.py index 4b1ffa801490..8ad4393b7ae5 100644 --- a/js/src/gdb/mozilla/unwind.py +++ b/js/src/gdb/mozilla/unwind.py @@ -9,6 +9,7 @@ import platform import gdb import gdb.types from gdb.FrameDecorator import FrameDecorator + from mozilla.JSObject import get_function_name, get_function_script from mozilla.prettyprinters import TypeCache diff --git a/python/gdbpp/gdbpp/enumset.py b/python/gdbpp/gdbpp/enumset.py index 6023364eb9e0..c36e863627dd 100644 --- a/python/gdbpp/gdbpp/enumset.py +++ b/python/gdbpp/gdbpp/enumset.py @@ -5,6 +5,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import gdb + from gdbpp import GeckoPrettyPrinter diff --git a/python/gdbpp/gdbpp/owningthread.py b/python/gdbpp/gdbpp/owningthread.py index cdf0b30c82b3..52055b3c99ff 100644 --- a/python/gdbpp/gdbpp/owningthread.py +++ b/python/gdbpp/gdbpp/owningthread.py @@ -5,6 +5,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import gdb + from gdbpp import GeckoPrettyPrinter diff --git a/python/gdbpp/gdbpp/thashtable.py b/python/gdbpp/gdbpp/thashtable.py index 5775f2994727..8b0294acf60d 100644 --- a/python/gdbpp/gdbpp/thashtable.py +++ b/python/gdbpp/gdbpp/thashtable.py @@ -5,6 +5,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import gdb + from gdbpp import GeckoPrettyPrinter diff --git a/python/mach/mach/test/test_site.py b/python/mach/mach/test/test_site.py index df3a5acd739e..d7c3d8c489ba 100644 --- a/python/mach/mach/test/test_site.py +++ b/python/mach/mach/test/test_site.py @@ -5,7 +5,7 @@ import os from unittest import mock -import pytest as pytest +import pytest from buildconfig import topsrcdir from mozunit import main diff --git a/python/mozbuild/.ruff.toml b/python/mozbuild/.ruff.toml index 4c51ce9e5a8f..ba54f854aaf6 100644 --- a/python/mozbuild/.ruff.toml +++ b/python/mozbuild/.ruff.toml @@ -3,6 +3,7 @@ src = [ # Treat direct imports in the test modules as first party. "mozpack/test", "mozbuild/test", +] [isort] known-first-party = ["mozbuild"] diff --git a/python/mozbuild/mozbuild/compilation/codecomplete.py b/python/mozbuild/mozbuild/compilation/codecomplete.py index 497061e983bd..b5a466b72928 100644 --- a/python/mozbuild/mozbuild/compilation/codecomplete.py +++ b/python/mozbuild/mozbuild/compilation/codecomplete.py @@ -9,6 +9,7 @@ from mach.decorators import Command, CommandArgument from mozbuild.shellutil import quote as shell_quote from mozbuild.shellutil import split as shell_split + # Instropection commands. diff --git a/python/mozbuild/mozbuild/configure/options.py b/python/mozbuild/mozbuild/configure/options.py index 4b623af5fad2..cc3b4516ea6b 100644 --- a/python/mozbuild/mozbuild/configure/options.py +++ b/python/mozbuild/mozbuild/configure/options.py @@ -147,7 +147,7 @@ class NegativeOptionValue(OptionValue): return super(NegativeOptionValue, cls).__new__(cls, origin=origin) def __init__(self, origin="unknown"): - return super(NegativeOptionValue, self).__init__(origin=origin) + super(NegativeOptionValue, self).__init__(origin=origin) class InvalidOptionError(Exception): diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index 0a4e6550d9b6..25a785fc493a 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -32,9 +32,12 @@ from mach.decorators import ( from voluptuous import All, Boolean, Required, Schema import mozbuild.settings # noqa need @SettingsProvider hook to execute -from mozbuild.base import BinaryNotFoundException, BuildEnvironmentNotFoundException +from mozbuild.base import ( + BinaryNotFoundException, + BuildEnvironmentNotFoundException, + MozbuildObject, +) from mozbuild.base import MachCommandConditions as conditions -from mozbuild.base import MozbuildObject from mozbuild.util import MOZBUILD_METRICS_PATH here = os.path.abspath(os.path.dirname(__file__)) diff --git a/python/mozbuild/mozbuild/test/configure/test_checks_configure.py b/python/mozbuild/mozbuild/test/configure/test_checks_configure.py index c82900eed12c..ebca6576681d 100644 --- a/python/mozbuild/mozbuild/test/configure/test_checks_configure.py +++ b/python/mozbuild/mozbuild/test/configure/test_checks_configure.py @@ -8,11 +8,11 @@ import textwrap import unittest from buildconfig import topsrcdir -from common import ConfigureTestSandbox, ensure_exe_extension, fake_short_path from mozpack import path as mozpath from mozunit import MockedOpen, main from six import StringIO +from common import ConfigureTestSandbox, ensure_exe_extension, fake_short_path from mozbuild.configure import ConfigureError, ConfigureSandbox from mozbuild.shellutil import quote as shell_quote from mozbuild.util import exec_ diff --git a/python/mozbuild/mozbuild/test/configure/test_compile_checks.py b/python/mozbuild/mozbuild/test/configure/test_compile_checks.py index 92f4dc664957..37988d535f73 100644 --- a/python/mozbuild/mozbuild/test/configure/test_compile_checks.py +++ b/python/mozbuild/mozbuild/test/configure/test_compile_checks.py @@ -8,11 +8,11 @@ import unittest import mozpack.path as mozpath from buildconfig import topsrcdir -from common import ConfigureTestSandbox from mozunit import main from six import StringIO from test_toolchain_helpers import FakeCompiler +from common import ConfigureTestSandbox from mozbuild.util import exec_ diff --git a/python/mozbuild/mozbuild/test/configure/test_moz_configure.py b/python/mozbuild/mozbuild/test/configure/test_moz_configure.py index f9acfb704704..22129a397098 100644 --- a/python/mozbuild/mozbuild/test/configure/test_moz_configure.py +++ b/python/mozbuild/mozbuild/test/configure/test_moz_configure.py @@ -2,9 +2,9 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -from common import BaseConfigureTest, ConfigureTestSandbox from mozunit import main +from common import BaseConfigureTest, ConfigureTestSandbox from mozbuild.util import ReadOnlyNamespace, exec_, memoized_property diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py index 25f0b65574f9..0e142c2a7f12 100644 --- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py +++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py @@ -6,13 +6,13 @@ import logging import os import six -from common import BaseConfigureTest from mozboot.util import MINIMUM_RUST_VERSION from mozpack import path as mozpath from mozunit import main from six import StringIO from test_toolchain_helpers import CompilerResult, FakeCompiler, PrependFlags +from common import BaseConfigureTest from mozbuild.configure.util import Version from mozbuild.util import ReadOnlyNamespace, memoize diff --git a/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py index dab8109e2ca8..e6b96b3627ca 100644 --- a/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py +++ b/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py @@ -5,10 +5,10 @@ import os from buildconfig import topsrcdir -from common import BaseConfigureTest from mozpack import path as mozpath from mozunit import MockedOpen, main +from common import BaseConfigureTest from mozbuild.configure.options import InvalidOptionError diff --git a/python/mozbuild/mozbuild/test/configure/test_util.py b/python/mozbuild/mozbuild/test/configure/test_util.py index 39ea503453b9..81c2e2a8bf21 100644 --- a/python/mozbuild/mozbuild/test/configure/test_util.py +++ b/python/mozbuild/mozbuild/test/configure/test_util.py @@ -11,11 +11,11 @@ import unittest import six from buildconfig import topsrcdir -from common import ConfigureTestSandbox from mozpack import path as mozpath from mozunit import main from six import StringIO +from common import ConfigureTestSandbox from mozbuild.configure import ConfigureSandbox from mozbuild.configure.util import ( ConfigureOutputHandler, diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py index d0c72a07d001..3e1e0dbde4dc 100644 --- a/python/mozbuild/mozbuild/util.py +++ b/python/mozbuild/mozbuild/util.py @@ -430,7 +430,7 @@ class List(list): raise ValueError("List can only be created from other list instances.") self._kwargs = kwargs - return super(List, self).__init__(iterable) + super(List, self).__init__(iterable) def extend(self, l): if not isinstance(l, list): diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py index 08e975dbe1d1..6b096c862aaa 100644 --- a/python/mozbuild/mozpack/chrome/flags.py +++ b/python/mozbuild/mozpack/chrome/flags.py @@ -6,9 +6,10 @@ import re from collections import OrderedDict import six -from mozpack.errors import errors from packaging.version import Version +from mozpack.errors import errors + class Flag(object): """ diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py index badbd2fd9ceb..14c11d4c1daa 100644 --- a/python/mozbuild/mozpack/chrome/manifest.py +++ b/python/mozbuild/mozpack/chrome/manifest.py @@ -5,11 +5,12 @@ import os import re -import mozpack.path as mozpath import six +from six.moves.urllib.parse import urlparse + +import mozpack.path as mozpath from mozpack.chrome.flags import Flags from mozpack.errors import errors -from six.moves.urllib.parse import urlparse class ManifestEntry(object): diff --git a/python/mozbuild/mozpack/copier.py b/python/mozbuild/mozpack/copier.py index bf222abbcaf2..c042e5432f28 100644 --- a/python/mozbuild/mozpack/copier.py +++ b/python/mozbuild/mozpack/copier.py @@ -9,8 +9,9 @@ import stat import sys from collections import Counter, OrderedDict, defaultdict -import mozpack.path as mozpath import six + +import mozpack.path as mozpath from mozpack.errors import errors from mozpack.files import BaseFile, Dest diff --git a/python/mozbuild/mozpack/files.py b/python/mozbuild/mozpack/files.py index ba8c5d9f1366..691c248b02b3 100644 --- a/python/mozbuild/mozpack/files.py +++ b/python/mozbuild/mozpack/files.py @@ -18,18 +18,18 @@ from itertools import chain, takewhile from tarfile import TarFile, TarInfo from tempfile import NamedTemporaryFile, mkstemp -import mozpack.path as mozpath import six from jsmin import JavascriptMinify + +import mozbuild.makeutil as makeutil +import mozpack.path as mozpath +from mozbuild.preprocessor import Preprocessor +from mozbuild.util import FileAvoidWrite, ensure_unicode, memoize from mozpack.chrome.manifest import ManifestEntry, ManifestInterfaces from mozpack.errors import ErrorMessage, errors from mozpack.executables import elfhack, is_executable, may_elfhack, may_strip, strip from mozpack.mozjar import JarReader -import mozbuild.makeutil as makeutil -from mozbuild.preprocessor import Preprocessor -from mozbuild.util import FileAvoidWrite, ensure_unicode, memoize - try: import hglib except ImportError: diff --git a/python/mozbuild/mozpack/manifests.py b/python/mozbuild/mozpack/manifests.py index 32ec3f73630c..2df6c729eaf0 100644 --- a/python/mozbuild/mozpack/manifests.py +++ b/python/mozbuild/mozpack/manifests.py @@ -5,9 +5,10 @@ import json from contextlib import contextmanager -import mozpack.path as mozpath import six +import mozpack.path as mozpath + from .files import ( AbsoluteSymlinkFile, ExistingFile, diff --git a/python/mozbuild/mozpack/mozjar.py b/python/mozbuild/mozpack/mozjar.py index c98412013723..6500ebfceccf 100644 --- a/python/mozbuild/mozpack/mozjar.py +++ b/python/mozbuild/mozpack/mozjar.py @@ -9,9 +9,9 @@ from collections import OrderedDict from io import BytesIO, UnsupportedOperation from zipfile import ZIP_DEFLATED, ZIP_STORED -import mozpack.path as mozpath import six +import mozpack.path as mozpath from mozbuild.util import ensure_bytes JAR_STORED = ZIP_STORED diff --git a/python/mozbuild/mozpack/packager/__init__.py b/python/mozbuild/mozpack/packager/__init__.py index b118b6a2d10d..83b12e469643 100644 --- a/python/mozbuild/mozpack/packager/__init__.py +++ b/python/mozbuild/mozpack/packager/__init__.py @@ -8,8 +8,10 @@ import os import re from collections import deque -import mozpack.path as mozpath import six + +import mozpack.path as mozpath +from mozbuild.preprocessor import Preprocessor from mozpack.chrome.manifest import ( Manifest, ManifestBinaryComponent, @@ -20,8 +22,6 @@ from mozpack.chrome.manifest import ( ) from mozpack.errors import errors -from mozbuild.preprocessor import Preprocessor - class Component(object): """ diff --git a/python/mozbuild/mozpack/packager/formats.py b/python/mozbuild/mozpack/packager/formats.py index db5dc0c5174b..95a6dee2f699 100644 --- a/python/mozbuild/mozpack/packager/formats.py +++ b/python/mozbuild/mozpack/packager/formats.py @@ -2,6 +2,8 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. +from six.moves.urllib.parse import urlparse + import mozpack.path as mozpath from mozpack.chrome.manifest import ( Manifest, @@ -14,7 +16,6 @@ from mozpack.chrome.manifest import ( from mozpack.copier import FileRegistry, FileRegistrySubtree, Jarrer from mozpack.errors import errors from mozpack.files import ManifestFile -from six.moves.urllib.parse import urlparse """ Formatters are classes receiving packaging instructions and creating the diff --git a/python/mozbuild/mozpack/packager/l10n.py b/python/mozbuild/mozpack/packager/l10n.py index a3b628ac9f2f..76871e15cdfe 100644 --- a/python/mozbuild/mozpack/packager/l10n.py +++ b/python/mozbuild/mozpack/packager/l10n.py @@ -10,9 +10,10 @@ directory. import json import os -import mozpack.path as mozpath import six from createprecomplete import generate_precomplete + +import mozpack.path as mozpath from mozpack.chrome.manifest import ( Manifest, ManifestChrome, diff --git a/python/mozbuild/mozpack/packager/unpack.py b/python/mozbuild/mozpack/packager/unpack.py index f5729a3e91bd..dff295eb9ba5 100644 --- a/python/mozbuild/mozpack/packager/unpack.py +++ b/python/mozbuild/mozpack/packager/unpack.py @@ -4,6 +4,8 @@ import codecs +from six.moves.urllib.parse import urlparse + import mozpack.path as mozpath from mozpack.chrome.manifest import ( ManifestEntryWithRelPath, @@ -16,7 +18,6 @@ from mozpack.files import BaseFinder, DeflatedFile, FileFinder, ManifestFile from mozpack.mozjar import JarReader from mozpack.packager import SimplePackager from mozpack.packager.formats import FlatFormatter -from six.moves.urllib.parse import urlparse class UnpackFinder(BaseFinder): diff --git a/python/mozbuild/mozpack/test/test_archive.py b/python/mozbuild/mozpack/test/test_archive.py index 9cf14768e469..3417f279dff0 100644 --- a/python/mozbuild/mozpack/test/test_archive.py +++ b/python/mozbuild/mozpack/test/test_archive.py @@ -11,6 +11,8 @@ import tempfile import unittest import pytest +from mozunit import main + from mozpack.archive import ( DEFAULT_MTIME, create_tar_bz2_from_files, @@ -18,7 +20,6 @@ from mozpack.archive import ( create_tar_gz_from_files, ) from mozpack.files import GeneratedFile -from mozunit import main MODE_STANDARD = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH diff --git a/python/mozbuild/mozpack/test/test_chrome_flags.py b/python/mozbuild/mozpack/test/test_chrome_flags.py index 340484ad2968..4f1a968dc2e6 100644 --- a/python/mozbuild/mozpack/test/test_chrome_flags.py +++ b/python/mozbuild/mozpack/test/test_chrome_flags.py @@ -5,6 +5,7 @@ import unittest import mozunit + from mozpack.chrome.flags import Flag, Flags, StringFlag, VersionFlag from mozpack.errors import ErrorMessage diff --git a/python/mozbuild/mozpack/test/test_chrome_manifest.py b/python/mozbuild/mozpack/test/test_chrome_manifest.py index 52aa5705e849..c1d5826bbc87 100644 --- a/python/mozbuild/mozpack/test/test_chrome_manifest.py +++ b/python/mozbuild/mozpack/test/test_chrome_manifest.py @@ -6,6 +6,7 @@ import os import unittest import mozunit + from mozpack.chrome.manifest import ( MANIFESTS_TYPES, Manifest, diff --git a/python/mozbuild/mozpack/test/test_copier.py b/python/mozbuild/mozpack/test/test_copier.py index ea2b0eae80f8..60ebd2c1e9e1 100644 --- a/python/mozbuild/mozpack/test/test_copier.py +++ b/python/mozbuild/mozpack/test/test_copier.py @@ -6,9 +6,10 @@ import os import stat import unittest -import mozpack.path as mozpath import mozunit import six + +import mozpack.path as mozpath from mozpack.copier import FileCopier, FileRegistry, FileRegistrySubtree, Jarrer from mozpack.errors import ErrorMessage from mozpack.files import ExistingFile, GeneratedFile diff --git a/python/mozbuild/mozpack/test/test_errors.py b/python/mozbuild/mozpack/test/test_errors.py index 31e3922c9657..411b1b54c3b1 100644 --- a/python/mozbuild/mozpack/test/test_errors.py +++ b/python/mozbuild/mozpack/test/test_errors.py @@ -7,6 +7,7 @@ import unittest import mozunit import six + from mozpack.errors import AccumulatedErrors, ErrorMessage, errors diff --git a/python/mozbuild/mozpack/test/test_files.py b/python/mozbuild/mozpack/test/test_files.py index 07edad79592e..1c86f2e0cca0 100644 --- a/python/mozbuild/mozpack/test/test_files.py +++ b/python/mozbuild/mozpack/test/test_files.py @@ -2,6 +2,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. +from mozbuild.util import ensure_bytes, ensureParentDir from mozpack.errors import ErrorMessage, errors from mozpack.files import ( AbsoluteSymlinkFile, @@ -24,8 +25,6 @@ from mozpack.files import ( TarFinder, ) -from mozbuild.util import ensure_bytes, ensureParentDir - # We don't have hglib installed everywhere. try: import hglib @@ -42,9 +41,10 @@ from io import BytesIO from tempfile import mkdtemp import mozfile -import mozpack.path as mozpath import mozunit import six + +import mozpack.path as mozpath from mozpack.chrome.manifest import ( ManifestContent, ManifestLocale, diff --git a/python/mozbuild/mozpack/test/test_manifests.py b/python/mozbuild/mozpack/test/test_manifests.py index ee5e6220b49f..a5db53b58ce4 100644 --- a/python/mozbuild/mozpack/test/test_manifests.py +++ b/python/mozbuild/mozpack/test/test_manifests.py @@ -5,6 +5,7 @@ import os import mozunit + from mozpack.copier import FileCopier, FileRegistry from mozpack.manifests import InstallManifest, UnreadableInstallManifest from mozpack.test.test_files import TestWithTmpDir diff --git a/python/mozbuild/mozpack/test/test_mozjar.py b/python/mozbuild/mozpack/test/test_mozjar.py index 7a17501cc5fb..e96c59238f78 100644 --- a/python/mozbuild/mozpack/test/test_mozjar.py +++ b/python/mozbuild/mozpack/test/test_mozjar.py @@ -6,9 +6,10 @@ import os import unittest from collections import OrderedDict -import mozpack.path as mozpath import mozunit import six + +import mozpack.path as mozpath from mozpack.files import FileFinder from mozpack.mozjar import ( Deflater, diff --git a/python/mozbuild/mozpack/test/test_packager.py b/python/mozbuild/mozpack/test/test_packager.py index 3e5ae5cdcb56..266902ebb250 100644 --- a/python/mozbuild/mozpack/test/test_packager.py +++ b/python/mozbuild/mozpack/test/test_packager.py @@ -5,9 +5,12 @@ import os import unittest -import mozpack.path as mozpath import mozunit from buildconfig import topobjdir +from mozunit import MockedOpen + +import mozpack.path as mozpath +from mozbuild.preprocessor import Preprocessor from mozpack.chrome.manifest import ( ManifestBinaryComponent, ManifestContent, @@ -22,9 +25,6 @@ from mozpack.packager import ( SimplePackager, preprocess_manifest, ) -from mozunit import MockedOpen - -from mozbuild.preprocessor import Preprocessor MANIFEST = """ bar/* diff --git a/python/mozbuild/mozpack/test/test_packager_formats.py b/python/mozbuild/mozpack/test/test_packager_formats.py index e9bc56c85683..b09971a1028e 100644 --- a/python/mozbuild/mozpack/test/test_packager_formats.py +++ b/python/mozbuild/mozpack/test/test_packager_formats.py @@ -5,9 +5,10 @@ import unittest from itertools import chain -import mozpack.path as mozpath import mozunit import six + +import mozpack.path as mozpath from mozpack.chrome.manifest import ( ManifestBinaryComponent, ManifestComponent, diff --git a/python/mozbuild/mozpack/test/test_packager_l10n.py b/python/mozbuild/mozpack/test/test_packager_l10n.py index caef92a3c01a..0714ae3252d4 100644 --- a/python/mozbuild/mozpack/test/test_packager_l10n.py +++ b/python/mozbuild/mozpack/test/test_packager_l10n.py @@ -6,6 +6,7 @@ import unittest import mozunit import six + from mozpack.chrome.manifest import Manifest, ManifestContent, ManifestLocale from mozpack.copier import FileRegistry from mozpack.files import GeneratedFile, ManifestFile diff --git a/python/mozbuild/mozpack/test/test_packager_unpack.py b/python/mozbuild/mozpack/test/test_packager_unpack.py index 1f679e3a0df5..57a2d71edac7 100644 --- a/python/mozbuild/mozpack/test/test_packager_unpack.py +++ b/python/mozbuild/mozpack/test/test_packager_unpack.py @@ -3,6 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import mozunit + from mozpack.copier import FileCopier, FileRegistry from mozpack.packager.formats import FlatFormatter, JarFormatter, OmniJarFormatter from mozpack.packager.unpack import unpack_to_registry diff --git a/python/mozbuild/mozpack/test/test_path.py b/python/mozbuild/mozpack/test/test_path.py index daee5df0e4bc..6c7aeb5400db 100644 --- a/python/mozbuild/mozpack/test/test_path.py +++ b/python/mozbuild/mozpack/test/test_path.py @@ -6,6 +6,7 @@ import os import unittest import mozunit + from mozpack.path import ( basedir, basename, diff --git a/python/mozbuild/mozpack/test/test_pkg.py b/python/mozbuild/mozpack/test/test_pkg.py index 171afa63a1c1..f1febbbae021 100644 --- a/python/mozbuild/mozpack/test/test_pkg.py +++ b/python/mozbuild/mozpack/test/test_pkg.py @@ -6,8 +6,9 @@ from pathlib import Path from string import Template from unittest.mock import patch -import mozpack.pkg import mozunit + +import mozpack.pkg from mozpack.pkg import ( create_bom, create_payload, diff --git a/python/mozbuild/mozpack/test/test_unify.py b/python/mozbuild/mozpack/test/test_unify.py index cf2eb58160c9..15de50dcccc1 100644 --- a/python/mozbuild/mozpack/test/test_unify.py +++ b/python/mozbuild/mozpack/test/test_unify.py @@ -7,14 +7,14 @@ import sys from io import StringIO import mozunit + +from mozbuild.util import ensureParentDir from mozpack.errors import AccumulatedErrors, ErrorMessage, errors from mozpack.files import FileFinder from mozpack.mozjar import JarWriter from mozpack.test.test_files import MockDest, TestWithTmpDir from mozpack.unify import UnifiedBuildFinder, UnifiedFinder -from mozbuild.util import ensureParentDir - class TestUnified(TestWithTmpDir): def create_one(self, which, path, content): diff --git a/python/mozbuild/mozpack/unify.py b/python/mozbuild/mozpack/unify.py index 3cc5c037676f..ca4d0017a994 100644 --- a/python/mozbuild/mozpack/unify.py +++ b/python/mozbuild/mozpack/unify.py @@ -10,13 +10,13 @@ from collections import OrderedDict from tempfile import mkstemp import buildconfig + import mozpack.path as mozpath +from mozbuild.util import hexdump from mozpack.errors import errors from mozpack.executables import MACHO_SIGNATURES from mozpack.files import BaseFile, BaseFinder, ExecutableFile, GeneratedFile -from mozbuild.util import hexdump - # Regular expressions for unifying install.rdf FIND_TARGET_PLATFORM = re.compile( r""" diff --git a/python/mozrelease/mozrelease/buglist_creator.py b/python/mozrelease/mozrelease/buglist_creator.py index 90d9f9fb3f80..8c7b8d039193 100644 --- a/python/mozrelease/mozrelease/buglist_creator.py +++ b/python/mozrelease/mozrelease/buglist_creator.py @@ -10,7 +10,6 @@ from operator import itemgetter import requests from mozilla_version.gecko import GeckoVersion - from taskcluster import Notify, optionsFromEnvironment BUGLIST_TEMPLATE = "* [Bugs since previous changeset]({url})\n" diff --git a/python/mozrelease/mozrelease/scriptworker_canary.py b/python/mozrelease/mozrelease/scriptworker_canary.py index 92e89ed8f01c..dabdc6868d3f 100644 --- a/python/mozrelease/mozrelease/scriptworker_canary.py +++ b/python/mozrelease/mozrelease/scriptworker_canary.py @@ -12,12 +12,11 @@ import tempfile from contextlib import contextmanager from pathlib import Path +import taskcluster from appdirs import user_config_dir from gecko_taskgraph import GECKO from mach.base import FailedCommandError -import taskcluster - logger = logging.getLogger(__name__) diff --git a/taskcluster/gecko_taskgraph/__init__.py b/taskcluster/gecko_taskgraph/__init__.py index 90ad9d5bdff3..1346bf3c3330 100644 --- a/taskcluster/gecko_taskgraph/__init__.py +++ b/taskcluster/gecko_taskgraph/__init__.py @@ -50,8 +50,8 @@ def register(graph_config): """ from taskgraph import generator - from gecko_taskgraph import morph # noqa: trigger morph registration from gecko_taskgraph import ( # noqa: trigger target task method registration + morph, # noqa: trigger morph registration target_tasks, ) from gecko_taskgraph.parameters import register_parameters diff --git a/taskcluster/gecko_taskgraph/transforms/task.py b/taskcluster/gecko_taskgraph/transforms/task.py index f1d3e713f123..7462d183592a 100644 --- a/taskcluster/gecko_taskgraph/transforms/task.py +++ b/taskcluster/gecko_taskgraph/transforms/task.py @@ -17,6 +17,7 @@ import time import attr from mozbuild.util import memoize +from taskcluster.utils import fromNow from taskgraph.transforms.base import TransformSequence from taskgraph.util.keyed_by import evaluate_keyed_by from taskgraph.util.schema import ( @@ -40,7 +41,6 @@ from gecko_taskgraph.util.partners import get_partners_to_be_published from gecko_taskgraph.util.scriptworker import BALROG_ACTIONS, get_release_config from gecko_taskgraph.util.signed_artifacts import get_signed_artifacts from gecko_taskgraph.util.workertypes import get_worker_type, worker_type_implementation -from taskcluster.utils import fromNow RUN_TASK = os.path.join(GECKO, "taskcluster", "scripts", "run-task") diff --git a/taskcluster/gecko_taskgraph/util/taskcluster.py b/taskcluster/gecko_taskgraph/util/taskcluster.py index 8c863496a735..cddb01fd373d 100644 --- a/taskcluster/gecko_taskgraph/util/taskcluster.py +++ b/taskcluster/gecko_taskgraph/util/taskcluster.py @@ -7,6 +7,7 @@ import logging import os import taskcluster_urls as liburls +from taskcluster import Hooks from taskgraph.util import taskcluster as tc_util from taskgraph.util.taskcluster import ( _do_request, @@ -16,8 +17,6 @@ from taskgraph.util.taskcluster import ( get_task_url, ) -from taskcluster import Hooks - logger = logging.getLogger(__name__) diff --git a/testing/condprofile/condprof/client.py b/testing/condprofile/condprof/client.py index ab901052767b..186e8cf4c4a0 100644 --- a/testing/condprofile/condprof/client.py +++ b/testing/condprofile/condprof/client.py @@ -12,6 +12,8 @@ import tarfile import tempfile import time +from mozprofile.prefs import Preferences + from condprof import progress from condprof.changelog import Changelog from condprof.util import ( @@ -21,7 +23,6 @@ from condprof.util import ( download_file, logger, ) -from mozprofile.prefs import Preferences TC_SERVICE = "https://firefox-ci-tc.services.mozilla.com" ROOT_URL = TC_SERVICE + "/api/index" diff --git a/testing/condprofile/condprof/scenarii/full.py b/testing/condprofile/condprof/scenarii/full.py index 9fb01f3b1f41..ec93b48b46aa 100644 --- a/testing/condprofile/condprof/scenarii/full.py +++ b/testing/condprofile/condprof/scenarii/full.py @@ -7,6 +7,7 @@ import os import random from arsenic.errors import UnknownArsenicError, UnknownError + from condprof.helpers import TabSwitcher, execute_async_script, is_mobile from condprof.util import get_credentials, logger diff --git a/testing/condprofile/condprof/tests/test_client.py b/testing/condprofile/condprof/tests/test_client.py index 0a6613f41562..8410133e16e6 100644 --- a/testing/condprofile/condprof/tests/test_client.py +++ b/testing/condprofile/condprof/tests/test_client.py @@ -7,9 +7,10 @@ import tempfile import unittest import responses +from mozprofile.prefs import Preferences + from condprof.client import ROOT_URL, TC_SERVICE, get_profile from condprof.util import _DEFAULT_SERVER -from mozprofile.prefs import Preferences PROFILE = re.compile(ROOT_URL + "/.*/.*tgz") PROFILE_FOR_TESTS = os.path.join(os.path.dirname(__file__), "profile") diff --git a/testing/condprofile/condprof/tests/test_runner.py b/testing/condprofile/condprof/tests/test_runner.py index e64d9d1860a8..e200a537e1ba 100644 --- a/testing/condprofile/condprof/tests/test_runner.py +++ b/testing/condprofile/condprof/tests/test_runner.py @@ -7,6 +7,7 @@ import tempfile import unittest import responses + from condprof import client from condprof.client import ROOT_URL, TC_SERVICE from condprof.main import main diff --git a/testing/condprofile/condprof/util.py b/testing/condprofile/condprof/util.py index 83e0cc6b71e1..61bad372b1bd 100644 --- a/testing/condprofile/condprof/util.py +++ b/testing/condprofile/condprof/util.py @@ -16,10 +16,11 @@ from subprocess import PIPE, Popen import mozlog import requests import yaml -from condprof import progress from requests.exceptions import ConnectionError from requests.packages.urllib3.util.retry import Retry +from condprof import progress + TASK_CLUSTER = "TASK_ID" in os.environ.keys() DOWNLOAD_TIMEOUT = 30 diff --git a/testing/firefox-ui/harness/firefox_ui_harness/cli_functional.py b/testing/firefox-ui/harness/firefox_ui_harness/cli_functional.py index c3bed1f12f51..339a500f1908 100644 --- a/testing/firefox-ui/harness/firefox_ui_harness/cli_functional.py +++ b/testing/firefox-ui/harness/firefox_ui_harness/cli_functional.py @@ -4,9 +4,10 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. +from marionette_harness.runtests import cli as mn_cli + from firefox_ui_harness.arguments import FirefoxUIArguments from firefox_ui_harness.runners import FirefoxUITestRunner -from marionette_harness.runtests import cli as mn_cli def cli(args=None): diff --git a/testing/mach_commands.py b/testing/mach_commands.py index 77eb428e08d6..02ffb7a48d65 100644 --- a/testing/mach_commands.py +++ b/testing/mach_commands.py @@ -538,7 +538,7 @@ def run_desktop_test( def run_android_test(command_context, tests, symbols_path, manifest_path, log): - import remotecppunittests as remotecppunittests + import remotecppunittests from mozlog import commandline parser = remotecppunittests.RemoteCPPUnittestOptions() diff --git a/testing/marionette/harness/marionette_harness/runner/httpd.py b/testing/marionette/harness/marionette_harness/runner/httpd.py index 98c77362b641..8ffc85aeb0ec 100755 --- a/testing/marionette/harness/marionette_harness/runner/httpd.py +++ b/testing/marionette/harness/marionette_harness/runner/httpd.py @@ -16,9 +16,8 @@ import sys import time from six.moves.urllib import parse as urlparse -from wptserve import handlers, request +from wptserve import handlers, request, server from wptserve import routes as default_routes -from wptserve import server root = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) default_doc_root = os.path.join(root, "www") diff --git a/testing/marionette/harness/marionette_harness/runtests.py b/testing/marionette/harness/marionette_harness/runtests.py index 00f2ce8b5c14..0d86e1534d1d 100644 --- a/testing/marionette/harness/marionette_harness/runtests.py +++ b/testing/marionette/harness/marionette_harness/runtests.py @@ -6,6 +6,7 @@ import sys import mozlog from marionette_driver import __version__ as driver_version + from marionette_harness import ( BaseMarionetteArguments, BaseMarionetteTestRunner, diff --git a/testing/mozbase/manifestparser/manifestparser/manifestparser.py b/testing/mozbase/manifestparser/manifestparser/manifestparser.py index c9a5df3872c7..c43bb150daef 100644 --- a/testing/mozbase/manifestparser/manifestparser/manifestparser.py +++ b/testing/mozbase/manifestparser/manifestparser/manifestparser.py @@ -13,9 +13,8 @@ import types from six import StringIO, string_types -from .filters import DEFAULT_FILTERS, enabled +from .filters import DEFAULT_FILTERS, enabled, filterlist from .filters import exists as _exists -from .filters import filterlist from .ini import read_ini __all__ = ["ManifestParser", "TestManifest", "convert"] diff --git a/testing/mozbase/mozlog/mozlog/formatters/grouping.py b/testing/mozbase/mozlog/mozlog/formatters/grouping.py index ece1a614eaa0..36993b5595ef 100644 --- a/testing/mozbase/mozlog/mozlog/formatters/grouping.py +++ b/testing/mozbase/mozlog/mozlog/formatters/grouping.py @@ -8,6 +8,7 @@ import subprocess import sys import six + from mozlog.formatters import base DEFAULT_MOVE_UP_CODE = u"\x1b[A" diff --git a/testing/mozbase/mozlog/mozlog/handlers/base.py b/testing/mozbase/mozlog/mozlog/handlers/base.py index e6bb6b6336f5..59fc05cc1f89 100644 --- a/testing/mozbase/mozlog/mozlog/handlers/base.py +++ b/testing/mozbase/mozlog/mozlog/handlers/base.py @@ -8,6 +8,7 @@ import locale from threading import Lock import six + from mozlog.handlers.messagehandler import MessageHandler from mozlog.structuredlog import log_levels diff --git a/testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py b/testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py index 529c320d771c..ce51dacdeca8 100644 --- a/testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py +++ b/testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py @@ -4,10 +4,11 @@ import time -import mozlog import pytest import six +import mozlog + def pytest_addoption(parser): # We can't simply use mozlog.commandline.add_logging_group(parser) here because diff --git a/testing/mozbase/mozlog/mozlog/scripts/unstable.py b/testing/mozbase/mozlog/mozlog/scripts/unstable.py index 388fd295908c..4292aced2a4c 100644 --- a/testing/mozbase/mozlog/mozlog/scripts/unstable.py +++ b/testing/mozbase/mozlog/mozlog/scripts/unstable.py @@ -7,6 +7,7 @@ import json from collections import defaultdict import six + from mozlog import reader diff --git a/testing/mozbase/mozproxy/mozproxy/backends/mitm/android.py b/testing/mozbase/mozproxy/mozproxy/backends/mitm/android.py index c250d6f3e412..fe9bcd220d7f 100644 --- a/testing/mozbase/mozproxy/mozproxy/backends/mitm/android.py +++ b/testing/mozbase/mozproxy/mozproxy/backends/mitm/android.py @@ -9,6 +9,7 @@ import sys from subprocess import PIPE import mozinfo + from mozproxy.backends.mitm.mitm import Mitmproxy from mozproxy.utils import LOG, download_file_from_url, tooltool_download diff --git a/testing/mozbase/mozproxy/mozproxy/backends/mitm/desktop.py b/testing/mozbase/mozproxy/mozproxy/backends/mitm/desktop.py index dceb5c646457..f9c30c9b0ecb 100644 --- a/testing/mozbase/mozproxy/mozproxy/backends/mitm/desktop.py +++ b/testing/mozbase/mozproxy/mozproxy/backends/mitm/desktop.py @@ -6,6 +6,7 @@ import os import sys import mozinfo + from mozproxy.backends.mitm.mitm import Mitmproxy from mozproxy.utils import LOG diff --git a/testing/mozbase/mozproxy/mozproxy/backends/mitm/mitm.py b/testing/mozbase/mozproxy/mozproxy/backends/mitm/mitm.py index e5fc23b0e912..9b447f4dc28a 100644 --- a/testing/mozbase/mozproxy/mozproxy/backends/mitm/mitm.py +++ b/testing/mozbase/mozproxy/mozproxy/backends/mitm/mitm.py @@ -11,6 +11,7 @@ import time import mozinfo import six from mozprocess import ProcessHandler + from mozproxy.backends.base import Playback from mozproxy.recordings import RecordingFile from mozproxy.utils import ( diff --git a/testing/mozbase/mozproxy/mozproxy/utils.py b/testing/mozbase/mozproxy/mozproxy/utils.py index c9bf3379bbc5..49b27e70cd97 100644 --- a/testing/mozbase/mozproxy/mozproxy/utils.py +++ b/testing/mozbase/mozproxy/mozproxy/utils.py @@ -26,6 +26,7 @@ except ImportError: from mozlog import get_proxy_logger from mozprocess import ProcessHandler + from mozproxy import mozbase_dir, mozharness_dir LOG = get_proxy_logger(component="mozproxy") diff --git a/testing/mozbase/mozversion/mozversion/mozversion.py b/testing/mozbase/mozversion/mozversion/mozversion.py index 907023a09a0a..cca9c7e7c5d2 100644 --- a/testing/mozbase/mozversion/mozversion/mozversion.py +++ b/testing/mozbase/mozversion/mozversion/mozversion.py @@ -9,9 +9,10 @@ import sys import zipfile import mozlog -from mozversion import errors from six.moves import configparser +from mozversion import errors + INI_DATA_MAPPING = (("application", "App"), ("platform", "Build")) diff --git a/testing/mozharness/mozharness/base/diskutils.py b/testing/mozharness/mozharness/base/diskutils.py index d61661cc3616..757a6ffb7ab2 100644 --- a/testing/mozharness/mozharness/base/diskutils.py +++ b/testing/mozharness/mozharness/base/diskutils.py @@ -33,9 +33,10 @@ import logging import os import sys -from mozharness.base.log import INFO, numeric_log_level from six import string_types +from mozharness.base.log import INFO, numeric_log_level + # use mozharness log log = logging.getLogger(__name__) diff --git a/testing/mozharness/mozharness/base/python.py b/testing/mozharness/mozharness/base/python.py index ba2514c92671..338389758427 100644 --- a/testing/mozharness/mozharness/base/python.py +++ b/testing/mozharness/mozharness/base/python.py @@ -23,6 +23,8 @@ try: except ImportError: import urllib.parse as urlparse +from six import string_types + import mozharness from mozharness.base.errors import VirtualenvErrorList from mozharness.base.log import FATAL, WARNING @@ -32,7 +34,6 @@ from mozharness.base.script import ( PreScriptAction, ScriptMixin, ) -from six import string_types external_tools_path = os.path.join( os.path.abspath(os.path.dirname(os.path.dirname(mozharness.__file__))), diff --git a/testing/mozharness/mozharness/base/script.py b/testing/mozharness/mozharness/base/script.py index 5e427c792fc3..e0db58833311 100644 --- a/testing/mozharness/mozharness/base/script.py +++ b/testing/mozharness/mozharness/base/script.py @@ -38,6 +38,9 @@ from io import BytesIO import mozinfo import six +from mozprocess import ProcessHandler +from six import binary_type + from mozharness.base.config import BaseConfig from mozharness.base.log import ( DEBUG, @@ -51,8 +54,6 @@ from mozharness.base.log import ( OutputParser, SimpleFileLogger, ) -from mozprocess import ProcessHandler -from six import binary_type try: import httplib diff --git a/testing/mozharness/mozharness/mozilla/building/buildbase.py b/testing/mozharness/mozharness/mozilla/building/buildbase.py index 9bdc2b5b16fc..54c387b8f98c 100755 --- a/testing/mozharness/mozharness/mozilla/building/buildbase.py +++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py @@ -21,6 +21,8 @@ from datetime import datetime import six import yaml +from yaml import YAMLError + from mozharness.base.config import DEFAULT_CONFIG_PATH, BaseConfig, parse_config_file from mozharness.base.errors import MakefileErrorList from mozharness.base.log import ERROR, FATAL, OutputParser @@ -37,7 +39,6 @@ from mozharness.mozilla.automation import ( AutomationMixin, ) from mozharness.mozilla.secrets import SecretsMixin -from yaml import YAMLError AUTOMATION_EXIT_CODES = sorted(EXIT_STATUS_DICT.values()) diff --git a/testing/mozharness/mozharness/mozilla/testing/android.py b/testing/mozharness/mozharness/mozilla/testing/android.py index 8afd8b56cca1..7e1770755284 100644 --- a/testing/mozharness/mozharness/mozilla/testing/android.py +++ b/testing/mozharness/mozharness/mozilla/testing/android.py @@ -18,6 +18,7 @@ import time from threading import Timer import six + from mozharness.base.script import PostScriptAction, PreScriptAction from mozharness.mozilla.automation import EXIT_STATUS_DICT, TBPL_RETRY diff --git a/testing/mozharness/mozharness/mozilla/testing/codecoverage.py b/testing/mozharness/mozharness/mozilla/testing/codecoverage.py index ec86cc3f1444..091ff7aa1c8b 100644 --- a/testing/mozharness/mozharness/mozilla/testing/codecoverage.py +++ b/testing/mozharness/mozharness/mozilla/testing/codecoverage.py @@ -14,6 +14,7 @@ import uuid import zipfile import mozinfo + from mozharness.base.script import PostScriptAction, PreScriptAction from mozharness.mozilla.testing.per_test_base import SingleTestMixin diff --git a/testing/mozharness/mozharness/mozilla/testing/raptor.py b/testing/mozharness/mozharness/mozilla/testing/raptor.py index c02c4994601b..569aee08a873 100644 --- a/testing/mozharness/mozharness/mozilla/testing/raptor.py +++ b/testing/mozharness/mozharness/mozilla/testing/raptor.py @@ -15,6 +15,8 @@ import sys import tempfile from shutil import copyfile, rmtree +from six import string_types + import mozharness from mozharness.base.errors import PythonErrorList from mozharness.base.log import CRITICAL, DEBUG, ERROR, INFO, OutputParser @@ -33,7 +35,6 @@ from mozharness.mozilla.testing.codecoverage import ( ) from mozharness.mozilla.testing.errors import HarnessErrorList, TinderBoxPrintRe from mozharness.mozilla.testing.testbase import TestingMixin, testing_config_options -from six import string_types scripts_path = os.path.abspath(os.path.dirname(os.path.dirname(mozharness.__file__))) external_tools_path = os.path.join(scripts_path, "external_tools") diff --git a/testing/mozharness/mozharness/mozilla/testing/talos.py b/testing/mozharness/mozharness/mozilla/testing/talos.py index 0863668cdbc6..0dd0dcbf432a 100755 --- a/testing/mozharness/mozharness/mozilla/testing/talos.py +++ b/testing/mozharness/mozharness/mozilla/testing/talos.py @@ -19,8 +19,9 @@ import shutil import subprocess import sys -import mozharness import six + +import mozharness from mozharness.base.config import parse_config_file from mozharness.base.errors import PythonErrorList from mozharness.base.log import CRITICAL, DEBUG, ERROR, INFO, WARNING, OutputParser diff --git a/testing/mozharness/mozharness/mozilla/testing/testbase.py b/testing/mozharness/mozharness/mozilla/testing/testbase.py index 18943a2028d1..9254bcffeede 100755 --- a/testing/mozharness/mozharness/mozilla/testing/testbase.py +++ b/testing/mozharness/mozharness/mozilla/testing/testbase.py @@ -11,6 +11,9 @@ import os import platform import ssl +from six.moves import urllib +from six.moves.urllib.parse import ParseResult, urlparse + from mozharness.base.errors import BaseErrorList from mozharness.base.log import FATAL, WARNING from mozharness.base.python import ( @@ -28,8 +31,6 @@ from mozharness.mozilla.testing.verify_tools import ( verify_config_options, ) from mozharness.mozilla.tooltool import TooltoolMixin -from six.moves import urllib -from six.moves.urllib.parse import ParseResult, urlparse INSTALLER_SUFFIXES = ( ".apk", # Android diff --git a/testing/mozharness/mozharness/mozilla/testing/try_tools.py b/testing/mozharness/mozharness/mozilla/testing/try_tools.py index 463bd1ad9c20..ac92ef534cc2 100644 --- a/testing/mozharness/mozharness/mozilla/testing/try_tools.py +++ b/testing/mozharness/mozharness/mozilla/testing/try_tools.py @@ -11,6 +11,7 @@ import re from collections import defaultdict import six + from mozharness.base.script import PostScriptAction from mozharness.base.transfer import TransferMixin diff --git a/testing/raptor/mach_commands.py b/testing/raptor/mach_commands.py index 54a25a75e4c9..643b11cd8e0e 100644 --- a/testing/raptor/mach_commands.py +++ b/testing/raptor/mach_commands.py @@ -15,9 +15,8 @@ import sys from mach.decorators import Command from mach.util import get_state_dir -from mozbuild.base import BinaryNotFoundException +from mozbuild.base import BinaryNotFoundException, MozbuildObject from mozbuild.base import MachCommandConditions as Conditions -from mozbuild.base import MozbuildObject HERE = os.path.dirname(os.path.realpath(__file__)) diff --git a/testing/talos/talos/cmanager_win32.py b/testing/talos/talos/cmanager_win32.py index 5d075efdb823..84bab8743d62 100644 --- a/testing/talos/talos/cmanager_win32.py +++ b/testing/talos/talos/cmanager_win32.py @@ -16,6 +16,7 @@ from ctypes import ( from ctypes.wintypes import DWORD, HANDLE, LONG, LPCSTR, LPCWSTR, LPSTR import six + from talos.cmanager_base import CounterManager from talos.utils import TalosError diff --git a/testing/talos/talos/config.py b/testing/talos/talos/config.py index 7cda20ac4474..31ccbfd27800 100644 --- a/testing/talos/talos/config.py +++ b/testing/talos/talos/config.py @@ -7,6 +7,7 @@ import re import sys from mozlog.commandline import setup_logging + from talos import test, utils from talos.cmdline import parse_args diff --git a/testing/talos/talos/ffsetup.py b/testing/talos/talos/ffsetup.py index 4ac5ed688b94..c44535a677e2 100644 --- a/testing/talos/talos/ffsetup.py +++ b/testing/talos/talos/ffsetup.py @@ -16,6 +16,7 @@ import mozrunner import six from mozlog import get_proxy_logger from mozprofile.profile import Profile + from talos import heavy, utils from talos.gecko_profile import GeckoProfile from talos.utils import TalosError, run_in_debug_mode diff --git a/testing/talos/talos/output.py b/testing/talos/talos/output.py index b9c1b77d956d..b6d244a57162 100644 --- a/testing/talos/talos/output.py +++ b/testing/talos/talos/output.py @@ -6,6 +6,7 @@ # NOTE: we have a circular dependency with output.py when we import results import simplejson as json from mozlog import get_proxy_logger + from talos import filter, utils LOG = get_proxy_logger() diff --git a/testing/talos/talos/results.py b/testing/talos/talos/results.py index 3ca8f5a0b62e..73ebd56ed349 100755 --- a/testing/talos/talos/results.py +++ b/testing/talos/talos/results.py @@ -14,6 +14,7 @@ import os import re import six + from talos import filter, output, utils diff --git a/testing/talos/talos/run_tests.py b/testing/talos/talos/run_tests.py index 5be7ec8ff108..d7f8c00116c8 100755 --- a/testing/talos/talos/run_tests.py +++ b/testing/talos/talos/run_tests.py @@ -14,13 +14,14 @@ import mozversion import six from mozgeckoprofiler import view_gecko_profile from mozlog import get_proxy_logger +from wptserve import server +from wptserve.handlers import handler + from talos import utils from talos.config import ConfigurationError, get_configs from talos.results import TalosResults from talos.ttest import TTest from talos.utils import TalosError, TalosRegression -from wptserve import server -from wptserve.handlers import handler # directory of this file here = os.path.dirname(os.path.realpath(__file__)) diff --git a/testing/talos/talos/talos_process.py b/testing/talos/talos/talos_process.py index 5f6b539ddbf6..db3a5f4b858e 100644 --- a/testing/talos/talos/talos_process.py +++ b/testing/talos/talos/talos_process.py @@ -14,6 +14,7 @@ import psutil import six from mozlog import get_proxy_logger from mozprocess import ProcessHandler + from talos.utils import TalosError LOG = get_proxy_logger() diff --git a/testing/talos/talos/ttest.py b/testing/talos/talos/ttest.py index f085f80cd9fa..d5bdb7c9b6ab 100644 --- a/testing/talos/talos/ttest.py +++ b/testing/talos/talos/ttest.py @@ -23,6 +23,7 @@ import mozcrash import mozfile import six from mozlog import get_proxy_logger + from talos import results, talosconfig, utils from talos.cmanager import CounterManagement from talos.ffsetup import FFSetup diff --git a/testing/talos/talos/unittests/test_config.py b/testing/talos/talos/unittests/test_config.py index 7d62dc69f4ba..68549f0f735f 100644 --- a/testing/talos/talos/unittests/test_config.py +++ b/testing/talos/talos/unittests/test_config.py @@ -6,6 +6,7 @@ import conftest import mozunit import pytest import six + from talos.config import ( DEFAULTS, ConfigurationError, diff --git a/testing/talos/talos/unittests/test_test.py b/testing/talos/talos/unittests/test_test.py index 192fd377bb7f..0f20676d251a 100644 --- a/testing/talos/talos/unittests/test_test.py +++ b/testing/talos/talos/unittests/test_test.py @@ -1,5 +1,6 @@ import mozunit import pytest + from talos.test import Test, TsBase, register_test, test_dict, ts_paint diff --git a/testing/talos/talos/unittests/test_xtalos.py b/testing/talos/talos/unittests/test_xtalos.py index 458ca7dfe605..ed536d793048 100644 --- a/testing/talos/talos/unittests/test_xtalos.py +++ b/testing/talos/talos/unittests/test_xtalos.py @@ -1,6 +1,7 @@ import re import mozunit + from talos.xtalos.etlparser import NAME_SUBSTITUTIONS diff --git a/testing/web-platform/mozilla/tests/webdriver/support/fixtures.py b/testing/web-platform/mozilla/tests/webdriver/support/fixtures.py index f0646da31032..3a66df07941c 100644 --- a/testing/web-platform/mozilla/tests/webdriver/support/fixtures.py +++ b/testing/web-platform/mozilla/tests/webdriver/support/fixtures.py @@ -10,6 +10,7 @@ import webdriver from mozprocess import ProcessHandler from mozprofile import Profile from mozrunner import FirefoxRunner + from support.network import get_free_port diff --git a/testing/xpcshell/mach_commands.py b/testing/xpcshell/mach_commands.py index 1e16e168de13..bd2c041c874f 100644 --- a/testing/xpcshell/mach_commands.py +++ b/testing/xpcshell/mach_commands.py @@ -11,9 +11,8 @@ import sys from multiprocessing import cpu_count from mach.decorators import Command -from mozbuild.base import BinaryNotFoundException +from mozbuild.base import BinaryNotFoundException, MozbuildObject from mozbuild.base import MachCommandConditions as conditions -from mozbuild.base import MozbuildObject from mozlog import structured from xpcshellcommandline import parser_desktop, parser_remote diff --git a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/fog_testcase.py b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/fog_testcase.py index 6963aa8a0bb8..c5bc54e9d232 100644 --- a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/fog_testcase.py +++ b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/fog_testcase.py @@ -3,6 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import mozlog + from telemetry_harness.fog_ping_server import FOGPingServer from telemetry_harness.testcase import TelemetryTestCase diff --git a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/runner.py b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/runner.py index 21aeab2c7781..37a91023cef0 100644 --- a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/runner.py +++ b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/runner.py @@ -3,6 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from marionette_harness import BaseMarionetteTestRunner + from telemetry_harness.testcase import TelemetryTestCase SERVER_URL = "http://localhost:8000" diff --git a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/runtests.py b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/runtests.py index e18905bcc5b2..4ecee669f179 100644 --- a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/runtests.py +++ b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/runtests.py @@ -3,6 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from marionette_harness.runtests import cli as mn_cli + from telemetry_harness.runner import TelemetryTestRunner diff --git a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py index e77b2dc5e379..b6f51e47b236 100644 --- a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py +++ b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py @@ -12,6 +12,7 @@ from marionette_driver.errors import MarionetteException from marionette_driver.wait import Wait from marionette_harness import MarionetteTestCase from marionette_harness.runner.mixins.window_manager import WindowManagerMixin + from telemetry_harness.ping_server import PingServer CANARY_CLIENT_ID = "c0ffeec0-ffee-c0ff-eec0-ffeec0ffeec0" diff --git a/tools/lint/eslint/__init__.py b/tools/lint/eslint/__init__.py index af3f5efc56fd..e09e8b00e615 100644 --- a/tools/lint/eslint/__init__.py +++ b/tools/lint/eslint/__init__.py @@ -11,10 +11,11 @@ import subprocess import sys sys.path.append(os.path.join(os.path.dirname(__file__), "eslint")) -from eslint import setup_helper from mozbuild.nodeutil import find_node_executable from mozlint import result +from eslint import setup_helper + ESLINT_ERROR_MESSAGE = """ An error occurred running eslint. Please check the following error messages: diff --git a/tools/lint/perfdocs/framework_gatherers.py b/tools/lint/perfdocs/framework_gatherers.py index dd571db30db5..656364b8d0ed 100644 --- a/tools/lint/perfdocs/framework_gatherers.py +++ b/tools/lint/perfdocs/framework_gatherers.py @@ -9,6 +9,7 @@ import re from gecko_taskgraph.util.attributes import match_run_on_projects from manifestparser import TestManifest from mozperftest.script import ScriptInfo + from perfdocs.doc_helpers import TableBuilder from perfdocs.logger import PerfDocLogger from perfdocs.utils import read_yaml diff --git a/tools/lint/perfdocs/utils.py b/tools/lint/perfdocs/utils.py index 3bf20d33cc48..1ba7daeb524b 100644 --- a/tools/lint/perfdocs/utils.py +++ b/tools/lint/perfdocs/utils.py @@ -8,6 +8,7 @@ import pathlib import yaml from mozversioncontrol import get_repository_object + from perfdocs.logger import PerfDocLogger logger = PerfDocLogger() diff --git a/tools/lint/perfdocs/verifier.py b/tools/lint/perfdocs/verifier.py index db6f849922fd..1911210a78bb 100644 --- a/tools/lint/perfdocs/verifier.py +++ b/tools/lint/perfdocs/verifier.py @@ -6,6 +6,7 @@ import pathlib import re import jsonschema + from perfdocs.gatherer import Gatherer from perfdocs.logger import PerfDocLogger from perfdocs.utils import read_file, read_yaml @@ -550,7 +551,7 @@ class Verifier(object): valid = True break if not valid: - logger.warning( + logger.warning( # noqa: PLE1205 "Cannot find a '{documentation}' entry in the given index file", rst_path, ) diff --git a/tools/lint/python/black.py b/tools/lint/python/black.py index 8c44a5695129..ac975e62a228 100644 --- a/tools/lint/python/black.py +++ b/tools/lint/python/black.py @@ -88,7 +88,7 @@ def parse_issues(config, output, paths, *, log): results.append(result.from_config(config, **res)) continue - log.debug("Unhandled line", line) + log.debug(f"Unhandled line: {line}") return results diff --git a/tools/moztreedocs/mach_commands.py b/tools/moztreedocs/mach_commands.py index 487733c97036..d2aee6edcfb0 100644 --- a/tools/moztreedocs/mach_commands.py +++ b/tools/moztreedocs/mach_commands.py @@ -150,6 +150,7 @@ def build_docs( import webbrowser from livereload import Server + from moztreedocs.package import create_tarball unique_id = "%s/%s" % (project(), str(uuid.uuid1())) diff --git a/tools/tryselect/selectors/chooser/__init__.py b/tools/tryselect/selectors/chooser/__init__.py index 51263a184545..b71cf801ea39 100644 --- a/tools/tryselect/selectors/chooser/__init__.py +++ b/tools/tryselect/selectors/chooser/__init__.py @@ -7,6 +7,7 @@ import webbrowser from threading import Timer from gecko_taskgraph.target_tasks import filter_by_uncommon_try_tasks + from tryselect.cli import BaseTryParser from tryselect.push import ( check_working_directory, diff --git a/tools/tryselect/selectors/compare.py b/tools/tryselect/selectors/compare.py index a6e77ad61b23..0ca20f59b241 100644 --- a/tools/tryselect/selectors/compare.py +++ b/tools/tryselect/selectors/compare.py @@ -6,6 +6,7 @@ import os from mozbuild.base import MozbuildObject from mozversioncontrol import get_repository_object + from tryselect.cli import BaseTryParser from .again import run as again_run diff --git a/xpcom/idl-parser/xpidl/runtests.py b/xpcom/idl-parser/xpidl/runtests.py index f209b5483a15..2dd269dfd980 100755 --- a/xpcom/idl-parser/xpidl/runtests.py +++ b/xpcom/idl-parser/xpidl/runtests.py @@ -15,6 +15,7 @@ sys.path.pop(0) import unittest import mozunit + from xpidl import header, xpidl