more 3.7 features (#2015)

This commit is contained in:
Jelle Zijlstra
2018-04-06 11:09:11 -07:00
committed by Guido van Rossum
parent ce0656a8c7
commit 7cfbc7d17f
6 changed files with 30 additions and 4 deletions

View File

@@ -15,6 +15,11 @@ daylight: int
timezone: int
tzname: Tuple[str, str]
if sys.version_info >= (3, 7) and sys.platform != 'win32':
CLOCK_BOOTTIME: int # Linux
CLOCK_PROF: int # FreeBSD, NetBSD, OpenBSD
CLOCK_UPTIME: int # FreeBSD, OpenBSD
if sys.version_info >= (3, 3) and sys.platform != 'win32':
CLOCK_HIGHRES: int = ... # Solaris only
CLOCK_MONOTONIC: int = ... # Unix only
@@ -94,3 +99,5 @@ if sys.version_info >= (3, 7):
def perf_counter_ns() -> int: ...
def process_time_ns() -> int: ...
def time_ns() -> int: ...
def thread_time() -> float: ...
def thread_time_ns() -> int: ...

View File

@@ -1,10 +1,13 @@
# Stubs for uu (Python 2 and 3)
import sys
from typing import BinaryIO, Union, Optional, Text
_File = Union[Text, BinaryIO]
class Error(Exception): ...
def encode(in_file: _File, out_file: _File, name: Optional[str] = ..., mode: Optional[int] = ...) -> None: ...
if sys.version_info >= (3, 7):
def encode(in_file: _File, out_file: _File, name: Optional[str] = ..., mode: Optional[int] = ..., backtick: bool = ...) -> None: ...
else:
def encode(in_file: _File, out_file: _File, name: Optional[str] = ..., mode: Optional[int] = ...) -> None: ...
def decode(in_file: _File, out_file: Optional[_File] = ..., mode: Optional[int] = ..., quiet: int = ...) -> None: ...

View File

@@ -1,11 +1,16 @@
# Stubs for zipapp (Python 3.5+)
from pathlib import Path
from typing import BinaryIO, Optional, Union
import sys
from typing import BinaryIO, Callable, Optional, Union
_Path = Union[str, Path, BinaryIO]
class ZipAppError(Exception): ...
def create_archive(source: _Path, target: Optional[_Path] = ..., interpreter: Optional[str] = ..., main: Optional[str] = ...) -> None: ...
if sys.version_info >= (3, 7):
def create_archive(source: _Path, target: Optional[_Path] = ..., interpreter: Optional[str] = ..., main: Optional[str] = ...,
filter: Optional[Callable[[Path], bool]] = ..., compressed: bool = ...) -> None: ...
else:
def create_archive(source: _Path, target: Optional[_Path] = ..., interpreter: Optional[str] = ..., main: Optional[str] = ...) -> None: ...
def get_interpreter(archive: _Path) -> str: ...

View File

@@ -72,6 +72,8 @@ class _flags:
bytes_warning = 0
quiet = 0
hash_randomization = 0
if sys.version_info >= (3, 7):
dev_mode: int
float_info = ... # type: _float_info
class _float_info:

View File

@@ -1,3 +1,4 @@
import sys
from typing import Any
import tkinter
@@ -105,6 +106,11 @@ class Separator(Widget):
class Sizegrip(Widget):
def __init__(self, master=None, **kw): ...
if sys.version_info >= (3, 7):
class Spinbox(Entry):
def __init__(self, master: Any = ..., **kw: Any) -> None: ...
def set(self, value: Any) -> None: ...
class Treeview(Widget, tkinter.XView, tkinter.YView):
def __init__(self, master=None, **kw): ...
def bbox(self, item, column=None): ...

View File

@@ -176,3 +176,6 @@ if sys.version_info >= (3, 3):
class PropertyMock(Mock):
def __get__(self, obj: Any, obj_type: Any) -> Any: ...
def __set__(self, obj: Any, val: Any) -> Any: ...
if sys.version_info >= (3, 7):
def seal(mock: Any) -> None: ...