Skip to content

Commit ec44015

Browse files
github-actions[bot]hauntsaninjaAlexWaygood
authored
Sync typeshed (#17081)
Sync typeshed Source commit: python/typeshed@d3c831c Note that you will need to close and re-open the PR in order to trigger CI. --------- Co-authored-by: mypybot <> Co-authored-by: Shantanu <[email protected]> Co-authored-by: AlexWaygood <[email protected]>
1 parent 4a7e5d3 commit ec44015

File tree

15 files changed

+34
-34
lines changed

15 files changed

+34
-34
lines changed

mypy/typeshed/stdlib/builtins.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -1777,6 +1777,7 @@ class MemoryError(Exception): ...
17771777

17781778
class NameError(Exception):
17791779
if sys.version_info >= (3, 10):
1780+
def __init__(self, *args: object, name: str | None = ...) -> None: ...
17801781
name: str
17811782

17821783
class ReferenceError(Exception): ...

mypy/typeshed/stdlib/dataclasses.pyi

+4-4
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class InitVar(Generic[_T], metaclass=_InitVarMeta):
243243
if sys.version_info >= (3, 12):
244244
def make_dataclass(
245245
cls_name: str,
246-
fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]],
246+
fields: Iterable[str | tuple[str, Any] | tuple[str, Any, Any]],
247247
*,
248248
bases: tuple[type, ...] = (),
249249
namespace: dict[str, Any] | None = None,
@@ -263,7 +263,7 @@ if sys.version_info >= (3, 12):
263263
elif sys.version_info >= (3, 11):
264264
def make_dataclass(
265265
cls_name: str,
266-
fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]],
266+
fields: Iterable[str | tuple[str, Any] | tuple[str, Any, Any]],
267267
*,
268268
bases: tuple[type, ...] = (),
269269
namespace: dict[str, Any] | None = None,
@@ -282,7 +282,7 @@ elif sys.version_info >= (3, 11):
282282
elif sys.version_info >= (3, 10):
283283
def make_dataclass(
284284
cls_name: str,
285-
fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]],
285+
fields: Iterable[str | tuple[str, Any] | tuple[str, Any, Any]],
286286
*,
287287
bases: tuple[type, ...] = (),
288288
namespace: dict[str, Any] | None = None,
@@ -300,7 +300,7 @@ elif sys.version_info >= (3, 10):
300300
else:
301301
def make_dataclass(
302302
cls_name: str,
303-
fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]],
303+
fields: Iterable[str | tuple[str, Any] | tuple[str, Any, Any]],
304304
*,
305305
bases: tuple[type, ...] = (),
306306
namespace: dict[str, Any] | None = None,

mypy/typeshed/stdlib/importlib/resources/simple.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ if sys.version_info >= (3, 11):
2828
def is_file(self) -> Literal[True]: ...
2929
def is_dir(self) -> Literal[False]: ...
3030
@overload
31-
def open(self, mode: OpenTextMode = "r", *args: Incomplete, **kwargs: Incomplete) -> TextIOWrapper: ...
31+
def open(self, mode: OpenTextMode = "r", *args, **kwargs) -> TextIOWrapper: ...
3232
@overload
3333
def open(self, mode: OpenBinaryMode, *args: Unused, **kwargs: Unused) -> BinaryIO: ...
3434
@overload
35-
def open(self, mode: str, *args: Incomplete, **kwargs: Incomplete) -> IO[Any]: ...
35+
def open(self, mode: str, *args: Incomplete, **kwargs) -> IO[Any]: ...
3636
def joinpath(self, name: Never) -> NoReturn: ... # type: ignore[override]
3737

3838
class ResourceContainer(Traversable, metaclass=abc.ABCMeta):

mypy/typeshed/stdlib/multiprocessing/resource_tracker.pyi

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
from _typeshed import FileDescriptorOrPath, Incomplete
1+
from _typeshed import FileDescriptorOrPath
22
from collections.abc import Sized
33

44
__all__ = ["ensure_running", "register", "unregister"]
55

66
class ResourceTracker:
77
def getfd(self) -> int | None: ...
88
def ensure_running(self) -> None: ...
9-
def register(self, name: Sized, rtype: Incomplete) -> None: ...
10-
def unregister(self, name: Sized, rtype: Incomplete) -> None: ...
9+
def register(self, name: Sized, rtype) -> None: ...
10+
def unregister(self, name: Sized, rtype) -> None: ...
1111

1212
_resource_tracker: ResourceTracker
1313
ensure_running = _resource_tracker.ensure_running

mypy/typeshed/stdlib/multiprocessing/util.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def is_abstract_socket_namespace(address: str | bytes | None) -> bool: ...
4242
abstract_sockets_supported: bool
4343

4444
def get_temp_dir() -> str: ...
45-
def register_after_fork(obj: Incomplete, func: Callable[[Incomplete], object]) -> None: ...
45+
def register_after_fork(obj, func: Callable[[Incomplete], object]) -> None: ...
4646

4747
class Finalize:
4848
def __init__(
@@ -59,7 +59,7 @@ class Finalize:
5959
_finalizer_registry: MutableMapping[Incomplete, Incomplete] = {},
6060
sub_debug: Callable[..., object] = ...,
6161
getpid: Callable[[], int] = ...,
62-
) -> Incomplete: ...
62+
): ...
6363
def cancel(self) -> None: ...
6464
def still_active(self) -> bool: ...
6565

mypy/typeshed/stdlib/pyexpat/__init__.pyi

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class XMLParserType:
3232
def ExternalEntityParserCreate(self, context: str | None, encoding: str = ..., /) -> XMLParserType: ...
3333
def SetParamEntityParsing(self, flag: int, /) -> int: ...
3434
def UseForeignDTD(self, flag: bool = True, /) -> None: ...
35+
def GetReparseDeferralEnabled(self) -> bool: ...
36+
def SetReparseDeferralEnabled(self, enabled: bool, /) -> None: ...
3537
@property
3638
def intern(self) -> dict[str, str]: ...
3739
buffer_size: int

mypy/typeshed/stdlib/signal.pyi

+2-6
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,8 @@ else:
175175
@property
176176
def si_band(self) -> int: ...
177177

178-
if sys.version_info >= (3, 10):
179-
def sigtimedwait(sigset: Iterable[int], timeout: float, /) -> struct_siginfo | None: ...
180-
def sigwaitinfo(sigset: Iterable[int], /) -> struct_siginfo: ...
181-
else:
182-
def sigtimedwait(sigset: Iterable[int], timeout: float) -> struct_siginfo | None: ...
183-
def sigwaitinfo(sigset: Iterable[int]) -> struct_siginfo: ...
178+
def sigtimedwait(sigset: Iterable[int], timeout: float, /) -> struct_siginfo | None: ...
179+
def sigwaitinfo(sigset: Iterable[int], /) -> struct_siginfo: ...
184180

185181
def strsignal(signalnum: _SIGNUM, /) -> str | None: ...
186182
def valid_signals() -> set[Signals]: ...

mypy/typeshed/stdlib/tkinter/commondialog.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ class Dialog:
1010
command: ClassVar[str | None]
1111
master: Incomplete | None
1212
options: Mapping[str, Incomplete]
13-
def __init__(self, master: Incomplete | None = None, **options: Incomplete) -> None: ...
14-
def show(self, **options: Incomplete) -> Incomplete: ...
13+
def __init__(self, master: Incomplete | None = None, **options) -> None: ...
14+
def show(self, **options): ...

mypy/typeshed/stdlib/tkinter/dialog.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ DIALOG_ICON: str
1212
class Dialog(Widget):
1313
widgetName: str
1414
num: int
15-
def __init__(self, master: Incomplete | None = None, cnf: Mapping[str, Any] = {}, **kw: Incomplete) -> None: ...
15+
def __init__(self, master: Incomplete | None = None, cnf: Mapping[str, Any] = {}, **kw) -> None: ...
1616
def destroy(self) -> None: ...
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from _typeshed import Incomplete
21
from tkinter import Frame, Misc, Scrollbar, Text
32

43
__all__ = ["ScrolledText"]
@@ -7,4 +6,4 @@ __all__ = ["ScrolledText"]
76
class ScrolledText(Text):
87
frame: Frame
98
vbar: Scrollbar
10-
def __init__(self, master: Misc | None = None, **kwargs: Incomplete) -> None: ...
9+
def __init__(self, master: Misc | None = None, **kwargs) -> None: ...

mypy/typeshed/stdlib/traceback.pyi

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ __all__ = [
2727
"walk_tb",
2828
]
2929

30-
_PT: TypeAlias = tuple[str, int, str, str | None]
30+
_FrameSummaryTuple: TypeAlias = tuple[str, int, str, str | None]
3131

3232
def print_tb(tb: TracebackType | None, limit: int | None = None, file: SupportsWrite[str] | None = None) -> None: ...
3333

@@ -80,10 +80,10 @@ def print_last(limit: int | None = None, file: SupportsWrite[str] | None = None,
8080
def print_stack(f: FrameType | None = None, limit: int | None = None, file: SupportsWrite[str] | None = None) -> None: ...
8181
def extract_tb(tb: TracebackType | None, limit: int | None = None) -> StackSummary: ...
8282
def extract_stack(f: FrameType | None = None, limit: int | None = None) -> StackSummary: ...
83-
def format_list(extracted_list: list[FrameSummary]) -> list[str]: ...
83+
def format_list(extracted_list: Iterable[FrameSummary | _FrameSummaryTuple]) -> list[str]: ...
8484

8585
# undocumented
86-
def print_list(extracted_list: list[FrameSummary], file: SupportsWrite[str] | None = None) -> None: ...
86+
def print_list(extracted_list: Iterable[FrameSummary | _FrameSummaryTuple], file: SupportsWrite[str] | None = None) -> None: ...
8787

8888
if sys.version_info >= (3, 10):
8989
@overload
@@ -255,7 +255,7 @@ class StackSummary(list[FrameSummary]):
255255
capture_locals: bool = False,
256256
) -> StackSummary: ...
257257
@classmethod
258-
def from_list(cls, a_list: Iterable[FrameSummary | _PT]) -> StackSummary: ...
258+
def from_list(cls, a_list: Iterable[FrameSummary | _FrameSummaryTuple]) -> StackSummary: ...
259259
if sys.version_info >= (3, 11):
260260
def format_frame_summary(self, frame_summary: FrameSummary) -> str: ...
261261

mypy/typeshed/stdlib/typing.pyi

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import collections # noqa: F401 # pyright: ignore
66
import sys
77
import typing_extensions
88
from _collections_abc import dict_items, dict_keys, dict_values
9-
from _typeshed import IdentityFunction, Incomplete, ReadableBuffer, SupportsKeysAndGetItem
9+
from _typeshed import IdentityFunction, ReadableBuffer, SupportsKeysAndGetItem
1010
from abc import ABCMeta, abstractmethod
1111
from contextlib import AbstractAsyncContextManager, AbstractContextManager
1212
from re import Match as Match, Pattern as Pattern
@@ -170,7 +170,7 @@ class TypeVar:
170170
def __or__(self, right: Any) -> _SpecialForm: ...
171171
def __ror__(self, left: Any) -> _SpecialForm: ...
172172
if sys.version_info >= (3, 11):
173-
def __typing_subst__(self, arg: Incomplete) -> Incomplete: ...
173+
def __typing_subst__(self, arg): ...
174174

175175
# Used for an undocumented mypy feature. Does not exist at runtime.
176176
_promote = object()
@@ -221,7 +221,7 @@ if sys.version_info >= (3, 11):
221221
def __init__(self, name: str) -> None: ...
222222
def __iter__(self) -> Any: ...
223223
def __typing_subst__(self, arg: Never) -> Never: ...
224-
def __typing_prepare_subst__(self, alias: Incomplete, args: Incomplete) -> Incomplete: ...
224+
def __typing_prepare_subst__(self, alias, args): ...
225225

226226
if sys.version_info >= (3, 10):
227227
@final
@@ -270,8 +270,8 @@ if sys.version_info >= (3, 10):
270270
@property
271271
def kwargs(self) -> ParamSpecKwargs: ...
272272
if sys.version_info >= (3, 11):
273-
def __typing_subst__(self, arg: Incomplete) -> Incomplete: ...
274-
def __typing_prepare_subst__(self, alias: Incomplete, args: Incomplete) -> Incomplete: ...
273+
def __typing_subst__(self, arg): ...
274+
def __typing_prepare_subst__(self, alias, args): ...
275275

276276
def __or__(self, right: Any) -> _SpecialForm: ...
277277
def __ror__(self, left: Any) -> _SpecialForm: ...

mypy/typeshed/stdlib/typing_extensions.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import abc
22
import sys
33
import typing
44
from _collections_abc import dict_items, dict_keys, dict_values
5-
from _typeshed import IdentityFunction, Incomplete
5+
from _typeshed import IdentityFunction
66
from typing import ( # noqa: Y022,Y037,Y038,Y039
77
IO as IO,
88
TYPE_CHECKING as TYPE_CHECKING,
@@ -413,7 +413,7 @@ class TypeVar:
413413
def __or__(self, right: Any) -> _SpecialForm: ...
414414
def __ror__(self, left: Any) -> _SpecialForm: ...
415415
if sys.version_info >= (3, 11):
416-
def __typing_subst__(self, arg: Incomplete) -> Incomplete: ...
416+
def __typing_subst__(self, arg): ...
417417

418418
@final
419419
class ParamSpec:

mypy/typeshed/stdlib/xml/dom/xmlbuilder.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class DOMBuilder:
6060
def supportsFeature(self, name: str) -> bool: ...
6161
def canSetFeature(self, name: str, state: int) -> bool: ...
6262
# getFeature could return any attribute from an instance of `Options`
63-
def getFeature(self, name: str) -> Incomplete: ...
63+
def getFeature(self, name: str): ...
6464
def parseURI(self, uri: str) -> ExpatBuilder | ExpatBuilderNS: ...
6565
def parse(self, input: DOMInputSource) -> ExpatBuilder | ExpatBuilderNS: ...
6666
# `input` and `cnode` argtypes for `parseWithContext` are unknowable

mypy/typeshed/stdlib/xml/etree/ElementTree.pyi

+2
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ class XMLPullParser:
250250
# Second element in the tuple could be `Element`, `tuple[str, str]` or `None`.
251251
# Use `Any` to avoid false-positive errors.
252252
def read_events(self) -> Iterator[tuple[str, Any]]: ...
253+
def flush(self) -> None: ...
253254

254255
def XML(text: str | ReadableBuffer, parser: XMLParser | None = None) -> Element: ...
255256
def XMLID(text: str | ReadableBuffer, parser: XMLParser | None = None) -> tuple[Element, dict[str, Element]]: ...
@@ -323,3 +324,4 @@ class XMLParser:
323324
def __init__(self, *, target: Any = ..., encoding: str | None = ...) -> None: ...
324325
def close(self) -> Any: ...
325326
def feed(self, data: str | ReadableBuffer, /) -> None: ...
327+
def flush(self) -> None: ...

0 commit comments

Comments
 (0)