Skip to content

Commit 5ffa6dd

Browse files
Sync typeshed (python#16918)
Source commit: python/typeshed@48a0497
1 parent c26f129 commit 5ffa6dd

36 files changed

+653
-553
lines changed

mypy/typeshed/stdlib/_ast.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ PyCF_ONLY_AST: Literal[1024]
66
PyCF_TYPE_COMMENTS: Literal[4096]
77
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]
88

9+
# Alias used for fields that must always be valid identifiers
10+
# A string `x` counts as a valid identifier if both the following are True
11+
# (1) `x.isidentifier()` evaluates to `True`
12+
# (2) `keyword.iskeyword(x)` evaluates to `False`
913
_Identifier: typing_extensions.TypeAlias = str
1014

1115
class AST:
@@ -499,7 +503,7 @@ class keyword(AST):
499503
class alias(AST):
500504
if sys.version_info >= (3, 10):
501505
__match_args__ = ("name", "asname")
502-
name: _Identifier
506+
name: str
503507
asname: _Identifier | None
504508

505509
class withitem(AST):

mypy/typeshed/stdlib/_curses.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,5 +553,6 @@ if sys.platform != "win32":
553553
major: int
554554
minor: int
555555
patch: int
556+
556557
ncurses_version: _ncurses_version
557558
window = _CursesWindow # undocumented

mypy/typeshed/stdlib/_msi.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ if sys.platform == "win32":
4545
# Don't exist at runtime
4646
__new__: None # type: ignore[assignment]
4747
__init__: None # type: ignore[assignment]
48+
4849
def UuidCreate() -> str: ...
4950
def FCICreate(__cabname: str, __files: list[str]) -> None: ...
5051
def OpenDatabase(__path: str, __persist: int) -> _Database: ...

mypy/typeshed/stdlib/_thread.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def get_native_id() -> int: ... # only available on some platforms
3232
class _ExceptHookArgs(structseq[Any], tuple[type[BaseException], BaseException | None, TracebackType | None, Thread | None]):
3333
if sys.version_info >= (3, 10):
3434
__match_args__: Final = ("exc_type", "exc_value", "exc_traceback", "thread")
35+
3536
@property
3637
def exc_type(self) -> type[BaseException]: ...
3738
@property

mypy/typeshed/stdlib/asyncio/sslproto.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ if sys.version_info >= (3, 11):
2525
STATE_CON_MADE: str
2626
STATE_EOF: str
2727
STATE_CON_LOST: str
28+
2829
def add_flowcontrol_defaults(high: int | None, low: int | None, kb: int) -> tuple[int, int]: ...
2930

3031
else:
@@ -155,9 +156,10 @@ class SSLProtocol(_SSLProtocolBase):
155156
def _check_handshake_timeout(self) -> None: ...
156157
def _on_handshake_complete(self, handshake_exc: BaseException | None) -> None: ...
157158
def _fatal_error(self, exc: BaseException, message: str = "Fatal error on transport") -> None: ...
158-
def _abort(self) -> None: ...
159159
if sys.version_info >= (3, 11):
160+
def _abort(self, exc: BaseException | None) -> None: ...
160161
def get_buffer(self, n: int) -> memoryview: ...
161162
else:
163+
def _abort(self) -> None: ...
162164
def _finalize(self) -> None: ...
163165
def _process_write_backlog(self) -> None: ...

mypy/typeshed/stdlib/asyncio/unix_events.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ if sys.platform != "win32":
9696
def __exit__(self, a: type[BaseException] | None, b: BaseException | None, c: types.TracebackType | None) -> None: ...
9797
def add_child_handler(self, pid: int, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> None: ...
9898
def remove_child_handler(self, pid: int) -> bool: ...
99+
99100
else:
100101
class SafeChildWatcher(BaseChildWatcher):
101102
def __enter__(self) -> Self: ...
@@ -120,6 +121,7 @@ if sys.platform != "win32":
120121
else:
121122
def get_child_watcher(self) -> AbstractChildWatcher: ...
122123
def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ...
124+
123125
SelectorEventLoop = _UnixSelectorEventLoop
124126

125127
DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy
@@ -136,6 +138,7 @@ if sys.platform != "win32":
136138
def add_child_handler(self, pid: int, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> None: ...
137139
def remove_child_handler(self, pid: int) -> bool: ...
138140
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
141+
139142
else:
140143
class MultiLoopChildWatcher(AbstractChildWatcher):
141144
def is_active(self) -> bool: ...

mypy/typeshed/stdlib/asyncio/windows_events.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ if sys.platform == "win32":
6969
def recvfrom_into(
7070
self, conn: socket.socket, buf: WriteableBuffer, flags: int = 0
7171
) -> futures.Future[tuple[int, socket._RetAddress]]: ...
72+
7273
SelectorEventLoop = _WindowsSelectorEventLoop
7374

7475
class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
@@ -80,4 +81,5 @@ if sys.platform == "win32":
8081
_loop_factory: ClassVar[type[ProactorEventLoop]]
8182
def get_child_watcher(self) -> NoReturn: ...
8283
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
84+
8385
DefaultEventLoopPolicy = WindowsSelectorEventLoopPolicy

mypy/typeshed/stdlib/calendar.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class HTMLCalendar(Calendar):
124124
def formatyear(self, theyear: int, width: int = 3) -> str: ...
125125
def formatyearpage(
126126
self, theyear: int, width: int = 3, css: str | None = "calendar.css", encoding: str | None = None
127-
) -> str: ...
127+
) -> bytes: ...
128128

129129
class different_locale:
130130
def __init__(self, locale: _LocaleType) -> None: ...
@@ -166,6 +166,7 @@ if sys.version_info >= (3, 12):
166166
OCTOBER: Literal[10]
167167
NOVEMBER: Literal[11]
168168
DECEMBER: Literal[12]
169+
169170
JANUARY = Month.JANUARY
170171
FEBRUARY = Month.FEBRUARY
171172
MARCH = Month.MARCH
@@ -187,6 +188,7 @@ if sys.version_info >= (3, 12):
187188
FRIDAY: Literal[4]
188189
SATURDAY: Literal[5]
189190
SUNDAY: Literal[6]
191+
190192
MONDAY = Day.MONDAY
191193
TUESDAY = Day.TUESDAY
192194
WEDNESDAY = Day.WEDNESDAY

mypy/typeshed/stdlib/contextlib.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class closing(AbstractContextManager[_SupportsCloseT]):
118118
if sys.version_info >= (3, 10):
119119
class _SupportsAclose(Protocol):
120120
def aclose(self) -> Awaitable[object]: ...
121+
121122
_SupportsAcloseT = TypeVar("_SupportsAcloseT", bound=_SupportsAclose)
122123

123124
class aclosing(AbstractAsyncContextManager[_SupportsAcloseT]):

mypy/typeshed/stdlib/dbm/gnu.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ if sys.platform != "win32":
3737
# Don't exist at runtime
3838
__new__: None # type: ignore[assignment]
3939
__init__: None # type: ignore[assignment]
40+
4041
def open(__filename: str, __flags: str = "r", __mode: int = 0o666) -> _gdbm: ...

0 commit comments

Comments
 (0)