Method: pylint.lint.utils.fix_import_path
Calls: 2158, Exceptions: 0, Paths: 1Back
Path 1: 2158 calls (1.0)
['/Users/andrehora/Documents/git/projects-pathspotter/pylint/tests/config/file_to_lint.py'] (100) ['/Users/andrehora/Documents/git/projects-pathspotte...
None (2158)
1@contextlib.contextmanager
2def fix_import_path(args: Sequence[str]) -> Iterator[None]:
3 """Prepare 'sys.path' for running the linter checks.
4
5 Within this context, each of the given arguments is importable.
6 Paths are added to 'sys.path' in corresponding order to the arguments.
7 We avoid adding duplicate directories to sys.path.
8 `sys.path` is reset to its original value upon exiting this context.
9 """
10 original = _patch_sys_path(args)
11 try:
12 yield
13 finally:
14 sys.path[:] = original