Skip to content

Commit d07c3f1

Browse files
Remove _is_relative_to() util
1 parent 7da1db8 commit d07c3f1

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

pylint/lint/pylinter.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
report_total_messages_stats,
4949
)
5050
from pylint.lint.utils import (
51-
_is_relative_to,
5251
augmented_sys_path,
5352
get_fatal_error_message,
5453
prepare_crash_report,
@@ -918,7 +917,7 @@ def _get_namespace_for_file(
918917
self, filepath: Path, namespaces: DirectoryNamespaceDict
919918
) -> argparse.Namespace | None:
920919
for directory in namespaces:
921-
if _is_relative_to(filepath, directory):
920+
if Path.is_relative_to(filepath, directory):
922921
namespace = self._get_namespace_for_file(
923922
filepath, namespaces[directory][1]
924923
)

pylint/lint/utils.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,3 @@ def augmented_sys_path(additional_paths: Sequence[str]) -> Iterator[None]:
133133
yield
134134
finally:
135135
sys.path[:] = original
136-
137-
138-
def _is_relative_to(self: Path, *other: Path) -> bool:
139-
"""Checks if self is relative to other.
140-
141-
Backport of pathlib.Path.is_relative_to for Python <3.9
142-
TODO: py39: Remove this backport and use stdlib function.
143-
"""
144-
try:
145-
self.relative_to(*other)
146-
return True
147-
except ValueError:
148-
return False

0 commit comments

Comments
 (0)