Skip to content

Commit

Permalink
Remove duplicate definitions (#8483)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Aug 4, 2022
1 parent 103c2f3 commit a376da8
Show file tree
Hide file tree
Showing 20 changed files with 4 additions and 101 deletions.
4 changes: 0 additions & 4 deletions stdlib/_compression.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
1 change: 0 additions & 1 deletion stdlib/_decimal.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
1 change: 0 additions & 1 deletion stdlib/_dummy_thread.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
1 change: 0 additions & 1 deletion stdlib/_markupbase.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
2 changes: 0 additions & 2 deletions stdlib/_threading_local.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...

This comment has been minimized.

Copy link
@AlexWaygood

AlexWaygood Aug 5, 2022

Member

This doesn't have the same signature as object.__delattr__: the argument is positional-only on object.__delattr__, but positional-or-keyword on _threading_local. Stubtest doesn't provide any coverage for positional/positional-or-keyword differences with dunder methods.

3 changes: 0 additions & 3 deletions stdlib/_weakrefset.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand All @@ -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: ...
Expand Down
1 change: 0 additions & 1 deletion stdlib/argparse.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions stdlib/array.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]: ...
Expand All @@ -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: ...
Expand Down
7 changes: 0 additions & 7 deletions stdlib/asynchat.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncore
import socket
from abc import abstractmethod

class simple_producer:
Expand All @@ -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: ...
14 changes: 1 addition & 13 deletions stdlib/asyncio/base_subprocess.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 0 additions & 2 deletions stdlib/asyncio/events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: ...
Expand Down
6 changes: 1 addition & 5 deletions stdlib/asyncio/locks.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 2 additions & 25 deletions stdlib/asyncio/proactor_events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand All @@ -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):
Expand All @@ -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: ...
15 changes: 0 additions & 15 deletions stdlib/asyncio/sslproto.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]: ...
Expand Down Expand Up @@ -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: ...
Expand All @@ -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: ...
4 changes: 0 additions & 4 deletions stdlib/asyncio/streams.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down
3 changes: 0 additions & 3 deletions stdlib/asyncio/subprocess.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions stdlib/asyncio/tasks.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
3 changes: 0 additions & 3 deletions stdlib/asyncio/transports.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]: ...
3 changes: 0 additions & 3 deletions stdlib/asyncio/unix_events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down Expand Up @@ -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: ...
Expand All @@ -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: ...
Expand Down
2 changes: 0 additions & 2 deletions stdlib/asyncore.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...

Expand Down

0 comments on commit a376da8

Please sign in to comment.