36
36
37
37
38
38
def _worker_initialize (
39
- linter : bytes , extra_packages_paths : Sequence [str ] | None = None
39
+ linter : bytes , extra_sys_paths : Sequence [str ] | None = None
40
40
) -> None :
41
41
"""Function called to initialize a worker for a Process within a concurrent Pool.
42
42
43
43
:param linter: A linter-class (PyLinter) instance pickled with dill
44
- :param extra_packages_paths : Extra entries to be added to `sys.path`
44
+ :param extra_sys_paths : Extra entries to be added to `sys.path`
45
45
"""
46
46
global _worker_linter # pylint: disable=global-statement
47
47
_worker_linter = dill .loads (linter )
@@ -57,8 +57,8 @@ def _worker_initialize(
57
57
_worker_linter .load_plugin_modules (_worker_linter ._dynamic_plugins , force = True )
58
58
_worker_linter .load_plugin_configuration ()
59
59
60
- if extra_packages_paths :
61
- _augment_sys_path (extra_packages_paths )
60
+ if extra_sys_paths :
61
+ _augment_sys_path (extra_sys_paths )
62
62
63
63
64
64
def _worker_check_single_file (
@@ -125,7 +125,7 @@ def check_parallel(
125
125
linter : PyLinter ,
126
126
jobs : int ,
127
127
files : Iterable [FileItem ],
128
- extra_packages_paths : Sequence [str ] | None = None ,
128
+ extra_sys_paths : Sequence [str ] | None = None ,
129
129
) -> None :
130
130
"""Use the given linter to lint the files with given amount of workers (jobs).
131
131
@@ -135,9 +135,7 @@ def check_parallel(
135
135
# The linter is inherited by all the pool's workers, i.e. the linter
136
136
# is identical to the linter object here. This is required so that
137
137
# a custom PyLinter object can be used.
138
- initializer = functools .partial (
139
- _worker_initialize , extra_packages_paths = extra_packages_paths
140
- )
138
+ initializer = functools .partial (_worker_initialize , extra_sys_paths = extra_sys_paths )
141
139
with ProcessPoolExecutor (
142
140
max_workers = jobs , initializer = initializer , initargs = (dill .dumps (linter ),)
143
141
) as executor :
0 commit comments