Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

GH-130798: Add type hints to pathlib.types#131639

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ap-- wants to merge19 commits intopython:main
base:main
Choose a base branch
Loading
fromap--:pathlib-types-add-typehints
Open
Changes from1 commit
Commits
Show all changes
19 commits
Select commitHold shift + click to select a range
3d9816b
Add typehints to pathlib.types
ap--Mar 23, 2025
310c245
Iterator type for .glob and .iterdir
ap--Mar 24, 2025
399a213
Merge remote-tracking branch 'origin/main' into pathlib-types-add-typ…
ap--Mar 24, 2025
d1583c0
Update types
ap--Mar 24, 2025
50a8f88
Update pathlib.types to use Self
ap--Mar 24, 2025
e21b884
Rely on python3.13 Generator defaults
ap--Mar 24, 2025
b004c2d
Switch walk to Iterator[...]
ap--Mar 26, 2025
b1de80e
Use abstract base classes from collections.abc
ap--Mar 26, 2025
4aa2540
Use _PathParser in _explode_path
ap--Mar 26, 2025
54acfa3
Rename TypeVar to _WritablePathT
ap--Mar 26, 2025
d2dc4b1
Move _explode_path
ap--Mar 26, 2025
44b1b6f
Update Lib/pathlib/types.py
ap--Mar 27, 2025
aace9d0
Merge remote-tracking branch 'origin/main' into pathlib-types-add-typ…
ap--Apr 23, 2025
73d79da
pathlib.types: don't rely on typing.Optional
ap--Apr 23, 2025
965c3c7
avoid typing imports that are not needed at runtime
ap--Apr 23, 2025
b952ab0
add pathlib to Misc/mypy tests
ap--Apr 23, 2025
d83531f
pathlib: fix most typing issues
ap--Apr 23, 2025
e596130
prevent missing glob typing to bleed into _pyrepl mypy tests
ap--Apr 23, 2025
7cd07f1
workaround crashing mypy
ap--Apr 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Rename TypeVar to _WritablePathT
  • Loading branch information
@ap--
ap-- committedMar 26, 2025
commit54acfa3879acb087ae1415237a343d31c8d695d5
6 changes: 3 additions & 3 deletionsLib/pathlib/types.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@
runtime_checkable,
)

_WP = TypeVar("_WP", bound="_WritablePath")
_WritablePathT = TypeVar("_WritablePathT", bound="_WritablePath")


def _explode_path(path: str, parser: "_PathParser") -> tuple[str, list[str]]:
Expand DownExpand Up@@ -345,15 +345,15 @@ def readlink(self) -> Self:
"""
raise NotImplementedError

def copy(self, target:_WP, **kwargs: Any) ->_WP:
def copy(self, target:_WritablePathT, **kwargs: Any) ->_WritablePathT:
"""
Recursively copy this file or directory tree to the given destination.
"""
ensure_distinct_paths(self, target)
target._copy_from(self, **kwargs)
return target.joinpath() # Empty join to ensure fresh metadata.

def copy_into(self, target_dir:_WP, **kwargs: Any) ->_WP:
def copy_into(self, target_dir:_WritablePathT, **kwargs: Any) ->_WritablePathT:
"""
Copy this file or directory tree into the given existing directory.
"""
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp