Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ Release date: TBA

Closes #4301

* By default the similarity checker will now ignore imports and ignore function signatures when computing
duplication. If you want to keep the previous behaviour set ``ignore-imports`` and ``ignore-signatures`` to ``False``.

* Improved recognition of namespace packages. They should no longer be added to ``sys.path``
which should prevent various issues with false positives.
Because of the difficulties with mirroring the python import mechanics we would gladly
hear feedback on this change.

Closes #5226, Closes #2648

* ``BaseChecker`` classes now require the ``linter`` argument to be passed.

* Fix a failure to respect inline disables for ``fixme`` occurring on the last line
Expand Down
7 changes: 0 additions & 7 deletions doc/whatsnew/2.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,6 @@ Other Changes

Closes #4301

* Improved recognition of namespace packages. They should no longer be added to ``sys.path``
which should prevent various issues with false positives.
Because of the difficulties with mirroring the python import mechanics we would gladly
hear feedback on this change.

Closes #5226, Closes #2648

* Update ``invalid-slots-object`` message to show bad object rather than its inferred value.

Closes #6101
Expand Down
19 changes: 0 additions & 19 deletions pylint/lint/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
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

Expand Down Expand Up @@ -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)
Expand Down
25 changes: 0 additions & 25 deletions tests/lint/test_namespace_packages.py

This file was deleted.

8 changes: 0 additions & 8 deletions tests/lint/unittest_expand_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,6 @@ def test__is_in_ignore_list_re_match() -> None:
"path": str(TEST_DIRECTORY / "lint/test_caching.py"),
}

test_namespace_packages = {
"basename": "lint",
"basepath": INIT_PATH,
"isarg": False,
"name": "lint.test_namespace_packages",
"path": str(TEST_DIRECTORY / "lint/test_namespace_packages.py"),
}

init_of_package = {
"basename": "lint",
Expand Down Expand Up @@ -115,7 +108,6 @@ class Checker(BaseChecker):
[
init_of_package,
test_caching,
test_namespace_packages,
test_pylinter,
test_utils,
this_file_from_init,
Expand Down
Empty file.
5 changes: 0 additions & 5 deletions tests/regrtest_data/namespace_import_self/pylint/__init__.py

This file was deleted.

โšก