shutil.rmtree: Add onexc parameter; add parameter defaults (#10219)

This commit is contained in:
Alex Waygood
2023-05-26 07:38:21 +01:00
committed by GitHub
parent cf6fb07f2f
commit a4856c5650

View File

@@ -87,22 +87,46 @@ else:
ignore_dangling_symlinks: bool = False,
) -> _PathReturn: ...
_OnErrorCallback: TypeAlias = Callable[[Callable[..., Any], Any, Any], object]
_OnErrorCallback: TypeAlias = Callable[[Callable[..., Any], str, Any], object]
_OnExcCallback: TypeAlias = Callable[[Callable[..., Any], str, Exception], object]
class _RmtreeType(Protocol):
avoids_symlink_attacks: bool
if sys.version_info >= (3, 11):
if sys.version_info >= (3, 12):
@overload
def __call__(
self,
path: StrOrBytesPath,
ignore_errors: bool = ...,
onerror: _OnErrorCallback | None = ...,
ignore_errors: bool = False,
onerror: _OnErrorCallback | None = None,
*,
dir_fd: int | None = ...,
onexc: None = None,
dir_fd: int | None = None,
) -> None: ...
@overload
def __call__(
self,
path: StrOrBytesPath,
ignore_errors: bool = False,
onerror: None = None,
*,
onexc: _OnExcCallback,
dir_fd: int | None = None,
) -> None: ...
elif sys.version_info >= (3, 11):
def __call__(
self,
path: StrOrBytesPath,
ignore_errors: bool = False,
onerror: _OnErrorCallback | None = None,
*,
dir_fd: int | None = None,
) -> None: ...
else:
def __call__(self, path: StrOrBytesPath, ignore_errors: bool = ..., onerror: _OnErrorCallback | None = ...) -> None: ...
def __call__(
self, path: StrOrBytesPath, ignore_errors: bool = False, onerror: _OnErrorCallback | None = None
) -> None: ...
rmtree: _RmtreeType