diff --git a/SConstruct b/SConstruct index 5468fe2304d..2e30c6c35a3 100644 --- a/SConstruct +++ b/SConstruct @@ -11,12 +11,9 @@ import pathlib import platform import shlex import shutil -import stat import subprocess import sys import textwrap -import threading -import time import uuid from datetime import datetime from glob import glob diff --git a/bazel/platforms/remote_execution_containers_generator.py b/bazel/platforms/remote_execution_containers_generator.py index 3345d6fe6bb..4c388b251c6 100755 --- a/bazel/platforms/remote_execution_containers_generator.py +++ b/bazel/platforms/remote_execution_containers_generator.py @@ -3,12 +3,9 @@ import argparse from datetime import datetime -import json import os import pathlib import subprocess -import tempfile -import urllib.request def log_subprocess_run(*args, **kwargs): diff --git a/bazel/toolchains/mongo_toolchain_version_generator.py b/bazel/toolchains/mongo_toolchain_version_generator.py index 3fedb9c9649..62b218d234f 100644 --- a/bazel/toolchains/mongo_toolchain_version_generator.py +++ b/bazel/toolchains/mongo_toolchain_version_generator.py @@ -2,7 +2,6 @@ import argparse import hashlib -import json import os import pathlib import tempfile diff --git a/buildscripts/bazel_scons_diff.py b/buildscripts/bazel_scons_diff.py index 14e2670cd4d..84b4a689afc 100644 --- a/buildscripts/bazel_scons_diff.py +++ b/buildscripts/bazel_scons_diff.py @@ -6,7 +6,6 @@ import argparse import os import platform import re -import shutil import subprocess import sys from buildscripts.install_bazel import install_bazel diff --git a/buildscripts/ciconfig/evergreen.py b/buildscripts/ciconfig/evergreen.py index 5048a7697e0..b9bad3243ce 100644 --- a/buildscripts/ciconfig/evergreen.py +++ b/buildscripts/ciconfig/evergreen.py @@ -17,7 +17,6 @@ from typing import Any, Dict, List, Optional, Set import structlog import yaml -from buildscripts.util import runcommand ENTERPRISE_MODULE_NAME = "enterprise" ASAN_SIGNATURE = "detect_leaks=1" diff --git a/buildscripts/convert_bazel_headers.py b/buildscripts/convert_bazel_headers.py index 941dc39e0ea..203e7bb27f3 100644 --- a/buildscripts/convert_bazel_headers.py +++ b/buildscripts/convert_bazel_headers.py @@ -5,7 +5,6 @@ import platform import os import shlex import concurrent.futures -import glob import traceback import shutil from typing import Annotated, List diff --git a/buildscripts/cost_model/ce_data_settings.py b/buildscripts/cost_model/ce_data_settings.py index 3ac1df7d282..99517ced7fb 100644 --- a/buildscripts/cost_model/ce_data_settings.py +++ b/buildscripts/cost_model/ce_data_settings.py @@ -29,7 +29,6 @@ from pathlib import Path from datetime import datetime -import random from typing import Sequence import config from random_generator import ( diff --git a/buildscripts/cost_model/ce_generate_data.py b/buildscripts/cost_model/ce_generate_data.py index 67c8bb670c4..6ff1ffedfde 100644 --- a/buildscripts/cost_model/ce_generate_data.py +++ b/buildscripts/cost_model/ce_generate_data.py @@ -28,21 +28,18 @@ """Data generation entry point.""" import asyncio -import dataclasses from datetime import datetime import json import math import os import re -import subprocess from pathlib import Path import seaborn as sns import bson import matplotlib.pyplot as plt from config import CollectionTemplate, FieldTemplate -from data_generator import CollectionInfo, DataGenerator +from data_generator import DataGenerator from database_instance import DatabaseInstance -import parameters_extractor from random_generator import DataType from ce_data_settings import database_config, data_generator_config diff --git a/buildscripts/cost_model/random_generator.py b/buildscripts/cost_model/random_generator.py index 4ee53a1c399..b8d04a661c8 100644 --- a/buildscripts/cost_model/random_generator.py +++ b/buildscripts/cost_model/random_generator.py @@ -35,7 +35,6 @@ from enum import Enum from itertools import chain from typing import Generic, Sequence, TypeVar import numpy as np -import random __all__ = ["RangeGenerator", "DataType", "RandomDistribution"] diff --git a/buildscripts/cost_model/start.py b/buildscripts/cost_model/start.py index 98821b83a3d..da5577414a2 100644 --- a/buildscripts/cost_model/start.py +++ b/buildscripts/cost_model/start.py @@ -40,7 +40,7 @@ import abt_calibrator import workload_execution from workload_execution import Query, QueryParameters import parameters_extractor -from calibration_settings import distributions, main_config +from calibration_settings import main_config __all__ = [] diff --git a/buildscripts/debugsymb_mapper.py b/buildscripts/debugsymb_mapper.py index da95d2db7b4..eb9dceaa865 100644 --- a/buildscripts/debugsymb_mapper.py +++ b/buildscripts/debugsymb_mapper.py @@ -11,7 +11,7 @@ import subprocess import sys import time from json import JSONDecoder -from typing import Optional, Tuple, Generator, Dict, List, NamedTuple +from typing import Optional, Generator, Dict, List, NamedTuple import requests diff --git a/buildscripts/evergreen_activate_gen_tasks.py b/buildscripts/evergreen_activate_gen_tasks.py index cd17bd39a3f..f679d0d595a 100755 --- a/buildscripts/evergreen_activate_gen_tasks.py +++ b/buildscripts/evergreen_activate_gen_tasks.py @@ -3,7 +3,6 @@ import os import sys -from typing import List, Optional import click import structlog diff --git a/buildscripts/evergreen_expansions2bash.py b/buildscripts/evergreen_expansions2bash.py index 5017e4259a7..731f77f7da0 100644 --- a/buildscripts/evergreen_expansions2bash.py +++ b/buildscripts/evergreen_expansions2bash.py @@ -1,9 +1,7 @@ """Convert Evergreen's expansions.yml to an eval-able shell script.""" import sys -import platform from shlex import quote -from typing import Any def _error(msg: str) -> None: diff --git a/buildscripts/gdb/mongo.py b/buildscripts/gdb/mongo.py index f4b0610806d..fcb93bc4ed1 100644 --- a/buildscripts/gdb/mongo.py +++ b/buildscripts/gdb/mongo.py @@ -1,6 +1,5 @@ """GDB commands for MongoDB.""" -import datetime import json import os import re diff --git a/buildscripts/gdb/udb.py b/buildscripts/gdb/udb.py index efc834c7a0b..902945ae34f 100644 --- a/buildscripts/gdb/udb.py +++ b/buildscripts/gdb/udb.py @@ -2,7 +2,6 @@ import os import re -from typing import Optional import gdb # Pattern to match output of 'info files' diff --git a/buildscripts/generate_version_expansions.py b/buildscripts/generate_version_expansions.py index 484fe7dc0b5..9cfe20e82df 100755 --- a/buildscripts/generate_version_expansions.py +++ b/buildscripts/generate_version_expansions.py @@ -10,7 +10,6 @@ import argparse import json import os import re -import sys import yaml VERSION_JSON = "version.json" diff --git a/buildscripts/golden_test.py b/buildscripts/golden_test.py index 736eff70805..5b3898e0365 100755 --- a/buildscripts/golden_test.py +++ b/buildscripts/golden_test.py @@ -5,7 +5,6 @@ Utility to interact with golden data test outputs, produced by golden data test For details on the golden data test framework see: docs/golden_data_test_framework.md. """ -import json import os import pathlib import platform @@ -13,7 +12,7 @@ import re import sys import shutil -from subprocess import call, CalledProcessError, check_output, STDOUT, DEVNULL +from subprocess import call, check_output import click # Get relative imports to work when the package is not installed on the PYTHONPATH. diff --git a/buildscripts/idl/check_stable_api_commands_have_idl_definitions.py b/buildscripts/idl/check_stable_api_commands_have_idl_definitions.py index de5900347c4..5a82080d3c7 100644 --- a/buildscripts/idl/check_stable_api_commands_have_idl_definitions.py +++ b/buildscripts/idl/check_stable_api_commands_have_idl_definitions.py @@ -35,7 +35,7 @@ import logging import os import sys from tempfile import TemporaryDirectory -from typing import Any, Dict, List, Mapping, Set +from typing import Dict, List, Set from pymongo import MongoClient @@ -49,8 +49,6 @@ from buildscripts.resmokelib import configure_resmoke from buildscripts.resmokelib.logging import loggers from buildscripts.resmokelib.testing.fixtures import interface from buildscripts.resmokelib.testing.fixtures.fixturelib import FixtureLib -from buildscripts.resmokelib.testing.fixtures.shardedcluster import ShardedClusterFixture -from buildscripts.resmokelib.testing.fixtures.standalone import MongoDFixture # pylint: enable=wrong-import-position LOGGER_NAME = "check-idl-definitions" diff --git a/buildscripts/idl/checkout_idl_files_from_past_releases.py b/buildscripts/idl/checkout_idl_files_from_past_releases.py index 9992f285ae5..2d1c9a82c57 100755 --- a/buildscripts/idl/checkout_idl_files_from_past_releases.py +++ b/buildscripts/idl/checkout_idl_files_from_past_releases.py @@ -30,7 +30,6 @@ import argparse import logging import os import sys -import re import shutil from subprocess import check_output from typing import List diff --git a/buildscripts/idl/idl/ast.py b/buildscripts/idl/idl/ast.py index f9276bc9a4a..a3d32044534 100644 --- a/buildscripts/idl/idl/ast.py +++ b/buildscripts/idl/idl/ast.py @@ -34,11 +34,9 @@ This is a lossy translation from the IDL Syntax tree as the IDL AST only contain the enums and structs that need code generated for them, and just enough information to do that. """ -from abc import ABCMeta, abstractmethod import enum -from typing import Any, Dict, List, Optional -from . import common, errors +from . import common class IDLBoundSpec(object): diff --git a/buildscripts/idl/idl/binder.py b/buildscripts/idl/idl/binder.py index 05e5169dddb..0b0cbcaf8cc 100644 --- a/buildscripts/idl/idl/binder.py +++ b/buildscripts/idl/idl/binder.py @@ -30,7 +30,7 @@ import collections import re import typing -from typing import Type, TypeVar, cast, List, Set, Union, Optional +from typing import cast from . import ast from . import bson diff --git a/buildscripts/idl/idl/bson.py b/buildscripts/idl/idl/bson.py index aa7cb962c3f..d10f735a988 100644 --- a/buildscripts/idl/idl/bson.py +++ b/buildscripts/idl/idl/bson.py @@ -31,8 +31,6 @@ BSON Type Information. Utilities for validating bson types, etc. """ -from typing import Dict, List - # Dictionary of BSON type Information # scalar: True if the type is not an array or object # bson_type_enum: The BSONType enum value for the given type diff --git a/buildscripts/idl/idl/common.py b/buildscripts/idl/idl/common.py index 3adaf699456..115bcd0ab60 100644 --- a/buildscripts/idl/idl/common.py +++ b/buildscripts/idl/idl/common.py @@ -33,7 +33,6 @@ Classes which are shared among both the IDL idl.syntax and idl.AST trees. import os import string -from typing import Mapping COMMAND_NAMESPACE_CONCATENATE_WITH_DB = "concatenate_with_db" COMMAND_NAMESPACE_CONCATENATE_WITH_DB_OR_UUID = "concatenate_with_db_or_uuid" diff --git a/buildscripts/idl/idl/compiler.py b/buildscripts/idl/idl/compiler.py index d73871381f9..4e1ad87436e 100644 --- a/buildscripts/idl/idl/compiler.py +++ b/buildscripts/idl/idl/compiler.py @@ -35,7 +35,6 @@ import io import logging import os import platform -from typing import Any, List from . import binder from . import errors diff --git a/buildscripts/idl/idl/cpp_types.py b/buildscripts/idl/idl/cpp_types.py index 91246db19d8..38acd74a5e2 100644 --- a/buildscripts/idl/idl/cpp_types.py +++ b/buildscripts/idl/idl/cpp_types.py @@ -30,9 +30,7 @@ from abc import ABCMeta, abstractmethod import textwrap -from typing import Any, List, Optional -from . import ast from . import bson from . import common from . import writer diff --git a/buildscripts/idl/idl/enum_types.py b/buildscripts/idl/idl/enum_types.py index 0411fdbab07..101e26d0ba4 100644 --- a/buildscripts/idl/idl/enum_types.py +++ b/buildscripts/idl/idl/enum_types.py @@ -34,12 +34,11 @@ Support the code generation for enums from abc import ABCMeta, abstractmethod import json import textwrap -from typing import cast, List, Optional, Union +from typing import cast import bson from . import ast from . import common -from . import syntax from . import writer diff --git a/buildscripts/idl/idl/errors.py b/buildscripts/idl/idl/errors.py index b62b9089fb4..d0b82fe4717 100644 --- a/buildscripts/idl/idl/errors.py +++ b/buildscripts/idl/idl/errors.py @@ -35,7 +35,6 @@ Common error handling code for IDL compiler. import inspect import os import sys -from typing import List, Union import yaml from . import common diff --git a/buildscripts/idl/idl/generator.py b/buildscripts/idl/idl/generator.py index 62437d90d88..3595805eae8 100644 --- a/buildscripts/idl/idl/generator.py +++ b/buildscripts/idl/idl/generator.py @@ -36,7 +36,7 @@ import sys import textwrap from abc import ABCMeta, abstractmethod from enum import Enum -from typing import Callable, Dict, List, Mapping, Optional, Tuple, Union, cast +from typing import List, cast from . import ( ast, diff --git a/buildscripts/idl/idl/parser.py b/buildscripts/idl/idl/parser.py index 7d7942b4da5..35f27ea78bd 100644 --- a/buildscripts/idl/idl/parser.py +++ b/buildscripts/idl/idl/parser.py @@ -33,10 +33,7 @@ Only validates the document is syntatically correct, not semantically. """ from abc import ABCMeta, abstractmethod -import io -from typing import Any, Callable, Dict, List, Set, Tuple, Union import yaml -from yaml import nodes from . import common from . import cpp_types diff --git a/buildscripts/idl/idl/struct_types.py b/buildscripts/idl/idl/struct_types.py index 6f0faca4952..0b83bb2b3e2 100644 --- a/buildscripts/idl/idl/struct_types.py +++ b/buildscripts/idl/idl/struct_types.py @@ -29,12 +29,10 @@ import textwrap from abc import ABCMeta, abstractmethod -from typing import Optional, List from . import ast from . import common from . import cpp_types -from . import writer def _is_required_constructor_arg(field): diff --git a/buildscripts/idl/idl/syntax.py b/buildscripts/idl/idl/syntax.py index a7febc5f6b6..dd3030154a0 100644 --- a/buildscripts/idl/idl/syntax.py +++ b/buildscripts/idl/idl/syntax.py @@ -34,10 +34,9 @@ it follows the rules of the IDL, etc. """ import itertools -from typing import Any, Dict, Iterator, List, Optional, Tuple, Union, cast +from typing import cast from . import common -from . import errors class IDLParsedSpec(object): diff --git a/buildscripts/idl/idl/writer.py b/buildscripts/idl/idl/writer.py index 5f4d0098c65..6c17f71d8d9 100644 --- a/buildscripts/idl/idl/writer.py +++ b/buildscripts/idl/idl/writer.py @@ -27,9 +27,6 @@ # """Text Writing Utilites.""" -import io -from typing import Callable, List, Mapping - from . import common # Number of spaces to indent code diff --git a/buildscripts/idl/idl_compatibility_errors.py b/buildscripts/idl/idl_compatibility_errors.py index c07d78fac17..57cc818d06a 100644 --- a/buildscripts/idl/idl_compatibility_errors.py +++ b/buildscripts/idl/idl_compatibility_errors.py @@ -33,7 +33,6 @@ Common error handling code for IDL compatibility checker. """ import inspect -import os import sys from typing import List, Optional diff --git a/buildscripts/idl/tests/context.py b/buildscripts/idl/tests/context.py index efeff931567..52191c5bd48 100644 --- a/buildscripts/idl/tests/context.py +++ b/buildscripts/idl/tests/context.py @@ -32,10 +32,10 @@ import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) -import idl.ast # pylint: disable=wrong-import-position -import idl.binder # pylint: disable=wrong-import-position -import idl.compiler # pylint: disable=wrong-import-position -import idl.errors # pylint: disable=wrong-import-position -import idl.generator # pylint: disable=wrong-import-position -import idl.parser # pylint: disable=wrong-import-position -import idl.syntax # pylint: disable=wrong-import-position +import idl.ast # noqa: F401 +import idl.binder # noqa: F401 +import idl.compiler # noqa: F401 +import idl.errors # noqa: F401 +import idl.generator # noqa: F401 +import idl.parser # noqa: F401 +import idl.syntax # noqa: F401 diff --git a/buildscripts/idl/tests/test_import.py b/buildscripts/idl/tests/test_import.py index 0d88b2a5349..04317a140bf 100644 --- a/buildscripts/idl/tests/test_import.py +++ b/buildscripts/idl/tests/test_import.py @@ -32,7 +32,6 @@ import io import textwrap import unittest -from typing import Any, Dict # import package so that it works regardless of whether we run as a module or file if __package__ is None: diff --git a/buildscripts/idl/tests/testcase.py b/buildscripts/idl/tests/testcase.py index b6e9972a96e..6cbab093494 100644 --- a/buildscripts/idl/tests/testcase.py +++ b/buildscripts/idl/tests/testcase.py @@ -29,7 +29,6 @@ import io import unittest -from typing import Any, Tuple if __name__ == "testcase": import sys diff --git a/buildscripts/iwyu/test/basic/expected_results.py b/buildscripts/iwyu/test/basic/expected_results.py index 6fa0dad469c..ea160f7a9e7 100644 --- a/buildscripts/iwyu/test/basic/expected_results.py +++ b/buildscripts/iwyu/test/basic/expected_results.py @@ -1,4 +1,3 @@ -import os import sys EXPECTED_B_CPP = """ diff --git a/buildscripts/iwyu/test/no_include/expected_results.py b/buildscripts/iwyu/test/no_include/expected_results.py index 9e3d66173ab..6f488af9d78 100644 --- a/buildscripts/iwyu/test/no_include/expected_results.py +++ b/buildscripts/iwyu/test/no_include/expected_results.py @@ -1,4 +1,3 @@ -import os import sys EXPECTED_B_CPP = """// IWYU pragma: no_include "b.h" diff --git a/buildscripts/iwyu/test/run_tests.py b/buildscripts/iwyu/test/run_tests.py index eb88a34ed5d..25057666847 100644 --- a/buildscripts/iwyu/test/run_tests.py +++ b/buildscripts/iwyu/test/run_tests.py @@ -1,5 +1,4 @@ import pathlib -import yaml import json import shutil import os diff --git a/buildscripts/large_file_check.py b/buildscripts/large_file_check.py index d2b9f2fb85f..eb9a47dc4f2 100755 --- a/buildscripts/large_file_check.py +++ b/buildscripts/large_file_check.py @@ -11,7 +11,7 @@ import pathlib import sys import textwrap -from typing import Any, Callable, Dict, List, Optional, Tuple +from typing import Any, Dict, List, Optional, Tuple import structlog diff --git a/buildscripts/libdeps/analyzer_unittests.py b/buildscripts/libdeps/analyzer_unittests.py index d0814a43580..abce59f89f5 100755 --- a/buildscripts/libdeps/analyzer_unittests.py +++ b/buildscripts/libdeps/analyzer_unittests.py @@ -24,18 +24,14 @@ """Unittests for the graph analyzer.""" import json -import sys import unittest -import networkx import libdeps.analyzer from libdeps.graph import ( DependsReportTypes, LibdepsGraph, - EdgeProps, LinterTypes, - NodeProps, CountTypes, ) from generate_test_graphs import get_double_diamond_mock_graph, get_basic_mock_graph diff --git a/buildscripts/libdeps/graph_visualizer.py b/buildscripts/libdeps/graph_visualizer.py index 52a183eb82b..eb23d2a6afd 100644 --- a/buildscripts/libdeps/graph_visualizer.py +++ b/buildscripts/libdeps/graph_visualizer.py @@ -35,14 +35,10 @@ web service if not debug. import os from pathlib import Path import argparse -import shutil import subprocess -import platform import threading -import copy import textwrap -import flask from werkzeug.serving import is_running_from_reloader from graph_visualizer_web_stack.flask.flask_backend import BackendServer diff --git a/buildscripts/libdeps/libdeps/analyzer.py b/buildscripts/libdeps/libdeps/analyzer.py index 31300c5769e..8c4702cd4cd 100644 --- a/buildscripts/libdeps/libdeps/analyzer.py +++ b/buildscripts/libdeps/libdeps/analyzer.py @@ -29,9 +29,7 @@ graph generated from SCons generate-libdeps-graph target. The graph represents the dependency information between all binaries from the build. """ -import sys import textwrap -import copy import json import inspect import functools diff --git a/buildscripts/libdeps/libdeps/graph.py b/buildscripts/libdeps/libdeps/graph.py index 68783d4ab3e..c86213f163b 100755 --- a/buildscripts/libdeps/libdeps/graph.py +++ b/buildscripts/libdeps/libdeps/graph.py @@ -28,7 +28,6 @@ These are used for attributing data across the build scripts and analyzer script """ from enum import Enum, auto -from pathlib import Path import json import networkx diff --git a/buildscripts/linter/base.py b/buildscripts/linter/base.py index eb3832568d5..b41f41c4ec2 100644 --- a/buildscripts/linter/base.py +++ b/buildscripts/linter/base.py @@ -1,7 +1,6 @@ """Base class and support functions for linters.""" from abc import ABCMeta, abstractmethod -from typing import Dict, List, Optional class LinterBase(object, metaclass=ABCMeta): diff --git a/buildscripts/linter/filediff.py b/buildscripts/linter/filediff.py index 8de8af1b9df..b1857f3dddc 100644 --- a/buildscripts/linter/filediff.py +++ b/buildscripts/linter/filediff.py @@ -2,7 +2,7 @@ import os import sys -from typing import Tuple, List, Dict, Callable +from typing import Tuple, List, Callable from git import Repo import structlog diff --git a/buildscripts/linter/mypy.py b/buildscripts/linter/mypy.py index 9934d00c7f9..e0550d5ef25 100644 --- a/buildscripts/linter/mypy.py +++ b/buildscripts/linter/mypy.py @@ -1,7 +1,6 @@ """Mypy linter support module.""" import os -from typing import List from . import base diff --git a/buildscripts/linter/parallel.py b/buildscripts/linter/parallel.py index 25a6f0d7e75..630e01398a2 100644 --- a/buildscripts/linter/parallel.py +++ b/buildscripts/linter/parallel.py @@ -4,7 +4,6 @@ import queue import threading import time from multiprocessing import cpu_count -from typing import Any, Callable, List def parallel_process(items, func): diff --git a/buildscripts/linter/pydocstyle.py b/buildscripts/linter/pydocstyle.py index 9e8a74a3857..5f94f4dab05 100644 --- a/buildscripts/linter/pydocstyle.py +++ b/buildscripts/linter/pydocstyle.py @@ -1,7 +1,5 @@ """PyDocStyle linter support module.""" -from typing import List - from . import base diff --git a/buildscripts/linter/pylint.py b/buildscripts/linter/pylint.py index cce21f3765c..b531c901330 100644 --- a/buildscripts/linter/pylint.py +++ b/buildscripts/linter/pylint.py @@ -1,10 +1,6 @@ """PyLint linter support module.""" -import os -from typing import List - from . import base -from . import git class PyLintLinter(base.LinterBase): diff --git a/buildscripts/linter/ruffchecker.py b/buildscripts/linter/ruffchecker.py index fa6a7a48a8a..486da8108e2 100644 --- a/buildscripts/linter/ruffchecker.py +++ b/buildscripts/linter/ruffchecker.py @@ -1,7 +1,5 @@ """Ruff linter support module.""" -from typing import List - from . import base diff --git a/buildscripts/linter/ruffformatter.py b/buildscripts/linter/ruffformatter.py index 545da83c36f..f5394aa5d20 100644 --- a/buildscripts/linter/ruffformatter.py +++ b/buildscripts/linter/ruffformatter.py @@ -1,7 +1,5 @@ """Ruff formatter support module.""" -from typing import List - from . import base diff --git a/buildscripts/linter/runner.py b/buildscripts/linter/runner.py index 57639d45475..47f7b3fcc44 100644 --- a/buildscripts/linter/runner.py +++ b/buildscripts/linter/runner.py @@ -1,8 +1,5 @@ """Class to support running various linters in a common framework.""" -from typing import Dict, List, Optional - -import difflib import logging import os import re diff --git a/buildscripts/linter/yapf.py b/buildscripts/linter/yapf.py index e339e3fc763..d4be62c5be8 100644 --- a/buildscripts/linter/yapf.py +++ b/buildscripts/linter/yapf.py @@ -1,7 +1,5 @@ """YAPF linter support module.""" -from typing import List - from . import base diff --git a/buildscripts/lldb/lldb_printers.py b/buildscripts/lldb/lldb_printers.py index a37ff7dc21b..a404abad915 100644 --- a/buildscripts/lldb/lldb_printers.py +++ b/buildscripts/lldb/lldb_printers.py @@ -20,7 +20,6 @@ import lldb try: import bson from bson import json_util - from bson.codec_options import CodecOptions from bson.codec_options import DEFAULT_CODEC_OPTIONS from bson import Decimal128 except ImportError: diff --git a/buildscripts/make_vcxproj.py b/buildscripts/make_vcxproj.py index cbfc888994e..dde6ef26018 100644 --- a/buildscripts/make_vcxproj.py +++ b/buildscripts/make_vcxproj.py @@ -17,7 +17,6 @@ import io import json import os import re -import sys import uuid import argparse import xml.etree.ElementTree as ET diff --git a/buildscripts/mongosymb_multithread.py b/buildscripts/mongosymb_multithread.py index ded49fa5c98..44e5d0221fa 100755 --- a/buildscripts/mongosymb_multithread.py +++ b/buildscripts/mongosymb_multithread.py @@ -7,8 +7,6 @@ Assembles json documents which are fed to the mongosymb library. See mongosymb.p import argparse import json -import re -import subprocess import sys import mongosymb diff --git a/buildscripts/package_test.py b/buildscripts/package_test.py index 86e54ba5167..04b3cdfecd1 100644 --- a/buildscripts/package_test.py +++ b/buildscripts/package_test.py @@ -10,7 +10,6 @@ import time import traceback import uuid import requests -import shutil import tarfile import subprocess diff --git a/buildscripts/pylinters.py b/buildscripts/pylinters.py index 16cae2cb364..d4b4e27df1a 100755 --- a/buildscripts/pylinters.py +++ b/buildscripts/pylinters.py @@ -5,7 +5,6 @@ import argparse import logging import os import sys -from typing import Dict, List import structlog @@ -15,7 +14,6 @@ if __name__ == "__main__" and __package__ is None: sys.path.append(mongo_dir) # pylint: disable=wrong-import-position -from buildscripts.linter.filediff import gather_changed_files_for_lint from buildscripts.linter import runner from buildscripts.linter import ruffchecker from buildscripts.linter import ruffformatter diff --git a/buildscripts/quickmongolint.py b/buildscripts/quickmongolint.py index 32cbef1e877..7a353907979 100755 --- a/buildscripts/quickmongolint.py +++ b/buildscripts/quickmongolint.py @@ -6,7 +6,6 @@ import logging import os import re import sys -import threading from typing import List # Get relative imports to work when the package is not installed on the PYTHONPATH. diff --git a/buildscripts/resmokelib/__init__.py b/buildscripts/resmokelib/__init__.py index a4d8ac6df6e..522a0966418 100644 --- a/buildscripts/resmokelib/__init__.py +++ b/buildscripts/resmokelib/__init__.py @@ -9,3 +9,15 @@ from buildscripts.resmokelib import sighandler from buildscripts.resmokelib import suitesconfig from buildscripts.resmokelib import testing from buildscripts.resmokelib import utils + +__all__ = [ + "config", + "errors", + "logging", + "parser", + "reportfile", + "sighandler", + "suitesconfig", + "testing", + "utils", +] diff --git a/buildscripts/resmokelib/core/__init__.py b/buildscripts/resmokelib/core/__init__.py index c2dff881a8f..fdd4d931456 100644 --- a/buildscripts/resmokelib/core/__init__.py +++ b/buildscripts/resmokelib/core/__init__.py @@ -2,3 +2,5 @@ from buildscripts.resmokelib.core import network from buildscripts.resmokelib.core import programs + +__all__ = ["network", "programs"] diff --git a/buildscripts/resmokelib/discovery/__init__.py b/buildscripts/resmokelib/discovery/__init__.py index b8e90e1b261..86259d7e280 100644 --- a/buildscripts/resmokelib/discovery/__init__.py +++ b/buildscripts/resmokelib/discovery/__init__.py @@ -15,6 +15,8 @@ from buildscripts.resmokelib.multiversion.multiversion_service import ( from buildscripts.resmokelib.plugin import PluginInterface, Subcommand from buildscripts.resmokelib.testing.suite import Suite +__all__ = ["MultiversionService", "MongoReleases", "MongoVersion"] + TEST_DISCOVERY_SUBCOMMAND = "test-discovery" SUITECONFIG_SUBCOMMAND = "suiteconfig" diff --git a/buildscripts/resmokelib/generate_fuzz_config/__init__.py b/buildscripts/resmokelib/generate_fuzz_config/__init__.py index f4f7c1a5e76..a563de7d3c5 100644 --- a/buildscripts/resmokelib/generate_fuzz_config/__init__.py +++ b/buildscripts/resmokelib/generate_fuzz_config/__init__.py @@ -1,6 +1,5 @@ """Generate mongod.conf and mongos.conf using config fuzzer.""" -import json import os.path import shutil diff --git a/buildscripts/resmokelib/hang_analyzer/__init__.py b/buildscripts/resmokelib/hang_analyzer/__init__.py index f73847e92d8..07d4f1a72c2 100644 --- a/buildscripts/resmokelib/hang_analyzer/__init__.py +++ b/buildscripts/resmokelib/hang_analyzer/__init__.py @@ -4,3 +4,5 @@ from buildscripts.resmokelib.hang_analyzer import dumper from buildscripts.resmokelib.hang_analyzer import process from buildscripts.resmokelib.hang_analyzer import process_list from buildscripts.resmokelib.hang_analyzer.hang_analyzer import HangAnalyzerPlugin + +__all__ = ["dumper", "process", "process_list", "HangAnalyzerPlugin"] diff --git a/buildscripts/resmokelib/hang_analyzer/extractor.py b/buildscripts/resmokelib/hang_analyzer/extractor.py index 73960a693e9..ddf2c58a816 100644 --- a/buildscripts/resmokelib/hang_analyzer/extractor.py +++ b/buildscripts/resmokelib/hang_analyzer/extractor.py @@ -22,7 +22,7 @@ from opentelemetry.trace.status import StatusCode from buildscripts.resmokelib.hang_analyzer.dumper import Dumper from buildscripts.resmokelib.setup_multiversion.download import DownloadError -from buildscripts.resmokelib.run import compare_start_time +from buildscripts.resmokelib.run.runtime_recorder import compare_start_time from buildscripts.resmokelib.setup_multiversion.setup_multiversion import ( _DownloadOptions, SetupMultiversion, diff --git a/buildscripts/resmokelib/logging/__init__.py b/buildscripts/resmokelib/logging/__init__.py index b0da109e502..13b4893d756 100644 --- a/buildscripts/resmokelib/logging/__init__.py +++ b/buildscripts/resmokelib/logging/__init__.py @@ -2,8 +2,10 @@ # Alias the built-in logging.Logger class for type checking arguments. Those interested in # constructing a new Logger instance should use the loggers.new_logger() function instead. -from logging import Logger +from logging import Logger # noqa: F401 from buildscripts.resmokelib.logging import buildlogger from buildscripts.resmokelib.logging import flush from buildscripts.resmokelib.logging import loggers + +__all__ = ["buildlogger", "flush", "loggers"] diff --git a/buildscripts/resmokelib/mongo_fuzzer_configs.py b/buildscripts/resmokelib/mongo_fuzzer_configs.py index b5404982f73..66392bc7570 100644 --- a/buildscripts/resmokelib/mongo_fuzzer_configs.py +++ b/buildscripts/resmokelib/mongo_fuzzer_configs.py @@ -20,7 +20,6 @@ def generate_normal_wt_parameters(rng, value): def generate_special_eviction_configs(rng, ret, fuzzer_stress_mode, params): """Returns the value assigned the WiredTiger eviction parameters based on the fields of the parameters in config_fuzzer_wt_limits.py for special parameters (parameters with different assignment behaviors).""" - from buildscripts.resmokelib.config_fuzzer_wt_limits import target_bytes_max # eviction_trigger is relative to eviction_target, so you have to leave them excluded to ensure # eviction_trigger is fuzzed first. diff --git a/buildscripts/resmokelib/powercycle/lib/services.py b/buildscripts/resmokelib/powercycle/lib/services.py index 5c184d03a19..d30e461a283 100644 --- a/buildscripts/resmokelib/powercycle/lib/services.py +++ b/buildscripts/resmokelib/powercycle/lib/services.py @@ -25,8 +25,6 @@ def _try_import(module, name=None): if _IS_WINDOWS: # These modules are used on both sides for dumping python stacks. - import win32api - import win32event # These modules are used on the 'server' side. _try_import("ntsecuritycon") diff --git a/buildscripts/resmokelib/powercycle/powercycle.py b/buildscripts/resmokelib/powercycle/powercycle.py index 5579e8651e3..07e4e5834d4 100755 --- a/buildscripts/resmokelib/powercycle/powercycle.py +++ b/buildscripts/resmokelib/powercycle/powercycle.py @@ -4,7 +4,6 @@ import atexit import collections import copy import datetime -import distutils.spawn import importlib import json import logging @@ -41,7 +40,6 @@ from buildscripts.resmokelib.powercycle import powercycle_config, powercycle_con # See https://docs.python.org/2/library/sys.html#sys.platform from buildscripts.resmokelib.powercycle.lib.services import WindowsService, PosixService -from buildscripts.resmokelib.utils.filesystem import build_hygienic_bin_path _IS_WINDOWS = sys.platform in ["win32", "cygwin"] _IS_LINUX = sys.platform.startswith("linux") diff --git a/buildscripts/resmokelib/powercycle/remote_hang_analyzer/__init__.py b/buildscripts/resmokelib/powercycle/remote_hang_analyzer/__init__.py index 1693b9c8f70..3fb79e2f55a 100644 --- a/buildscripts/resmokelib/powercycle/remote_hang_analyzer/__init__.py +++ b/buildscripts/resmokelib/powercycle/remote_hang_analyzer/__init__.py @@ -1,6 +1,5 @@ """Run the hang analyzer on the remote powercycle instance.""" -import os import re from buildscripts.resmokelib.powercycle import powercycle_constants diff --git a/buildscripts/resmokelib/run/__init__.py b/buildscripts/resmokelib/run/__init__.py index b222f64f2f4..33d29c8fe77 100644 --- a/buildscripts/resmokelib/run/__init__.py +++ b/buildscripts/resmokelib/run/__init__.py @@ -33,7 +33,6 @@ from buildscripts.resmokelib.plugin import PluginInterface, Subcommand from buildscripts.resmokelib.run import generate_multiversion_exclude_tags from buildscripts.resmokelib.run import runtime_recorder from buildscripts.resmokelib.run import list_tags -from buildscripts.resmokelib.run.runtime_recorder import compare_start_time from buildscripts.resmokelib.suitesconfig import get_suite_files from buildscripts.resmokelib.testing.docker_cluster_image_builder import build_images from buildscripts.resmokelib.testing.suite import Suite diff --git a/buildscripts/resmokelib/setup_multiversion/__init__.py b/buildscripts/resmokelib/setup_multiversion/__init__.py index 8b3f13fa693..2dd8f5352ea 100644 --- a/buildscripts/resmokelib/setup_multiversion/__init__.py +++ b/buildscripts/resmokelib/setup_multiversion/__init__.py @@ -1,3 +1,5 @@ """Setup multiversion mongodb module.""" from buildscripts.resmokelib.setup_multiversion.setup_multiversion import SetupMultiversionPlugin + +__all__ = ["SetupMultiversionPlugin"] diff --git a/buildscripts/resmokelib/setup_multiversion/download.py b/buildscripts/resmokelib/setup_multiversion/download.py index 6d6270c0789..0f301c3030a 100644 --- a/buildscripts/resmokelib/setup_multiversion/download.py +++ b/buildscripts/resmokelib/setup_multiversion/download.py @@ -6,7 +6,6 @@ import glob import os import shutil import tarfile -import tempfile import zipfile import requests diff --git a/buildscripts/resmokelib/setup_multiversion/setup_multiversion.py b/buildscripts/resmokelib/setup_multiversion/setup_multiversion.py index 0d95cce81b6..9716734ba87 100644 --- a/buildscripts/resmokelib/setup_multiversion/setup_multiversion.py +++ b/buildscripts/resmokelib/setup_multiversion/setup_multiversion.py @@ -18,7 +18,6 @@ import time from typing import Optional, Dict, Any, List, NamedTuple import distro -import structlog import yaml from requests.exceptions import HTTPError diff --git a/buildscripts/resmokelib/testing/__init__.py b/buildscripts/resmokelib/testing/__init__.py index 7cae4bc0a51..08004bd01a4 100644 --- a/buildscripts/resmokelib/testing/__init__.py +++ b/buildscripts/resmokelib/testing/__init__.py @@ -2,3 +2,5 @@ from buildscripts.resmokelib.testing import executor from buildscripts.resmokelib.testing import suite + +__all__ = ["executor", "suite"] diff --git a/buildscripts/resmokelib/testing/executor.py b/buildscripts/resmokelib/testing/executor.py index ceddfbb8240..6d05b3e4d6e 100644 --- a/buildscripts/resmokelib/testing/executor.py +++ b/buildscripts/resmokelib/testing/executor.py @@ -15,10 +15,6 @@ from buildscripts.resmokelib.testing import hook_test_archival as archival from buildscripts.resmokelib.testing import hooks as _hooks from buildscripts.resmokelib.testing import job as _job from buildscripts.resmokelib.testing import report as _report -from buildscripts.resmokelib.testing.docker_cluster_image_builder import ( - DockerComposeImageBuilder, - build_images, -) from buildscripts.resmokelib.testing.fixtures.interface import Fixture from buildscripts.resmokelib.testing.hooks.interface import Hook from buildscripts.resmokelib.testing.queue_element import ( diff --git a/buildscripts/resmokelib/testing/fixtures/__init__.py b/buildscripts/resmokelib/testing/fixtures/__init__.py index 49293d4fe4a..a78fc21fafa 100644 --- a/buildscripts/resmokelib/testing/fixtures/__init__.py +++ b/buildscripts/resmokelib/testing/fixtures/__init__.py @@ -8,6 +8,8 @@ from buildscripts.resmokelib.utils import autoloader as _autoloader EXTERNAL_FIXTURE_CLASS = _ExternalFixture.REGISTERED_NAME NOOP_FIXTURE_CLASS = _NoOpFixture.REGISTERED_NAME +__all__ = ["make_fixture"] + # We dynamically load all modules in the fixtures/ package so that any Fixture classes declared # within them are automatically registered. _autoloader.load_all_modules(name=__name__, path=__path__) # type: ignore diff --git a/buildscripts/resmokelib/testing/fixtures/_builder.py b/buildscripts/resmokelib/testing/fixtures/_builder.py index 7517a4d412e..a423136f1a5 100644 --- a/buildscripts/resmokelib/testing/fixtures/_builder.py +++ b/buildscripts/resmokelib/testing/fixtures/_builder.py @@ -19,7 +19,7 @@ from buildscripts.resmokelib.testing.fixtures.shardedcluster import ( _RouterView, ) from buildscripts.resmokelib.testing.fixtures.standalone import MongoDFixture -from buildscripts.resmokelib.utils import autoloader, default_if_none, pick_catalog_shard_node +from buildscripts.resmokelib.utils import default_if_none, pick_catalog_shard_node MONGO_REPO_LOCATION = "." FIXTURE_DIR = "buildscripts/resmokelib/testing/fixtures" diff --git a/buildscripts/resmokelib/testing/fixtures/fixturelib.py b/buildscripts/resmokelib/testing/fixtures/fixturelib.py index 4221ff7338d..7e2a2cf9069 100644 --- a/buildscripts/resmokelib/testing/fixtures/fixturelib.py +++ b/buildscripts/resmokelib/testing/fixtures/fixturelib.py @@ -8,7 +8,6 @@ from buildscripts.resmokelib.core import network from buildscripts.resmokelib.utils.dictionary import merge_dicts from buildscripts.resmokelib.utils.history import HistoryDict, make_historic as _make_historic from buildscripts.resmokelib.testing.fixtures import _builder -from buildscripts.resmokelib.testing.retry import with_naive_retry class FixtureLib: diff --git a/buildscripts/resmokelib/testing/fixtures/mongot.py b/buildscripts/resmokelib/testing/fixtures/mongot.py index a850a9059eb..bbbf0d313bd 100644 --- a/buildscripts/resmokelib/testing/fixtures/mongot.py +++ b/buildscripts/resmokelib/testing/fixtures/mongot.py @@ -8,13 +8,9 @@ A resmoke suite's yml definition can enable launching mongot(s) enabled via the mongod via a $changeStream. """ -import os -import os.path import time import shutil -import uuid -import yaml import pymongo import pymongo.errors diff --git a/buildscripts/resmokelib/testing/fixtures/replicaset.py b/buildscripts/resmokelib/testing/fixtures/replicaset.py index f16f9af206f..33149fb2887 100644 --- a/buildscripts/resmokelib/testing/fixtures/replicaset.py +++ b/buildscripts/resmokelib/testing/fixtures/replicaset.py @@ -1,14 +1,12 @@ """Replica set fixture for executing JSTests against.""" import os.path -import random import time import bson import pymongo import pymongo.errors import pymongo.write_concern -from pymongo import ReadPreference from buildscripts.resmokelib.testing.fixtures import interface diff --git a/buildscripts/resmokelib/testing/fixtures/standalone.py b/buildscripts/resmokelib/testing/fixtures/standalone.py index 035d508b355..5fd60079f3d 100644 --- a/buildscripts/resmokelib/testing/fixtures/standalone.py +++ b/buildscripts/resmokelib/testing/fixtures/standalone.py @@ -14,8 +14,6 @@ import pymongo.errors from buildscripts.resmokelib import logging from buildscripts.resmokelib.testing.fixtures import interface from buildscripts.resmokelib.testing.fixtures.fixturelib import FixtureLib -from buildscripts.resmokelib.testing.fixtures.interface import _FIXTURES -from buildscripts.resmokelib.testing.fixtures.mongot import MongoTFixture from buildscripts.resmokelib.utils.history import HistoryDict diff --git a/buildscripts/resmokelib/testing/fixtures/yesfixture.py b/buildscripts/resmokelib/testing/fixtures/yesfixture.py index 0b2b3e5ef62..0e29a2bae41 100644 --- a/buildscripts/resmokelib/testing/fixtures/yesfixture.py +++ b/buildscripts/resmokelib/testing/fixtures/yesfixture.py @@ -3,7 +3,6 @@ import signal from buildscripts.resmokelib.testing.fixtures import interface -from buildscripts.resmokelib.testing.fixtures.fixturelib import FixtureLib class YesFixture(interface.Fixture): # pylint: disable=abstract-method diff --git a/buildscripts/resmokelib/testing/hooks/__init__.py b/buildscripts/resmokelib/testing/hooks/__init__.py index 7f2b29855f6..4b39fdb1f31 100644 --- a/buildscripts/resmokelib/testing/hooks/__init__.py +++ b/buildscripts/resmokelib/testing/hooks/__init__.py @@ -8,6 +8,8 @@ before or after each suite. from buildscripts.resmokelib.testing.hooks.interface import make_hook from buildscripts.resmokelib.utils import autoloader as _autoloader +__all__ = ["make_hook"] + # We dynamically load all modules in the hooks/ package so that any Hook classes declared # within them are automatically registered. _autoloader.load_all_modules(name=__name__, path=__path__) # type: ignore diff --git a/buildscripts/resmokelib/testing/hooks/background_job.py b/buildscripts/resmokelib/testing/hooks/background_job.py index 2adba99b97e..b01196ba462 100644 --- a/buildscripts/resmokelib/testing/hooks/background_job.py +++ b/buildscripts/resmokelib/testing/hooks/background_job.py @@ -3,7 +3,6 @@ import sys import threading -from buildscripts.resmokelib import errors from buildscripts.resmokelib.testing.hooks import jsfile diff --git a/buildscripts/resmokelib/testing/hooks/cleanup_concurrency_workloads.py b/buildscripts/resmokelib/testing/hooks/cleanup_concurrency_workloads.py index d3b99ce4db1..4e0651283e2 100644 --- a/buildscripts/resmokelib/testing/hooks/cleanup_concurrency_workloads.py +++ b/buildscripts/resmokelib/testing/hooks/cleanup_concurrency_workloads.py @@ -3,7 +3,7 @@ import copy from buildscripts.resmokelib import utils -from buildscripts.resmokelib.testing.fixtures.fixturelib import with_naive_retry +from buildscripts.resmokelib.testing.retry import with_naive_retry from buildscripts.resmokelib.testing.hooks import interface diff --git a/buildscripts/resmokelib/testing/hooks/cluster_parameter.py b/buildscripts/resmokelib/testing/hooks/cluster_parameter.py index bc90e835347..2d05b5acb84 100644 --- a/buildscripts/resmokelib/testing/hooks/cluster_parameter.py +++ b/buildscripts/resmokelib/testing/hooks/cluster_parameter.py @@ -3,8 +3,6 @@ A hook to set the given cluster server parameter on a replica set fixture. """ -from time import sleep - from buildscripts.resmokelib.testing.hooks import interface diff --git a/buildscripts/resmokelib/testing/hooks/continuous_initial_sync.py b/buildscripts/resmokelib/testing/hooks/continuous_initial_sync.py index 1f136aad833..070559a6efe 100644 --- a/buildscripts/resmokelib/testing/hooks/continuous_initial_sync.py +++ b/buildscripts/resmokelib/testing/hooks/continuous_initial_sync.py @@ -1,18 +1,15 @@ """Test hook that periodically initial-syncs a node and steps it up.""" -import collections import os.path import random import threading import time from enum import Enum -from random import choice import bson import bson.errors import pymongo.errors -import buildscripts.resmokelib.utils.filesystem as fs from buildscripts.resmokelib import core from buildscripts.resmokelib import errors from buildscripts.resmokelib.testing.fixtures import interface as fixture_interface diff --git a/buildscripts/resmokelib/testing/hooks/enable_change_stream.py b/buildscripts/resmokelib/testing/hooks/enable_change_stream.py index d8e31c033d5..d5e73fcc4e8 100644 --- a/buildscripts/resmokelib/testing/hooks/enable_change_stream.py +++ b/buildscripts/resmokelib/testing/hooks/enable_change_stream.py @@ -6,11 +6,8 @@ environment. from time import sleep from bson.objectid import ObjectId -from pymongo import MongoClient import os.path -import json -from buildscripts.resmokelib import config from buildscripts.resmokelib.testing.hooks import interface from buildscripts.resmokelib.testing.hooks import jsfile diff --git a/buildscripts/resmokelib/testing/hooks/fuzz_runtime_parameters.py b/buildscripts/resmokelib/testing/hooks/fuzz_runtime_parameters.py index 923affd2391..a11efab898a 100644 --- a/buildscripts/resmokelib/testing/hooks/fuzz_runtime_parameters.py +++ b/buildscripts/resmokelib/testing/hooks/fuzz_runtime_parameters.py @@ -1,14 +1,11 @@ """Test hook that periodically makes the primary of a replica set step down.""" -import collections import copy -import os.path import random import threading import time import sys -import pymongo.errors from buildscripts.resmokelib import errors from buildscripts.resmokelib.mongo_fuzzer_configs import generate_normal_mongo_parameters diff --git a/buildscripts/resmokelib/testing/hooks/fuzz_runtime_stress.py b/buildscripts/resmokelib/testing/hooks/fuzz_runtime_stress.py index 4298615044e..a1fe3f44c2b 100644 --- a/buildscripts/resmokelib/testing/hooks/fuzz_runtime_stress.py +++ b/buildscripts/resmokelib/testing/hooks/fuzz_runtime_stress.py @@ -4,7 +4,6 @@ import time import multiprocessing import os import math -import sys from buildscripts.resmokelib import errors from buildscripts.resmokelib.testing.hooks import interface diff --git a/buildscripts/resmokelib/testing/hooks/hello_failures.py b/buildscripts/resmokelib/testing/hooks/hello_failures.py index 4d74a360f64..cbf37f182fc 100644 --- a/buildscripts/resmokelib/testing/hooks/hello_failures.py +++ b/buildscripts/resmokelib/testing/hooks/hello_failures.py @@ -4,11 +4,7 @@ from __future__ import absolute_import import os -from buildscripts.resmokelib import errors -from buildscripts.resmokelib import utils from buildscripts.resmokelib.testing.hooks import interface -from buildscripts.resmokelib.testing.fixtures import replicaset -from buildscripts.resmokelib.testing.fixtures import shardedcluster from . import interface from . import jsfile diff --git a/buildscripts/resmokelib/testing/hooks/lifecycle.py b/buildscripts/resmokelib/testing/hooks/lifecycle.py index f4ba6ff9077..18fa70ca192 100644 --- a/buildscripts/resmokelib/testing/hooks/lifecycle.py +++ b/buildscripts/resmokelib/testing/hooks/lifecycle.py @@ -3,13 +3,9 @@ import collections import os.path import threading -import time -import pymongo.errors import buildscripts.resmokelib.utils.filesystem as fs -from buildscripts.resmokelib import errors -from buildscripts.resmokelib.testing.hooks import interface ActionFiles = collections.namedtuple("ActionFiles", ["permitted", "idle_request", "idle_ack"]) diff --git a/buildscripts/resmokelib/testing/hooks/queryable_server_hook.py b/buildscripts/resmokelib/testing/hooks/queryable_server_hook.py index bdd7697c0cf..fc2e582e75e 100644 --- a/buildscripts/resmokelib/testing/hooks/queryable_server_hook.py +++ b/buildscripts/resmokelib/testing/hooks/queryable_server_hook.py @@ -1,8 +1,7 @@ import threading -from http.server import BaseHTTPRequestHandler, HTTPServer +from http.server import HTTPServer from buildscripts.resmokelib.testing.hooks import interface -from buildscripts.resmokelib.testing.hooks import jsfile from buildscripts.resmokelib.testing import queryable_server diff --git a/buildscripts/resmokelib/testing/hooks/stepdown.py b/buildscripts/resmokelib/testing/hooks/stepdown.py index c8390a068db..3eb5671dfca 100644 --- a/buildscripts/resmokelib/testing/hooks/stepdown.py +++ b/buildscripts/resmokelib/testing/hooks/stepdown.py @@ -8,7 +8,6 @@ import time import pymongo.errors -import buildscripts.resmokelib.utils.filesystem as fs from buildscripts.resmokelib import errors from buildscripts.resmokelib.testing.fixtures import interface as fixture_interface from buildscripts.resmokelib.testing.fixtures import replicaset diff --git a/buildscripts/resmokelib/testing/report.py b/buildscripts/resmokelib/testing/report.py index 7ff8ab869c5..71578ab9240 100644 --- a/buildscripts/resmokelib/testing/report.py +++ b/buildscripts/resmokelib/testing/report.py @@ -5,7 +5,6 @@ This is used to support additional test status and timing information for the re """ import copy -import os import threading import time import unittest diff --git a/buildscripts/resmokelib/testing/testcases/__init__.py b/buildscripts/resmokelib/testing/testcases/__init__.py index 917ffca4348..cd382622eb7 100644 --- a/buildscripts/resmokelib/testing/testcases/__init__.py +++ b/buildscripts/resmokelib/testing/testcases/__init__.py @@ -3,6 +3,8 @@ from buildscripts.resmokelib.testing.testcases.interface import make_test_case from buildscripts.resmokelib.utils import autoloader as _autoloader +__all__ = ["make_test_case"] + # We dynamically load all modules in the testcases/ package so that any TestCase classes declared # within them are automatically registered. _autoloader.load_all_modules(name=__name__, path=__path__) # type: ignore diff --git a/buildscripts/resmokelib/testing/testcases/bulk_write_cluster_js_test.py b/buildscripts/resmokelib/testing/testcases/bulk_write_cluster_js_test.py index 01df9dc2f07..24a637695f6 100644 --- a/buildscripts/resmokelib/testing/testcases/bulk_write_cluster_js_test.py +++ b/buildscripts/resmokelib/testing/testcases/bulk_write_cluster_js_test.py @@ -3,7 +3,6 @@ from typing import Optional from buildscripts.resmokelib import logging -from buildscripts.resmokelib.testing.testcases import interface from buildscripts.resmokelib.testing.testcases import jsrunnerfile diff --git a/buildscripts/resmokelib/testing/testcases/cpp_libfuzzer_test.py b/buildscripts/resmokelib/testing/testcases/cpp_libfuzzer_test.py index ee3d5349e03..cafbc00244e 100644 --- a/buildscripts/resmokelib/testing/testcases/cpp_libfuzzer_test.py +++ b/buildscripts/resmokelib/testing/testcases/cpp_libfuzzer_test.py @@ -5,7 +5,6 @@ import os from typing import Optional from buildscripts.resmokelib import core, logging, utils -from buildscripts.resmokelib.testing.fixtures import interface as fixture_interface from buildscripts.resmokelib.testing.testcases import interface diff --git a/buildscripts/resmokelib/testing/testcases/magic_restore_js_test.py b/buildscripts/resmokelib/testing/testcases/magic_restore_js_test.py index cb1b08fa1d7..a4468650de7 100644 --- a/buildscripts/resmokelib/testing/testcases/magic_restore_js_test.py +++ b/buildscripts/resmokelib/testing/testcases/magic_restore_js_test.py @@ -1,9 +1,5 @@ """The unittest.TestCase to run tests in a try/catch block.""" -import hashlib -import threading - -from buildscripts.resmokelib.testing.testcases import interface from buildscripts.resmokelib.testing.testcases import jsrunnerfile diff --git a/buildscripts/resmokelib/testing/testcases/pretty_printer_testcase.py b/buildscripts/resmokelib/testing/testcases/pretty_printer_testcase.py index 02914683c9a..0170e33b985 100644 --- a/buildscripts/resmokelib/testing/testcases/pretty_printer_testcase.py +++ b/buildscripts/resmokelib/testing/testcases/pretty_printer_testcase.py @@ -2,7 +2,7 @@ from typing import Optional -from buildscripts.resmokelib import config, logging, core, utils +from buildscripts.resmokelib import logging, core, utils from buildscripts.resmokelib.testing.testcases import interface diff --git a/buildscripts/resmokelib/testing/testcases/sdam_json_test.py b/buildscripts/resmokelib/testing/testcases/sdam_json_test.py index 9b7a3bcd86e..9a9c08d219e 100644 --- a/buildscripts/resmokelib/testing/testcases/sdam_json_test.py +++ b/buildscripts/resmokelib/testing/testcases/sdam_json_test.py @@ -6,7 +6,6 @@ from typing import Optional from buildscripts.resmokelib import config, core, errors, logging, utils from buildscripts.resmokelib.testing.testcases import interface -from buildscripts.resmokelib.utils import globstar class SDAMJsonTestCase(interface.ProcessTestCase): diff --git a/buildscripts/resmokelib/testing/testcases/server_selection_json_test.py b/buildscripts/resmokelib/testing/testcases/server_selection_json_test.py index e634a771aaa..2090307bd02 100644 --- a/buildscripts/resmokelib/testing/testcases/server_selection_json_test.py +++ b/buildscripts/resmokelib/testing/testcases/server_selection_json_test.py @@ -6,7 +6,6 @@ from typing import Optional from buildscripts.resmokelib import config, logging, core, errors, utils from buildscripts.resmokelib.testing.testcases import interface -from buildscripts.resmokelib.utils import globstar class ServerSelectionJsonTestCase(interface.ProcessTestCase): diff --git a/buildscripts/resmokelib/undodb/fetch.py b/buildscripts/resmokelib/undodb/fetch.py index e3e234d1533..47ed3dd0e76 100644 --- a/buildscripts/resmokelib/undodb/fetch.py +++ b/buildscripts/resmokelib/undodb/fetch.py @@ -2,7 +2,6 @@ import os from typing import List, Optional -import subprocess import tempfile from urllib.request import urlopen from shutil import copyfileobj diff --git a/buildscripts/resmokelib/utils/__init__.py b/buildscripts/resmokelib/utils/__init__.py index 1f9b52ff750..ef8ab87d6e5 100644 --- a/buildscripts/resmokelib/utils/__init__.py +++ b/buildscripts/resmokelib/utils/__init__.py @@ -10,6 +10,8 @@ import yaml from buildscripts.resmokelib import config as _config from buildscripts.resmokelib.utils import archival +__all__ = ["archival"] + @contextlib.contextmanager def open_or_use_stdout(filename): diff --git a/buildscripts/simple_report.py b/buildscripts/simple_report.py index 472a9d026d9..9a0c280ace7 100644 --- a/buildscripts/simple_report.py +++ b/buildscripts/simple_report.py @@ -3,7 +3,7 @@ import json import pathlib import os -from typing import List, Dict, Optional +from typing import List from typing_extensions import TypedDict import click diff --git a/buildscripts/tests/resmoke_validation/test_generated_matrix_suites.py b/buildscripts/tests/resmoke_validation/test_generated_matrix_suites.py index 67f0373a878..ac1dceb6f69 100644 --- a/buildscripts/tests/resmoke_validation/test_generated_matrix_suites.py +++ b/buildscripts/tests/resmoke_validation/test_generated_matrix_suites.py @@ -2,7 +2,6 @@ import logging import os import unittest from buildscripts.resmokelib import config, suitesconfig -from buildscripts.resmokelib.errors import InvalidMatrixSuiteError from buildscripts.resmokelib.logging import loggers diff --git a/buildscripts/tests/resmokelib/test_undodb.py b/buildscripts/tests/resmokelib/test_undodb.py index 67fc9511857..3b0ef3fbe10 100644 --- a/buildscripts/tests/resmokelib/test_undodb.py +++ b/buildscripts/tests/resmokelib/test_undodb.py @@ -1,8 +1,7 @@ """Fetch subcommand unittest.""" -import os import unittest -from mock import MagicMock, Mock, patch, call +from mock import MagicMock, patch import evergreen from buildscripts.resmokelib.undodb import fetch diff --git a/buildscripts/tests/resmokelib/testing/hooks/test_lifecycle.py b/buildscripts/tests/resmokelib/testing/hooks/test_lifecycle.py index 7173b5530b6..4f6626f25a2 100644 --- a/buildscripts/tests/resmokelib/testing/hooks/test_lifecycle.py +++ b/buildscripts/tests/resmokelib/testing/hooks/test_lifecycle.py @@ -1,12 +1,10 @@ """Unit tests for buildscripts/resmokelib/testing/hooks/lifecycle.py.""" -import logging import os import unittest import mock -from buildscripts.resmokelib import errors from buildscripts.resmokelib.testing.hooks import lifecycle as lifecycle_interface # pylint: disable=protected-access diff --git a/buildscripts/tests/resmokelib/testing/hooks/test_runtime_parameter_fuzzing.py b/buildscripts/tests/resmokelib/testing/hooks/test_runtime_parameter_fuzzing.py index 63c29b3eb96..62b03c09e4a 100644 --- a/buildscripts/tests/resmokelib/testing/hooks/test_runtime_parameter_fuzzing.py +++ b/buildscripts/tests/resmokelib/testing/hooks/test_runtime_parameter_fuzzing.py @@ -1,16 +1,12 @@ """Unit tests for buildscripts/resmokelib/testing/hooks/fuzz_runtime_parameters.py.""" -import logging -import os import unittest import random import sys import mock -from buildscripts.resmokelib import errors from buildscripts.resmokelib.testing.hooks import fuzz_runtime_parameters as _runtime_fuzzer -from buildscripts.resmokelib.testing.hooks import lifecycle as lifecycle_interface # pylint: disable=protected-access diff --git a/buildscripts/tests/resmokelib/testing/hooks/test_stepdown.py b/buildscripts/tests/resmokelib/testing/hooks/test_stepdown.py index c39ebc3d25e..ece149f52d5 100644 --- a/buildscripts/tests/resmokelib/testing/hooks/test_stepdown.py +++ b/buildscripts/tests/resmokelib/testing/hooks/test_stepdown.py @@ -1,7 +1,6 @@ """Unit tests for buildscripts/resmokelib/testing/hooks/stepdown.py.""" import logging -import os import unittest import mock diff --git a/buildscripts/tests/resmokelib/utils/test_history.py b/buildscripts/tests/resmokelib/utils/test_history.py index 7a1ca511dff..e1364fc1e0c 100644 --- a/buildscripts/tests/resmokelib/utils/test_history.py +++ b/buildscripts/tests/resmokelib/utils/test_history.py @@ -1,6 +1,5 @@ """Unit tests for buildscripts/resmokelib/utils/history.py.""" -import sched import unittest from buildscripts.resmokelib.utils.history import HistoryDict, make_historic diff --git a/buildscripts/tests/test_errorcodes.py b/buildscripts/tests/test_errorcodes.py index f8a38252944..6414e516810 100644 --- a/buildscripts/tests/test_errorcodes.py +++ b/buildscripts/tests/test_errorcodes.py @@ -1,7 +1,5 @@ """Unit tests for the selected_tests script.""" -import json -import os import unittest from buildscripts import errorcodes diff --git a/buildscripts/tests/test_evergreen_activate_gen_tasks.py b/buildscripts/tests/test_evergreen_activate_gen_tasks.py index aab1be62d93..cb8065f781d 100644 --- a/buildscripts/tests/test_evergreen_activate_gen_tasks.py +++ b/buildscripts/tests/test_evergreen_activate_gen_tasks.py @@ -6,7 +6,7 @@ import unittest from mock import MagicMock, mock from buildscripts import evergreen_activate_gen_tasks as under_test -from evergreen import Build, EvergreenApi, Task, Version +from evergreen import EvergreenApi, Task, Version def build_mock_task(display_name, task_id): diff --git a/buildscripts/tests/test_jepsen_report.py b/buildscripts/tests/test_jepsen_report.py index 0ce9100fd5d..22f1d8cb8f4 100644 --- a/buildscripts/tests/test_jepsen_report.py +++ b/buildscripts/tests/test_jepsen_report.py @@ -4,7 +4,7 @@ import unittest import textwrap import random import os -from unittest.mock import patch, mock_open, MagicMock +from unittest.mock import patch from click.testing import CliRunner from buildscripts.jepsen_report import parse, ParserOutput, main diff --git a/buildscripts/tracing_profiler/profile_format.py b/buildscripts/tracing_profiler/profile_format.py index cecc588b3d3..fe80a7e6f5f 100755 --- a/buildscripts/tracing_profiler/profile_format.py +++ b/buildscripts/tracing_profiler/profile_format.py @@ -2,7 +2,6 @@ import argparse import copy -from dataclasses import dataclass import json import sys import textwrap diff --git a/buildscripts/tracing_profiler/profilerlib.py b/buildscripts/tracing_profiler/profilerlib.py index a51e7729675..b110dbc53e9 100644 --- a/buildscripts/tracing_profiler/profilerlib.py +++ b/buildscripts/tracing_profiler/profilerlib.py @@ -1,5 +1,5 @@ from dataclasses import dataclass -from typing import Dict, List +from typing import Dict import json diff --git a/buildscripts/util/runcommand.py b/buildscripts/util/runcommand.py index 08c1aa45ee7..ec6d157d54d 100644 --- a/buildscripts/util/runcommand.py +++ b/buildscripts/util/runcommand.py @@ -3,7 +3,6 @@ import os import pipes import shlex -import sys import subprocess from . import fileops diff --git a/evergreen/lint_fuzzer_sanity_patch.py b/evergreen/lint_fuzzer_sanity_patch.py index bde1f26d244..4fa7c37ab3e 100644 --- a/evergreen/lint_fuzzer_sanity_patch.py +++ b/evergreen/lint_fuzzer_sanity_patch.py @@ -6,7 +6,6 @@ import glob from concurrent import futures from pathlib import Path import time -from typing import List, Tuple # Get relative imports to work when the package is not installed on the PYTHONPATH. if __name__ == "__main__" and __package__ is None: diff --git a/jstests/SConscript b/jstests/SConscript index 2f2db1dd25f..97cd134e513 100644 --- a/jstests/SConscript +++ b/jstests/SConscript @@ -1,6 +1,5 @@ # Includes the jstests in distribution tarballs generated by SCons -import os from collections import defaultdict Import("env") diff --git a/jstests/auth/lib/automated_idp_authn_simulator_azure.py b/jstests/auth/lib/automated_idp_authn_simulator_azure.py index 81f35d80050..c0b01416f9d 100644 --- a/jstests/auth/lib/automated_idp_authn_simulator_azure.py +++ b/jstests/auth/lib/automated_idp_authn_simulator_azure.py @@ -9,7 +9,6 @@ will simulate automatically logging in as a human would. """ import argparse -import os import json import traceback diff --git a/jstests/auth/lib/automated_idp_authn_simulator_okta.py b/jstests/auth/lib/automated_idp_authn_simulator_okta.py index f82027e524d..bc238a9ce54 100644 --- a/jstests/auth/lib/automated_idp_authn_simulator_okta.py +++ b/jstests/auth/lib/automated_idp_authn_simulator_okta.py @@ -9,7 +9,6 @@ will simulate automatically logging in as a human would. """ import argparse -import os import json import traceback diff --git a/jstests/noPassthrough/libs/configExpand/rest_server.py b/jstests/noPassthrough/libs/configExpand/rest_server.py index d0f6b98777f..3616b66d179 100644 --- a/jstests/noPassthrough/libs/configExpand/rest_server.py +++ b/jstests/noPassthrough/libs/configExpand/rest_server.py @@ -3,7 +3,6 @@ import argparse import http.server -import json import logging import time import urllib.parse diff --git a/jstests/ssl/x509/mkcert.py b/jstests/ssl/x509/mkcert.py index 8d02939e265..284dd17b50d 100755 --- a/jstests/ssl/x509/mkcert.py +++ b/jstests/ssl/x509/mkcert.py @@ -8,7 +8,6 @@ Optionally providing a cert ID to only regenerate a single cert. import argparse import binascii -import datetime import os import random import subprocess diff --git a/pyproject.toml b/pyproject.toml index 3874b4d0e76..f11fe3bfd4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -198,7 +198,6 @@ ignore = [ "E721", # type-comparison "E722", # bare-except "E741", # ambiguous-variable-name - "F401", # unused-import "F402", # import-shadowed-by-loop-var "F403", # undefined-local-with-import-star "F405", # undefined-local-with-import-star-usage diff --git a/site_scons/mongo/pip_requirements.py b/site_scons/mongo/pip_requirements.py index 9c23f940519..c9ba2a6f40b 100644 --- a/site_scons/mongo/pip_requirements.py +++ b/site_scons/mongo/pip_requirements.py @@ -38,7 +38,7 @@ def verify_requirements(silent: bool = False, executable=sys.executable): # Import poetry. If this fails then we know the next function will fail. # This is so the user will have an easier time diagnosing the problem try: - import poetry + import poetry # noqa: F401 except ModuleNotFoundError as ex: raiseSuggestion(ex, "'poetry==1.8.3'") diff --git a/site_scons/site_tools/abilink.py b/site_scons/site_tools/abilink.py index 701e0cd1af5..e075dd3a88d 100644 --- a/site_scons/site_tools/abilink.py +++ b/site_scons/site_tools/abilink.py @@ -21,7 +21,6 @@ # import SCons -import subprocess # TODO: Make a SUFF variable for the suffix to write to # TODO: Prevent using abilink when -gsplit-dwarf is in play, since it doesn't work diff --git a/site_scons/site_tools/build_auto_retry.py b/site_scons/site_tools/build_auto_retry.py index 1014da52d6b..f7f86187a06 100644 --- a/site_scons/site_tools/build_auto_retry.py +++ b/site_scons/site_tools/build_auto_retry.py @@ -28,7 +28,6 @@ import sys import time import random import os -import re from typing import Callable, List, Dict diff --git a/site_scons/site_tools/build_metrics/artifacts.py b/site_scons/site_tools/build_metrics/artifacts.py index 286155c1b5e..6b38897fbcd 100644 --- a/site_scons/site_tools/build_metrics/artifacts.py +++ b/site_scons/site_tools/build_metrics/artifacts.py @@ -1,17 +1,13 @@ import os -import glob import subprocess import csv -import io import enum import platform import puremagic import pathlib from typing import Optional -from SCons.Node.FS import File, Dir from typing_extensions import TypedDict -from .util import get_build_metric_dict from .protocol import BuildMetricsCollector diff --git a/site_scons/site_tools/build_metrics/memory.py b/site_scons/site_tools/build_metrics/memory.py index b25580c488e..7a40e8a19f5 100644 --- a/site_scons/site_tools/build_metrics/memory.py +++ b/site_scons/site_tools/build_metrics/memory.py @@ -1,7 +1,6 @@ import threading import time import psutil -import sys from .util import timestamp_now from .protocol import BuildMetricsCollector diff --git a/site_scons/site_tools/build_metrics/per_action_metrics.py b/site_scons/site_tools/build_metrics/per_action_metrics.py index f976e38e141..573af0d8a53 100644 --- a/site_scons/site_tools/build_metrics/per_action_metrics.py +++ b/site_scons/site_tools/build_metrics/per_action_metrics.py @@ -1,7 +1,6 @@ import functools import time import psutil -import subprocess import memory_profiler import SCons diff --git a/site_scons/site_tools/build_metrics/scons.py b/site_scons/site_tools/build_metrics/scons.py index 2abfdb814ed..eeee8ff8628 100644 --- a/site_scons/site_tools/build_metrics/scons.py +++ b/site_scons/site_tools/build_metrics/scons.py @@ -1,7 +1,6 @@ -import time from typing import Tuple, List, Any, Optional -from typing_extensions import Protocol, TypedDict +from typing_extensions import TypedDict from .protocol import BuildMetricsCollector import SCons.Script diff --git a/site_scons/site_tools/build_metrics/top_n_metrics.py b/site_scons/site_tools/build_metrics/top_n_metrics.py index 983506fa058..bf54e0c8243 100644 --- a/site_scons/site_tools/build_metrics/top_n_metrics.py +++ b/site_scons/site_tools/build_metrics/top_n_metrics.py @@ -1,5 +1,4 @@ import json -import sys import datetime import argparse import logging diff --git a/site_scons/site_tools/ccache.py b/site_scons/site_tools/ccache.py index bc48b3b57ad..0f70f3879c8 100644 --- a/site_scons/site_tools/ccache.py +++ b/site_scons/site_tools/ccache.py @@ -20,7 +20,6 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -import math import os import re import subprocess diff --git a/site_scons/site_tools/distsrc.py b/site_scons/site_tools/distsrc.py index 7e4654d7b6e..664ebd70583 100644 --- a/site_scons/site_tools/distsrc.py +++ b/site_scons/site_tools/distsrc.py @@ -23,9 +23,6 @@ import git import SCons import os -import os.path as ospath -import subprocess -import shutil import tarfile import time import zipfile diff --git a/site_scons/site_tools/integrate_bazel.py b/site_scons/site_tools/integrate_bazel.py index 898aac30a50..9870e1c827f 100644 --- a/site_scons/site_tools/integrate_bazel.py +++ b/site_scons/site_tools/integrate_bazel.py @@ -1,5 +1,3 @@ -import copy -from enum import Enum import errno import getpass import hashlib @@ -27,7 +25,6 @@ import atexit import SCons import mongo.platform as mongo_platform -import mongo.generators as mongo_generators # Disable retries locally _LOCAL_MAX_RETRY_ATTEMPTS = 1 diff --git a/site_scons/site_tools/libtool.py b/site_scons/site_tools/libtool.py index b5f6184127c..c636a387f0d 100644 --- a/site_scons/site_tools/libtool.py +++ b/site_scons/site_tools/libtool.py @@ -20,8 +20,6 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -import SCons - def generate(env): env["AR"] = "libtool" diff --git a/site_scons/site_tools/mongo_benchmark.py b/site_scons/site_tools/mongo_benchmark.py index 0b614e03d83..ea7238c2dbd 100644 --- a/site_scons/site_tools/mongo_benchmark.py +++ b/site_scons/site_tools/mongo_benchmark.py @@ -23,8 +23,6 @@ Pseudo-builders for building and registering benchmarks. """ -from SCons.Script import Action - from site_scons.mongo import insort_wrapper diff --git a/site_scons/site_tools/mongo_integrationtest.py b/site_scons/site_tools/mongo_integrationtest.py index e9903b19e63..52fbbe07012 100644 --- a/site_scons/site_tools/mongo_integrationtest.py +++ b/site_scons/site_tools/mongo_integrationtest.py @@ -23,8 +23,6 @@ Pseudo-builders for building and registering integration tests. """ -from SCons.Script import Action - from site_scons.mongo import insort_wrapper diff --git a/site_scons/site_tools/mongo_libfuzzer.py b/site_scons/site_tools/mongo_libfuzzer.py index 6f89b42d696..fe41ef56384 100644 --- a/site_scons/site_tools/mongo_libfuzzer.py +++ b/site_scons/site_tools/mongo_libfuzzer.py @@ -21,8 +21,6 @@ # """Pseudo-builders for building and registering libfuzzer tests.""" -from SCons.Script import Action - def exists(env): return True diff --git a/site_scons/site_tools/mongo_pretty_printer_tests.py b/site_scons/site_tools/mongo_pretty_printer_tests.py index 1076eccf23f..c7042c3aea8 100644 --- a/site_scons/site_tools/mongo_pretty_printer_tests.py +++ b/site_scons/site_tools/mongo_pretty_printer_tests.py @@ -21,7 +21,6 @@ # """Pseudo-builders for building and registering tests for pretty printers.""" -import subprocess import os import sys diff --git a/site_scons/site_tools/mongo_unittest.py b/site_scons/site_tools/mongo_unittest.py index ab5fbfcd3d5..7b79c3b5157 100644 --- a/site_scons/site_tools/mongo_unittest.py +++ b/site_scons/site_tools/mongo_unittest.py @@ -21,8 +21,6 @@ # """Pseudo-builders for building and registering unit tests.""" -from SCons.Script import Action - from site_scons.mongo import insort_wrapper LAST_TEST_GROUP = 0 diff --git a/site_scons/site_tools/mongo_workload_simulator.py b/site_scons/site_tools/mongo_workload_simulator.py index a0ae7f640e6..8e5d908fc2a 100644 --- a/site_scons/site_tools/mongo_workload_simulator.py +++ b/site_scons/site_tools/mongo_workload_simulator.py @@ -21,8 +21,6 @@ # """Pseudo-builders for building workload simulators.""" -from SCons.Script import Action - from site_scons.mongo import insort_wrapper diff --git a/site_scons/site_tools/tapilink.py b/site_scons/site_tools/tapilink.py index df54e96c1e4..d2e0854204b 100644 --- a/site_scons/site_tools/tapilink.py +++ b/site_scons/site_tools/tapilink.py @@ -21,7 +21,6 @@ # import SCons -import subprocess # TODO: DRY this with abilink.py by moving duplicated code out to a common # support module. diff --git a/site_scons/site_tools/vcredist.py b/site_scons/site_tools/vcredist.py index 104d1306c9c..54057c35cf5 100644 --- a/site_scons/site_tools/vcredist.py +++ b/site_scons/site_tools/vcredist.py @@ -25,8 +25,6 @@ import re import subprocess import winreg -import SCons - def exists(env): result = "msvc" in env["TOOLS"] diff --git a/src/SConscript b/src/SConscript index 23638bcf106..c6f8b693d93 100644 --- a/src/SConscript +++ b/src/SConscript @@ -3,7 +3,6 @@ # This is the principle SConscript file, invoked by the SConstruct. Its job is # to delegate to any and all per-module SConscript files. -import SCons Import("env") Import("module_sconscripts") diff --git a/src/mongo/SConscript b/src/mongo/SConscript index 30449b453df..a02daeee828 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -1,6 +1,5 @@ # -*- mode: python; -*- -import re import sys Import( diff --git a/src/mongo/db/concurrency/SConscript b/src/mongo/db/concurrency/SConscript index 82f06244052..2c712309667 100644 --- a/src/mongo/db/concurrency/SConscript +++ b/src/mongo/db/concurrency/SConscript @@ -1,5 +1,4 @@ # -*- mode: python -*- -import sys Import("env") diff --git a/src/mongo/db/ftdc/SConscript b/src/mongo/db/ftdc/SConscript index eaf9f967ae0..688d26487a4 100644 --- a/src/mongo/db/ftdc/SConscript +++ b/src/mongo/db/ftdc/SConscript @@ -1,6 +1,5 @@ # -*- mode: python -*- -from site_scons.mongo import insort_wrapper Import("env") diff --git a/src/mongo/db/fts/unicode/gen_casefold_map.py b/src/mongo/db/fts/unicode/gen_casefold_map.py index d0f6bc0b571..367d04c9d63 100644 --- a/src/mongo/db/fts/unicode/gen_casefold_map.py +++ b/src/mongo/db/fts/unicode/gen_casefold_map.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -import os import sys from gen_helper import getCopyrightNotice, openNamespaces, closeNamespaces, include diff --git a/src/mongo/db/fts/unicode/gen_diacritic_map.py b/src/mongo/db/fts/unicode/gen_diacritic_map.py index 9bdb6c9a7bd..8a7c345019b 100644 --- a/src/mongo/db/fts/unicode/gen_diacritic_map.py +++ b/src/mongo/db/fts/unicode/gen_diacritic_map.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys -from unicodedata import normalize, category, unidata_version +from unicodedata import normalize, unidata_version from gen_helper import getCopyrightNotice, openNamespaces, closeNamespaces, include diff --git a/src/mongo/embedded/SConscript b/src/mongo/embedded/SConscript index d5e00437117..8a636f23306 100644 --- a/src/mongo/embedded/SConscript +++ b/src/mongo/embedded/SConscript @@ -1,6 +1,5 @@ # -*- mode: python; -*- -import re Import("env") Import("get_option") diff --git a/src/mongo/installer/msi/SConscript b/src/mongo/installer/msi/SConscript index 90682041507..98251fced74 100644 --- a/src/mongo/installer/msi/SConscript +++ b/src/mongo/installer/msi/SConscript @@ -11,9 +11,6 @@ Import("has_option") if not env.TargetOSIs("windows"): Return() -import re -import subprocess -import winreg env = env.Clone() diff --git a/src/mongo/resmoke/SConscript b/src/mongo/resmoke/SConscript index 927371557d7..a43f2334762 100644 --- a/src/mongo/resmoke/SConscript +++ b/src/mongo/resmoke/SConscript @@ -1,5 +1,4 @@ # -*- mode: python -*- -import os import SCons Import("env") diff --git a/src/mongo/tools/workload_simulation/process_logs.py b/src/mongo/tools/workload_simulation/process_logs.py index 2ccdd178667..05e286fdca1 100755 --- a/src/mongo/tools/workload_simulation/process_logs.py +++ b/src/mongo/tools/workload_simulation/process_logs.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 import sys import json -from os.path import abspath import argparse import matplotlib.pyplot as pyplot diff --git a/src/mongo/util/SConscript b/src/mongo/util/SConscript index 88a1d917c07..5f0d2f59e14 100644 --- a/src/mongo/util/SConscript +++ b/src/mongo/util/SConscript @@ -1,9 +1,6 @@ # -*- mode: python -*- from site_scons.mongo import insort_wrapper -import subprocess -import sys -import os Import( [ diff --git a/src/mongo/util/generate_icu_init_cpp.py b/src/mongo/util/generate_icu_init_cpp.py index 93eca31c48e..5ac609892ff 100755 --- a/src/mongo/util/generate_icu_init_cpp.py +++ b/src/mongo/util/generate_icu_init_cpp.py @@ -28,7 +28,6 @@ # it in the license file. import optparse -import os import sys