Skip to content

Commit d98d167

Browse files
authored
Fix a few issues with parameter defaults (#9572)
1 parent 7e40d70 commit d98d167

File tree

10 files changed

+37
-30
lines changed

10 files changed

+37
-30
lines changed

stdlib/asyncore.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class dispatcher:
3636
def __init__(self, sock: _Socket | None = None, map: _MapType | None = None) -> None: ...
3737
def add_channel(self, map: _MapType | None = None) -> None: ...
3838
def del_channel(self, map: _MapType | None = None) -> None: ...
39-
def create_socket(self, family: int = 2, type: int = 1) -> None: ...
39+
def create_socket(self, family: int = ..., type: int = ...) -> None: ...
4040
def set_socket(self, sock: _Socket, map: _MapType | None = None) -> None: ...
4141
def set_reuse_addr(self) -> None: ...
4242
def readable(self) -> bool: ...

stdlib/collections/__init__.pyi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,18 @@ class UserString(Sequence[UserString]):
163163
def capitalize(self: Self) -> Self: ...
164164
def casefold(self: Self) -> Self: ...
165165
def center(self: Self, width: int, *args: Any) -> Self: ...
166-
def count(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ...
166+
def count(self, sub: str | UserString, start: int = 0, end: int = ...) -> int: ...
167167
if sys.version_info >= (3, 8):
168168
def encode(self: UserString, encoding: str | None = "utf-8", errors: str | None = "strict") -> bytes: ...
169169
else:
170170
def encode(self: Self, encoding: str | None = ..., errors: str | None = ...) -> Self: ...
171171

172-
def endswith(self, suffix: str | tuple[str, ...], start: int | None = 0, end: int | None = 9223372036854775807) -> bool: ...
172+
def endswith(self, suffix: str | tuple[str, ...], start: int | None = 0, end: int | None = ...) -> bool: ...
173173
def expandtabs(self: Self, tabsize: int = 8) -> Self: ...
174-
def find(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ...
174+
def find(self, sub: str | UserString, start: int = 0, end: int = ...) -> int: ...
175175
def format(self, *args: Any, **kwds: Any) -> str: ...
176176
def format_map(self, mapping: Mapping[str, Any]) -> str: ...
177-
def index(self, sub: str, start: int = 0, end: int = 9223372036854775807) -> int: ...
177+
def index(self, sub: str, start: int = 0, end: int = ...) -> int: ...
178178
def isalpha(self) -> bool: ...
179179
def isalnum(self) -> bool: ...
180180
def isdecimal(self) -> bool: ...
@@ -203,15 +203,15 @@ class UserString(Sequence[UserString]):
203203
def removesuffix(self: Self, __suffix: str | UserString) -> Self: ...
204204

205205
def replace(self: Self, old: str | UserString, new: str | UserString, maxsplit: int = -1) -> Self: ...
206-
def rfind(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ...
207-
def rindex(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ...
206+
def rfind(self, sub: str | UserString, start: int = 0, end: int = ...) -> int: ...
207+
def rindex(self, sub: str | UserString, start: int = 0, end: int = ...) -> int: ...
208208
def rjust(self: Self, width: int, *args: Any) -> Self: ...
209209
def rpartition(self, sep: str) -> tuple[str, str, str]: ...
210210
def rstrip(self: Self, chars: str | None = None) -> Self: ...
211211
def split(self, sep: str | None = None, maxsplit: int = -1) -> list[str]: ...
212212
def rsplit(self, sep: str | None = None, maxsplit: int = -1) -> list[str]: ...
213213
def splitlines(self, keepends: bool = False) -> list[str]: ...
214-
def startswith(self, prefix: str | tuple[str, ...], start: int | None = 0, end: int | None = 9223372036854775807) -> bool: ...
214+
def startswith(self, prefix: str | tuple[str, ...], start: int | None = 0, end: int | None = ...) -> bool: ...
215215
def strip(self: Self, chars: str | None = None) -> Self: ...
216216
def swapcase(self: Self) -> Self: ...
217217
def title(self: Self) -> Self: ...

stdlib/ctypes/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CDLL:
2525
def __init__(
2626
self,
2727
name: str | None,
28-
mode: int = 4,
28+
mode: int = ...,
2929
handle: int | None = None,
3030
use_errno: bool = False,
3131
use_last_error: bool = False,

stdlib/email/parser.pyi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ class Parser:
1111
def parse(self, fp: TextIO, headersonly: bool = False) -> Message: ...
1212
def parsestr(self, text: str, headersonly: bool = False) -> Message: ...
1313

14-
class HeaderParser(Parser): ...
14+
class HeaderParser(Parser):
15+
def parse(self, fp: TextIO, headersonly: bool = True) -> Message: ...
16+
def parsestr(self, text: str, headersonly: bool = True) -> Message: ...
1517

1618
class BytesParser:
1719
def __init__(self, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> None: ...
1820
def parse(self, fp: BinaryIO, headersonly: bool = False) -> Message: ...
1921
def parsebytes(self, text: bytes | bytearray, headersonly: bool = False) -> Message: ...
2022

21-
class BytesHeaderParser(BytesParser): ...
23+
class BytesHeaderParser(BytesParser):
24+
def parse(self, fp: BinaryIO, headersonly: bool = True) -> Message: ...
25+
def parsebytes(self, text: bytes | bytearray, headersonly: bool = True) -> Message: ...

stdlib/multiprocessing/heap.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if sys.platform != "win32":
2727
def rebuild_arena(size: int, dupfd: _SupportsDetach) -> Arena: ...
2828

2929
class Heap:
30-
def __init__(self, size: int = 16384) -> None: ...
30+
def __init__(self, size: int = ...) -> None: ...
3131
def free(self, block: _Block) -> None: ...
3232
def malloc(self, size: int) -> _Block: ...
3333

stdlib/platform.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ def java_ver(
3737
release: str = "", vendor: str = "", vminfo: tuple[str, str, str] = ..., osinfo: tuple[str, str, str] = ...
3838
) -> tuple[str, str, tuple[str, str, str], tuple[str, str, str]]: ...
3939
def system_alias(system: str, release: str, version: str) -> tuple[str, str, str]: ...
40-
def architecture(
41-
executable: str = "/Users/jelle/py/venvs/py311/bin/python", bits: str = "", linkage: str = ""
42-
) -> tuple[str, str]: ...
40+
def architecture(executable: str = ..., bits: str = "", linkage: str = "") -> tuple[str, str]: ...
4341

4442
class uname_result(NamedTuple):
4543
system: str

stdlib/pydoc.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Doc:
5858
def docproperty(self, object: object, name: str | None = None, *args: Any) -> str: ...
5959
@abstractmethod
6060
def docdata(self, object: object, name: str | None = None, *args: Any) -> str: ...
61-
def getdocloc(self, object: object, basedir: str = "/Users/jelle/.pyenv/versions/3.11.1/lib/python3.11") -> str | None: ...
61+
def getdocloc(self, object: object, basedir: str = ...) -> str | None: ...
6262

6363
class HTMLRepr(Repr):
6464
def escape(self, text: str) -> str: ...

stdlib/socket.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,12 @@ else:
779779
if sys.version_info >= (3, 8):
780780
def has_dualstack_ipv6() -> bool: ...
781781
def create_server(
782-
address: _Address, *, family: int = 2, backlog: int | None = None, reuse_port: bool = False, dualstack_ipv6: bool = False
782+
address: _Address,
783+
*,
784+
family: int = ...,
785+
backlog: int | None = None,
786+
reuse_port: bool = False,
787+
dualstack_ipv6: bool = False,
783788
) -> socket: ...
784789

785790
# the 5th tuple item is an address

stdlib/ssl.pyi

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def wrap_socket(
4949
keyfile: StrOrBytesPath | None = None,
5050
certfile: StrOrBytesPath | None = None,
5151
server_side: bool = False,
52-
cert_reqs: int = 0,
53-
ssl_version: int = 2,
52+
cert_reqs: int = ...,
53+
ssl_version: int = ...,
5454
ca_certs: str | None = None,
5555
do_handshake_on_connect: bool = True,
5656
suppress_ragged_eofs: bool = True,
@@ -68,7 +68,7 @@ if sys.version_info >= (3, 10):
6868
def _create_unverified_context(
6969
protocol: int | None = None,
7070
*,
71-
cert_reqs: int = 0,
71+
cert_reqs: int = ...,
7272
check_hostname: bool = False,
7373
purpose: Purpose = ...,
7474
certfile: StrOrBytesPath | None = None,
@@ -83,13 +83,13 @@ else:
8383
protocol: int = ...,
8484
*,
8585
cert_reqs: int = ...,
86-
check_hostname: bool = ...,
86+
check_hostname: bool = False,
8787
purpose: Purpose = ...,
88-
certfile: StrOrBytesPath | None = ...,
89-
keyfile: StrOrBytesPath | None = ...,
90-
cafile: StrOrBytesPath | None = ...,
91-
capath: StrOrBytesPath | None = ...,
92-
cadata: str | ReadableBuffer | None = ...,
88+
certfile: StrOrBytesPath | None = None,
89+
keyfile: StrOrBytesPath | None = None,
90+
cafile: StrOrBytesPath | None = None,
91+
capath: StrOrBytesPath | None = None,
92+
cadata: str | ReadableBuffer | None = None,
9393
) -> SSLContext: ...
9494

9595
_create_default_https_context: Callable[..., SSLContext]
@@ -107,11 +107,11 @@ def cert_time_to_seconds(cert_time: str) -> int: ...
107107

108108
if sys.version_info >= (3, 10):
109109
def get_server_certificate(
110-
addr: tuple[str, int], ssl_version: int = 16, ca_certs: str | None = None, timeout: float = ...
110+
addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = None, timeout: float = ...
111111
) -> str: ...
112112

113113
else:
114-
def get_server_certificate(addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ...) -> str: ...
114+
def get_server_certificate(addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = None) -> str: ...
115115

116116
def DER_cert_to_PEM_cert(der_cert_bytes: ReadableBuffer) -> str: ...
117117
def PEM_cert_to_DER_cert(pem_cert_string: str) -> bytes: ...

stdlib/sysconfig.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ if sys.version_info >= (3, 10):
2828
def get_preferred_scheme(key: Literal["prefix", "home", "user"]) -> str: ...
2929

3030
def get_path_names() -> tuple[str, ...]: ...
31-
def get_path(name: str, scheme: str = "venv", vars: dict[str, Any] | None = None, expand: bool = True) -> str: ...
32-
def get_paths(scheme: str = "venv", vars: dict[str, Any] | None = None, expand: bool = True) -> dict[str, str]: ...
31+
def get_path(name: str, scheme: str = ..., vars: dict[str, Any] | None = None, expand: bool = True) -> str: ...
32+
def get_paths(scheme: str = ..., vars: dict[str, Any] | None = None, expand: bool = True) -> dict[str, str]: ...
3333
def get_python_version() -> str: ...
3434
def get_platform() -> str: ...
3535

0 commit comments

Comments
 (0)