Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions mypy/typeshed/stdlib/_interpqueues.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
from typing import Any, SupportsIndex
from typing import Any, Literal, SupportsIndex
from typing_extensions import TypeAlias

_UnboundOp: TypeAlias = Literal[1, 2, 3]

class QueueError(RuntimeError): ...
class QueueNotFoundError(QueueError): ...

def bind(qid: SupportsIndex) -> None: ...
def create(maxsize: SupportsIndex, fmt: SupportsIndex) -> int: ...
def create(maxsize: SupportsIndex, fmt: SupportsIndex, unboundop: _UnboundOp) -> int: ...
def destroy(qid: SupportsIndex) -> None: ...
def get(qid: SupportsIndex) -> tuple[Any, int]: ...
def get(qid: SupportsIndex) -> tuple[Any, int, _UnboundOp | None]: ...
def get_count(qid: SupportsIndex) -> int: ...
def get_maxsize(qid: SupportsIndex) -> int: ...
def get_queue_defaults(qid: SupportsIndex) -> tuple[int]: ...
def get_queue_defaults(qid: SupportsIndex) -> tuple[int, _UnboundOp]: ...
def is_full(qid: SupportsIndex) -> bool: ...
def list_all() -> list[tuple[int, int]]: ...
def put(qid: SupportsIndex, obj: Any, fmt: SupportsIndex) -> None: ...
def list_all() -> list[tuple[int, int, _UnboundOp]]: ...
def put(qid: SupportsIndex, obj: Any, fmt: SupportsIndex, unboundop: _UnboundOp) -> None: ...
def release(qid: SupportsIndex) -> None: ...
4 changes: 3 additions & 1 deletion mypy/typeshed/stdlib/_interpreters.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ def get_main() -> tuple[int, int]: ...
def is_running(id: SupportsIndex, *, restrict: bool = False) -> bool: ...
def get_config(id: SupportsIndex, *, restrict: bool = False) -> types.SimpleNamespace: ...
def whence(id: SupportsIndex) -> int: ...
def exec(id: SupportsIndex, code: str, shared: bool | None = None, *, restrict: bool = False) -> None: ...
def exec(
id: SupportsIndex, code: str | types.CodeType | Callable[[], object], shared: bool | None = None, *, restrict: bool = False
) -> None | types.SimpleNamespace: ...
def call(
id: SupportsIndex,
callable: Callable[..., object],
Expand Down
4 changes: 1 addition & 3 deletions mypy/typeshed/stdlib/_ssl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,7 @@ OP_SINGLE_ECDH_USE: int
OP_NO_COMPRESSION: int
OP_ENABLE_MIDDLEBOX_COMPAT: int
OP_NO_RENEGOTIATION: int
if sys.version_info >= (3, 11):
OP_IGNORE_UNEXPECTED_EOF: int
elif sys.version_info >= (3, 8) and sys.platform == "linux":
if sys.version_info >= (3, 11) or sys.platform == "linux":
OP_IGNORE_UNEXPECTED_EOF: int
if sys.version_info >= (3, 12):
OP_LEGACY_SERVER_CONNECT: int
Expand Down
9 changes: 8 additions & 1 deletion mypy/typeshed/stdlib/ctypes/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,14 @@ def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to
if sys.platform == "win32":
def DllCanUnloadNow() -> int: ...
def DllGetClassObject(rclsid: Any, riid: Any, ppv: Any) -> int: ... # TODO not documented
def GetLastError() -> int: ...

# Actually just an instance of _NamedFuncPointer (aka _CDLLFuncPointer),
# but we want to set a more specific __call__
@type_check_only
class _GetLastErrorFunctionType(_NamedFuncPointer):
def __call__(self) -> int: ...

GetLastError: _GetLastErrorFunctionType

# Actually just an instance of _CFunctionType, but we want to set a more
# specific __call__.
Expand Down
4 changes: 2 additions & 2 deletions mypy/typeshed/stdlib/socket.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ def create_server(
address: _Address, *, family: int = ..., backlog: int | None = None, reuse_port: bool = False, dualstack_ipv6: bool = False
) -> socket: ...

# the 5th tuple item is an address
# The 5th tuple item is the socket address, for IP4, IP6, or IP6 if Python is compiled with --disable-ipv6, respectively.
def getaddrinfo(
host: bytes | str | None, port: bytes | str | int | None, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0
) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ...
) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]]]: ...
8 changes: 6 additions & 2 deletions mypy/typeshed/stdlib/sys/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from collections.abc import AsyncGenerator, Callable, Sequence
from io import TextIOWrapper
from types import FrameType, ModuleType, TracebackType
from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final, type_check_only
from typing_extensions import TypeAlias
from typing_extensions import LiteralString, TypeAlias

_T = TypeVar("_T")

Expand Down Expand Up @@ -45,7 +45,7 @@ if sys.version_info >= (3, 10):
path: list[str]
path_hooks: list[Callable[[str], PathEntryFinderProtocol]]
path_importer_cache: dict[str, PathEntryFinderProtocol | None]
platform: str
platform: LiteralString
if sys.version_info >= (3, 9):
platlibdir: str
prefix: str
Expand Down Expand Up @@ -393,6 +393,10 @@ if sys.platform == "win32":
def getwindowsversion() -> _WinVersion: ...

def intern(string: str, /) -> str: ...

if sys.version_info >= (3, 13):
def _is_gil_enabled() -> bool: ...

def is_finalizing() -> bool: ...
def breakpointhook(*args: Any, **kwargs: Any) -> Any: ...

Expand Down
4 changes: 2 additions & 2 deletions mypy/typeshed/stdlib/tarfile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def open(
@overload
def open(
name: StrOrBytesPath | None,
mode: Literal["x", "x:", "a", "a:", "w", "w:"],
mode: Literal["x", "x:", "a", "a:", "w", "w:", "w:tar"],
fileobj: _Fileobj | None = None,
bufsize: int = 10240,
*,
Expand All @@ -141,7 +141,7 @@ def open(
def open(
name: StrOrBytesPath | None = None,
*,
mode: Literal["x", "x:", "a", "a:", "w", "w:"],
mode: Literal["x", "x:", "a", "a:", "w", "w:", "w:tar"],
fileobj: _Fileobj | None = None,
bufsize: int = 10240,
format: int | None = ...,
Expand Down
4 changes: 2 additions & 2 deletions mypy/typeshed/stdlib/telnetlib.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import socket
from collections.abc import Callable, Sequence
from collections.abc import Callable, MutableSequence, Sequence
from re import Match, Pattern
from types import TracebackType
from typing import Any
Expand Down Expand Up @@ -114,7 +114,7 @@ class Telnet:
def mt_interact(self) -> None: ...
def listener(self) -> None: ...
def expect(
self, list: Sequence[Pattern[bytes] | bytes], timeout: float | None = None
self, list: MutableSequence[Pattern[bytes] | bytes] | Sequence[Pattern[bytes]], timeout: float | None = None
) -> tuple[int, Match[bytes] | None, bytes]: ...
def __enter__(self) -> Self: ...
def __exit__(
Expand Down
18 changes: 9 additions & 9 deletions mypy/typeshed/stdlib/tkinter/filedialog.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class Directory(commondialog.Dialog):
# TODO: command kwarg available on macos
def asksaveasfilename(
*,
confirmoverwrite: bool | None = ...,
defaultextension: str | None = ...,
confirmoverwrite: bool | None = True,
defaultextension: str | None = "",
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
Expand All @@ -91,7 +91,7 @@ def asksaveasfilename(
) -> str: ... # can be empty string
def askopenfilename(
*,
defaultextension: str | None = ...,
defaultextension: str | None = "",
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
Expand All @@ -101,7 +101,7 @@ def askopenfilename(
) -> str: ... # can be empty string
def askopenfilenames(
*,
defaultextension: str | None = ...,
defaultextension: str | None = "",
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
Expand All @@ -110,15 +110,15 @@ def askopenfilenames(
typevariable: StringVar | str | None = ...,
) -> Literal[""] | tuple[str, ...]: ...
def askdirectory(
*, initialdir: StrOrBytesPath | None = ..., mustexist: bool | None = ..., parent: Misc | None = ..., title: str | None = ...
*, initialdir: StrOrBytesPath | None = ..., mustexist: bool | None = False, parent: Misc | None = ..., title: str | None = ...
) -> str: ... # can be empty string

# TODO: If someone actually uses these, overload to have the actual return type of open(..., mode)
def asksaveasfile(
mode: str = "w",
*,
confirmoverwrite: bool | None = ...,
defaultextension: str | None = ...,
confirmoverwrite: bool | None = True,
defaultextension: str | None = "",
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
Expand All @@ -129,7 +129,7 @@ def asksaveasfile(
def askopenfile(
mode: str = "r",
*,
defaultextension: str | None = ...,
defaultextension: str | None = "",
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
Expand All @@ -140,7 +140,7 @@ def askopenfile(
def askopenfiles(
mode: str = "r",
*,
defaultextension: str | None = ...,
defaultextension: str | None = "",
filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ...,
initialdir: StrOrBytesPath | None = ...,
initialfile: StrOrBytesPath | None = ...,
Expand Down
6 changes: 3 additions & 3 deletions mypy/typeshed/stdlib/xml/dom/minidom.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ class ReadOnlySequentialNamedNodeMap:
def length(self) -> int: ...

class Identified:
publicId: Incomplete
systemId: Incomplete
publicId: str | None
systemId: str | None

class DocumentType(Identified, Childless, Node):
nodeType: int
Expand Down Expand Up @@ -331,7 +331,7 @@ class Notation(Identified, Childless, Node):
class DOMImplementation(DOMImplementationLS):
def hasFeature(self, feature: str, version: str | None) -> bool: ...
def createDocument(self, namespaceURI: str | None, qualifiedName: str | None, doctype: DocumentType | None) -> Document: ...
def createDocumentType(self, qualifiedName: str | None, publicId: str, systemId: str) -> DocumentType: ...
def createDocumentType(self, qualifiedName: str | None, publicId: str | None, systemId: str | None) -> DocumentType: ...
def getInterface(self, feature: str) -> Self | None: ...

class ElementInfo:
Expand Down
Loading