diff --git a/pylint/lint/parallel.py b/pylint/lint/parallel.py index 58ce867ec80..92af977dc32 100644 --- a/pylint/lint/parallel.py +++ b/pylint/lint/parallel.py @@ -135,9 +135,7 @@ def check_parallel( # The linter is inherited by all the pool's workers, i.e. the linter # is identical to the linter object here. This is required so that # a custom PyLinter object can be used. - initializer = functools.partial( - _worker_initialize, extra_sys_paths=extra_sys_paths - ) + initializer = functools.partial(_worker_initialize, extra_sys_paths=extra_sys_paths) with ProcessPoolExecutor( max_workers=jobs, initializer=initializer, initargs=(dill.dumps(linter),) ) as executor: diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py index c272d02b7e2..1195af0b937 100644 --- a/pylint/lint/pylinter.py +++ b/pylint/lint/pylinter.py @@ -50,9 +50,9 @@ from pylint.lint.utils import ( _is_relative_to, augmented_sys_path, - realpath_transformer, get_fatal_error_message, prepare_crash_report, + realpath_transformer, ) from pylint.message import Message, MessageDefinition, MessageDefinitionStore from pylint.reporters.base_reporter import BaseReporter @@ -75,8 +75,7 @@ class GetAstProtocol(Protocol): def __call__( self, filepath: str, modname: str, data: str | None = None - ) -> nodes.Module: - ... + ) -> nodes.Module: ... def _read_stdin() -> str: @@ -310,9 +309,9 @@ def __init__( """Dictionary of possible but non-initialized reporters.""" # Attributes for checkers and plugins - self._checkers: defaultdict[ - str, list[checkers.BaseChecker] - ] = collections.defaultdict(list) + self._checkers: defaultdict[str, list[checkers.BaseChecker]] = ( + collections.defaultdict(list) + ) """Dictionary of registered and initialized checkers.""" self._dynamic_plugins: dict[str, ModuleType | ModuleNotFoundError | bool] = {} """Set of loaded plugin names.""" @@ -674,7 +673,9 @@ def check(self, files_or_modules: Sequence[str]) -> None: } ) # Prefer package paths detected per module over user-defined PYTHONPATH additions - extra_sys_paths = extra_packages_paths + realpath_transformer(self.config.pythonpath) + extra_sys_paths = extra_packages_paths + realpath_transformer( + self.config.pythonpath + ) # TODO: Move the parallel invocation into step 3 of the checking process if not self.config.from_stdin and self.config.jobs > 1: diff --git a/pylint/pyreverse/main.py b/pylint/pyreverse/main.py index a1641c758cc..fb1d630ca09 100644 --- a/pylint/pyreverse/main.py +++ b/pylint/pyreverse/main.py @@ -305,7 +305,9 @@ def run(self, args: list[str]) -> int: {discover_package_path(arg, self.config.source_roots) for arg in args} ) # Prefer package paths detected per module over global PYTHONPATH additons - extra_sys_paths = extra_packages_paths + realpath_transformer(self.config.pythonpath) + extra_sys_paths = extra_packages_paths + realpath_transformer( + self.config.pythonpath + ) with augmented_sys_path(extra_sys_paths): project = project_from_files( args, diff --git a/tests/lint/unittest_lint.py b/tests/lint/unittest_lint.py index 755301f6951..2a8def887cd 100644 --- a/tests/lint/unittest_lint.py +++ b/tests/lint/unittest_lint.py @@ -1250,7 +1250,9 @@ def test_import_sibling_module_from_namespace(initialized_linter: PyLinter) -> N assert not linter.stats.by_msg -def test_import_external_module_with_relative_pythonpath_config(initialized_linter: PyLinter) -> None: +def test_import_external_module_with_relative_pythonpath_config( + initialized_linter: PyLinter, +) -> None: """Given a module that imports an external module, ensure that the external module is found when the path to the external module is configured in `main.pythonpath`. diff --git a/tests/test_check_parallel.py b/tests/test_check_parallel.py index f59ae5c2b40..77f23bab95e 100644 --- a/tests/test_check_parallel.py +++ b/tests/test_check_parallel.py @@ -186,9 +186,7 @@ def test_worker_initialize(self) -> None: def test_worker_initialize_with_package_paths(self) -> None: linter = PyLinter(reporter=Reporter()) with augmented_sys_path([]): - worker_initialize( - linter=dill.dumps(linter), extra_sys_paths=["fake-path"] - ) + worker_initialize(linter=dill.dumps(linter), extra_sys_paths=["fake-path"]) assert "fake-path" in sys.path def test_worker_initialize_reregisters_custom_plugins(self) -> None: