Skip to content

State of os.path and path types #1841

Closed
@FichteFoll

Description

@FichteFoll

According to a few older PRs (#1150, #1459), it seems like the stubs for for 2 and 3 should be merged into a 2and3 version, however some commits continue to introduce changes to only one of the os files (notably #1645). Merging them is supposedly blocked on os/__init__.py.

Is this merge still a goal moving forward? If not, I suppose they would benefit from some simplification (notably the 2 version).

Furthermore, I intend to add a couple more _PathType type signatures to os.path functions as pretty much all of them support it internally, but only ~half of them are annotated correctly. Ideally, Union[AnyStr, _PathLike[AnyStr]] is to be used for the _PathType type (via #1441), but it seems like that is still blocked on python/mypy#3644. When replacing AnyStr with _PathType (with _PathLike instead of _PathLike[AnyStr]), the generic properties of the functions signatures are lost, so that would be a regression, but the annotations are currently in a mixed state anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions