Skip to content

pathlib: more changes for py312 #10261

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 3 commits into from
Jun 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 20 additions & 4 deletions stdlib/pathlib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ class PurePath(PathLike[str]):
if sys.version_info >= (3, 9):
def is_relative_to(self, *other: StrPath) -> bool: ...

def match(self, path_pattern: str) -> bool: ...
if sys.version_info >= (3, 12):
def match(self, path_pattern: str, *, case_sensitive: bool | None = None) -> bool: ...
else:
def match(self, path_pattern: str) -> bool: ...

def relative_to(self, *other: StrPath) -> Self: ...
def with_name(self, name: str) -> Self: ...
if sys.version_info >= (3, 9):
Expand All @@ -70,6 +74,9 @@ class PurePath(PathLike[str]):
if sys.version_info >= (3, 9) and sys.version_info < (3, 11):
def __class_getitem__(cls, type: Any) -> GenericAlias: ...

if sys.version_info >= (3, 12):
def with_segments(self, *args: StrPath) -> Self: ...

class PurePosixPath(PurePath): ...
class PureWindowsPath(PurePath): ...

Expand All @@ -86,15 +93,25 @@ class Path(PurePath):
def stat(self) -> stat_result: ...
def chmod(self, mode: int) -> None: ...

def exists(self) -> bool: ...
def glob(self, pattern: str) -> Generator[Self, None, None]: ...
if sys.version_info >= (3, 12):
def exists(self, *, follow_symlinks: bool = True) -> bool: ...
def glob(self, pattern: str, *, case_sensitive: bool | None = None) -> Generator[Self, None, None]: ...
def rglob(self, pattern: str, *, case_sensitive: bool | None = None) -> Generator[Self, None, None]: ...
else:
def exists(self) -> bool: ...
def glob(self, pattern: str) -> Generator[Self, None, None]: ...
def rglob(self, pattern: str) -> Generator[Self, None, None]: ...

def is_dir(self) -> bool: ...
def is_file(self) -> bool: ...
def is_symlink(self) -> bool: ...
def is_socket(self) -> bool: ...
def is_fifo(self) -> bool: ...
def is_block_device(self) -> bool: ...
def is_char_device(self) -> bool: ...
if sys.version_info >= (3, 12):
def is_junction(self) -> bool: ...

def iterdir(self) -> Generator[Self, None, None]: ...
def lchmod(self, mode: int) -> None: ...
def lstat(self) -> stat_result: ...
Expand Down Expand Up @@ -175,7 +192,6 @@ class Path(PurePath):
def replace(self, target: str | PurePath) -> None: ...

def resolve(self, strict: bool = False) -> Self: ...
def rglob(self, pattern: str) -> Generator[Self, None, None]: ...
def rmdir(self) -> None: ...
def symlink_to(self, target: StrOrBytesPath, target_is_directory: bool = False) -> None: ...
if sys.version_info >= (3, 10):
Expand Down
6 changes: 0 additions & 6 deletions tests/stubtest_allowlists/py312.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,9 @@ os.path.__all__
os.path.isjunction
os.path.splitroot
pathlib.Path.__init__
pathlib.Path.exists
pathlib.Path.glob
pathlib.Path.is_junction
pathlib.Path.rglob
pathlib.PurePath.__init__
pathlib.PurePath.is_relative_to
pathlib.PurePath.match
pathlib.PurePath.relative_to
pathlib.PurePath.with_segments
pdb.Pdb.set_convenience_variable
pkgutil.ImpImporter
pkgutil.ImpLoader
Expand Down