add some more Python 3.7 features (#2014)

This commit is contained in:
Jelle Zijlstra
2018-04-06 11:08:30 -07:00
committed by Guido van Rossum
parent 32b4eacea1
commit ce0656a8c7
4 changed files with 36 additions and 26 deletions

View File

@@ -454,7 +454,16 @@ if sys.version_info >= (3, 3):
def rmdir(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ...
else:
def rmdir(path: _PathType) -> None: ...
if sys.version_info >= (3, 6):
if sys.version_info >= (3, 7):
class _ScandirIterator(Iterator[DirEntry[AnyStr]], ContextManager[_ScandirIterator[AnyStr]]):
def close(self) -> None: ...
@overload
def scandir() -> _ScandirIterator[str]: ...
@overload
def scandir(path: int) -> _ScandirIterator[str]: ...
@overload
def scandir(path: Union[AnyStr, PathLike[AnyStr]]) -> _ScandirIterator[AnyStr]: ...
elif sys.version_info >= (3, 6):
class _ScandirIterator(Iterator[DirEntry[AnyStr]], ContextManager[_ScandirIterator[AnyStr]]):
def close(self) -> None: ...
@overload
@@ -608,3 +617,6 @@ if sys.version_info >= (3, 6):
def urandom(size: int) -> bytes: ...
else:
def urandom(n: int) -> bytes: ...
if sys.version_info >= (3, 7):
def register_at_fork(func: Callable[..., object], when: str) -> None: ...

View File

@@ -120,6 +120,10 @@ class Connection:
# set_progress_handler(handler, n) -> see https://docs.python.org/2/library/sqlite3.html#sqlite3.Connection.set_progress_handler
def set_progress_handler(self, *args, **kwargs) -> None: ...
def set_trace_callback(self, *args, **kwargs): ...
if sys.version_info >= (3, 7):
def backup(self, target: Connection, *, pages: int = ...,
progress: Optional[Callable[[int, int, int], object]] = ..., name: str = ...,
sleep: float = ...) -> None: ...
def __call__(self, *args, **kwargs): ...
def __enter__(self, *args, **kwargs): ...
def __exit__(self, *args, **kwargs): ...