diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-05-09 09:05:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-09 09:05:56 +0200 |
commit | f020b2f07361fa2b577bc07c4a68309905bd46ae (patch) | |
tree | a1d1880451fac270df94ce861677e736b2c9163c /pylint/lint | |
parent | 40ddfabcb0afe5dadab3c4dcd890b8302db9edd0 (diff) | |
download | pylint-git-f020b2f07361fa2b577bc07c4a68309905bd46ae.tar.gz |
Revert "Do not append namespace packages to sys.path (#6405)" (#6548)
This reverts commit 603be8408a5d2d98283f41cfd9a94998fd7cfd3c.
Diffstat (limited to 'pylint/lint')
-rw-r--r-- | pylint/lint/utils.py | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/pylint/lint/utils.py b/pylint/lint/utils.py index a08cd6d2a..30694c25c 100644 --- a/pylint/lint/utils.py +++ b/pylint/lint/utils.py @@ -11,8 +11,6 @@ from collections.abc import Iterator, Sequence from datetime import datetime from pathlib import Path -from astroid import modutils - from pylint.config import PYLINT_HOME from pylint.lint.expand_modules import get_python_path @@ -73,29 +71,12 @@ def get_fatal_error_message(filepath: str, issue_template_path: Path) -> str: ) -def _is_part_of_namespace_package(filename: str) -> bool: - """Check if a file is part of a namespace package.""" - try: - modname = modutils.modpath_from_file(filename) - except ImportError: - modname = [Path(filename).stem] - - try: - spec = modutils.file_info_from_modpath(modname) - except ImportError: - return False - - return modutils.is_namespace(spec) - - def _patch_sys_path(args: Sequence[str]) -> list[str]: original = list(sys.path) changes = [] seen = set() for arg in args: path = get_python_path(arg) - if _is_part_of_namespace_package(path): - continue if path not in seen: changes.append(path) seen.add(path) |