-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify Traversable signature (#10934)
Simplify Traversable.open() signature. This is necessary so that implentors can reasonanbly implement this method. For example `zipfile.Path.open()` (which is considered a `Traversable`) only supports this subset. Make `Traversable.__truediv__` and `joinpath` arguments pos-only. The arguments are named differently in both `pathlib.Path` and `zipfile.Path`.
- Loading branch information
Showing
6 changed files
with
40 additions
and
70 deletions.
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
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,13 @@ | ||
import importlib.abc | ||
import pathlib | ||
import sys | ||
import zipfile | ||
|
||
# Assert that some Path classes are Traversable. | ||
if sys.version_info >= (3, 9): | ||
|
||
def traverse(t: importlib.abc.Traversable) -> None: | ||
pass | ||
|
||
traverse(pathlib.Path()) | ||
traverse(zipfile.Path("")) |
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