0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-21 12:39:08 +01:00

SERVER-94077 Use isort in Ruff configs (#27865)

GitOrigin-RevId: e793d662774ccd3ab6c3f356c2287cf1f7ff9805
This commit is contained in:
Juan Gu 2024-10-10 10:59:18 -07:00 committed by MongoDB Bot
parent a35c18f077
commit 855dfadef0
328 changed files with 864 additions and 802 deletions

View File

@ -6,9 +6,9 @@ import errno
import functools
import json
import os
import re
import pathlib
import platform
import re
import shlex
import shutil
import subprocess
@ -18,11 +18,11 @@ import uuid
from datetime import datetime
from glob import glob
from pkg_resources import parse_version
import SCons
import SCons.Script
from mongo_tooling_metrics.lib.top_level_metrics import SConsToolingMetrics
from pkg_resources import parse_version
from site_scons.mongo import build_profiles
# This must be first, even before EnsureSConsVersion, if
@ -32,10 +32,10 @@ DefaultEnvironment(tools=[])
# These come from site_scons/mongo. Import these things
# after calling DefaultEnvironment, for the sake of paranoia.
import mongo
import mongo.platform as mongo_platform
import mongo.toolchain as mongo_toolchain
import mongo.generators as mongo_generators
import mongo.install_actions as install_actions
import mongo.platform as mongo_platform
import mongo.toolchain as mongo_toolchain
EnsurePythonVersion(3, 10)
EnsureSConsVersion(3, 1, 1)
@ -51,10 +51,10 @@ def release_target_info_noop(self):
SCons.Node.FS.File.release_target_info = release_target_info_noop
from buildscripts import utils
from buildscripts import moduleconfig
import psutil
from buildscripts import moduleconfig, utils
scons_invocation = "{} {}".format(sys.executable, " ".join(sys.argv))
print("scons: running with args {}".format(scons_invocation))
@ -1669,6 +1669,7 @@ SConsignFile(str(sconsDataDir.File("sconsign.py3")))
def printLocalInfo():
import sys
import SCons
print(("scons version: " + SCons.__version__))

View File

@ -6,11 +6,11 @@
# --output-path mongo.h --template-path mongo.h.in \
# --check-path mongo_checks.py --log-path mongo.h.log
import argparse
import textwrap
import inspect
from typing import Dict
import sys
import os
import sys
import textwrap
from typing import Dict
def write_config_header(input_path: str, output_path: str, definitions: Dict[str, str]) -> None:

View File

@ -1,7 +1,7 @@
import os
import sys
import subprocess
import io
import os
import subprocess
import sys
# assume we are always running from project root to find buildscripts
sys.path.append(".")

View File

@ -2,10 +2,10 @@
# the dockerfiles listed in bazel/remote_execution_container/.
import argparse
from datetime import datetime
import os
import pathlib
import subprocess
from datetime import datetime
def log_subprocess_run(*args, **kwargs):

View File

@ -5,8 +5,8 @@ All but the last argument are input tracefiles or .txt files which list tracefil
The last argument is the tracefile to which the output will be written.
"""
import subprocess
import os
import subprocess
import sys
from optparse import OptionParser

View File

@ -3,6 +3,7 @@
import json
import subprocess
from time import sleep
from utils import mongo_process_running, retry_until_success
CONFIGSVR_CONFIG = {

View File

@ -2,9 +2,9 @@
"""Applies fixes, generated by clang-tidy, across the codebase."""
import argparse
import hashlib
import json
import os
import hashlib
def get_replacements_for_file(filepath: str, file_data: dict, fixes: dict):

View File

@ -8,6 +8,7 @@ import platform
import re
import subprocess
import sys
from buildscripts.install_bazel import install_bazel
bazel_env_settings: dict[str, str] = {}

View File

@ -5,8 +5,8 @@ import pathlib
import platform
import subprocess
from simple_report import put_report, try_combine_reports, make_report
import download_buildifier
from simple_report import make_report, put_report, try_combine_reports
mongo_dir = pathlib.Path(__file__).parents[1]

View File

@ -25,20 +25,21 @@ if __name__ == "__main__" and __package__ is None:
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# pylint: disable=wrong-import-position
from buildscripts.patch_builds.change_data import (
generate_revision_map,
RevisionMap,
find_changed_files_in_repos,
)
import buildscripts.resmokelib.parser
from buildscripts.resmokelib.suitesconfig import create_test_membership_map, get_suites
from buildscripts.resmokelib.utils import default_if_none, globstar
from buildscripts.ciconfig.evergreen import (
parse_evergreen_file,
EvergreenProjectConfig,
Variant,
VariantTask,
parse_evergreen_file,
)
from buildscripts.patch_builds.change_data import (
RevisionMap,
find_changed_files_in_repos,
generate_revision_map,
)
from buildscripts.resmokelib.suitesconfig import create_test_membership_map, get_suites
from buildscripts.resmokelib.utils import default_if_none, globstar
# pylint: enable=wrong-import-position
structlog.configure(logger_factory=LoggerFactory())

View File

@ -1,15 +1,14 @@
import datetime
import pkg_resources
from pydantic import ValidationError
import mongo_tooling_metrics.client as metrics_client
import pkg_resources
import pymongo
from mongo_tooling_metrics.lib.top_level_metrics import (
NinjaToolingMetrics,
ResmokeToolingMetrics,
SConsToolingMetrics,
)
import pymongo
from pydantic import ValidationError
# Check cluster connectivity
try:

View File

@ -17,7 +17,6 @@ from typing import Any, Dict, List, Optional, Set
import structlog
import yaml
ENTERPRISE_MODULE_NAME = "enterprise"
ASAN_SIGNATURE = "detect_leaks=1"

View File

@ -22,7 +22,6 @@ import threading
import urllib.error
import urllib.parse
import urllib.request
from optparse import OptionParser
import structlog

View File

@ -3,22 +3,23 @@
import argparse
import datetime
import hashlib
import json
import locale
import math
import multiprocessing
import os
import re
import subprocess
import sys
import locale
import hashlib
import time
import math
from typing import Any, Dict, List, Optional, Tuple
import multiprocessing
from pathlib import Path
from concurrent import futures
from simple_report import put_report, try_combine_reports, make_report
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
import yaml
from clang_tidy_vscode import CHECKS_SO
from simple_report import make_report, put_report, try_combine_reports
def _clang_tidy_executor(

View File

@ -24,9 +24,9 @@ Expected Format:
# TODO: if https://github.com/notskm/vscode-clang-tidy/pull/77#issuecomment-1422910143 is resolved then this script can be removed
import os
import subprocess
import sys
import os
CHECKS_SO = "build/install/lib/libmongo_tidy_checks.so"

View File

@ -1,12 +1,13 @@
import argparse
from functools import lru_cache
import difflib
import glob
import os
import pathlib
import subprocess
import sys
from functools import lru_cache
import yaml
import difflib
OWNERS_FILE_NAME = "OWNERS.yml"

View File

@ -1,14 +1,14 @@
#!/usr/bin/env python3
"""Collect system resource information on processes running in Evergreen on a given interval."""
from datetime import datetime
import optparse
import os
import sys
import time
from datetime import datetime
from bson.json_util import dumps
import requests
from bson.json_util import dumps
# Get relative imports to work when the package is not installed on the PYTHONPATH.
if __name__ == "__main__" and __package__ is None:

View File

@ -11,8 +11,8 @@ from optparse import OptionParser
if __name__ == "__main__" and __package__ is None:
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from buildscripts.resmokelib.testing import report # pylint: disable=wrong-import-position
from buildscripts.resmokelib import utils # pylint: disable=wrong-import-position
from buildscripts.resmokelib.testing import report # pylint: disable=wrong-import-position
def read_json_file(json_file):

View File

@ -8,11 +8,12 @@ This comparison does not currently support nested properties is as it does only
"""
import argparse
from enum import Enum
import io
import os
import pprint
import unittest
from enum import Enum
import yaml
_COMPARE_FIELDS_SERVER_PARAMETERS = ["default", "set_at", "validator", "test_only"]

View File

@ -1,12 +1,12 @@
import concurrent.futures
import json
import os
import platform
import shlex
import shutil
import subprocess
import sys
import json
import platform
import os
import shlex
import concurrent.futures
import traceback
import shutil
from typing import Annotated, List
import typer

View File

@ -28,13 +28,14 @@
"""Calibrate ABT nodes."""
from __future__ import annotations
import experiment as exp
import pandas as pd
from sklearn.linear_model import LinearRegression
import statsmodels.api as sm
from config import AbtCalibratorConfig, AbtNodeCalibrationConfig
from database_instance import DatabaseInstance
from cost_estimator import estimate
import experiment as exp
from database_instance import DatabaseInstance
from sklearn.linear_model import LinearRegression
__all__ = ["calibrate"]

View File

@ -28,17 +28,18 @@
"""A/B performance test to compare plans produced by different sets of cost model coefficients."""
from __future__ import annotations
import asyncio
import logging
from dataclasses import asdict, dataclass
from typing import Sequence
from scipy import stats
import bson.json_util as json
from config import BenchmarkConfig
from database_instance import DatabaseInstance, Pipeline, get_database_parameter
import physical_tree
import bson.json_util as json
import execution_tree
import physical_tree
from config import BenchmarkConfig
from database_instance import DatabaseInstance, Pipeline, get_database_parameter
from scipy import stats
@dataclass

View File

@ -28,8 +28,9 @@
"""Calibration configuration."""
import random
import config
from random_generator import RangeGenerator, RandomDistribution, ArrayRandomDistribution, DataType
from random_generator import ArrayRandomDistribution, DataType, RandomDistribution, RangeGenerator
__all__ = ["main_config", "distributions"]

View File

@ -27,16 +27,17 @@
#
"""Configuration of data generation for CE accuracy testing."""
from pathlib import Path
from datetime import datetime
from pathlib import Path
from typing import Sequence
import config
from random_generator import (
RangeGenerator,
RandomDistribution,
ArrayRandomDistribution,
DataType,
DistributionType,
RandomDistribution,
RangeGenerator,
)
__all__ = ["database_config", "data_generator_config"]

View File

@ -28,20 +28,21 @@
"""Data generation entry point."""
import asyncio
from datetime import datetime
import json
import math
import os
import re
from datetime import datetime
from pathlib import Path
import seaborn as sns
import bson
import matplotlib.pyplot as plt
import seaborn as sns
from ce_data_settings import data_generator_config, database_config
from config import CollectionTemplate, FieldTemplate
from data_generator import DataGenerator
from database_instance import DatabaseInstance
from random_generator import DataType
from ce_data_settings import database_config, data_generator_config
__all__ = []

View File

@ -28,10 +28,12 @@
"""Configuration of Cost Model Calibration."""
from __future__ import annotations
from dataclasses import dataclass
from enum import Enum
from typing import Callable, Sequence
from random_generator import RandomDistribution, DataType
from random_generator import DataType, RandomDistribution
@dataclass

View File

@ -28,9 +28,11 @@
"""Common cost estimator types and functions."""
from __future__ import annotations
from dataclasses import dataclass
import numpy as np
from sklearn.metrics import mean_squared_error, r2_score, explained_variance_score
from sklearn.metrics import explained_variance_score, mean_squared_error, r2_score
from sklearn.model_selection import train_test_split
from workload_execution import QueryParameters

View File

@ -28,16 +28,18 @@
"""Implements to populate MongoDB collections with generated data used to calibrate Cost Model."""
from __future__ import annotations
from dataclasses import dataclass
import time
from typing import Sequence
import asyncio
import time
from dataclasses import dataclass
from typing import Sequence
import pymongo
from pymongo import IndexModel
from motor.motor_asyncio import AsyncIOMotorCollection
from random_generator import RandomDistribution, DataType
from config import DataGeneratorConfig, WriteMode
from database_instance import DatabaseInstance
from motor.motor_asyncio import AsyncIOMotorCollection
from pymongo import IndexModel
from random_generator import DataType, RandomDistribution
__all__ = ["DataGenerator"]

View File

@ -28,11 +28,13 @@
"""A wrapper with useful methods over MongoDB database."""
from __future__ import annotations
from typing import Sequence, Mapping, NewType, Any
import subprocess
from contextlib import asynccontextmanager
from motor.motor_asyncio import AsyncIOMotorClient
from typing import Any, Mapping, NewType, Sequence
from config import DatabaseConfig, RestoreMode
from motor.motor_asyncio import AsyncIOMotorClient
__all__ = ["DatabaseInstance", "Pipeline"]
"""MongoDB Aggregate's Pipeline"""

View File

@ -33,26 +33,27 @@ It produces descriptive statistics (mean, stddev, min, max) and calculates R2 to
estimate quality of the tested Cost Model.
"""
from typing import Callable, Sequence, Tuple
import os
import asyncio
import dataclasses
import pandas as pd
import numpy as np
from sklearn.metrics import r2_score
from calibration_settings import main_config, HIDDEN_STRING_VALUE, distributions
from database_instance import DatabaseInstance, get_database_parameter
from random_generator import RandomDistribution
from data_generator import CollectionInfo, DataGenerator
from benchmark import CostModelCoefficients
from workload_execution import Query
import workload_execution
import os
from typing import Callable, Sequence, Tuple
import config
import experiment as exp
import physical_tree as pt
import execution_tree as et
from parameters_extractor import get_excution_stats
import experiment as exp
import numpy as np
import pandas as pd
import physical_tree as pt
import workload_execution
from benchmark import CostModelCoefficients
from calibration_settings import HIDDEN_STRING_VALUE, distributions, main_config
from cost_estimator import ExecutionStats
from data_generator import CollectionInfo, DataGenerator
from database_instance import DatabaseInstance, get_database_parameter
from parameters_extractor import get_excution_stats
from random_generator import RandomDistribution
from sklearn.metrics import r2_score
from workload_execution import Query
class CostEstimator:

View File

@ -28,8 +28,10 @@
"""Define SBE execution tree and parse it from query explain."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Optional
import bson.json_util as json
__all__ = ["Node", "build_execution_tree"]

View File

@ -94,17 +94,19 @@ sns.lineplot(x=ixscan_df['n_processed'],y=y_pred, color='red')
"""
from __future__ import annotations
import dataclasses
import bson.json_util as json
import seaborn as sns
import execution_tree as sbe
import pandas as pd
from sklearn.metrics import r2_score
from sklearn.linear_model import LinearRegression
import physical_tree as abt
import seaborn as sns
import statsmodels.api as sm
from database_instance import DatabaseInstance
import execution_tree as sbe
import physical_tree as abt
from parameters_extractor import extract_execution_stats
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
async def load_calibration_data(database: DatabaseInstance, collection_name: str) -> pd.DataFrame:
@ -229,6 +231,7 @@ def calibrate(abt_node_df: pd.DataFrame, variables: list[str] = None):
if __name__ == "__main__":
import asyncio
from config import DatabaseConfig
async def test():

View File

@ -28,15 +28,17 @@
"""Parse explain and extract parameters."""
from __future__ import annotations
from collections import deque, defaultdict
from typing import Mapping, Sequence, TypeVar, Callable
from collections import defaultdict, deque
from typing import Callable, Mapping, Sequence, TypeVar
import bson.json_util as json
from workload_execution import QueryParameters
from config import AbtCalibratorConfig
from database_instance import DatabaseInstance
from cost_estimator import CostModelParameters, ExecutionStats
import execution_tree
import physical_tree
from config import AbtCalibratorConfig
from cost_estimator import CostModelParameters, ExecutionStats
from database_instance import DatabaseInstance
from workload_execution import QueryParameters
__all__ = ["extract_parameters", "extract_execution_stats"]

View File

@ -28,6 +28,7 @@
"""Define ABT physical tree and parse it from query explain."""
from __future__ import annotations
from dataclasses import dataclass
__all__ = ["Node", "build"]

View File

@ -27,11 +27,12 @@
#
"""Prepare parameters for QSN cost calibration."""
from typing import TypeVar, Callable, Optional
import query_solution_tree as qsn
from typing import Callable, Optional, TypeVar
import execution_tree as sbe
from workload_execution import QueryParameters
import pandas as pd
import query_solution_tree as qsn
from workload_execution import QueryParameters
Node = TypeVar("Node")

View File

@ -28,6 +28,7 @@
"""Define Query Solution tree (aka QSN tree) and parse it from query explain."""
from __future__ import annotations
from dataclasses import dataclass
__all__ = ["Node", "build"]

View File

@ -28,12 +28,14 @@
"""Random data generator of various distributions."""
from __future__ import annotations
from ctypes import Union
from dataclasses import dataclass
from datetime import datetime
from enum import Enum
from itertools import chain
from typing import Generic, Sequence, TypeVar
import numpy as np
__all__ = ["RangeGenerator", "DataType", "RandomDistribution"]

View File

@ -27,20 +27,21 @@
#
"""Cost Model Calibrator entry point."""
import asyncio
import csv
import dataclasses
import os
import csv
import asyncio
from typing import Mapping, Sequence
import abt_calibrator
import parameters_extractor
import workload_execution
from calibration_settings import main_config
from config import WriteMode
from cost_estimator import ExecutionStats, CostModelParameters
from cost_estimator import CostModelParameters, ExecutionStats
from data_generator import CollectionInfo, DataGenerator
from database_instance import DatabaseInstance
import abt_calibrator
import workload_execution
from workload_execution import Query, QueryParameters
import parameters_extractor
from calibration_settings import main_config
__all__ = []

View File

@ -28,13 +28,15 @@
"""Workload Execution. Run the queries to collect data for calibration."""
from __future__ import annotations
from dataclasses import asdict, dataclass
from typing import Sequence
import bson.json_util as json
from bson.objectid import ObjectId
from config import WorkloadExecutionConfig, WriteMode
from data_generator import CollectionInfo
from database_instance import DatabaseInstance, Pipeline
from config import WorkloadExecutionConfig, WriteMode
__all__ = ["execute"]

View File

@ -1,14 +1,15 @@
import argparse
import concurrent.futures
import datetime
import os
import re
import sys
import evergreen
import os
from dateutil import tz
import evergreen
from buildscripts.resmokelib.utils import evergreen_conn
from buildscripts.util.read_config import read_config_file
from dateutil import tz
timeouts_without_dumps = set()
passed_with_dumps = set()

View File

@ -11,7 +11,7 @@ import subprocess
import sys
import time
from json import JSONDecoder
from typing import Optional, Generator, Dict, List, NamedTuple
from typing import Dict, Generator, List, NamedTuple, Optional
import requests
@ -19,12 +19,12 @@ import requests
sys.path.append(str(pathlib.Path(os.path.join(os.getcwd(), __file__)).parent.parent))
# pylint: disable=wrong-import-position
from buildscripts.util.oauth import get_client_cred_oauth_credentials, Configs
from buildscripts.build_system_options import PathOptions
from buildscripts.resmokelib.setup_multiversion.setup_multiversion import (
SetupMultiversion,
download,
)
from buildscripts.build_system_options import PathOptions
from buildscripts.util.oauth import Configs, get_client_cred_oauth_credentials
BUILD_INFO_RE = re.compile(r"Build Info: ({(\n.*)*})")
MONGOD = "mongod"

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python3
import argparse
import json
import subprocess
import uuid
import json
from pathlib import Path
_MAX_RUNS = 1000

View File

@ -2,6 +2,7 @@
"""Download the binaries from a previous sys-perf run."""
import argparse
import requests
BASE_URI = "https://evergreen.mongodb.com/rest/v2/"

View File

@ -9,8 +9,8 @@ import bisect
import os.path
import sys
from collections import defaultdict, namedtuple
from optparse import OptionParser
from functools import reduce
from optparse import OptionParser
from pathlib import Path
# Get relative imports to work when the package is not installed on the PYTHONPATH.

View File

@ -12,6 +12,7 @@ parameter supplied. This lets ESLint search for candidate files to lint.
import logging
import os
import platform
import shutil
import string
import subprocess
@ -19,14 +20,13 @@ import sys
import tarfile
import tempfile
import threading
import platform
from typing import Optional
import urllib.error
import urllib.parse
import urllib.request
from distutils import spawn
from optparse import OptionParser
from typing import Optional
import structlog
# Get relative imports to work when the package is not installed on the PYTHONPATH.
@ -34,8 +34,9 @@ if __name__ == "__main__" and __package__ is None:
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(os.path.realpath(__file__)))))
# pylint: disable=wrong-import-position
from buildscripts.linter.filediff import gather_changed_files_for_lint
from buildscripts.linter import git, parallel
from buildscripts.linter.filediff import gather_changed_files_for_lint
# pylint: enable=wrong-import-position
##############################################################################

View File

@ -10,8 +10,8 @@ def _error(msg: str) -> None:
try:
import yaml
import click
import yaml
except ModuleNotFoundError:
_error(
"ERROR: Failed to import a dependency. This is almost certainly because "

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python3
import os
import sys
import platform
import sys
from shrub.v2 import ShrubProject, Task, BuildVariant, FunctionCall, TaskGroup
from shrub.v2 import BuildVariant, FunctionCall, ShrubProject, Task, TaskGroup
from shrub.v2.command import BuiltInCommand

View File

@ -2,10 +2,10 @@
"""Generate multiple powercycle tasks to run in evergreen."""
from collections import namedtuple
from typing import Any, List, Tuple, Set
from typing import Any, List, Set, Tuple
import click
from shrub.v2 import BuildVariant, FunctionCall, ShrubProject, Task, TaskDependency, ExistingTask
from shrub.v2 import BuildVariant, ExistingTask, FunctionCall, ShrubProject, Task, TaskDependency
from shrub.v2.command import BuiltInCommand
from buildscripts.util.fileops import write_file

View File

@ -1,8 +1,7 @@
#!/usr/bin/env python3
"""Script to gather information about how tags are used in evergreen tasks."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import absolute_import, print_function
import argparse
import os

View File

@ -16,13 +16,13 @@ import inject
import structlog
import yaml
from pydantic import BaseModel
from evergreen import EvergreenApi, RetryingEvergreenApi
from buildscripts.ciconfig.evergreen import EvergreenProjectConfig, parse_evergreen_file
from buildscripts.resmoke_proxy.resmoke_proxy import ResmokeProxyService
from buildscripts.timeouts.timeout_service import TimeoutParams, TimeoutService
from buildscripts.util.cmdutils import enable_logging
from buildscripts.util.taskname import determine_task_base_name
from evergreen import EvergreenApi, RetryingEvergreenApi
LOGGER = structlog.get_logger(__name__)
DEFAULT_TIMEOUT_OVERRIDES = "etc/evergreen_timeouts.yml"

View File

@ -1,17 +1,19 @@
import argparse
import concurrent.futures
import glob
import gzip
import json
import shutil
import boto3
import requests
from buildscripts.util.read_config import read_config_file
import glob
import os
import shutil
import sys
import time
from typing import Dict, List, Optional
import boto3
import requests
from buildscripts.util.read_config import read_config_file
def process_file(
file: str,

View File

@ -7,13 +7,14 @@
"""
# TODO(SERVER-94780) Add buildozer dep to poetry
import subprocess
import json
from typing import List, Optional, Dict, Annotated, Tuple
import typer
import sys
import os
import pprint
import subprocess
import sys
from typing import Annotated, Dict, List, Optional, Tuple
import typer
# Get relative imports to work when the package is not installed on the PYTHONPATH.
if __name__ == "__main__" and __package__ is None:

View File

@ -1,11 +1,11 @@
"""GDB commands for MongoDB."""
import glob
import json
import os
import re
import sys
import glob
import subprocess
import sys
import warnings
from pathlib import Path
@ -85,8 +85,8 @@ def load_libstdcxx_printers(progspace):
try:
sys.path.insert(0, stdcxx_printer_toolchain_paths[progspace])
global stdlib_printers # pylint: disable=invalid-name,global-variable-not-assigned
from libstdcxx.v6 import register_libstdcxx_printers
from libstdcxx.v6 import printers as stdlib_printers
from libstdcxx.v6 import register_libstdcxx_printers
register_libstdcxx_printers(progspace)
print(

View File

@ -1,19 +1,20 @@
"""Mongo lock module."""
import os
import re
import sys
import os
from pathlib import Path
import gdb
import gdb.printing
if not gdb:
sys.path.insert(0, str(Path(os.path.abspath(__file__)).parent.parent.parent))
from buildscripts.gdb.mongo import (
RegisterMongoCommand,
get_current_thread_name,
get_thread_id,
lookup_type,
RegisterMongoCommand,
)
if sys.version_info[0] < 3:

View File

@ -6,27 +6,31 @@ import struct
import sys
import uuid
from pathlib import Path
import gdb
import gdb.printing
ROOT_PATH = str(Path(os.path.abspath(__file__)).parent.parent.parent)
if ROOT_PATH not in sys.path:
sys.path.insert(0, ROOT_PATH)
from src.third_party.immer.dist.tools.gdb_pretty_printers.printers import ListIter as ImmerListIter # pylint: disable=wrong-import-position
from src.third_party.immer.dist.tools.gdb_pretty_printers.printers import (
ListIter as ImmerListIter, # pylint: disable=wrong-import-position
)
if not gdb:
from buildscripts.gdb.mongo import (
get_boost_optional,
lookup_type,
get_decorable_info,
get_object_decoration,
lookup_type,
)
from buildscripts.gdb.optimizer_printers import register_optimizer_printers
try:
import collections
import bson
import bson.json_util
import collections
from bson.codec_options import CodecOptions
except ImportError:
print("Warning: Could not load bson library for Python '" + str(sys.version) + "'.")

View File

@ -3,6 +3,7 @@
import os
import sys
from pathlib import Path
import gdb
import gdb.printing

View File

@ -2,6 +2,7 @@
import os
import re
import gdb
# Pattern to match output of 'info files'

View File

@ -1,9 +1,10 @@
import gdb
import bson
import sys
import os
from pprint import pprint
import sys
from pathlib import Path
from pprint import pprint
import bson
import gdb
if not gdb:
sys.path.insert(0, str(Path(os.path.abspath(__file__)).parent.parent.parent))

View File

@ -8,8 +8,9 @@ $ python generate_compile_expansions.py --out compile_expansions.yml
import argparse
import os
import sys
import shlex
import sys
import yaml
VERSION_JSON = "version.json"

View File

@ -8,8 +8,9 @@ $ python generate_compile_expansions.py --out compile_expansions.yml
import argparse
import os
import sys
import shlex
import sys
import yaml
VERSION_JSON = "version.json"

View File

@ -10,6 +10,7 @@ import argparse
import json
import os
import re
import yaml
VERSION_JSON = "version.json"

View File

@ -9,10 +9,10 @@ import os
import pathlib
import platform
import re
import sys
import shutil
import sys
from subprocess import call, check_output
import click
# Get relative imports to work when the package is not installed on the PYTHONPATH.
@ -21,6 +21,7 @@ if __name__ == "__main__" and __package__ is None:
# pylint: disable=wrong-import-position
from buildscripts.util.fileops import read_yaml_file
# pylint: enable=wrong-import-position
assert sys.version_info >= (3, 7)

View File

@ -44,11 +44,13 @@ sys.path.append(os.path.normpath(os.path.join(os.path.abspath(__file__), "../../
# pylint: disable=wrong-import-position
from idl import syntax
from buildscripts.idl.lib import list_idls, parse_idl
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
# pylint: enable=wrong-import-position
LOGGER_NAME = "check-idl-definitions"

View File

@ -29,10 +29,11 @@
import argparse
import logging
import os
import sys
import shutil
import sys
from subprocess import check_output
from typing import List
from packaging.version import Version
# Get relative imports to work when the package is not installed on the PYTHONPATH.
@ -41,10 +42,11 @@ if __name__ == "__main__" and __package__ is None:
# pylint: disable=wrong-import-position
from buildscripts.resmokelib.multiversionconstants import (
LAST_LTS_FCV,
LAST_CONTINUOUS_FCV,
LAST_LTS_FCV,
LATEST_FCV,
)
# pylint: enable=wrong-import-position
LOGGER_NAME = "checkout-idl"

View File

@ -32,7 +32,6 @@ Used by resmoke.py to run only feature flag tests.
import os
import sys
from typing import List
import yaml

View File

@ -32,7 +32,6 @@ Used by DSI to conditionally allow configuration of internalQueryStatsRateLimit
import os
import sys
from typing import List
# Permit imports from "buildscripts".

View File

@ -32,12 +32,7 @@ import re
import typing
from typing import cast
from . import ast
from . import bson
from . import common
from . import enum_types
from . import errors
from . import syntax
from . import ast, bson, common, enum_types, errors, syntax
def _validate_single_bson_type(ctxt, idl_type, syntax_type):

View File

@ -36,11 +36,7 @@ import logging
import os
import platform
from . import binder
from . import errors
from . import generator
from . import parser
from . import syntax
from . import binder, errors, generator, parser, syntax
class CompilerArgs(object):

View File

@ -27,13 +27,10 @@
#
"""IDL C++ Code Generator."""
import textwrap
from abc import ABCMeta, abstractmethod
import textwrap
from . import bson
from . import common
from . import writer
from . import bson, common, writer
_STD_ARRAY_UINT8_16 = "std::array<std::uint8_t,16>"

View File

@ -31,15 +31,14 @@ IDL Enum type information.
Support the code generation for enums
"""
from abc import ABCMeta, abstractmethod
import json
import textwrap
from abc import ABCMeta, abstractmethod
from typing import cast
import bson
from . import ast
from . import common
from . import writer
from . import ast, common, writer
class EnumTypeInfoBase(object, metaclass=ABCMeta):

View File

@ -35,6 +35,7 @@ Common error handling code for IDL compiler.
import inspect
import os
import sys
import yaml
from . import common

View File

@ -33,12 +33,10 @@ Only validates the document is syntatically correct, not semantically.
"""
from abc import ABCMeta, abstractmethod
import yaml
from . import common
from . import cpp_types
from . import errors
from . import syntax
from . import common, cpp_types, errors, syntax
class _RuleDesc(object):

View File

@ -30,9 +30,7 @@
import textwrap
from abc import ABCMeta, abstractmethod
from . import ast
from . import common
from . import cpp_types
from . import ast, common, cpp_types
def _is_required_constructor_arg(field):

View File

@ -40,12 +40,12 @@ directories containing the old IDL files from previous releases.
import argparse
import os
import sys
import yaml
from dataclasses import dataclass
from enum import Enum
from typing import Dict, List, Set, Optional, Tuple, Union
from typing import Dict, List, Optional, Set, Tuple, Union
from idl import parser, syntax, errors, common
import yaml
from idl import common, errors, parser, syntax
from idl.compiler import CompilerImportResolver
from idl_compatibility_errors import IDLCompatibilityContext, IDLCompatibilityErrorCollection

View File

@ -27,10 +27,9 @@
"""Library functions and utility methods used across user-facing IDL scripts."""
import os
from typing import List, Set
from typing import Set, List
from buildscripts.idl.idl import syntax, parser
from buildscripts.idl.idl import parser, syntax
from buildscripts.idl.idl.compiler import CompilerImportResolver

View File

@ -35,6 +35,7 @@ Generates a file called results.xml in the XUnit format.
import sys
import unittest
from xmlrunner import XMLTestRunner

View File

@ -38,11 +38,11 @@ if __package__ is None:
from os import path
sys.path.append(path.dirname(path.abspath(__file__)))
from context import idl
import testcase
from context import idl
else:
from .context import idl
from . import testcase
from .context import idl
# All YAML tests assume 4 space indent
INDENT_SPACE_COUNT = 4

View File

@ -29,8 +29,8 @@
#
"""Test cases for IDL compatibility checker."""
import unittest
import sys
import unittest
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))

View File

@ -45,11 +45,11 @@ if __package__ is None:
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from context import idl
import testcase
from context import idl
else:
from .context import idl
from . import testcase
from .context import idl
class TestGenerator(testcase.IDLTestcase):

View File

@ -39,11 +39,11 @@ if __package__ is None:
from os import path
sys.path.append(path.dirname(path.abspath(__file__)))
from context import idl
import testcase
from context import idl
else:
from .context import idl
from . import testcase
from .context import idl
class DictionaryImportResolver(idl.parser.ImportResolverBase):

View File

@ -38,11 +38,11 @@ if __package__ is None:
from os import path
sys.path.append(path.dirname(path.abspath(__file__)))
from context import idl
import testcase
from context import idl
else:
from .context import idl
from . import testcase
from .context import idl
class TestParser(testcase.IDLTestcase):

View File

@ -2,12 +2,13 @@ import argparse
import hashlib
import os
import platform
from retry import retry
import shutil
import stat
import sys
import urllib.request
from retry import retry
_S3_HASH_MAPPING = {
"https://mdb-build-public.s3.amazonaws.com/bazel-binaries/bazel-6.4.0-ppc64le": "dd21c75817533ff601bf797e64f0eb2f7f6b813af26c829f0bda30e328caef46",
"https://mdb-build-public.s3.amazonaws.com/bazel-binaries/bazel-6.4.0-s390x": "6d72eabc1789b041bbe4cfc033bbac4491ec9938ef6da9899c0188ecf270a7f4",

View File

@ -34,28 +34,28 @@ The tool uses mtime and MD5 hashing to know if any header dep has changed.
"""
import argparse
import atexit
import concurrent.futures
import enum
import hashlib
import json
import subprocess
import tempfile
import shlex
import os
import re
import concurrent.futures
import hashlib
import atexit
import traceback
import threading
import shlex
import shutil
import signal
import subprocess
import sys
import yaml
import enum
from dataclasses import dataclass, asdict
from typing import Dict, List, Any, Optional, Callable, Union, Tuple
import tempfile
import threading
import traceback
from dataclasses import asdict, dataclass
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from tqdm import tqdm
from colorama import init as colorama_init
import yaml
from colorama import Fore
from colorama import init as colorama_init
from tqdm import tqdm
colorama_init()

View File

@ -1,12 +1,12 @@
import pathlib
import json
import shutil
import os
import glob
import subprocess
import sys
import argparse
import concurrent.futures
import glob
import json
import os
import pathlib
import shutil
import subprocess
import sys
parser = argparse.ArgumentParser(description="Run tests for the IWYU analysis script.")

View File

@ -1,16 +1,16 @@
"""Generate Evergreen reports from the Jepsen list-append workload."""
import json
import os
import re
import sys
import os
from datetime import datetime, timezone
from typing import List, Optional, Tuple
from typing_extensions import TypedDict
import click
from typing_extensions import TypedDict
from buildscripts.simple_report import Result, Report
from buildscripts.simple_report import Report, Result
class ParserOutput(TypedDict):

View File

@ -10,11 +10,9 @@ import os
import pathlib
import sys
import textwrap
from typing import Any, Dict, List, Optional, Tuple
import structlog
from git import Repo
mongo_dir = os.path.dirname(os.path.dirname(os.path.abspath(os.path.realpath(__file__))))

View File

@ -26,15 +26,14 @@
import json
import unittest
import libdeps.analyzer
from generate_test_graphs import get_basic_mock_graph, get_double_diamond_mock_graph
from libdeps.graph import (
CountTypes,
DependsReportTypes,
LibdepsGraph,
LinterTypes,
CountTypes,
)
from generate_test_graphs import get_double_diamond_mock_graph, get_basic_mock_graph
class Tests(unittest.TestCase):

View File

@ -28,15 +28,14 @@ A Command line interface to the graph analysis module.
"""
import argparse
import textwrap
import sys
from pathlib import Path
import copy
import networkx
import sys
import textwrap
from pathlib import Path
import libdeps.analyzer as libdeps_analyzer
from libdeps.graph import LibdepsGraph, CountTypes, LinterTypes
import networkx
from libdeps.graph import CountTypes, LibdepsGraph, LinterTypes
class LinterSplitArgs(argparse.Action):

View File

@ -23,12 +23,12 @@
#
"""Test graphs for the graph visualizer and analyzer."""
import os
import json
import argparse
import networkx
import json
import os
from libdeps.graph import LibdepsGraph, EdgeProps, NodeProps
import networkx
from libdeps.graph import EdgeProps, LibdepsGraph, NodeProps
def get_args():

View File

@ -32,16 +32,15 @@ This script will automatically install the npm modules, and build and run the pr
web service if not debug.
"""
import os
from pathlib import Path
import argparse
import os
import subprocess
import threading
import textwrap
from werkzeug.serving import is_running_from_reloader
import threading
from pathlib import Path
from graph_visualizer_web_stack.flask.flask_backend import BackendServer
from werkzeug.serving import is_running_from_reloader
def get_args():

View File

@ -27,23 +27,21 @@ Flask backend web server.
The backend interacts with the graph_analyzer to perform queries on various libdeps graphs.
"""
from pathlib import Path
from collections import namedtuple, OrderedDict
import time
import threading
import gc
import threading
import time
from collections import OrderedDict, namedtuple
from pathlib import Path
import flask
import networkx
import cxxfilt
from pympler.asizeof import asizeof
import flask
import libdeps.analyzer
import libdeps.graph
import networkx
from flask import request
from flask_cors import CORS
from lxml import etree
from flask import request
import libdeps.graph
import libdeps.analyzer
from pympler.asizeof import asizeof
class BackendServer:

View File

@ -29,17 +29,16 @@ graph generated from SCons generate-libdeps-graph target. The graph
represents the dependency information between all binaries from the build.
"""
import textwrap
import json
import inspect
import functools
from pathlib import Path
import inspect
import json
import subprocess
import textwrap
from pathlib import Path
import networkx
import cxxfilt
from libdeps.graph import CountTypes, DependsReportTypes, LinterTypes, EdgeProps, NodeProps
import networkx
from libdeps.graph import CountTypes, DependsReportTypes, EdgeProps, LinterTypes, NodeProps
class UnsupportedAnalyzer(Exception):

View File

@ -27,8 +27,8 @@ Libdeps Graph Enums.
These are used for attributing data across the build scripts and analyzer scripts.
"""
from enum import Enum, auto
import json
from enum import Enum, auto
import networkx

View File

@ -2,10 +2,10 @@
import os
import sys
from typing import Tuple, List, Callable
from typing import Callable, List, Tuple
from git import Repo
import structlog
from git import Repo
# Get relative imports to work when the package is not installed on the PYTHONPATH.
if __name__ == "__main__" and __package__ is None:
@ -14,9 +14,9 @@ if __name__ == "__main__" and __package__ is None:
# pylint: disable=wrong-import-position
from buildscripts.linter import git
from buildscripts.patch_builds.change_data import (
generate_revision_map,
RevisionMap,
find_changed_files_in_repos,
generate_revision_map,
)
# pylint: enable=wrong-import-position

View File

@ -4,12 +4,12 @@ from __future__ import annotations
import itertools
import os
from pathlib import Path
import re
from pathlib import Path
from typing import Callable, List
from buildscripts.linter import git_base as _git
from buildscripts import moduleconfig
from buildscripts.linter import git_base as _git
# Path to the modules in the mongodb source tree
# Has to match the string in SConstruct

View File

@ -7,6 +7,7 @@ import site
import subprocess
import sys
import threading
import pkg_resources
from . import base

View File

@ -19,9 +19,8 @@ import lldb
try:
import bson
from bson import json_util
from bson import Decimal128, json_util
from bson.codec_options import DEFAULT_CODEC_OPTIONS
from bson import Decimal128
except ImportError:
print("Warning: Could not load bson library for Python {}.".format(sys.version))
print("Check with the pip command if pymongo 3.x is installed.")

View File

@ -27,12 +27,12 @@ For a detailed usage example, see src/SConscript.client or src/mongo/SConscript.
import optparse
import os
import sys
import shlex
import shutil
import zipfile
import sys
import tempfile
from subprocess import Popen, PIPE, STDOUT
import zipfile
from subprocess import PIPE, STDOUT, Popen
def main(argv):

View File

@ -13,12 +13,12 @@ To build mongodb, you must use scons. You can use this project to navigate code
where FILE_NAME is the of the file to generate e.g., "mongod"
"""
import argparse
import io
import json
import os
import re
import uuid
import argparse
import xml.etree.ElementTree as ET
VCXPROJ_FOOTER = r"""

View File

@ -29,20 +29,19 @@ from abc import ABC, abstractmethod
from collections import OrderedDict
from datetime import timedelta
from pathlib import Path
from typing import Dict, List, Any, Union, Optional
from typing import Any, Dict, List, Optional, Union
import requests
from tenacity import wait_fixed, stop_after_delay, retry_if_result, Retrying
from tenacity import Retrying, retry_if_result, stop_after_delay, wait_fixed
sys.path.append(str(Path(os.getcwd(), __file__).parent.parent))
from buildscripts.build_system_options import PathOptions # pylint: disable=wrong-import-position
from buildscripts.util.oauth import (
Configs,
get_oauth_credentials,
get_client_cred_oauth_credentials,
get_oauth_credentials,
) # pylint: disable=wrong-import-position
from buildscripts.build_system_options import PathOptions # pylint: disable=wrong-import-position
SYMBOLIZER_PATH_ENV = "MONGOSYMB_SYMBOLIZER_PATH"
# since older versions may have issues with symbolizing, we are setting the toolchain version to v4

Some files were not shown because too many files have changed in this diff Show More