From 556ff5208ef7ec9e7c3683b084e8f0850539f6a3 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Sat, 18 May 2024 17:12:00 -0400 Subject: [PATCH 1/2] shutil: add chown args in py313 --- stdlib/shutil.pyi | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/stdlib/shutil.pyi b/stdlib/shutil.pyi index a06181ce876d..9a7e730ca734 100644 --- a/stdlib/shutil.pyi +++ b/stdlib/shutil.pyi @@ -132,14 +132,24 @@ def disk_usage(path: FileDescriptorOrPath) -> _ntuple_diskusage: ... # While chown can be imported on Windows, it doesn't actually work; # see https://bugs.python.org/issue33140. We keep it here because it's # in __all__. -@overload -def chown(path: FileDescriptorOrPath, user: str | int, group: None = None) -> None: ... -@overload -def chown(path: FileDescriptorOrPath, user: None = None, *, group: str | int) -> None: ... -@overload -def chown(path: FileDescriptorOrPath, user: None, group: str | int) -> None: ... -@overload -def chown(path: FileDescriptorOrPath, user: str | int, group: str | int) -> None: ... +if sys.version_info >= (3, 13): + @overload + def chown(path: FileDescriptorOrPath, user: str | int, group: None = None, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> None: ... + @overload + def chown(path: FileDescriptorOrPath, user: None = None, *, group: str | int, dir_fd: int | None = None, follow_symlinks: bool = True) -> None: ... + @overload + def chown(path: FileDescriptorOrPath, user: None, group: str | int, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> None: ... + @overload + def chown(path: FileDescriptorOrPath, user: str | int, group: str | int, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> None: ... +else: + @overload + def chown(path: FileDescriptorOrPath, user: str | int, group: None = None) -> None: ... + @overload + def chown(path: FileDescriptorOrPath, user: None = None, *, group: str | int) -> None: ... + @overload + def chown(path: FileDescriptorOrPath, user: None, group: str | int) -> None: ... + @overload + def chown(path: FileDescriptorOrPath, user: str | int, group: str | int) -> None: ... @overload def which(cmd: _StrPathT, mode: int = 1, path: StrPath | None = None) -> str | _StrPathT | None: ... @overload From adb4713fda51765764a5f5b11eccbf225b80c2dd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 18 May 2024 21:13:38 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/shutil.pyi | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/stdlib/shutil.pyi b/stdlib/shutil.pyi index 9a7e730ca734..f1f04837df21 100644 --- a/stdlib/shutil.pyi +++ b/stdlib/shutil.pyi @@ -134,13 +134,32 @@ def disk_usage(path: FileDescriptorOrPath) -> _ntuple_diskusage: ... # in __all__. if sys.version_info >= (3, 13): @overload - def chown(path: FileDescriptorOrPath, user: str | int, group: None = None, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> None: ... + def chown( + path: FileDescriptorOrPath, + user: str | int, + group: None = None, + *, + dir_fd: int | None = None, + follow_symlinks: bool = True, + ) -> None: ... @overload - def chown(path: FileDescriptorOrPath, user: None = None, *, group: str | int, dir_fd: int | None = None, follow_symlinks: bool = True) -> None: ... + def chown( + path: FileDescriptorOrPath, + user: None = None, + *, + group: str | int, + dir_fd: int | None = None, + follow_symlinks: bool = True, + ) -> None: ... @overload - def chown(path: FileDescriptorOrPath, user: None, group: str | int, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> None: ... + def chown( + path: FileDescriptorOrPath, user: None, group: str | int, *, dir_fd: int | None = None, follow_symlinks: bool = True + ) -> None: ... @overload - def chown(path: FileDescriptorOrPath, user: str | int, group: str | int, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> None: ... + def chown( + path: FileDescriptorOrPath, user: str | int, group: str | int, *, dir_fd: int | None = None, follow_symlinks: bool = True + ) -> None: ... + else: @overload def chown(path: FileDescriptorOrPath, user: str | int, group: None = None) -> None: ... @@ -150,6 +169,7 @@ else: def chown(path: FileDescriptorOrPath, user: None, group: str | int) -> None: ... @overload def chown(path: FileDescriptorOrPath, user: str | int, group: str | int) -> None: ... + @overload def which(cmd: _StrPathT, mode: int = 1, path: StrPath | None = None) -> str | _StrPathT | None: ... @overload