Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

pathlib ABCs: add protocols for supporting types #127456

Copy link
Copy link
Closed
@barneygale

Description

@barneygale
Issue body actions

Feature or enhancement

For typing and documentation purposes, it would be useful to define three protocols in pathlib:

  • Parser: like os.path, but including only pure functionality that's essential for PurePathBase
  • DirEntry: like os.DirEntry, but without some non-portable methods (like inode())
  • StatResult: like os.stat_result, but without the tuple-like interface, and dropping non-essential attributes

These could be defined in a private module like pathlib._types. For performance reasons that module shouldn't be imported by any other pathlib module.

If/when we make PathBase public, we'll also make these protocols public.

See also: https://discuss.python.org/t/make-pathlib-extensible/3428/196

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.