Skip to content

Commit abc9d15

Browse files
Sync typeshed (#13900)
Sync typeshed Source commit: python/typeshed@51e18a8 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 <12621235+hauntsaninja@users.noreply.github.com>
1 parent d528bf2 commit abc9d15

File tree

5 files changed

+23
-22
lines changed

5 files changed

+23
-22
lines changed

mypy/typeshed/stdlib/asyncio/transports.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class SubprocessTransport(BaseTransport):
3939
def get_pid(self) -> int: ...
4040
def get_returncode(self) -> int | None: ...
4141
def get_pipe_transport(self, fd: int) -> BaseTransport | None: ...
42-
def send_signal(self, signal: int) -> int: ...
42+
def send_signal(self, signal: int) -> None: ...
4343
def terminate(self) -> None: ...
4444
def kill(self) -> None: ...
4545

mypy/typeshed/stdlib/ctypes/__init__.pyi

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,10 @@ class _Pointer(Generic[_CT], _PointerLike, _CData):
165165
@overload
166166
def __init__(self, arg: _CT) -> None: ...
167167
@overload
168-
def __getitem__(self, __i: int) -> _CT: ...
169-
@overload
170-
def __getitem__(self, __s: slice) -> list[_CT]: ...
171-
@overload
172-
def __setitem__(self, __i: int, __o: _CT) -> None: ...
168+
def __getitem__(self, __i: int) -> Any: ...
173169
@overload
174-
def __setitem__(self, __s: slice, __o: Iterable[_CT]) -> None: ...
170+
def __getitem__(self, __s: slice) -> list[Any]: ...
171+
def __setitem__(self, __i: int, __o: Any) -> None: ...
175172

176173
def pointer(__arg: _CT) -> _Pointer[_CT]: ...
177174
def resize(obj: _CData, size: int) -> None: ...

mypy/typeshed/stdlib/pydoc.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ from collections.abc import Callable, Container, Mapping, MutableMapping
66
from reprlib import Repr
77
from types import MethodType, ModuleType, TracebackType
88
from typing import IO, Any, AnyStr, NoReturn, TypeVar
9+
from typing_extensions import TypeGuard
910

1011
__all__ = ["help"]
1112

@@ -231,5 +232,5 @@ class ModuleScanner:
231232
) -> None: ...
232233

233234
def apropos(key: str) -> None: ...
234-
def ispath(x: Any) -> bool: ...
235+
def ispath(x: object) -> TypeGuard[str]: ...
235236
def cli() -> None: ...

mypy/typeshed/stdlib/subprocess.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,8 +1828,8 @@ class TimeoutExpired(SubprocessError):
18281828
timeout: float
18291829
# morally: _TXT | None
18301830
output: Any
1831-
stdout: Any
1832-
stderr: Any
1831+
stdout: bytes | None
1832+
stderr: bytes | None
18331833

18341834
class CalledProcessError(SubprocessError):
18351835
returncode: int

mypy/typeshed/stdlib/urllib/parse.pyi

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import sys
22
from collections.abc import Callable, Mapping, Sequence
33
from typing import Any, AnyStr, Generic, NamedTuple, overload
4-
from typing_extensions import TypeAlias
54

65
if sys.version_info >= (3, 9):
76
from types import GenericAlias
@@ -30,8 +29,6 @@ __all__ = [
3029
"SplitResultBytes",
3130
]
3231

33-
_Str: TypeAlias = bytes | str
34-
3532
uses_relative: list[str]
3633
uses_netloc: list[str]
3734
uses_params: list[str]
@@ -135,16 +132,22 @@ def parse_qsl(
135132
separator: str = ...,
136133
) -> list[tuple[AnyStr, AnyStr]]: ...
137134
@overload
138-
def quote(string: str, safe: _Str = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ...
135+
def quote(string: str, safe: str | bytes = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ...
139136
@overload
140-
def quote(string: bytes, safe: _Str = ...) -> str: ...
141-
def quote_from_bytes(bs: bytes, safe: _Str = ...) -> str: ...
137+
def quote(string: bytes, safe: str | bytes = ...) -> str: ...
138+
def quote_from_bytes(bs: bytes, safe: str | bytes = ...) -> str: ...
142139
@overload
143-
def quote_plus(string: str, safe: _Str = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ...
140+
def quote_plus(string: str, safe: str | bytes = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ...
144141
@overload
145-
def quote_plus(string: bytes, safe: _Str = ...) -> str: ...
146-
def unquote(string: str, encoding: str = ..., errors: str = ...) -> str: ...
147-
def unquote_to_bytes(string: _Str) -> bytes: ...
142+
def quote_plus(string: bytes, safe: str | bytes = ...) -> str: ...
143+
144+
if sys.version_info >= (3, 9):
145+
def unquote(string: str | bytes, encoding: str = ..., errors: str = ...) -> str: ...
146+
147+
else:
148+
def unquote(string: str, encoding: str = ..., errors: str = ...) -> str: ...
149+
150+
def unquote_to_bytes(string: str | bytes) -> bytes: ...
148151
def unquote_plus(string: str, encoding: str = ..., errors: str = ...) -> str: ...
149152
@overload
150153
def urldefrag(url: str) -> DefragResult: ...
@@ -153,10 +156,10 @@ def urldefrag(url: bytes | None) -> DefragResultBytes: ...
153156
def urlencode(
154157
query: Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[tuple[Any, Any]] | Sequence[tuple[Any, Sequence[Any]]],
155158
doseq: bool = ...,
156-
safe: _Str = ...,
159+
safe: str | bytes = ...,
157160
encoding: str = ...,
158161
errors: str = ...,
159-
quote_via: Callable[[AnyStr, _Str, str, str], str] = ...,
162+
quote_via: Callable[[AnyStr, str | bytes, str, str], str] = ...,
160163
) -> str: ...
161164
def urljoin(base: AnyStr, url: AnyStr | None, allow_fragments: bool = ...) -> AnyStr: ...
162165
@overload

0 commit comments

Comments
 (0)