Audit stdlib object annotations (#9519)

This commit is contained in:
Avasam
2023-01-17 10:40:00 -05:00
committed by GitHub
parent 3d6b8dccfe
commit c70d303985
31 changed files with 79 additions and 79 deletions

View File

@@ -1,7 +1,7 @@
import os
import sys
from _ast import *
from _typeshed import ReadableBuffer
from _typeshed import ReadableBuffer, Unused
from collections.abc import Iterator
from typing import Any, TypeVar, overload
from typing_extensions import Literal
@@ -9,7 +9,7 @@ from typing_extensions import Literal
if sys.version_info >= (3, 8):
class _ABC(type):
if sys.version_info >= (3, 9):
def __init__(cls, *args: object) -> None: ...
def __init__(cls, *args: Unused) -> None: ...
class Num(Constant, metaclass=_ABC):
value: int | float | complex

View File

@@ -1,6 +1,6 @@
import ssl
import sys
from _typeshed import FileDescriptorLike, ReadableBuffer, Self, StrPath, WriteableBuffer
from _typeshed import FileDescriptorLike, ReadableBuffer, Self, StrPath, Unused, WriteableBuffer
from abc import ABCMeta, abstractmethod
from collections.abc import Awaitable, Callable, Coroutine, Generator, Sequence
from contextvars import Context
@@ -96,7 +96,7 @@ class AbstractServer:
@abstractmethod
def close(self) -> None: ...
async def __aenter__(self: Self) -> Self: ...
async def __aexit__(self, *exc: object) -> None: ...
async def __aexit__(self, *exc: Unused) -> None: ...
@abstractmethod
def get_loop(self) -> AbstractEventLoop: ...
@abstractmethod

View File

@@ -1,6 +1,6 @@
import enum
import sys
from _typeshed import Self
from _typeshed import Self, Unused
from collections import deque
from collections.abc import Callable, Generator
from types import TracebackType
@@ -31,7 +31,7 @@ else:
class _ContextManager:
def __init__(self, lock: Lock | Semaphore) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
class _ContextManagerMixin:
# Apparently this exists to *prohibit* use as a context manager.
@@ -104,7 +104,7 @@ if sys.version_info >= (3, 11):
class Barrier(_LoopBoundMixin):
def __init__(self, parties: int) -> None: ...
async def __aenter__(self: Self) -> Self: ...
async def __aexit__(self, *args: object) -> None: ...
async def __aexit__(self, *args: Unused) -> None: ...
async def wait(self) -> int: ...
async def abort(self) -> None: ...
async def reset(self) -> None: ...

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import Self
from _typeshed import Self, Unused
from collections.abc import Callable, Coroutine
from contextvars import Context
from typing import Any, TypeVar
@@ -18,7 +18,7 @@ if sys.version_info >= (3, 11):
class Runner:
def __init__(self, *, debug: bool | None = ..., loop_factory: Callable[[], AbstractEventLoop] | None = ...) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, exc_type: object, exc_val: object, exc_tb: object) -> None: ...
def __exit__(self, exc_type: Unused, exc_val: Unused, exc_tb: Unused) -> None: ...
def close(self) -> None: ...
def get_loop(self) -> AbstractEventLoop: ...
def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = ...) -> _T: ...

View File

@@ -953,7 +953,7 @@ class function:
__module__: str
# mypy uses `builtins.function.__get__` to represent methods, properties, and getset_descriptors so we type the return as Any.
def __get__(self, obj: object | None, type: type | None = ...) -> Any: ...
def __get__(self, obj: object, type: type | None = ...) -> Any: ...
class list(MutableSequence[_T], Generic[_T]):
@overload

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import Self, StrOrBytesPath
from _typeshed import Self, StrOrBytesPath, Unused
from collections.abc import Callable
from types import CodeType
from typing import Any, TypeVar
@@ -32,6 +32,6 @@ class Profile:
def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ...
if sys.version_info >= (3, 8):
def __enter__(self: Self) -> Self: ...
def __exit__(self, *exc_info: object) -> None: ...
def __exit__(self, *exc_info: Unused) -> None: ...
def label(code: str | CodeType) -> _Label: ... # undocumented

View File

@@ -1,5 +1,6 @@
import datetime
import sys
from _typeshed import Unused
from collections.abc import Iterable, Sequence
from time import struct_time
from typing import ClassVar
@@ -108,7 +109,7 @@ class HTMLCalendar(Calendar):
class different_locale:
def __init__(self, locale: _LocaleType) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
class LocaleTextCalendar(TextCalendar):
def __init__(self, firstweekday: int = ..., locale: _LocaleType | None = ...) -> None: ...

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import Self, SupportsGetItem, SupportsItemAccess
from _typeshed import Self, SupportsGetItem, SupportsItemAccess, Unused
from builtins import list as _list, type as _type
from collections.abc import Iterable, Iterator, Mapping
from email.message import Message
@@ -106,7 +106,7 @@ class FieldStorage:
separator: str = ...,
) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def __getitem__(self, key: str) -> Any: ...
def getvalue(self, key: str, default: Any = ...) -> Any: ...

View File

@@ -1,6 +1,6 @@
import sys
import threading
from _typeshed import Self
from _typeshed import Self, Unused
from collections.abc import Callable, Iterable, Iterator, Sequence
from logging import Logger
from types import TracebackType
@@ -108,4 +108,4 @@ class _AcquireFutures:
futures: Iterable[Future[Any]]
def __init__(self, futures: Iterable[Future[Any]]) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...

View File

@@ -1,6 +1,6 @@
import abc
import sys
from _typeshed import FileDescriptorOrPath, Self
from _typeshed import FileDescriptorOrPath, Self, Unused
from abc import abstractmethod
from collections.abc import AsyncGenerator, AsyncIterator, Awaitable, Callable, Generator, Iterator
from types import TracebackType
@@ -108,7 +108,7 @@ _SupportsCloseT = TypeVar("_SupportsCloseT", bound=_SupportsClose)
class closing(AbstractContextManager[_SupportsCloseT]):
def __init__(self, thing: _SupportsCloseT) -> None: ...
def __exit__(self, *exc_info: object) -> None: ...
def __exit__(self, *exc_info: Unused) -> None: ...
if sys.version_info >= (3, 10):
class _SupportsAclose(Protocol):
@@ -117,7 +117,7 @@ if sys.version_info >= (3, 10):
class aclosing(AbstractAsyncContextManager[_SupportsAcloseT]):
def __init__(self, thing: _SupportsAcloseT) -> None: ...
async def __aexit__(self, *exc_info: object) -> None: ...
async def __aexit__(self, *exc_info: Unused) -> None: ...
class suppress(AbstractContextManager[None]):
def __init__(self, *exceptions: type[BaseException]) -> None: ...
@@ -178,9 +178,9 @@ if sys.version_info >= (3, 10):
@overload
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
def __enter__(self) -> _T: ...
def __exit__(self, *exctype: object) -> None: ...
def __exit__(self, *exctype: Unused) -> None: ...
async def __aenter__(self) -> _T: ...
async def __aexit__(self, *exctype: object) -> None: ...
async def __aexit__(self, *exctype: Unused) -> None: ...
else:
class nullcontext(AbstractContextManager[_T]):
@@ -190,7 +190,7 @@ else:
@overload
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
def __enter__(self) -> _T: ...
def __exit__(self, *exctype: object) -> None: ...
def __exit__(self, *exctype: Unused) -> None: ...
if sys.version_info >= (3, 11):
_T_fd_or_any_path = TypeVar("_T_fd_or_any_path", bound=FileDescriptorOrPath)
@@ -199,4 +199,4 @@ if sys.version_info >= (3, 11):
path: _T_fd_or_any_path
def __init__(self, path: _T_fd_or_any_path) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, *excinfo: object) -> None: ...
def __exit__(self, *excinfo: Unused) -> None: ...

View File

@@ -1,4 +1,4 @@
from _typeshed import StrPath
from _typeshed import StrPath, Unused
from collections.abc import Callable, Container, Iterable, Mapping
from typing import Any
from typing_extensions import Literal
@@ -25,10 +25,7 @@ def byte_compile(
) -> None: ...
def rfc822_escape(header: str) -> str: ...
def run_2to3(
files: Iterable[str],
fixer_names: Iterable[str] | None = ...,
options: Mapping[str, Any] | None = ...,
explicit: Container[str] | None = ..., # unused
files: Iterable[str], fixer_names: Iterable[str] | None = ..., options: Mapping[str, Any] | None = ..., explicit: Unused = ...
) -> None: ...
def copydir_run_2to3(
src: StrPath,

View File

@@ -1,6 +1,6 @@
import sys
import types
from _typeshed import Self, SupportsKeysAndGetItem
from _typeshed import Self, SupportsKeysAndGetItem, Unused
from abc import ABCMeta
from builtins import property as _builtins_property
from collections.abc import Iterable, Iterator, Mapping
@@ -177,7 +177,7 @@ class Enum(metaclass=EnumMeta):
def __new__(cls: type[Self], value: object) -> Self: ...
def __dir__(self) -> list[str]: ...
def __format__(self, format_spec: str) -> str: ...
def __reduce_ex__(self, proto: object) -> tuple[Any, ...]: ...
def __reduce_ex__(self, proto: Unused) -> tuple[Any, ...]: ...
if sys.version_info >= (3, 11):
class ReprEnum(Enum): ...

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import ReadableBuffer, Self
from _typeshed import ReadableBuffer, Self, Unused
from collections.abc import Iterable, Iterator, Sized
from typing import NoReturn, overload
@@ -74,7 +74,7 @@ class mmap(Iterable[int], Sized):
# so we claim that there is also an __iter__ to help type checkers.
def __iter__(self) -> Iterator[int]: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
if sys.version_info >= (3, 8) and sys.platform != "win32":
MADV_NORMAL: int

View File

@@ -1,4 +1,4 @@
from _typeshed import FileDescriptorLike
from _typeshed import FileDescriptorLike, Unused
from collections.abc import Sequence
from struct import Struct
from typing import Any
@@ -19,7 +19,7 @@ def main(
alive_r: FileDescriptorLike,
preload: Sequence[str],
main_path: str | None = ...,
sys_path: object | None = ...,
sys_path: Unused = ...,
) -> None: ...
def read_signed(fd: int) -> Any: ...
def write_signed(fd: int, n: int) -> None: ...

View File

@@ -1,6 +1,6 @@
import pickle
import sys
from _typeshed import HasFileno, SupportsWrite
from _typeshed import HasFileno, SupportsWrite, Unused
from abc import ABCMeta
from builtins import type as Type # alias to avoid name clash
from collections.abc import Callable
@@ -54,8 +54,7 @@ else:
ACKNOWLEDGE: Literal[False]
def recvfds(sock: socket, size: int) -> list[int]: ...
# destination_pid is unused
def send_handle(conn: HasFileno, handle: int, destination_pid: object) -> None: ...
def send_handle(conn: HasFileno, handle: int, destination_pid: Unused) -> None: ...
def recv_handle(conn: HasFileno) -> int: ...
def sendfds(sock: socket, fds: list[int]) -> None: ...
def DupFd(fd: int) -> Any: ... # Return type is really hard to get right
@@ -92,5 +91,4 @@ class AbstractReducer(metaclass=ABCMeta):
sendfds = _sendfds
recvfds = _recvfds
DupFd = _DupFd
# *args are unused
def __init__(self, *args: object) -> None: ...
def __init__(self, *args: Unused) -> None: ...

View File

@@ -1,5 +1,5 @@
import threading
from _typeshed import Incomplete, ReadableBuffer, SupportsTrunc
from _typeshed import Incomplete, ReadableBuffer, SupportsTrunc, Unused
from collections.abc import Callable, Iterable, Mapping, MutableMapping, Sequence
from logging import Logger, _Level as _LoggingLevel
from typing import Any, SupportsInt
@@ -56,7 +56,7 @@ class Finalize:
) -> None: ...
def __call__(
self,
wr: object = ...,
wr: Unused = ...,
_finalizer_registry: MutableMapping[Incomplete, Incomplete] = ...,
sub_debug: Callable[..., object] = ...,
getpid: Callable[[], int] = ...,
@@ -70,7 +70,7 @@ class ForkAwareThreadLock:
acquire: Callable[[bool, float], bool]
release: Callable[[], None]
def __enter__(self) -> bool: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
class ForkAwareLocal(threading.local): ...

View File

@@ -2,7 +2,7 @@ import datetime
import socket
import ssl
import sys
from _typeshed import Self
from _typeshed import Self, Unused
from builtins import list as _list # conflicts with a method named "list"
from collections.abc import Iterable
from typing import IO, Any, NamedTuple
@@ -73,7 +73,7 @@ class NNTP:
timeout: float = ...,
) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def getwelcome(self) -> str: ...
def getcapabilities(self) -> dict[str, _list[str]]: ...
def set_debuglevel(self, level: int) -> None: ...

View File

@@ -15,6 +15,7 @@ from _typeshed import (
StrOrBytesPath,
StrPath,
SupportsLenAndGetItem,
Unused,
WriteableBuffer,
structseq,
)
@@ -730,7 +731,7 @@ def rmdir(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> None: ...
class _ScandirIterator(Iterator[DirEntry[AnyStr]], AbstractContextManager[_ScandirIterator[AnyStr]]):
def __next__(self) -> DirEntry[AnyStr]: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def close(self) -> None: ...
@overload
@@ -997,7 +998,7 @@ if sys.version_info >= (3, 8):
def __init__(self, path: str | None, cookie: _T, remove_dll_directory: Callable[[_T], object]) -> None: ...
def close(self) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def add_dll_directory(path: str) -> _AddedDllDirectory: ...
if sys.platform == "linux":

View File

@@ -26,7 +26,7 @@ def replace(text: AnyStr, *pairs: AnyStr) -> AnyStr: ...
def cram(text: str, maxlen: int) -> str: ...
def stripid(text: str) -> str: ...
def allmethods(cl: type) -> MutableMapping[str, MethodType]: ...
def visiblename(name: str, all: Container[str] | None = ..., obj: object | None = ...) -> bool: ...
def visiblename(name: str, all: Container[str] | None = ..., obj: object = ...) -> bool: ...
def classify_class_attrs(object: object) -> list[tuple[str, str, type, str]]: ...
def ispackage(path: str) -> bool: ...
def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: ...

View File

@@ -1,4 +1,4 @@
from _typeshed import Self
from _typeshed import Self, Unused
from types import ModuleType
from typing import Any
@@ -9,13 +9,13 @@ class _TempModule:
module: ModuleType
def __init__(self, mod_name: str) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
class _ModifiedArgv0:
value: Any
def __init__(self, value: Any) -> None: ...
def __enter__(self) -> None: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def run_module(
mod_name: str, init_globals: dict[str, Any] | None = ..., run_name: str | None = ..., alter_sys: bool = ...

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import FileDescriptor, FileDescriptorLike, Self
from _typeshed import FileDescriptor, FileDescriptorLike, Self, Unused
from abc import ABCMeta, abstractmethod
from collections.abc import Mapping
from typing import Any, NamedTuple
@@ -29,7 +29,7 @@ class BaseSelector(metaclass=ABCMeta):
@abstractmethod
def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
class SelectSelector(BaseSelector):
def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ...

View File

@@ -112,7 +112,7 @@ from _socket import (
setdefaulttimeout as setdefaulttimeout,
timeout as timeout,
)
from _typeshed import ReadableBuffer, Self, WriteableBuffer
from _typeshed import ReadableBuffer, Self, Unused, WriteableBuffer
from collections.abc import Iterable
from enum import IntEnum, IntFlag
from io import BufferedReader, BufferedRWPair, BufferedWriter, IOBase, RawIOBase, TextIOWrapper
@@ -658,7 +658,7 @@ class socket(_socket.socket):
self, family: AddressFamily | int = ..., type: SocketKind | int = ..., proto: int = ..., fileno: int | None = ...
) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def dup(self: Self) -> Self: ... # noqa: F811
def accept(self) -> tuple[socket, _RetAddress]: ...
# Note that the makefile's documented windows-specific behavior is not represented
@@ -735,9 +735,8 @@ def fromfd(fd: _FD, family: AddressFamily | int, type: SocketKind | int, proto:
if sys.platform != "win32":
if sys.version_info >= (3, 9):
# flags and address appear to be unused in send_fds and recv_fds
def send_fds(
sock: socket, buffers: Iterable[ReadableBuffer], fds: Iterable[int], flags: int = ..., address: None = ...
sock: socket, buffers: Iterable[ReadableBuffer], fds: Iterable[int], flags: Unused = ..., address: Unused = ...
) -> int: ...
def recv_fds(sock: socket, bufsize: int, maxfds: int, flags: int = ...) -> tuple[bytes, list[int], int, Any]: ...

View File

@@ -1,6 +1,6 @@
import sqlite3
import sys
from _typeshed import Incomplete, ReadableBuffer, Self, StrOrBytesPath, SupportsLenAndGetItem
from _typeshed import Incomplete, ReadableBuffer, Self, StrOrBytesPath, SupportsLenAndGetItem, Unused
from collections.abc import Callable, Generator, Iterable, Iterator, Mapping
from datetime import date, datetime, time
from types import TracebackType
@@ -227,7 +227,7 @@ else:
if sys.version_info < (3, 8):
class Cache:
def __init__(self, *args: Incomplete, **kwargs: object) -> None: ...
def __init__(self, *args: Incomplete, **kwargs: Unused) -> None: ...
def display(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
def get(self, *args: Incomplete, **kwargs: Incomplete) -> None: ...
@@ -385,8 +385,8 @@ class Cursor(Iterator[Any]):
# Returns either a row (as created by the row_factory) or None, but
# putting None in the return annotation causes annoying false positives.
def fetchone(self) -> Any: ...
def setinputsizes(self, __sizes: object) -> None: ... # does nothing
def setoutputsize(self, __size: object, __column: object = ...) -> None: ... # does nothing
def setinputsizes(self, __sizes: Unused) -> None: ... # does nothing
def setoutputsize(self, __size: Unused, __column: Unused = ...) -> None: ... # does nothing
def __iter__(self: Self) -> Self: ...
def __next__(self) -> Any: ...

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import Self
from _typeshed import Self, Unused
from typing import IO, Any, NamedTuple, NoReturn, overload
from typing_extensions import Literal, TypeAlias
@@ -33,7 +33,7 @@ class _sunau_params(NamedTuple):
class Au_read:
def __init__(self, f: _File) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def getfp(self) -> IO[bytes] | None: ...
def rewind(self) -> None: ...
def close(self) -> None: ...
@@ -53,7 +53,7 @@ class Au_read:
class Au_write:
def __init__(self, f: _File) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def setnchannels(self, nchannels: int) -> None: ...
def getnchannels(self) -> int: ...
def setsampwidth(self, sampwidth: int) -> None: ...

View File

@@ -304,7 +304,7 @@ if sys.version_info >= (3, 8):
exc_value: BaseException | None
exc_traceback: TracebackType | None
err_msg: str | None
object: _object | None
object: _object
unraisablehook: Callable[[UnraisableHookArgs], Any]
def __unraisablehook__(__unraisable: UnraisableHookArgs) -> Any: ...
def addaudithook(hook: Callable[[str, tuple[Any, ...]], Any]) -> None: ...

View File

@@ -413,7 +413,7 @@ class _StaticFunctionType:
# By wrapping FunctionType in _StaticFunctionType, we get the right result;
# similar to wrapping a function in staticmethod() at runtime to prevent it
# being bound as a method.
def __get__(self, obj: object | None, type: type | None) -> FunctionType: ...
def __get__(self, obj: object, type: type | None) -> FunctionType: ...
@final
class MethodType:

View File

@@ -1,3 +1,5 @@
import sys
from _typeshed import Unused
from enum import Enum
from typing_extensions import TypeAlias
@@ -64,7 +66,12 @@ class UUID:
def __gt__(self, other: UUID) -> bool: ...
def __ge__(self, other: UUID) -> bool: ...
def getnode() -> int: ...
if sys.version_info >= (3, 9):
def getnode() -> int: ...
else:
def getnode(*, getters: Unused = ...) -> int: ... # undocumented
def uuid1(node: _Int | None = ..., clock_seq: _Int | None = ...) -> UUID: ...
def uuid3(namespace: UUID, name: str) -> UUID: ...
def uuid4() -> UUID: ...

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import ReadableBuffer, Self
from _typeshed import ReadableBuffer, Self, Unused
from typing import IO, Any, BinaryIO, NamedTuple, NoReturn, overload
from typing_extensions import Literal, TypeAlias
@@ -25,7 +25,7 @@ class _wave_params(NamedTuple):
class Wave_read:
def __init__(self, f: _File) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def getfp(self) -> BinaryIO | None: ...
def rewind(self) -> None: ...
def close(self) -> None: ...
@@ -45,7 +45,7 @@ class Wave_read:
class Wave_write:
def __init__(self, f: _File) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, *args: object) -> None: ...
def __exit__(self, *args: Unused) -> None: ...
def setnchannels(self, nchannels: int) -> None: ...
def getnchannels(self) -> int: ...
def setsampwidth(self, sampwidth: int) -> None: ...

View File

@@ -1,4 +1,4 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, Unused
from typing import Any, NoReturn
from typing_extensions import Literal, TypeAlias
from urllib.request import OpenerDirector
@@ -66,7 +66,7 @@ class DOMBuilder:
# `input` and `cnode` argtypes for `parseWithContext` are unknowable
# as the function does nothing with them, and always raises an exception.
# But `input` is *probably* `DOMInputSource`?
def parseWithContext(self, input: object, cnode: object, action: Literal[1, 2, 3, 4]) -> NoReturn: ...
def parseWithContext(self, input: Unused, cnode: Unused, action: Literal[1, 2, 3, 4]) -> NoReturn: ...
class DOMEntityResolver:
def resolveEntity(self, publicId: str | None, systemId: str) -> DOMInputSource: ...
@@ -86,9 +86,8 @@ class DOMBuilderFilter:
FILTER_SKIP: Literal[3]
FILTER_INTERRUPT: Literal[4]
whatToShow: int
# The argtypes for acceptNode and startContainer appear to be irrelevant.
def acceptNode(self, element: object) -> Literal[1]: ...
def startContainer(self, element: object) -> Literal[1]: ...
def acceptNode(self, element: Unused) -> Literal[1]: ...
def startContainer(self, element: Unused) -> Literal[1]: ...
class DocumentLS:
async_: bool
@@ -97,8 +96,8 @@ class DocumentLS:
# so the argtypes of `uri` and `source` are unknowable.
# `source` is *probably* `DOMInputSource`?
# `uri` is *probably* a str? (see DOMBuilder.parseURI())
def load(self, uri: object) -> NoReturn: ...
def loadXML(self, source: object) -> NoReturn: ...
def load(self, uri: Unused) -> NoReturn: ...
def loadXML(self, source: Unused) -> NoReturn: ...
def saveXML(self, snode: Node | None) -> str: ...
class DOMImplementationLS: