-
-
Notifications
You must be signed in to change notification settings - Fork 353
Path
refactor
#2959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Path
refactor
#2959
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
91bcaa6
`Path` refactor
etianen 3a4d24f
Renaming `_path.Self` to `_path.PathT`
etianen 00099dc
Including original documentation in wrapped methods
etianen d8a5314
Using `Self` rather than `PathT` when possible for `trio.Path`
etianen 5a9237d
Allowing `trio.Path` to be not `final`
etianen 70ff8e2
Supporting and documenting `trio.Path` subclass support
etianen 89826e8
Merge branch 'master' into dh/path-refactor
etianen 2f628db
Tweaking docscring grammar for `trio.Path`
etianen 7d407e5
Losing unnecessary `pyright: ignore`
etianen dad750a
Added newsfragment for new implementation
etianen 45f2012
Removing mentions of subclassing `trio.Path`, keeping this a private …
etianen 819ea33
Added OS-specific tests for `trio.Path`
etianen dadd176
Importing `AsyncIOWrapper` from `trio._file_io` in `Path` tests
etianen cdc5953
Merge branch 'master' into dh/path-refactor
etianen 7ad7763
Merge branch 'master' into dh/path-refactor
A5rocks b512a40
ignore all current trio._path.Path errors
jakkdl ba5b6c7
Merge remote-tracking branch 'origin/master' into dh/path-refactor
jakkdl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use case of using
trio.WindowsPath
ortrio.PosixPath
? Looking at the code, it looks like we only wrap methods fromPurePath
so it's not like they get more functionality (?)I'm probably missing something trivial though. Though if it's not necessary to then I think having to put platform-specific types is weird for an exported API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the
pathlib
module, that's exactly what they do there. Windows and posix have very different ways of expressing a path (backslashes vs forwardslashes etc). This is making thetrio
path behavior just like the stdlib.Practically, being able to make
trio.Path
a subclass ofPurePath
means it interops with all other path-derived things, and dramatically simplifies the implementation. However, you can't directly subclassPurePath
... you have to subclassPureWindowsPath
orPurePosixPath
. And that means you need to have to concretePosixPath
andWindowsPath
classes.