Skip to content

Commit 91e2ed0

Browse files
authored
[stdlib] Add more default values (#14632)
1 parent e8ba06f commit 91e2ed0

16 files changed

+158
-152
lines changed

stdlib/_asyncio.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Future(Awaitable[_T]):
2121
@_log_traceback.setter
2222
def _log_traceback(self, val: Literal[False]) -> None: ...
2323
_asyncio_future_blocking: bool # is a part of duck-typing contract for `Future`
24-
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
24+
def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ...
2525
def __del__(self) -> None: ...
2626
def get_loop(self) -> AbstractEventLoop: ...
2727
@property
@@ -58,7 +58,7 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn
5858
coro: _TaskCompatibleCoro[_T_co],
5959
*,
6060
loop: AbstractEventLoop | None = None,
61-
name: str | None = ...,
61+
name: str | None = None,
6262
context: Context | None = None,
6363
eager_start: bool = False,
6464
) -> None: ...
@@ -68,12 +68,12 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn
6868
coro: _TaskCompatibleCoro[_T_co],
6969
*,
7070
loop: AbstractEventLoop | None = None,
71-
name: str | None = ...,
71+
name: str | None = None,
7272
context: Context | None = None,
7373
) -> None: ...
7474
else:
7575
def __init__(
76-
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop | None = None, name: str | None = ...
76+
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop | None = None, name: str | None = None
7777
) -> None: ...
7878

7979
if sys.version_info >= (3, 12):

stdlib/_csv.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Dialect:
3636
strict: bool
3737
def __new__(
3838
cls,
39-
dialect: _DialectLike | None = ...,
39+
dialect: _DialectLike | None = None,
4040
delimiter: str = ",",
4141
doublequote: bool = True,
4242
escapechar: str | None = None,

stdlib/_curses.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def mouseinterval(interval: int, /) -> None: ...
324324
def mousemask(newmask: int, /) -> tuple[int, int]: ...
325325
def napms(ms: int, /) -> int: ...
326326
def newpad(nlines: int, ncols: int, /) -> window: ...
327-
def newwin(nlines: int, ncols: int, begin_y: int = ..., begin_x: int = ..., /) -> window: ...
327+
def newwin(nlines: int, ncols: int, begin_y: int = 0, begin_x: int = 0, /) -> window: ...
328328
def nl(flag: bool = True, /) -> None: ...
329329
def nocbreak() -> None: ...
330330
def noecho() -> None: ...
@@ -410,7 +410,7 @@ class window: # undocumented
410410
@overload
411411
def box(self) -> None: ...
412412
@overload
413-
def box(self, vertch: _ChType = ..., horch: _ChType = ...) -> None: ...
413+
def box(self, vertch: _ChType = 0, horch: _ChType = 0) -> None: ...
414414
@overload
415415
def chgat(self, attr: int) -> None: ...
416416
@overload
@@ -487,9 +487,9 @@ class window: # undocumented
487487
@overload
488488
def insstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ...
489489
@overload
490-
def instr(self, n: int = ...) -> bytes: ...
490+
def instr(self, n: int = 2047) -> bytes: ...
491491
@overload
492-
def instr(self, y: int, x: int, n: int = ...) -> bytes: ...
492+
def instr(self, y: int, x: int, n: int = 2047) -> bytes: ...
493493
def is_linetouched(self, line: int, /) -> bool: ...
494494
def is_wintouched(self) -> bool: ...
495495
def keypad(self, yes: bool, /) -> None: ...
@@ -523,7 +523,7 @@ class window: # undocumented
523523
@overload
524524
def refresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ...
525525
def resize(self, nlines: int, ncols: int) -> None: ...
526-
def scroll(self, lines: int = ...) -> None: ...
526+
def scroll(self, lines: int = 1) -> None: ...
527527
def scrollok(self, flag: bool) -> None: ...
528528
def setscrreg(self, top: int, bottom: int, /) -> None: ...
529529
def standend(self) -> None: ...
@@ -540,7 +540,7 @@ class window: # undocumented
540540
def syncok(self, flag: bool) -> None: ...
541541
def syncup(self) -> None: ...
542542
def timeout(self, delay: int) -> None: ...
543-
def touchline(self, start: int, count: int, changed: bool = ...) -> None: ...
543+
def touchline(self, start: int, count: int, changed: bool = True) -> None: ...
544544
def touchwin(self) -> None: ...
545545
def untouchwin(self) -> None: ...
546546
@overload

stdlib/_dbm.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if sys.platform != "win32":
3333
@overload
3434
def get(self, k: _KeyType, default: _T, /) -> bytes | _T: ...
3535
def keys(self) -> list[bytes]: ...
36-
def setdefault(self, k: _KeyType, default: _ValueType = ..., /) -> bytes: ...
36+
def setdefault(self, k: _KeyType, default: _ValueType = b"", /) -> bytes: ...
3737
# This isn't true, but the class can't be instantiated. See #13024
3838
__new__: None # type: ignore[assignment]
3939
__init__: None # type: ignore[assignment]

stdlib/_decimal.pyi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ if sys.version_info >= (3, 11):
5151
def localcontext(
5252
ctx: Context | None = None,
5353
*,
54-
prec: int | None = ...,
55-
rounding: str | None = ...,
56-
Emin: int | None = ...,
57-
Emax: int | None = ...,
58-
capitals: int | None = ...,
59-
clamp: int | None = ...,
60-
traps: dict[_TrapType, bool] | None = ...,
61-
flags: dict[_TrapType, bool] | None = ...,
54+
prec: int | None = None,
55+
rounding: str | None = None,
56+
Emin: int | None = None,
57+
Emax: int | None = None,
58+
capitals: int | None = None,
59+
clamp: int | None = None,
60+
traps: dict[_TrapType, bool] | None = None,
61+
flags: dict[_TrapType, bool] | None = None,
6262
) -> _ContextManager: ...
6363

6464
else:

stdlib/_lzma.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ PRESET_EXTREME: Final[int] # v big number
3838
@final
3939
class LZMADecompressor:
4040
if sys.version_info >= (3, 12):
41-
def __new__(cls, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> Self: ...
41+
def __new__(cls, format: int = 0, memlimit: int | None = None, filters: _FilterChain | None = None) -> Self: ...
4242
else:
43-
def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ...
43+
def __init__(self, format: int = 0, memlimit: int | None = None, filters: _FilterChain | None = None) -> None: ...
4444

4545
def decompress(self, data: ReadableBuffer, max_length: int = -1) -> bytes: ...
4646
@property
@@ -56,11 +56,11 @@ class LZMADecompressor:
5656
class LZMACompressor:
5757
if sys.version_info >= (3, 12):
5858
def __new__(
59-
cls, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
59+
cls, format: int = 1, check: int = -1, preset: int | None = None, filters: _FilterChain | None = None
6060
) -> Self: ...
6161
else:
6262
def __init__(
63-
self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
63+
self, format: int = 1, check: int = -1, preset: int | None = None, filters: _FilterChain | None = None
6464
) -> None: ...
6565

6666
def compress(self, data: ReadableBuffer, /) -> bytes: ...

stdlib/_warnings.pyi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ def warn_explicit(
3838
filename: str,
3939
lineno: int,
4040
module: str | None = ...,
41-
registry: dict[str | tuple[str, type[Warning], int], int] | None = ...,
42-
module_globals: dict[str, Any] | None = ...,
43-
source: Any | None = ...,
41+
registry: dict[str | tuple[str, type[Warning], int], int] | None = None,
42+
module_globals: dict[str, Any] | None = None,
43+
source: Any | None = None,
4444
) -> None: ...
4545
@overload
4646
def warn_explicit(
4747
message: Warning,
4848
category: Any,
4949
filename: str,
5050
lineno: int,
51-
module: str | None = ...,
52-
registry: dict[str | tuple[str, type[Warning], int], int] | None = ...,
53-
module_globals: dict[str, Any] | None = ...,
54-
source: Any | None = ...,
51+
module: str | None = None,
52+
registry: dict[str | tuple[str, type[Warning], int], int] | None = None,
53+
module_globals: dict[str, Any] | None = None,
54+
source: Any | None = None,
5555
) -> None: ...

stdlib/asyncio/base_events.pyi

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ from asyncio.transports import BaseTransport, DatagramTransport, ReadTransport,
1010
from collections.abc import Callable, Iterable, Sequence
1111
from concurrent.futures import Executor, ThreadPoolExecutor
1212
from contextvars import Context
13-
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
13+
from socket import AddressFamily, AddressInfo, SocketKind, _Address, _RetAddress, socket
1414
from typing import IO, Any, Literal, TypeVar, overload
1515
from typing_extensions import TypeAlias, TypeVarTuple, Unpack
1616

@@ -235,8 +235,8 @@ class BaseEventLoop(AbstractEventLoop):
235235
host: str | Sequence[str] | None = None,
236236
port: int = ...,
237237
*,
238-
family: int = ...,
239-
flags: int = ...,
238+
family: int = 0,
239+
flags: int = 1,
240240
sock: None = None,
241241
backlog: int = 100,
242242
ssl: _SSLContext = None,
@@ -254,8 +254,8 @@ class BaseEventLoop(AbstractEventLoop):
254254
host: None = None,
255255
port: None = None,
256256
*,
257-
family: int = ...,
258-
flags: int = ...,
257+
family: int = 0,
258+
flags: int = 1,
259259
sock: socket = ...,
260260
backlog: int = 100,
261261
ssl: _SSLContext = None,
@@ -274,8 +274,8 @@ class BaseEventLoop(AbstractEventLoop):
274274
host: str | Sequence[str] | None = None,
275275
port: int = ...,
276276
*,
277-
family: int = ...,
278-
flags: int = ...,
277+
family: int = AddressFamily.AF_UNSPEC,
278+
flags: int = AddressInfo.AI_PASSIVE,
279279
sock: None = None,
280280
backlog: int = 100,
281281
ssl: _SSLContext = None,
@@ -292,8 +292,8 @@ class BaseEventLoop(AbstractEventLoop):
292292
host: None = None,
293293
port: None = None,
294294
*,
295-
family: int = ...,
296-
flags: int = ...,
295+
family: int = AddressFamily.AF_UNSPEC,
296+
flags: int = AddressInfo.AI_PASSIVE,
297297
sock: socket = ...,
298298
backlog: int = 100,
299299
ssl: _SSLContext = None,
@@ -311,8 +311,8 @@ class BaseEventLoop(AbstractEventLoop):
311311
host: str | Sequence[str] | None = None,
312312
port: int = ...,
313313
*,
314-
family: int = ...,
315-
flags: int = ...,
314+
family: int = AddressFamily.AF_UNSPEC,
315+
flags: int = AddressInfo.AI_PASSIVE,
316316
sock: None = None,
317317
backlog: int = 100,
318318
ssl: _SSLContext = None,
@@ -328,8 +328,8 @@ class BaseEventLoop(AbstractEventLoop):
328328
host: None = None,
329329
port: None = None,
330330
*,
331-
family: int = ...,
332-
flags: int = ...,
331+
family: int = AddressFamily.AF_UNSPEC,
332+
flags: int = AddressInfo.AI_PASSIVE,
333333
sock: socket = ...,
334334
backlog: int = 100,
335335
ssl: _SSLContext = None,

stdlib/asyncio/events.pyi

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ from abc import ABCMeta, abstractmethod
1111
from collections.abc import Callable, Sequence
1212
from concurrent.futures import Executor
1313
from contextvars import Context
14-
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
14+
from socket import AddressFamily, AddressInfo, SocketKind, _Address, _RetAddress, socket
1515
from typing import IO, Any, Literal, Protocol, TypeVar, overload, type_check_only
1616
from typing_extensions import Self, TypeAlias, TypeVarTuple, Unpack, deprecated
1717

@@ -289,8 +289,8 @@ class AbstractEventLoop:
289289
host: str | Sequence[str] | None = None,
290290
port: int = ...,
291291
*,
292-
family: int = ...,
293-
flags: int = ...,
292+
family: int = AddressFamily.AF_UNSPEC,
293+
flags: int = AddressInfo.AI_PASSIVE,
294294
sock: None = None,
295295
backlog: int = 100,
296296
ssl: _SSLContext = None,
@@ -309,8 +309,8 @@ class AbstractEventLoop:
309309
host: None = None,
310310
port: None = None,
311311
*,
312-
family: int = ...,
313-
flags: int = ...,
312+
family: int = AddressFamily.AF_UNSPEC,
313+
flags: int = AddressInfo.AI_PASSIVE,
314314
sock: socket = ...,
315315
backlog: int = 100,
316316
ssl: _SSLContext = None,
@@ -330,8 +330,8 @@ class AbstractEventLoop:
330330
host: str | Sequence[str] | None = None,
331331
port: int = ...,
332332
*,
333-
family: int = ...,
334-
flags: int = ...,
333+
family: int = AddressFamily.AF_UNSPEC,
334+
flags: int = AddressInfo.AI_PASSIVE,
335335
sock: None = None,
336336
backlog: int = 100,
337337
ssl: _SSLContext = None,
@@ -349,8 +349,8 @@ class AbstractEventLoop:
349349
host: None = None,
350350
port: None = None,
351351
*,
352-
family: int = ...,
353-
flags: int = ...,
352+
family: int = AddressFamily.AF_UNSPEC,
353+
flags: int = AddressInfo.AI_PASSIVE,
354354
sock: socket = ...,
355355
backlog: int = 100,
356356
ssl: _SSLContext = None,
@@ -369,8 +369,8 @@ class AbstractEventLoop:
369369
host: str | Sequence[str] | None = None,
370370
port: int = ...,
371371
*,
372-
family: int = ...,
373-
flags: int = ...,
372+
family: int = AddressFamily.AF_UNSPEC,
373+
flags: int = AddressInfo.AI_PASSIVE,
374374
sock: None = None,
375375
backlog: int = 100,
376376
ssl: _SSLContext = None,
@@ -387,8 +387,8 @@ class AbstractEventLoop:
387387
host: None = None,
388388
port: None = None,
389389
*,
390-
family: int = ...,
391-
flags: int = ...,
390+
family: int = AddressFamily.AF_UNSPEC,
391+
flags: int = AddressInfo.AI_PASSIVE,
392392
sock: socket = ...,
393393
backlog: int = 100,
394394
ssl: _SSLContext = None,
@@ -536,7 +536,7 @@ class AbstractEventLoop:
536536
bufsize: Literal[0] = 0,
537537
encoding: None = None,
538538
errors: None = None,
539-
text: Literal[False] | None = ...,
539+
text: Literal[False] | None = None,
540540
**kwargs: Any,
541541
) -> tuple[SubprocessTransport, _ProtocolT]: ...
542542
@abstractmethod

stdlib/asyncio/streams.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if sys.version_info >= (3, 10):
3434
port: int | str | None = None,
3535
*,
3636
limit: int = 65536,
37-
ssl_handshake_timeout: float | None = ...,
37+
ssl_handshake_timeout: float | None = None,
3838
**kwds: Any,
3939
) -> tuple[StreamReader, StreamWriter]: ...
4040
async def start_server(
@@ -43,7 +43,7 @@ if sys.version_info >= (3, 10):
4343
port: int | str | None = None,
4444
*,
4545
limit: int = 65536,
46-
ssl_handshake_timeout: float | None = ...,
46+
ssl_handshake_timeout: float | None = None,
4747
**kwds: Any,
4848
) -> Server: ...
4949

@@ -54,7 +54,7 @@ else:
5454
*,
5555
loop: events.AbstractEventLoop | None = None,
5656
limit: int = 65536,
57-
ssl_handshake_timeout: float | None = ...,
57+
ssl_handshake_timeout: float | None = None,
5858
**kwds: Any,
5959
) -> tuple[StreamReader, StreamWriter]: ...
6060
async def start_server(
@@ -64,7 +64,7 @@ else:
6464
*,
6565
loop: events.AbstractEventLoop | None = None,
6666
limit: int = 65536,
67-
ssl_handshake_timeout: float | None = ...,
67+
ssl_handshake_timeout: float | None = None,
6868
**kwds: Any,
6969
) -> Server: ...
7070

0 commit comments

Comments
 (0)