-
Notifications
You must be signed in to change notification settings - Fork 1
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
DM-42306: Performance optimizations #76
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
9a0c337
Now that schemeless is never absolute, return False every time for isabs
timj d75f51a
No longer call isdir() on schemeless URI
timj 8f708ef
Modify how dirLike is calculated
timj 4291c61
Simplify relativeToPathRoot
timj 525cdff
forceDirectory=False now means that it is definitely a file-like URI
timj 11cb4a1
For updatedFile check if it is a directory directly
timj e6fc028
Speed up getExtension
timj 385cfd3
Use str.removesuffix
timj 5d79fb0
More simplifications and forceDirectory cleanups
timj d789db1
Use own getExtension implementation rather than pathlib
timj c5fa1c8
Must use isdir() not dirLike when checking
timj 8bc00da
Fix forceDirectory type annotations
timj e433233
Fix some bad quoting in sphinx docs
timj ef211ea
Add news fragments
timj 8af7208
Remove file system check from package resource constructor
timj c6a30a4
Now raise if forceDirectory=False and URI path ends with /
timj 88ddfdd
Remove posixpath.isdir call on file:// constructor
timj c22a44d
Fix schemeless.isdir
timj 08c8cd9
Add test specifically for schemeless isdir()
timj 69012e3
Simplify uri.join()
timj 5bb3c4d
Simplify Schemeless relative_to now that it can never be absolute URI
timj d5df587
When copying allow forceDirectory to override
timj 4ea37fe
Clean up parent to use dirLike
timj fc7646a
Change updatedFile to use dirLike and .parent
timj 6a639cc
Change getExtension to also work on directories
timj 58dcf84
Remove code checking for abspath schemeless
timj d2c5172
Improve test coverage
timj 1d37903
Add extra news fragment
timj File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
The ``forceDirectory`` flag now has three states. | ||
As before `True` indicates that it is known that the URI refers to a directory-like entity. | ||
Now `False` indicates that it is known that the URI refers to a file-like entity. | ||
`None` is the new default and that indicates that the caller does not know and that the status should be inferred either by checking the file system or looking for a trailing ``/``. | ||
It is now an error to create a ``ResourcePath`` which has a trailing ``/`` but with ``forceDirectory=False``. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* ``getExtension()`` now works for directories. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* Schemeless URIs no longer check the file system on construction. | ||
* Both `getExtension` and `relativeToPathRoot` have been rewritten to no longer use `pathlib`. | ||
* It is now possible to declare that a URI is file-like on construction. Use `forceDirectory=False`. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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 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.
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.
ResourcePath
is nominally immutable but this cache can be updated fromNone
tobool
. This will presumably need locking around it and in packageresource and schemeless implementations.I am also wondering if this and
isTemporary
andisLocal
should be made read-only getters with_dirLike
etc used internally.