From 7a570d67bf518684a63721ae40d151d40cf2874d Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 24 Jul 2024 20:32:20 +0300 Subject: [PATCH] Remove unused _util.is_directory --- Tests/test_util.py | 22 ---------------------- src/PIL/_util.py | 5 ----- 2 files changed, 27 deletions(-) diff --git a/Tests/test_util.py b/Tests/test_util.py index 197ef79eef5..9eaabf18a73 100644 --- a/Tests/test_util.py +++ b/Tests/test_util.py @@ -30,28 +30,6 @@ def test_is_not_path(tmp_path: Path) -> None: assert not it_is_not -def test_is_directory() -> None: - # Arrange - directory = "Tests" - - # Act - it_is = _util.is_directory(directory) - - # Assert - assert it_is - - -def test_is_not_directory() -> None: - # Arrange - text = "abc" - - # Act - it_is_not = _util.is_directory(text) - - # Assert - assert not it_is_not - - def test_deferred_error() -> None: # Arrange diff --git a/src/PIL/_util.py b/src/PIL/_util.py index 6bc76281616..8ef0d36f754 100644 --- a/src/PIL/_util.py +++ b/src/PIL/_util.py @@ -10,11 +10,6 @@ def is_path(f: Any) -> TypeGuard[StrOrBytesPath]: return isinstance(f, (bytes, str, os.PathLike)) -def is_directory(f: Any) -> TypeGuard[StrOrBytesPath]: - """Checks if an object is a string, and that it points to a directory.""" - return is_path(f) and os.path.isdir(f) - - class DeferredError: def __init__(self, ex: BaseException): self.ex = ex