From e08a6e120b7ce36c1316c56172d90ad918cc4061 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Wed, 23 Nov 2022 22:04:39 +0000 Subject: [PATCH] Bug 1790816 - Reformat config/ with isort. r=linter-reviewers,ahal DONTBUILD # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D162646 --- config/MozZipFile.py | 3 ++- config/check_js_msg_encoding.py | 1 - config/check_js_opcode.py | 3 +-- config/check_macroassembler_style.py | 3 +-- config/check_source_count.py | 6 +++--- config/check_vanilla_allocations.py | 1 + config/create_rc.py | 5 ++--- config/create_res.py | 5 +---- config/createprecomplete.py | 5 ++--- config/external/ffi/preprocess_libffi_asm.py | 9 +++++---- config/external/ffi/subst_header.py | 2 ++ config/external/icu/data/convert_icudata.py | 2 ++ config/make-stl-wrappers.py | 6 +++--- config/make-system-wrappers.py | 5 +++-- config/make-windows-h-wrapper.py | 3 ++- config/mozunit/mozunit/mozunit.py | 9 ++++----- config/nsinstall.py | 13 +++++++------ config/printconfigsetting.py | 7 +------ config/printprereleasesuffix.py | 5 ++--- config/rebuild_check.py | 3 ++- config/run_spidermonkey_checks.py | 4 +++- config/tests/test_mozbuild_reading.py | 13 ++++--------- config/tests/unit-mozunit.py | 4 +++- config/tests/unit-nsinstall.py | 14 +++++++------- config/tests/unit-printprereleasesuffix.py | 2 +- config/tests/unitMozZipFile.py | 13 +++++++------ 26 files changed, 71 insertions(+), 75 deletions(-) diff --git a/config/MozZipFile.py b/config/MozZipFile.py index c5f08aef03ca..2d3ff00ced32 100644 --- a/config/MozZipFile.py +++ b/config/MozZipFile.py @@ -3,11 +3,12 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import absolute_import, print_function, unicode_literals + import os -import six import time import zipfile +import six from mozbuild.util import lock_file diff --git a/config/check_js_msg_encoding.py b/config/check_js_msg_encoding.py index 69d2a368dcc5..56077ee2cf04 100644 --- a/config/check_js_msg_encoding.py +++ b/config/check_js_msg_encoding.py @@ -16,7 +16,6 @@ import sys from mozversioncontrol import get_repository_from_env - scriptname = os.path.basename(__file__) expected_encoding = "ascii" diff --git a/config/check_js_opcode.py b/config/check_js_opcode.py index c42ea5ee63fa..2f24061beec6 100644 --- a/config/check_js_opcode.py +++ b/config/check_js_opcode.py @@ -7,8 +7,7 @@ # This script checks bytecode documentation in js/src/vm/Opcodes.h # ---------------------------------------------------------------------------- -from __future__ import absolute_import -from __future__ import print_function +from __future__ import absolute_import, print_function import os import sys diff --git a/config/check_macroassembler_style.py b/config/check_macroassembler_style.py index b7c3e5c5000a..bfe28c0d8d61 100644 --- a/config/check_macroassembler_style.py +++ b/config/check_macroassembler_style.py @@ -20,8 +20,7 @@ # proper methods annotations. # ---------------------------------------------------------------------------- -from __future__ import absolute_import -from __future__ import print_function +from __future__ import absolute_import, print_function import difflib import os diff --git a/config/check_source_count.py b/config/check_source_count.py index 33f26acd393f..c465f6749a20 100755 --- a/config/check_source_count.py +++ b/config/check_source_count.py @@ -9,10 +9,10 @@ # not, an error message is printed, quoting ERROR_LOCATION, which should # probably be the filename and line number of the erroneous call to # check_source_count.py. -from __future__ import absolute_import -from __future__ import print_function -import sys +from __future__ import absolute_import, print_function + import re +import sys search_string = sys.argv[1] expected_count = int(sys.argv[2]) diff --git a/config/check_vanilla_allocations.py b/config/check_vanilla_allocations.py index bc8292e9259f..cb04144d5bc8 100644 --- a/config/check_vanilla_allocations.py +++ b/config/check_vanilla_allocations.py @@ -44,6 +44,7 @@ import argparse import re import subprocess import sys + import buildconfig # The obvious way to implement this script is to search for occurrences of diff --git a/config/create_rc.py b/config/create_rc.py index 973bb5b44e77..d75959d4e02b 100644 --- a/config/create_rc.py +++ b/config/create_rc.py @@ -2,14 +2,13 @@ # 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 datetime import datetime import io import os import sys +from datetime import datetime -from mozbuild.preprocessor import Preprocessor import buildconfig - +from mozbuild.preprocessor import Preprocessor TEMPLATE = """ // This Source Code Form is subject to the terms of the Mozilla Public diff --git a/config/create_res.py b/config/create_res.py index 3cb036fcf9e9..a0f6f600b118 100644 --- a/config/create_res.py +++ b/config/create_res.py @@ -2,14 +2,11 @@ # 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 argparse import ( - Action, - ArgumentParser, -) import os import subprocess import sys import tempfile +from argparse import Action, ArgumentParser import buildconfig diff --git a/config/createprecomplete.py b/config/createprecomplete.py index dda4efcdf8e1..7a442d65bf45 100644 --- a/config/createprecomplete.py +++ b/config/createprecomplete.py @@ -6,11 +6,10 @@ # longer present in a complete update. The current working directory is used for # the location to enumerate and to create the precomplete file. -from __future__ import absolute_import -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals -import os import io +import os def get_build_entries(root_path): diff --git a/config/external/ffi/preprocess_libffi_asm.py b/config/external/ffi/preprocess_libffi_asm.py index 69e65be5ea89..b4b6a8c5ae22 100644 --- a/config/external/ffi/preprocess_libffi_asm.py +++ b/config/external/ffi/preprocess_libffi_asm.py @@ -4,14 +4,15 @@ # License, v. 2.0. If a copy of the MPL was not distibuted with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -from __future__ import absolute_import -from __future__ import print_function -import buildconfig -import mozpack.path as mozpath +from __future__ import absolute_import, print_function + import os import shlex import subprocess +import buildconfig +import mozpack.path as mozpath + def main(output, input_asm, ffi_h, ffi_config_h, defines, includes): defines = shlex.split(defines) diff --git a/config/external/ffi/subst_header.py b/config/external/ffi/subst_header.py index 7614cfd92fd5..49c524eddc51 100644 --- a/config/external/ffi/subst_header.py +++ b/config/external/ffi/subst_header.py @@ -5,7 +5,9 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import absolute_import + import sys + import buildconfig from mozbuild.preprocessor import Preprocessor diff --git a/config/external/icu/data/convert_icudata.py b/config/external/icu/data/convert_icudata.py index c8c18f9e0196..b2ad5cee7375 100644 --- a/config/external/icu/data/convert_icudata.py +++ b/config/external/icu/data/convert_icudata.py @@ -3,8 +3,10 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import absolute_import + import os import subprocess + import buildconfig diff --git a/config/make-stl-wrappers.py b/config/make-stl-wrappers.py index 5102e1984ee8..0adbcb56d5a7 100644 --- a/config/make-stl-wrappers.py +++ b/config/make-stl-wrappers.py @@ -1,12 +1,12 @@ # This Source Code Form is subject to the terms of the Mozilla Public # 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 __future__ import absolute_import -from __future__ import print_function +from __future__ import absolute_import, print_function + import os import string -from mozbuild.util import FileAvoidWrite +from mozbuild.util import FileAvoidWrite # The 'unused' arg is the output file from the file_generate action. We actually # generate all the files in header_list diff --git a/config/make-system-wrappers.py b/config/make-system-wrappers.py index d46ec5cc0f5a..fc3fc6b29e6e 100644 --- a/config/make-system-wrappers.py +++ b/config/make-system-wrappers.py @@ -1,9 +1,10 @@ # This Source Code Form is subject to the terms of the Mozilla Public # 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 __future__ import absolute_import -from __future__ import print_function +from __future__ import absolute_import, print_function + import os + from mozbuild.util import FileAvoidWrite header_template = """#pragma GCC system_header diff --git a/config/make-windows-h-wrapper.py b/config/make-windows-h-wrapper.py index 8a1616696e0a..a64c318993bc 100644 --- a/config/make-windows-h-wrapper.py +++ b/config/make-windows-h-wrapper.py @@ -3,9 +3,10 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import absolute_import + import re -import textwrap import string +import textwrap comment_re = re.compile(r"//[^\n]*\n|/\*.*\*/", re.S) decl_re = re.compile( diff --git a/config/mozunit/mozunit/mozunit.py b/config/mozunit/mozunit/mozunit.py index 3fda0a45dc48..66a126888dc9 100644 --- a/config/mozunit/mozunit/mozunit.py +++ b/config/mozunit/mozunit/mozunit.py @@ -3,19 +3,18 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import absolute_import + import inspect import io import os -from six import ( - BytesIO, - StringIO, -) import sys import unittest -from unittest import TextTestRunner as _TestRunner, TestResult as _TestResult +from unittest import TestResult as _TestResult +from unittest import TextTestRunner as _TestRunner import pytest import six +from six import BytesIO, StringIO here = os.path.abspath(os.path.dirname(__file__)) diff --git a/config/nsinstall.py b/config/nsinstall.py index 49d57b795f7f..01dd5988b5be 100644 --- a/config/nsinstall.py +++ b/config/nsinstall.py @@ -9,15 +9,16 @@ # a full build environment set up. # The basic limitation is, it doesn't even try to link and ignores # all related options. -from __future__ import absolute_import -from __future__ import print_function -from optparse import OptionParser -import mozfile +from __future__ import absolute_import, print_function + import os import os.path -import six -import sys import shutil +import sys +from optparse import OptionParser + +import mozfile +import six def _nsinstall_internal(argv): diff --git a/config/printconfigsetting.py b/config/printconfigsetting.py index 79b3b4848b47..e2b7487760c2 100644 --- a/config/printconfigsetting.py +++ b/config/printconfigsetting.py @@ -3,12 +3,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import sys - -from configparser import ( - ConfigParser, - NoOptionError, - NoSectionError, -) +from configparser import ConfigParser, NoOptionError, NoSectionError try: (filename, section, key) = sys.argv[1:] diff --git a/config/printprereleasesuffix.py b/config/printprereleasesuffix.py index b7e667e87086..7d4182da1d2a 100644 --- a/config/printprereleasesuffix.py +++ b/config/printprereleasesuffix.py @@ -9,11 +9,10 @@ # 2.1a3pre > "" # 3.2b4 > " 3.2 Beta 4" # 3.2b4pre > "" -from __future__ import absolute_import -from __future__ import print_function +from __future__ import absolute_import, print_function -import sys import re +import sys def get_prerelease_suffix(version): diff --git a/config/rebuild_check.py b/config/rebuild_check.py index cea589a6a34e..537a411ec1c1 100644 --- a/config/rebuild_check.py +++ b/config/rebuild_check.py @@ -3,8 +3,9 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import absolute_import, print_function, unicode_literals -import os + import errno +import os def mtime(path): diff --git a/config/run_spidermonkey_checks.py b/config/run_spidermonkey_checks.py index 0f842d9d7055..0d927caee7fa 100644 --- a/config/run_spidermonkey_checks.py +++ b/config/run_spidermonkey_checks.py @@ -3,10 +3,12 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import absolute_import -import buildconfig + import subprocess import sys +import buildconfig + def main(output, lib_file, *scripts): for script in scripts: diff --git a/config/tests/test_mozbuild_reading.py b/config/tests/test_mozbuild_reading.py index 89be9618bdd7..6048d416120a 100644 --- a/config/tests/test_mozbuild_reading.py +++ b/config/tests/test_mozbuild_reading.py @@ -2,22 +2,17 @@ # 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 __future__ import absolute_import -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals import os import sys import unittest -from mozunit import main - from mozbuild.base import MozbuildObject -from mozpack.files import FileFinder from mozbuild.frontend.context import Files -from mozbuild.frontend.reader import ( - BuildReader, - EmptyConfig, -) +from mozbuild.frontend.reader import BuildReader, EmptyConfig +from mozpack.files import FileFinder +from mozunit import main class TestMozbuildReading(unittest.TestCase): diff --git a/config/tests/unit-mozunit.py b/config/tests/unit-mozunit.py index 0c18ec7227ae..3023b6ed2044 100644 --- a/config/tests/unit-mozunit.py +++ b/config/tests/unit-mozunit.py @@ -3,11 +3,13 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import absolute_import + import os -from mozunit import main, MockedOpen import unittest from tempfile import mkstemp +from mozunit import MockedOpen, main + class TestMozUnit(unittest.TestCase): def test_mocked_open(self): diff --git a/config/tests/unit-nsinstall.py b/config/tests/unit-nsinstall.py index 7f2b3328427b..3d893b7a9439 100644 --- a/config/tests/unit-nsinstall.py +++ b/config/tests/unit-nsinstall.py @@ -1,18 +1,18 @@ from __future__ import absolute_import -import unittest import os -import six -import sys import os.path +import sys import time -from tempfile import mkdtemp +import unittest from shutil import rmtree -import mozunit -from mozprocess import processhandler +from tempfile import mkdtemp -from nsinstall import nsinstall +import mozunit import nsinstall as nsinstall_module +import six +from mozprocess import processhandler +from nsinstall import nsinstall NSINSTALL_PATH = nsinstall_module.__file__ diff --git a/config/tests/unit-printprereleasesuffix.py b/config/tests/unit-printprereleasesuffix.py index 9e45ad0ea40d..bd0296cc9f77 100644 --- a/config/tests/unit-printprereleasesuffix.py +++ b/config/tests/unit-printprereleasesuffix.py @@ -1,8 +1,8 @@ from __future__ import absolute_import + import unittest import mozunit - from printprereleasesuffix import get_prerelease_suffix diff --git a/config/tests/unitMozZipFile.py b/config/tests/unitMozZipFile.py index 53cd05dcfe98..332f4942db69 100644 --- a/config/tests/unitMozZipFile.py +++ b/config/tests/unitMozZipFile.py @@ -3,13 +3,13 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. from __future__ import absolute_import -import unittest -import shutil -import os -import sys -import random import copy +import os +import random +import shutil +import sys +import unittest from string import letters """ @@ -31,9 +31,10 @@ if not __file__: __file__ = sys.argv[0] sys.path.append(os.path.join(os.path.dirname(__file__), "..")) -from MozZipFile import ZipFile import zipfile +from MozZipFile import ZipFile + leafs = ("firstdir/oneleaf", "seconddir/twoleaf", "thirddir/with/sub/threeleaf") _lengths = map(lambda n: n * 64, [16, 64, 80]) lengths = 3