Skip to content

Add pathlib-compatible special-file predicates - #275

Open
polootyyyyy wants to merge 3 commits into
jaraco:mainfrom
polootyyyyy:feature/special-file-predicates
Open

polootyyyyy wants to merge 3 commits into
jaraco:mainfrom
polootyyyyy:feature/special-file-predicates

Conversation

@polootyyyyy

Copy link
Copy Markdown

Adds Path.is_fifo(), Path.is_socket(), Path.is_block_device() and Path.is_char_device(), each delegating to the corresponding pathlib.Path method. This covers those four pending items in #214 and preserves the running standard library's predicate behavior. Includes a release note.

Regression tests cover real FIFOs, Unix-domain sockets, symlink targets, character devices, ordinary files and directories, missing paths, broken links and regular-file parents. Block-device classification uses a controlled stat result without requiring privileged device creation.

Validation on Linux arm64 with Python 3.12.15: all 44 focused cases fail with missing-method errors on unchanged upstream and pass with the additions. Full tox passes (208 passed, 1 skipped), including Ruff and mypy; the strict documentation build and sphinxlint also pass. The source archive used SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PATH=17.1.1, passed through tox's test and packaging environments. Native macOS and Windows were not run locally.

Refs #214; this does not close the broader compatibility checklist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant