Method: pylint.lint.parallel._worker_initialize
Calls: 3, Exceptions: 0, Paths: 1Back
Path 1: 3 calls (1.0)
bytes (3)
None (3)
1def _worker_initialize(
2 linter: bytes, arguments: None | str | Sequence[str] = None
3) -> None:
4 """Function called to initialize a worker for a Process within a concurrent Pool.
5
6 :param linter: A linter-class (PyLinter) instance pickled with dill
7 :param arguments: File or module name(s) to lint and to be added to sys.path
8 """
9 global _worker_linter # pylint: disable=global-statement
10 _worker_linter = dill.loads(linter)
11 assert _worker_linter
12
13 # On the worker process side the messages are just collected and passed back to
14 # parent process as _worker_check_file function's return value
15 _worker_linter.set_reporter(reporters.CollectingReporter())
16 _worker_linter.open()
17
18 # Patch sys.path so that each argument is importable just like in single job mode
19 _patch_sys_path(arguments or ())