Skip to content

Commit 43e6c3c

Browse files
add more minor 3.7 new features (#2000)
part of #1965
1 parent 6a1d25b commit 43e6c3c

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed

stdlib/2and3/hmac.pyi

+3
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ def compare_digest(a: str, b: str) -> bool: ...
3535
def compare_digest(a: bytes, b: bytes) -> bool: ...
3636
@overload
3737
def compare_digest(a: bytearray, b: bytearray) -> bool: ...
38+
39+
if sys.version_info >= (3, 7):
40+
def digest(key: _B, msg: _B, digest: str) -> bytes: ...

stdlib/2and3/locale.pyi

+6-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,12 @@ def strcoll(string1: _str, string2: _str) -> int: ...
9494
def strxfrm(string: _str) -> _str: ...
9595
def format(format: _str, val: Union[float, Decimal], grouping: bool = ...,
9696
monetary: bool = ...) -> _str: ...
97-
def format_string(format: _str, val: Sequence[Any],
98-
grouping: bool = ...) -> _str: ...
97+
if sys.version_info >= (3, 7):
98+
def format_string(format: _str, val: Sequence[Any],
99+
grouping: bool = ..., monetary: bool = ...) -> _str: ...
100+
else:
101+
def format_string(format: _str, val: Sequence[Any],
102+
grouping: bool = ...) -> _str: ...
99103
def currency(val: int, symbol: bool = ..., grouping: bool = ...,
100104
international: bool = ...) -> _str: ...
101105
if sys.version_info >= (3, 5):

stdlib/2and3/math.pyi

+2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ if sys.version_info >= (3, 3):
6161
def modf(x: float) -> Tuple[float, float]: ...
6262
def pow(x: float, y: float) -> float: ...
6363
def radians(x: float) -> float: ...
64+
if sys.version_info >= (3, 7):
65+
def remainder(x: float, y: float) -> float: ...
6466
def sin(x: float) -> float: ...
6567
def sinh(x: float) -> float: ...
6668
def sqrt(x: float) -> float: ...

stdlib/3/http/client.pyi

+8-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,14 @@ else:
125125
exc_tb: Optional[types.TracebackType]) -> bool: ...
126126

127127
class HTTPConnection:
128-
if sys.version_info >= (3, 4):
128+
if sys.version_info >= (3, 7):
129+
def __init__(
130+
self,
131+
host: str, port: Optional[int] = ...,
132+
timeout: int = ...,
133+
source_address: Optional[Tuple[str, int]] = ..., blocksize: int = ...
134+
) -> None: ...
135+
elif sys.version_info >= (3, 4):
129136
def __init__(
130137
self,
131138
host: str, port: Optional[int] = ...,

stdlib/3/http/server.pyi

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# Stubs for http.server (Python 3.4)
22

3+
import sys
34
from typing import Any, BinaryIO, Dict, List, Mapping, Optional, Tuple, Union
45
import socketserver
56
import email.message
67

8+
if sys.version_info >= (3, 7):
9+
from builtins import _PathLike
10+
711
class HTTPServer(socketserver.TCPServer):
812
server_name = ... # type: str
913
server_port = ... # type: int
@@ -53,8 +57,12 @@ class BaseHTTPRequestHandler:
5357

5458
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
5559
extensions_map = ... # type: Dict[str, str]
56-
def __init__(self, request: bytes, client_address: Tuple[str, int],
57-
server: socketserver.BaseServer) -> None: ...
60+
if sys.version_info >= (3, 7):
61+
def __init__(self, request: bytes, client_address: Tuple[str, int],
62+
server: socketserver.BaseServer, directory: Optional[Union[str, _PathLike[str]]]) -> None: ...
63+
else:
64+
def __init__(self, request: bytes, client_address: Tuple[str, int],
65+
server: socketserver.BaseServer) -> None: ...
5866
def do_GET(self) -> None: ...
5967
def do_HEAD(self) -> None: ...
6068

0 commit comments

Comments
 (0)