From a376da87bdfffc1cd632d659610ef4cc1ed27f01 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Thu, 4 Aug 2022 19:55:18 +0300 Subject: [PATCH] Remove duplicate definitions (#8483) --- stdlib/_compression.pyi | 4 ---- stdlib/_decimal.pyi | 1 - stdlib/_dummy_thread.pyi | 1 - stdlib/_markupbase.pyi | 1 - stdlib/_threading_local.pyi | 2 -- stdlib/_weakrefset.pyi | 3 --- stdlib/argparse.pyi | 1 - stdlib/array.pyi | 2 -- stdlib/asynchat.pyi | 7 ------- stdlib/asyncio/base_subprocess.pyi | 14 +------------- stdlib/asyncio/events.pyi | 2 -- stdlib/asyncio/locks.pyi | 6 +----- stdlib/asyncio/proactor_events.pyi | 27 ++------------------------- stdlib/asyncio/sslproto.pyi | 15 --------------- stdlib/asyncio/streams.pyi | 4 ---- stdlib/asyncio/subprocess.pyi | 3 --- stdlib/asyncio/tasks.pyi | 4 ---- stdlib/asyncio/transports.pyi | 3 --- stdlib/asyncio/unix_events.pyi | 3 --- stdlib/asyncore.pyi | 2 -- 20 files changed, 4 insertions(+), 101 deletions(-) diff --git a/stdlib/_compression.pyi b/stdlib/_compression.pyi index ec3c7fe70856..7047a7bcd325 100644 --- a/stdlib/_compression.pyi +++ b/stdlib/_compression.pyi @@ -20,10 +20,6 @@ class DecompressReader(RawIOBase): trailing_error: type[Exception] | tuple[type[Exception], ...] = ..., **decomp_args: Any, ) -> None: ... - def readable(self) -> bool: ... - def close(self) -> None: ... - def seekable(self) -> bool: ... def readinto(self, b: WriteableBuffer) -> int: ... def read(self, size: int = ...) -> bytes: ... def seek(self, offset: int, whence: int = ...) -> int: ... - def tell(self) -> int: ... diff --git a/stdlib/_decimal.pyi b/stdlib/_decimal.pyi index 71dff44658be..9980ce8899aa 100644 --- a/stdlib/_decimal.pyi +++ b/stdlib/_decimal.pyi @@ -201,7 +201,6 @@ class Context: ) -> None: ... # __setattr__() only allows to set a specific set of attributes, # already defined above. - def __delattr__(self, __name: str) -> None: ... def __reduce__(self: Self) -> tuple[type[Self], tuple[Any, ...]]: ... def clear_flags(self) -> None: ... def clear_traps(self) -> None: ... diff --git a/stdlib/_dummy_thread.pyi b/stdlib/_dummy_thread.pyi index 463399ca43db..ff16b1d3dcf4 100644 --- a/stdlib/_dummy_thread.pyi +++ b/stdlib/_dummy_thread.pyi @@ -15,7 +15,6 @@ def stack_size(size: int | None = ...) -> int: ... class LockType: locked_status: bool - def __init__(self) -> None: ... def acquire(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ... def __enter__(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ... def __exit__(self, typ: type[BaseException] | None, val: BaseException | None, tb: TracebackType | None) -> None: ... diff --git a/stdlib/_markupbase.pyi b/stdlib/_markupbase.pyi index 2c497f65bb43..7d2a39a7aaea 100644 --- a/stdlib/_markupbase.pyi +++ b/stdlib/_markupbase.pyi @@ -2,7 +2,6 @@ import sys from typing import Any class ParserBase: - def __init__(self) -> None: ... def reset(self) -> None: ... def getpos(self) -> tuple[int, int]: ... def unknown_decl(self, data: str) -> None: ... diff --git a/stdlib/_threading_local.pyi b/stdlib/_threading_local.pyi index 17ce1fe349fe..d455ce09227e 100644 --- a/stdlib/_threading_local.pyi +++ b/stdlib/_threading_local.pyi @@ -8,11 +8,9 @@ _LocalDict: TypeAlias = dict[Any, Any] class _localimpl: key: str dicts: dict[int, tuple[ReferenceType[Any], _LocalDict]] - def __init__(self) -> None: ... def get_dict(self) -> _LocalDict: ... def create_dict(self) -> _LocalDict: ... class local: def __getattribute__(self, name: str) -> Any: ... def __setattr__(self, name: str, value: Any) -> None: ... - def __delattr__(self, name: str) -> None: ... diff --git a/stdlib/_weakrefset.pyi b/stdlib/_weakrefset.pyi index 9e9269758b00..e2c7fa0aa987 100644 --- a/stdlib/_weakrefset.pyi +++ b/stdlib/_weakrefset.pyi @@ -17,10 +17,8 @@ class WeakSet(MutableSet[_T], Generic[_T]): @overload def __init__(self, data: Iterable[_T]) -> None: ... def add(self, item: _T) -> None: ... - def clear(self) -> None: ... def discard(self, item: _T) -> None: ... def copy(self: Self) -> Self: ... - def pop(self) -> _T: ... def remove(self, item: _T) -> None: ... def update(self, other: Iterable[_T]) -> None: ... def __contains__(self, item: object) -> bool: ... @@ -41,7 +39,6 @@ class WeakSet(MutableSet[_T], Generic[_T]): def issuperset(self, other: Iterable[_T]) -> bool: ... def __ge__(self, other: Iterable[_T]) -> bool: ... def __gt__(self, other: Iterable[_T]) -> bool: ... - def __eq__(self, other: object) -> bool: ... def symmetric_difference(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... def __xor__(self, other: Iterable[_S]) -> WeakSet[_S | _T]: ... def symmetric_difference_update(self, other: Iterable[_T]) -> None: ... diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 1b86a4e10cbb..70b89334dab4 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -330,7 +330,6 @@ class Namespace(_AttributeHolder): def __getattr__(self, name: str) -> Any: ... def __setattr__(self, __name: str, __value: Any) -> None: ... def __contains__(self, key: str) -> bool: ... - def __eq__(self, other: object) -> bool: ... class FileType: # undocumented diff --git a/stdlib/array.pyi b/stdlib/array.pyi index 4797bd067008..2d27cd72e8df 100644 --- a/stdlib/array.pyi +++ b/stdlib/array.pyi @@ -47,7 +47,6 @@ class array(MutableSequence[_T], Generic[_T]): def insert(self, __i: int, __v: _T) -> None: ... def pop(self, __i: int = ...) -> _T: ... def remove(self, __v: _T) -> None: ... - def reverse(self) -> None: ... def tobytes(self) -> bytes: ... def tofile(self, __f: SupportsWrite[bytes]) -> None: ... def tolist(self) -> list[_T]: ... @@ -56,7 +55,6 @@ class array(MutableSequence[_T], Generic[_T]): def fromstring(self, __buffer: bytes) -> None: ... def tostring(self) -> bytes: ... - def __contains__(self, __key: object) -> bool: ... def __len__(self) -> int: ... @overload def __getitem__(self, __i: SupportsIndex) -> _T: ... diff --git a/stdlib/asynchat.pyi b/stdlib/asynchat.pyi index 57254eef13fd..4d43b02c056c 100644 --- a/stdlib/asynchat.pyi +++ b/stdlib/asynchat.pyi @@ -1,5 +1,4 @@ import asyncore -import socket from abc import abstractmethod class simple_producer: @@ -9,20 +8,14 @@ class simple_producer: class async_chat(asyncore.dispatcher): ac_in_buffer_size: int ac_out_buffer_size: int - def __init__(self, sock: socket.socket | None = ..., map: asyncore._MapType | None = ...) -> None: ... @abstractmethod def collect_incoming_data(self, data: bytes) -> None: ... @abstractmethod def found_terminator(self) -> None: ... def set_terminator(self, term: bytes | int | None) -> None: ... def get_terminator(self) -> bytes | int | None: ... - def handle_read(self) -> None: ... - def handle_write(self) -> None: ... - def handle_close(self) -> None: ... def push(self, data: bytes) -> None: ... def push_with_producer(self, producer: simple_producer) -> None: ... - def readable(self) -> bool: ... - def writable(self) -> bool: ... def close_when_done(self) -> None: ... def initiate_send(self) -> None: ... def discard_buffers(self) -> None: ... diff --git a/stdlib/asyncio/base_subprocess.pyi b/stdlib/asyncio/base_subprocess.pyi index 44606b6d137c..d3ab16a3edd2 100644 --- a/stdlib/asyncio/base_subprocess.pyi +++ b/stdlib/asyncio/base_subprocess.pyi @@ -44,17 +44,10 @@ class BaseSubprocessTransport(transports.SubprocessTransport): bufsize: int, **kwargs: Any, ) -> None: ... # undocumented - def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ... - def get_protocol(self) -> protocols.BaseProtocol: ... - def is_closing(self) -> bool: ... - def close(self) -> None: ... def get_pid(self) -> int | None: ... # type: ignore[override] - def get_returncode(self) -> int | None: ... def get_pipe_transport(self, fd: int) -> _File: ... # type: ignore[override] def _check_proc(self) -> None: ... # undocumented def send_signal(self, signal: int) -> None: ... # type: ignore[override] - def terminate(self) -> None: ... - def kill(self) -> None: ... async def _connect_pipes(self, waiter: futures.Future[Any] | None) -> None: ... # undocumented def _call(self, cb: Callable[..., object], *data: Any) -> None: ... # undocumented def _pipe_connection_lost(self, fd: int, exc: BaseException | None) -> None: ... # undocumented @@ -66,10 +59,5 @@ class BaseSubprocessTransport(transports.SubprocessTransport): class WriteSubprocessPipeProto(protocols.BaseProtocol): # undocumented def __init__(self, proc: BaseSubprocessTransport, fd: int) -> None: ... - def connection_made(self, transport: transports.BaseTransport) -> None: ... - def connection_lost(self, exc: BaseException | None) -> None: ... - def pause_writing(self) -> None: ... - def resume_writing(self) -> None: ... -class ReadSubprocessPipeProto(WriteSubprocessPipeProto, protocols.Protocol): # undocumented - def data_received(self, data: bytes) -> None: ... +class ReadSubprocessPipeProto(WriteSubprocessPipeProto, protocols.Protocol): ... # undocumented diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index 0eeebbc3ab8f..643726b9975a 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -91,7 +91,6 @@ class TimerHandle(Handle): def __le__(self, other: TimerHandle) -> bool: ... def __gt__(self, other: TimerHandle) -> bool: ... def __ge__(self, other: TimerHandle) -> bool: ... - def __eq__(self, other: object) -> bool: ... class AbstractServer: @abstractmethod @@ -612,7 +611,6 @@ class AbstractEventLoopPolicy: def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ... class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy, metaclass=ABCMeta): - def __init__(self) -> None: ... def get_event_loop(self) -> AbstractEventLoop: ... def set_event_loop(self, loop: AbstractEventLoop | None) -> None: ... def new_event_loop(self) -> AbstractEventLoop: ... diff --git a/stdlib/asyncio/locks.pyi b/stdlib/asyncio/locks.pyi index 61f8a81dedc7..a5cdf9aa1184 100644 --- a/stdlib/asyncio/locks.pyi +++ b/stdlib/asyncio/locks.pyi @@ -92,11 +92,7 @@ class Semaphore(_ContextManagerMixin): def release(self) -> None: ... def _wake_up_next(self) -> None: ... -class BoundedSemaphore(Semaphore): - if sys.version_info >= (3, 11): - def __init__(self, value: int = ...) -> None: ... - else: - def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ... +class BoundedSemaphore(Semaphore): ... if sys.version_info >= (3, 11): class _BarrierState(enum.Enum): # undocumented diff --git a/stdlib/asyncio/proactor_events.pyi b/stdlib/asyncio/proactor_events.pyi index 665a885a1773..db88661a1b57 100644 --- a/stdlib/asyncio/proactor_events.pyi +++ b/stdlib/asyncio/proactor_events.pyi @@ -29,8 +29,6 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTr else: def __del__(self) -> None: ... - def get_write_buffer_size(self) -> int: ... - class _ProactorReadPipeTransport(_ProactorBasePipeTransport, transports.ReadTransport): if sys.version_info >= (3, 10): def __init__( @@ -54,28 +52,8 @@ class _ProactorReadPipeTransport(_ProactorBasePipeTransport, transports.ReadTran server: events.AbstractServer | None = ..., ) -> None: ... -class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport, transports.WriteTransport): - def __init__( - self, - loop: events.AbstractEventLoop, - sock: socket, - protocol: streams.StreamReaderProtocol, - waiter: futures.Future[Any] | None = ..., - extra: Mapping[Any, Any] | None = ..., - server: events.AbstractServer | None = ..., - ) -> None: ... - -class _ProactorWritePipeTransport(_ProactorBaseWritePipeTransport): - def __init__( - self, - loop: events.AbstractEventLoop, - sock: socket, - protocol: streams.StreamReaderProtocol, - waiter: futures.Future[Any] | None = ..., - extra: Mapping[Any, Any] | None = ..., - server: events.AbstractServer | None = ..., - ) -> None: ... - +class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport, transports.WriteTransport): ... +class _ProactorWritePipeTransport(_ProactorBaseWritePipeTransport): ... class _ProactorDuplexPipeTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): ... class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): @@ -92,7 +70,6 @@ class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePip ) -> None: ... def _set_extra(self, sock: socket) -> None: ... def can_write_eof(self) -> Literal[True]: ... - def write_eof(self) -> None: ... class BaseProactorEventLoop(base_events.BaseEventLoop): def __init__(self, proactor: Any) -> None: ... diff --git a/stdlib/asyncio/sslproto.pyi b/stdlib/asyncio/sslproto.pyi index 34414d649297..3bb4db69c123 100644 --- a/stdlib/asyncio/sslproto.pyi +++ b/stdlib/asyncio/sslproto.pyi @@ -72,20 +72,10 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport): _closed: bool def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol) -> None: ... def get_extra_info(self, name: str, default: Any | None = ...) -> dict[str, Any]: ... - def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ... - def get_protocol(self) -> protocols.BaseProtocol: ... - def is_closing(self) -> bool: ... - def close(self) -> None: ... - def is_reading(self) -> bool: ... - def pause_reading(self) -> None: ... - def resume_reading(self) -> None: ... - def set_write_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ... - def get_write_buffer_size(self) -> int: ... @property def _protocol_paused(self) -> bool: ... def write(self, data: bytes) -> None: ... def can_write_eof(self) -> Literal[False]: ... - def abort(self) -> None: ... if sys.version_info >= (3, 11): def get_write_buffer_limits(self) -> tuple[int, int]: ... def get_read_buffer_limits(self) -> tuple[int, int]: ... @@ -149,10 +139,7 @@ class SSLProtocol(_SSLProtocolBase): def _set_app_protocol(self, app_protocol: protocols.BaseProtocol) -> None: ... def _wakeup_waiter(self, exc: BaseException | None = ...) -> None: ... - def connection_made(self, transport: transports.BaseTransport) -> None: ... def connection_lost(self, exc: BaseException | None) -> None: ... - def pause_writing(self) -> None: ... - def resume_writing(self) -> None: ... def eof_received(self) -> None: ... def _get_extra_info(self, name: str, default: Any | None = ...) -> Any: ... def _start_shutdown(self) -> None: ... @@ -167,9 +154,7 @@ class SSLProtocol(_SSLProtocolBase): def _fatal_error(self, exc: BaseException, message: str = ...) -> None: ... def _abort(self) -> None: ... if sys.version_info >= (3, 11): - def buffer_updated(self, nbytes: int) -> None: ... def get_buffer(self, n: int) -> memoryview: ... else: def _finalize(self) -> None: ... def _process_write_backlog(self) -> None: ... - def data_received(self, data: bytes) -> None: ... diff --git a/stdlib/asyncio/streams.pyi b/stdlib/asyncio/streams.pyi index 5bf2d3620dbe..139d86b292c3 100644 --- a/stdlib/asyncio/streams.pyi +++ b/stdlib/asyncio/streams.pyi @@ -128,10 +128,6 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol): client_connected_cb: _ClientConnectedCallback | None = ..., loop: events.AbstractEventLoop | None = ..., ) -> None: ... - def connection_made(self, transport: transports.BaseTransport) -> None: ... - def connection_lost(self, exc: Exception | None) -> None: ... - def data_received(self, data: bytes) -> None: ... - def eof_received(self) -> bool: ... class StreamWriter: def __init__( diff --git a/stdlib/asyncio/subprocess.pyi b/stdlib/asyncio/subprocess.pyi index 5b62c20bd07f..32fcf1a65491 100644 --- a/stdlib/asyncio/subprocess.pyi +++ b/stdlib/asyncio/subprocess.pyi @@ -22,10 +22,7 @@ class SubprocessStreamProtocol(streams.FlowControlMixin, protocols.SubprocessPro stdout: streams.StreamReader | None stderr: streams.StreamReader | None def __init__(self, limit: int, loop: events.AbstractEventLoop) -> None: ... - def connection_made(self, transport: transports.BaseTransport) -> None: ... def pipe_data_received(self, fd: int, data: bytes | str) -> None: ... - def pipe_connection_lost(self, fd: int, exc: Exception | None) -> None: ... - def process_exited(self) -> None: ... class Process: stdin: streams.StreamWriter | None diff --git a/stdlib/asyncio/tasks.pyi b/stdlib/asyncio/tasks.pyi index d919a0299b99..76755f1109c3 100644 --- a/stdlib/asyncio/tasks.pyi +++ b/stdlib/asyncio/tasks.pyi @@ -285,10 +285,6 @@ class Task(Future[_T], Generic[_T]): def get_stack(self, *, limit: int | None = ...) -> list[FrameType]: ... def print_stack(self, *, limit: int | None = ..., file: TextIO | None = ...) -> None: ... - if sys.version_info >= (3, 9): - def cancel(self, msg: Any | None = ...) -> bool: ... - else: - def cancel(self) -> bool: ... if sys.version_info >= (3, 11): def cancelling(self) -> int: ... def uncancel(self) -> int: ... diff --git a/stdlib/asyncio/transports.pyi b/stdlib/asyncio/transports.pyi index be68cad5f894..52937c9bcbdf 100644 --- a/stdlib/asyncio/transports.pyi +++ b/stdlib/asyncio/transports.pyi @@ -45,6 +45,3 @@ class SubprocessTransport(BaseTransport): class _FlowControlMixin(Transport): def __init__(self, extra: Mapping[Any, Any] | None = ..., loop: AbstractEventLoop | None = ...) -> None: ... - def set_write_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ... - def get_write_buffer_size(self) -> int: ... - def get_write_buffer_limits(self) -> tuple[int, int]: ... diff --git a/stdlib/asyncio/unix_events.pyi b/stdlib/asyncio/unix_events.pyi index 54e663ece192..f63011a373be 100644 --- a/stdlib/asyncio/unix_events.pyi +++ b/stdlib/asyncio/unix_events.pyi @@ -57,7 +57,6 @@ if sys.platform != "win32": # Doesn't actually have ABCMeta metaclass at runtime, but mypy complains if we don't have it in the stub. # See discussion in #7412 class BaseChildWatcher(AbstractChildWatcher, metaclass=ABCMeta): - def __init__(self) -> None: ... def close(self) -> None: ... if sys.version_info >= (3, 8): def is_active(self) -> bool: ... @@ -95,7 +94,6 @@ if sys.platform != "win32": ) -> object: ... class MultiLoopChildWatcher(AbstractChildWatcher): - def __init__(self) -> None: ... def is_active(self) -> bool: ... def close(self) -> None: ... def __enter__(self: Self) -> Self: ... @@ -107,7 +105,6 @@ if sys.platform != "win32": def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... class ThreadedChildWatcher(AbstractChildWatcher): - def __init__(self) -> None: ... def is_active(self) -> Literal[True]: ... def close(self) -> None: ... def __enter__(self: Self) -> Self: ... diff --git a/stdlib/asyncore.pyi b/stdlib/asyncore.pyi index 8c3e03bc3eff..0025ec3f9b4e 100644 --- a/stdlib/asyncore.pyi +++ b/stdlib/asyncore.pyi @@ -63,9 +63,7 @@ class dispatcher: def handle_close(self) -> None: ... class dispatcher_with_send(dispatcher): - def __init__(self, sock: socket | None = ..., map: _MapType | None = ...) -> None: ... def initiate_send(self) -> None: ... - def handle_write(self) -> None: ... # incompatible signature: # def send(self, data: bytes) -> int | None: ...