Skip to content

Commit ab4d2a5

Browse files
author
mypybot
committed
Sync typeshed
Source commit: python/typeshed@46f0d91
1 parent 9183b28 commit ab4d2a5

File tree

17 files changed

+375
-144
lines changed

17 files changed

+375
-144
lines changed

mypy/typeshed/stdlib/_winapi.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ if sys.platform == "win32":
184184
def PeekNamedPipe(__handle: int, __size: int = ...) -> tuple[int, int] | tuple[bytes, int, int]: ...
185185
if sys.version_info >= (3, 10):
186186
def LCMapStringEx(locale: str, flags: int, src: str) -> str: ...
187+
def UnmapViewOfFile(__address: int) -> None: ...
187188

188189
@overload
189190
def ReadFile(handle: int, size: int, overlapped: Literal[True]) -> tuple[Overlapped, int]: ...

mypy/typeshed/stdlib/ast.pyi

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class NodeVisitor:
8989
def visit_Constant(self, node: Constant) -> Any: ...
9090
if sys.version_info >= (3, 8):
9191
def visit_NamedExpr(self, node: NamedExpr) -> Any: ...
92+
def visit_TypeIgnore(self, node: TypeIgnore) -> Any: ...
9293

9394
def visit_Attribute(self, node: Attribute) -> Any: ...
9495
def visit_Subscript(self, node: Subscript) -> Any: ...
@@ -135,6 +136,19 @@ class NodeVisitor:
135136
def visit_keyword(self, node: keyword) -> Any: ...
136137
def visit_alias(self, node: alias) -> Any: ...
137138
def visit_withitem(self, node: withitem) -> Any: ...
139+
if sys.version_info >= (3, 10):
140+
def visit_Match(self, node: Match) -> Any: ...
141+
def visit_MatchValue(self, node: MatchValue) -> Any: ...
142+
def visit_MatchSequence(self, node: MatchSequence) -> Any: ...
143+
def visit_MatchStar(self, node: MatchStar) -> Any: ...
144+
def visit_MatchMapping(self, node: MatchMapping) -> Any: ...
145+
def visit_MatchClass(self, node: MatchClass) -> Any: ...
146+
def visit_MatchAs(self, node: MatchAs) -> Any: ...
147+
def visit_MatchOr(self, node: MatchOr) -> Any: ...
148+
149+
if sys.version_info >= (3, 11):
150+
def visit_TryStar(self, node: TryStar) -> Any: ...
151+
138152
# visit methods for deprecated nodes
139153
def visit_ExtSlice(self, node: ExtSlice) -> Any: ...
140154
def visit_Index(self, node: Index) -> Any: ...
@@ -261,7 +275,7 @@ else:
261275
def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ...
262276

263277
def fix_missing_locations(node: _T) -> _T: ...
264-
def get_docstring(node: AST, clean: bool = ...) -> str | None: ...
278+
def get_docstring(node: AsyncFunctionDef | FunctionDef | ClassDef | Module, clean: bool = ...) -> str | None: ...
265279
def increment_lineno(node: _T, n: int = ...) -> _T: ...
266280
def iter_child_nodes(node: AST) -> Iterator[AST]: ...
267281
def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ...

mypy/typeshed/stdlib/asyncio/subprocess.pyi

Lines changed: 91 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import subprocess
22
import sys
33
from _typeshed import StrOrBytesPath
44
from asyncio import events, protocols, streams, transports
5-
from collections.abc import Callable
5+
from collections.abc import Callable, Collection
66
from typing import IO, Any
77
from typing_extensions import Literal, TypeAlias
88

@@ -40,7 +40,7 @@ class Process:
4040
def kill(self) -> None: ...
4141
async def communicate(self, input: bytes | bytearray | memoryview | None = ...) -> tuple[bytes, bytes]: ...
4242

43-
if sys.version_info >= (3, 10):
43+
if sys.version_info >= (3, 11):
4444
async def create_subprocess_shell(
4545
cmd: str | bytes,
4646
stdin: int | IO[Any] | None = ...,
@@ -65,7 +65,13 @@ if sys.version_info >= (3, 10):
6565
creationflags: int = ...,
6666
restore_signals: bool = ...,
6767
start_new_session: bool = ...,
68-
pass_fds: Any = ...,
68+
pass_fds: Collection[int] = ...,
69+
group: None | str | int = ...,
70+
extra_groups: None | Collection[str | int] = ...,
71+
user: None | str | int = ...,
72+
umask: int = ...,
73+
process_group: int | None = ...,
74+
pipesize: int = ...,
6975
) -> Process: ...
7076
async def create_subprocess_exec(
7177
program: _ExecArg,
@@ -91,10 +97,80 @@ if sys.version_info >= (3, 10):
9197
creationflags: int = ...,
9298
restore_signals: bool = ...,
9399
start_new_session: bool = ...,
94-
pass_fds: Any = ...,
100+
pass_fds: Collection[int] = ...,
101+
group: None | str | int = ...,
102+
extra_groups: None | Collection[str | int] = ...,
103+
user: None | str | int = ...,
104+
umask: int = ...,
105+
process_group: int | None = ...,
106+
pipesize: int = ...,
95107
) -> Process: ...
96108

97-
else:
109+
elif sys.version_info >= (3, 10):
110+
async def create_subprocess_shell(
111+
cmd: str | bytes,
112+
stdin: int | IO[Any] | None = ...,
113+
stdout: int | IO[Any] | None = ...,
114+
stderr: int | IO[Any] | None = ...,
115+
limit: int = ...,
116+
*,
117+
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
118+
universal_newlines: Literal[False] = ...,
119+
shell: Literal[True] = ...,
120+
bufsize: Literal[0] = ...,
121+
encoding: None = ...,
122+
errors: None = ...,
123+
text: Literal[False, None] = ...,
124+
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
125+
executable: StrOrBytesPath | None = ...,
126+
preexec_fn: Callable[[], Any] | None = ...,
127+
close_fds: bool = ...,
128+
cwd: StrOrBytesPath | None = ...,
129+
env: subprocess._ENV | None = ...,
130+
startupinfo: Any | None = ...,
131+
creationflags: int = ...,
132+
restore_signals: bool = ...,
133+
start_new_session: bool = ...,
134+
pass_fds: Collection[int] = ...,
135+
group: None | str | int = ...,
136+
extra_groups: None | Collection[str | int] = ...,
137+
user: None | str | int = ...,
138+
umask: int = ...,
139+
pipesize: int = ...,
140+
) -> Process: ...
141+
async def create_subprocess_exec(
142+
program: _ExecArg,
143+
*args: _ExecArg,
144+
stdin: int | IO[Any] | None = ...,
145+
stdout: int | IO[Any] | None = ...,
146+
stderr: int | IO[Any] | None = ...,
147+
limit: int = ...,
148+
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
149+
universal_newlines: Literal[False] = ...,
150+
shell: Literal[True] = ...,
151+
bufsize: Literal[0] = ...,
152+
encoding: None = ...,
153+
errors: None = ...,
154+
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
155+
text: bool | None = ...,
156+
executable: StrOrBytesPath | None = ...,
157+
preexec_fn: Callable[[], Any] | None = ...,
158+
close_fds: bool = ...,
159+
cwd: StrOrBytesPath | None = ...,
160+
env: subprocess._ENV | None = ...,
161+
startupinfo: Any | None = ...,
162+
creationflags: int = ...,
163+
restore_signals: bool = ...,
164+
start_new_session: bool = ...,
165+
pass_fds: Collection[int] = ...,
166+
group: None | str | int = ...,
167+
extra_groups: None | Collection[str | int] = ...,
168+
user: None | str | int = ...,
169+
umask: int = ...,
170+
pipesize: int = ...,
171+
) -> Process: ...
172+
173+
else: # >= 3.9
98174
async def create_subprocess_shell(
99175
cmd: str | bytes,
100176
stdin: int | IO[Any] | None = ...,
@@ -120,7 +196,11 @@ else:
120196
creationflags: int = ...,
121197
restore_signals: bool = ...,
122198
start_new_session: bool = ...,
123-
pass_fds: Any = ...,
199+
pass_fds: Collection[int] = ...,
200+
group: None | str | int = ...,
201+
extra_groups: None | Collection[str | int] = ...,
202+
user: None | str | int = ...,
203+
umask: int = ...,
124204
) -> Process: ...
125205
async def create_subprocess_exec(
126206
program: _ExecArg,
@@ -147,5 +227,9 @@ else:
147227
creationflags: int = ...,
148228
restore_signals: bool = ...,
149229
start_new_session: bool = ...,
150-
pass_fds: Any = ...,
230+
pass_fds: Collection[int] = ...,
231+
group: None | str | int = ...,
232+
extra_groups: None | Collection[str | int] = ...,
233+
user: None | str | int = ...,
234+
umask: int = ...,
151235
) -> Process: ...

mypy/typeshed/stdlib/asyncio/tasks.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ else:
270270
# While this is true in general, here it's sort-of okay to have a covariant subclass,
271271
# since the only reason why `asyncio.Future` is invariant is the `set_result()` method,
272272
# and `asyncio.Task.set_result()` always raises.
273-
class Task(Future[_T_co], Generic[_T_co]): # type: ignore[type-var]
273+
class Task(Future[_T_co], Generic[_T_co]): # type: ignore[type-var] # pyright: ignore[reportGeneralTypeIssues]
274274
if sys.version_info >= (3, 8):
275275
def __init__(
276276
self,

0 commit comments

Comments
 (0)