Accept PathLike[bytes] in os.listdir (#6870)

This commit is contained in:
Joseph Young
2022-01-09 14:17:01 +00:00
committed by GitHub
parent 67c5d73cdb
commit e6f28c052e

View File

@@ -1,5 +1,6 @@
import sys
from _typeshed import (
BytesPath,
FileDescriptorLike,
OpenBinaryMode,
OpenBinaryModeReading,
@@ -360,13 +361,11 @@ class PathLike(Protocol[_AnyStr_co]):
def __fspath__(self) -> _AnyStr_co: ...
@overload
def listdir(path: str | None = ...) -> list[str]: ...
def listdir(path: StrPath | None = ...) -> list[str]: ...
@overload
def listdir(path: bytes) -> list[bytes]: ...
def listdir(path: BytesPath) -> list[bytes]: ...
@overload
def listdir(path: int) -> list[str]: ...
@overload
def listdir(path: PathLike[str]) -> list[str]: ...
_FdOrAnyPath = Union[int, StrOrBytesPath]