Skip to content

add some more Python 3.7 features #2014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion stdlib/2/sqlite3/dbapi2.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Filip Hron <[email protected]>
# based heavily on Andrey Vlasovskikh's python-skeletons https://github.com/JetBrains/python-skeletons/blob/master/sqlite3.py

from typing import Any, Union, List, Iterator, Optional
import sys
from typing import Any, Callable, Iterator, List, Optional, Union
from datetime import time, datetime
from collections import Iterable

Expand Down Expand Up @@ -120,6 +121,10 @@ class Connection(object):
# 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):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the same change in 2 and 3 for this file to make sure the files stay mostly the same. I'll submit a followup PR to merge the two stubs.

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): ...
Expand Down
37 changes: 13 additions & 24 deletions stdlib/2and3/pdb.pyi
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
# NOTE: This stub is incomplete - only contains some global functions

import sys
from typing import Any, Dict, Optional

def run(statement: str,
globals: Optional[Dict[str, Any]] = ...,
locals: Optional[Dict[str, Any]] = ...) -> None:
...
def run(statement: str, globals: Optional[Dict[str, Any]] = ...,
locals: Optional[Dict[str, Any]] = ...) -> None: ...
def runeval(expression: str, globals: Optional[Dict[str, Any]] = ...,
locals: Optional[Dict[str, Any]] = ...) -> Any: ...
def runctx(statement: str, globals: Dict[str, Any], locals: Dict[str, Any]) -> None: ...
def runcall(*args: Any, **kwds: Any) -> Any: ...

def runeval(expression: str,
globals: Optional[Dict[str, Any]] = ...,
locals: Optional[Dict[str, Any]] = ...) -> Any:
...
if sys.version_info >= (3, 7):
def set_trace(*, header: Optional[str] = ...) -> None: ...
else:
def set_trace() -> None: ...

def runctx(statement: str,
globals: Dict[str, Any],
locals: Dict[str, Any]) -> None:
...

def runcall(*args: Any, **kwds: Any) -> Any:
...

def set_trace() -> None:
...

def post_mortem(t: Optional[Any] = ...) -> None:
...

def pm() -> None:
...
def post_mortem(t: Optional[Any] = ...) -> None: ...
def pm() -> None: ...
14 changes: 13 additions & 1 deletion stdlib/3/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: ...
4 changes: 4 additions & 0 deletions stdlib/3/sqlite3/dbapi2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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): ...
Expand Down