Use conditional overloads to simplify several stdlib functions (#7540)

This commit is contained in:
Alex Waygood authored and GitHub committed 2022-03-25 08:47:03 +01:00
1 parent b69d64df60
commit b63c963077
4 files changed
+21 -36

No files matched your search

+5 -10
View File
@@ -732,20 +732,15 @@ class _ScandirIterator(Iterator[DirEntry[AnyStr]], AbstractContextManager[_Scand
def __exit__(self, *args: object) -> None: ...
def close(self) -> None: ...
@overload
def scandir(path: None = ...) -> _ScandirIterator[str]: ...
if sys.version_info >= (3, 7):
@overload
def scandir(path: None = ...) -> _ScandirIterator[str]: ...
@overload
def scandir(path: int) -> _ScandirIterator[str]: ...
@overload
def scandir(path: AnyStr | PathLike[AnyStr]) -> _ScandirIterator[AnyStr]: ...
else:
@overload
def scandir(path: None = ...) -> _ScandirIterator[str]: ...
@overload
def scandir(path: AnyStr | PathLike[AnyStr]) -> _ScandirIterator[AnyStr]: ...
@overload
def scandir(path: AnyStr | PathLike[AnyStr]) -> _ScandirIterator[AnyStr]: ...
def stat(path: _FdOrAnyPath, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> stat_result: ...
if sys.version_info < (3, 7):