Skip to content

Commit 04ce4d5

Browse files
committed
[stdlib] Add default values part 2
1 parent 7c8dce0 commit 04ce4d5

File tree

13 files changed

+120
-108
lines changed

13 files changed

+120
-108
lines changed

stdlib/faulthandler.pyi

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@ from _typeshed import FileDescriptorLike
33

44
def cancel_dump_traceback_later() -> None: ...
55
def disable() -> None: ...
6-
def dump_traceback(file: FileDescriptorLike = ..., all_threads: bool = ...) -> None: ...
6+
def dump_traceback(file: FileDescriptorLike = sys.stderr, all_threads: bool = True) -> None: ...
77

88
if sys.version_info >= (3, 14):
9-
def dump_c_stack(file: FileDescriptorLike = ...) -> None: ...
9+
def dump_c_stack(file: FileDescriptorLike = sys.stderr) -> None: ...
1010

11-
def dump_traceback_later(timeout: float, repeat: bool = ..., file: FileDescriptorLike = ..., exit: bool = ...) -> None: ...
11+
def dump_traceback_later(
12+
timeout: float, repeat: bool = False, file: FileDescriptorLike = sys.stderr, exit: bool = False
13+
) -> None: ...
1214

1315
if sys.version_info >= (3, 14):
14-
def enable(file: FileDescriptorLike = ..., all_threads: bool = ..., c_stack: bool = True) -> None: ...
16+
def enable(file: FileDescriptorLike = sys.stderr, all_threads: bool = True, c_stack: bool = True) -> None: ...
1517

1618
else:
17-
def enable(file: FileDescriptorLike = ..., all_threads: bool = ...) -> None: ...
19+
def enable(file: FileDescriptorLike = sys.stderr, all_threads: bool = True) -> None: ...
1820

1921
def is_enabled() -> bool: ...
2022

2123
if sys.platform != "win32":
22-
def register(signum: int, file: FileDescriptorLike = ..., all_threads: bool = ..., chain: bool = ...) -> None: ...
24+
def register(signum: int, file: FileDescriptorLike = sys.stderr, all_threads: bool = True, chain: bool = False) -> None: ...
2325
def unregister(signum: int, /) -> None: ...

stdlib/hashlib.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ else:
6666
"pbkdf2_hmac",
6767
)
6868

69-
def new(name: str, data: ReadableBuffer = b"", *, usedforsecurity: bool = ...) -> HASH: ...
69+
def new(name: str, data: ReadableBuffer = b"", *, usedforsecurity: bool = True) -> HASH: ...
7070

7171
algorithms_guaranteed: AbstractSet[str]
7272
algorithms_available: AbstractSet[str]

stdlib/itertools.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class count(Generic[_N]):
3232
@overload
3333
def __new__(cls) -> count[int]: ...
3434
@overload
35-
def __new__(cls, start: _N, step: _Step = ...) -> count[_N]: ...
35+
def __new__(cls, start: _N = 0, step: _Step = 1) -> count[_N]: ...
3636
@overload
3737
def __new__(cls, *, step: _N) -> count[_N]: ...
3838
def __next__(self) -> _N: ...
@@ -57,9 +57,9 @@ class repeat(Generic[_T]):
5757
@disjoint_base
5858
class accumulate(Generic[_T]):
5959
@overload
60-
def __new__(cls, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> Self: ...
60+
def __new__(cls, iterable: Iterable[_T], func: None = None, *, initial: _T | None = None) -> Self: ...
6161
@overload
62-
def __new__(cls, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = ...) -> Self: ...
62+
def __new__(cls, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = None) -> Self: ...
6363
def __iter__(self) -> Self: ...
6464
def __next__(self) -> _T: ...
6565

@@ -105,7 +105,7 @@ class islice(Generic[_T]):
105105
@overload
106106
def __new__(cls, iterable: Iterable[_T], stop: int | None, /) -> Self: ...
107107
@overload
108-
def __new__(cls, iterable: Iterable[_T], start: int | None, stop: int | None, step: int | None = ..., /) -> Self: ...
108+
def __new__(cls, iterable: Iterable[_T], start: int | None, stop: int | None, step: int | None = 1, /) -> Self: ...
109109
def __iter__(self) -> Self: ...
110110
def __next__(self) -> _T: ...
111111

@@ -126,7 +126,7 @@ def tee(iterable: Iterable[_T], n: int = 2, /) -> tuple[Iterator[_T], ...]: ...
126126
class zip_longest(Generic[_T_co]):
127127
# one iterable (fillvalue doesn't matter)
128128
@overload
129-
def __new__(cls, iter1: Iterable[_T1], /, *, fillvalue: object = ...) -> zip_longest[tuple[_T1]]: ...
129+
def __new__(cls, iter1: Iterable[_T1], /, *, fillvalue: object = None) -> zip_longest[tuple[_T1]]: ...
130130
# two iterables
131131
@overload
132132
# In the overloads without fillvalue, all of the tuple members could theoretically be None,
@@ -298,7 +298,7 @@ class permutations(Generic[_T_co]):
298298
@overload
299299
def __new__(cls, iterable: Iterable[_T], r: Literal[5]) -> permutations[tuple[_T, _T, _T, _T, _T]]: ...
300300
@overload
301-
def __new__(cls, iterable: Iterable[_T], r: int | None = ...) -> permutations[tuple[_T, ...]]: ...
301+
def __new__(cls, iterable: Iterable[_T], r: int | None = None) -> permutations[tuple[_T, ...]]: ...
302302
def __iter__(self) -> Self: ...
303303
def __next__(self) -> _T_co: ...
304304

stdlib/multiprocessing/reduction.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ HAVE_SEND_HANDLE: Final[bool]
1919

2020
class ForkingPickler(pickle.Pickler):
2121
dispatch_table: _DispatchTableType
22-
def __init__(self, file: SupportsWrite[bytes], protocol: int | None = ...) -> None: ...
22+
def __init__(self, file: SupportsWrite[bytes], protocol: int | None = None) -> None: ...
2323
@classmethod
2424
def register(cls, type: Type, reduce: Callable[[Any], _ReducedType]) -> None: ...
2525
@classmethod

stdlib/os/__init__.pyi

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,10 +1020,10 @@ def fdopen(
10201020
mode: OpenTextMode = "r",
10211021
buffering: int = -1,
10221022
encoding: str | None = None,
1023-
errors: str | None = ...,
1024-
newline: str | None = ...,
1025-
closefd: bool = ...,
1026-
opener: _Opener | None = ...,
1023+
errors: str | None = None,
1024+
newline: str | None = None,
1025+
closefd: bool = True,
1026+
opener: _Opener | None = None,
10271027
) -> TextIOWrapper: ...
10281028
@overload
10291029
def fdopen(
@@ -1033,8 +1033,8 @@ def fdopen(
10331033
encoding: None = None,
10341034
errors: None = None,
10351035
newline: None = None,
1036-
closefd: bool = ...,
1037-
opener: _Opener | None = ...,
1036+
closefd: bool = True,
1037+
opener: _Opener | None = None,
10381038
) -> FileIO: ...
10391039
@overload
10401040
def fdopen(
@@ -1044,8 +1044,8 @@ def fdopen(
10441044
encoding: None = None,
10451045
errors: None = None,
10461046
newline: None = None,
1047-
closefd: bool = ...,
1048-
opener: _Opener | None = ...,
1047+
closefd: bool = True,
1048+
opener: _Opener | None = None,
10491049
) -> BufferedRandom: ...
10501050
@overload
10511051
def fdopen(
@@ -1055,8 +1055,8 @@ def fdopen(
10551055
encoding: None = None,
10561056
errors: None = None,
10571057
newline: None = None,
1058-
closefd: bool = ...,
1059-
opener: _Opener | None = ...,
1058+
closefd: bool = True,
1059+
opener: _Opener | None = None,
10601060
) -> BufferedWriter: ...
10611061
@overload
10621062
def fdopen(
@@ -1066,8 +1066,8 @@ def fdopen(
10661066
encoding: None = None,
10671067
errors: None = None,
10681068
newline: None = None,
1069-
closefd: bool = ...,
1070-
opener: _Opener | None = ...,
1069+
closefd: bool = True,
1070+
opener: _Opener | None = None,
10711071
) -> BufferedReader: ...
10721072
@overload
10731073
def fdopen(
@@ -1077,19 +1077,19 @@ def fdopen(
10771077
encoding: None = None,
10781078
errors: None = None,
10791079
newline: None = None,
1080-
closefd: bool = ...,
1081-
opener: _Opener | None = ...,
1080+
closefd: bool = True,
1081+
opener: _Opener | None = None,
10821082
) -> BinaryIO: ...
10831083
@overload
10841084
def fdopen(
10851085
fd: int,
10861086
mode: str,
10871087
buffering: int = -1,
10881088
encoding: str | None = None,
1089-
errors: str | None = ...,
1090-
newline: str | None = ...,
1091-
closefd: bool = ...,
1092-
opener: _Opener | None = ...,
1089+
errors: str | None = None,
1090+
newline: str | None = None,
1091+
closefd: bool = True,
1092+
opener: _Opener | None = None,
10931093
) -> IO[Any]: ...
10941094
def close(fd: int) -> None: ...
10951095
def closerange(fd_low: int, fd_high: int, /) -> None: ...
@@ -1478,12 +1478,12 @@ else:
14781478
env: _ExecEnv,
14791479
/,
14801480
*,
1481-
file_actions: Sequence[tuple[Any, ...]] | None = ...,
1481+
file_actions: Sequence[tuple[Any, ...]] | None = (),
14821482
setpgroup: int | None = ...,
1483-
resetids: bool = ...,
1484-
setsid: bool = ...,
1485-
setsigmask: Iterable[int] = ...,
1486-
setsigdef: Iterable[int] = ...,
1483+
resetids: bool = False,
1484+
setsid: bool = False,
1485+
setsigmask: Iterable[int] = (),
1486+
setsigdef: Iterable[int] = (),
14871487
scheduler: tuple[Any, sched_param] | None = ...,
14881488
) -> int: ...
14891489
def posix_spawnp(
@@ -1492,12 +1492,12 @@ else:
14921492
env: _ExecEnv,
14931493
/,
14941494
*,
1495-
file_actions: Sequence[tuple[Any, ...]] | None = ...,
1495+
file_actions: Sequence[tuple[Any, ...]] | None = (),
14961496
setpgroup: int | None = ...,
1497-
resetids: bool = ...,
1498-
setsid: bool = ...,
1499-
setsigmask: Iterable[int] = ...,
1500-
setsigdef: Iterable[int] = ...,
1497+
resetids: bool = False,
1498+
setsid: bool = False,
1499+
setsigmask: Iterable[int] = (),
1500+
setsigdef: Iterable[int] = (),
15011501
scheduler: tuple[Any, sched_param] | None = ...,
15021502
) -> int: ...
15031503
POSIX_SPAWN_OPEN: Final = 0
@@ -1584,12 +1584,12 @@ if sys.platform == "linux":
15841584
MFD_HUGE_2GB: Final[int]
15851585
MFD_HUGE_16GB: Final[int]
15861586
def memfd_create(name: str, flags: int = ...) -> int: ...
1587-
def copy_file_range(src: int, dst: int, count: int, offset_src: int | None = ..., offset_dst: int | None = ...) -> int: ...
1587+
def copy_file_range(src: int, dst: int, count: int, offset_src: int | None = None, offset_dst: int | None = None) -> int: ...
15881588

15891589
def waitstatus_to_exitcode(status: int) -> int: ...
15901590

15911591
if sys.platform == "linux":
1592-
def pidfd_open(pid: int, flags: int = ...) -> int: ...
1592+
def pidfd_open(pid: int, flags: int = 0) -> int: ...
15931593

15941594
if sys.version_info >= (3, 12) and sys.platform == "linux":
15951595
PIDFD_NONBLOCK: Final = 2048
@@ -1613,8 +1613,8 @@ if sys.version_info >= (3, 10) and sys.platform == "linux":
16131613
src: FileDescriptor,
16141614
dst: FileDescriptor,
16151615
count: int,
1616-
offset_src: int | None = ...,
1617-
offset_dst: int | None = ...,
1616+
offset_src: int | None = None,
1617+
offset_dst: int | None = None,
16181618
flags: int = 0,
16191619
) -> int: ...
16201620

stdlib/pstats.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Stats:
6161
sort_arg_dict_default: _SortArgDict
6262
def __init__(
6363
self,
64-
arg: None | str | Profile | _cProfile = ...,
64+
arg: None | str | Profile | _cProfile = None,
6565
/,
6666
*args: None | str | Profile | _cProfile | Self,
6767
stream: IO[Any] | None = None,

stdlib/sched.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
import time
23
from collections.abc import Callable
34
from typing import Any, ClassVar, NamedTuple, type_check_only
45
from typing_extensions import TypeAlias
@@ -32,7 +33,9 @@ class scheduler:
3233
timefunc: Callable[[], float]
3334
delayfunc: Callable[[float], object]
3435

35-
def __init__(self, timefunc: Callable[[], float] = ..., delayfunc: Callable[[float], object] = ...) -> None: ...
36+
def __init__(
37+
self, timefunc: Callable[[], float] = time.monotonic, delayfunc: Callable[[float], object] = time.sleep
38+
) -> None: ...
3639
def enterabs(
3740
self, time: float, priority: Any, action: _ActionCallback, argument: tuple[Any, ...] = (), kwargs: dict[str, Any] = ...
3841
) -> Event: ...

stdlib/select.pyi

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,7 @@ if sys.platform != "linux" and sys.platform != "win32":
4848
ident: int
4949
udata: Any
5050
def __init__(
51-
self,
52-
ident: FileDescriptorLike,
53-
filter: int = ...,
54-
flags: int = ...,
55-
fflags: int = ...,
56-
data: Any = ...,
57-
udata: Any = ...,
51+
self, ident: FileDescriptorLike, filter: int = ..., flags: int = ..., fflags: int = 0, data: Any = 0, udata: Any = 0
5852
) -> None: ...
5953
__hash__: ClassVar[None] # type: ignore[assignment]
6054

@@ -114,12 +108,12 @@ if sys.platform != "linux" and sys.platform != "win32":
114108
if sys.platform == "linux":
115109
@final
116110
class epoll:
117-
def __new__(self, sizehint: int = ..., flags: int = ...) -> Self: ...
111+
def __new__(self, sizehint: int = -1, flags: int = 0) -> Self: ...
118112
def __enter__(self) -> Self: ...
119113
def __exit__(
120114
self,
121115
exc_type: type[BaseException] | None = None,
122-
exc_value: BaseException | None = ...,
116+
exc_value: BaseException | None = None,
123117
exc_tb: TracebackType | None = None,
124118
/,
125119
) -> None: ...
@@ -160,4 +154,4 @@ if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win
160154
def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
161155
def modify(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
162156
def unregister(self, fd: FileDescriptorLike) -> None: ...
163-
def poll(self, timeout: float | None = ...) -> list[tuple[int, int]]: ...
157+
def poll(self, timeout: float | None = None) -> list[tuple[int, int]]: ...

0 commit comments

Comments
 (0)