Accept bytes paths in shutil.copyfile (#6841)

This commit is contained in:
Joseph Young
2022-01-06 22:30:31 +00:00
committed by GitHub
parent fe75ec69bf
commit 7784c56e11

View File

@@ -3,7 +3,7 @@ import sys
from _typeshed import StrOrBytesPath, StrPath, SupportsRead, SupportsWrite
from typing import Any, AnyStr, Callable, Iterable, NamedTuple, Sequence, TypeVar, Union, overload
_PathT = TypeVar("_PathT", str, os.PathLike[str])
_PathT = TypeVar("_PathT", str, bytes, os.PathLike[str], os.PathLike[bytes])
# Return value of some functions that may either return a path-like object that was passed in or
# a string
_PathReturn = Any
@@ -16,7 +16,7 @@ class ReadError(OSError): ...
class RegistryError(Exception): ...
def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ...
def copyfile(src: StrPath, dst: _PathT, *, follow_symlinks: bool = ...) -> _PathT: ...
def copyfile(src: StrOrBytesPath, dst: _PathT, *, follow_symlinks: bool = ...) -> _PathT: ...
def copymode(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ...
def copystat(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> None: ...
def copy(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ...