Skip to content

Commit 380022c

Browse files
authored
Remove empty __init__ methods (#8816)
1 parent deff426 commit 380022c

33 files changed

+1
-44
lines changed

stdlib/_dummy_threading.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ class Thread:
8686
class _DummyThread(Thread): ...
8787

8888
class Lock:
89-
def __init__(self) -> None: ...
9089
def __enter__(self) -> bool: ...
9190
def __exit__(
9291
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
@@ -96,7 +95,6 @@ class Lock:
9695
def locked(self) -> bool: ...
9796

9897
class _RLock:
99-
def __init__(self) -> None: ...
10098
def __enter__(self) -> bool: ...
10199
def __exit__(
102100
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
@@ -135,7 +133,6 @@ class Semaphore:
135133
class BoundedSemaphore(Semaphore): ...
136134

137135
class Event:
138-
def __init__(self) -> None: ...
139136
def is_set(self) -> bool: ...
140137
def set(self) -> None: ...
141138
def clear(self) -> None: ...

stdlib/asyncio/taskgroups.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ __all__ = ["TaskGroup"]
1313
_T = TypeVar("_T")
1414

1515
class TaskGroup:
16-
def __init__(self) -> None: ...
1716
async def __aenter__(self: Self) -> Self: ...
1817
async def __aexit__(self, et: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ...
1918
def create_task(

stdlib/asyncio/unix_events.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ if sys.platform != "win32":
118118

119119
if sys.version_info >= (3, 9):
120120
class PidfdChildWatcher(AbstractChildWatcher):
121-
def __init__(self) -> None: ...
122121
def __enter__(self: Self) -> Self: ...
123122
def __exit__(
124123
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None

stdlib/binhex.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ LINELEN: Literal[64]
1010
RUNCHAR: Literal[b"\x90"]
1111

1212
class FInfo:
13-
def __init__(self) -> None: ...
1413
Type: str
1514
Creator: str
1615
Flags: int

stdlib/codeop.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ def compile_command(source: str, filename: str = ..., symbol: str = ...) -> Code
66

77
class Compile:
88
flags: int
9-
def __init__(self) -> None: ...
109
def __call__(self, source: str, filename: str, symbol: str) -> CodeType: ...
1110

1211
class CommandCompiler:
1312
compiler: Compile
14-
def __init__(self) -> None: ...
1513
def __call__(self, source: str, filename: str = ..., symbol: str = ...) -> CodeType | None: ...

stdlib/concurrent/futures/_base.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ _T = TypeVar("_T")
3535
_P = ParamSpec("_P")
3636

3737
class Future(Generic[_T]):
38-
def __init__(self) -> None: ...
3938
def cancel(self) -> bool: ...
4039
def cancelled(self) -> bool: ...
4140
def running(self) -> bool: ...
@@ -90,14 +89,12 @@ def wait(fs: Iterable[Future[_T]], timeout: float | None = ..., return_when: str
9089
class _Waiter:
9190
event: threading.Event
9291
finished_futures: list[Future[Any]]
93-
def __init__(self) -> None: ...
9492
def add_result(self, future: Future[Any]) -> None: ...
9593
def add_exception(self, future: Future[Any]) -> None: ...
9694
def add_cancelled(self, future: Future[Any]) -> None: ...
9795

9896
class _AsCompletedWaiter(_Waiter):
9997
lock: threading.Lock
100-
def __init__(self) -> None: ...
10198

10299
class _FirstCompletedWaiter(_Waiter): ...
103100

stdlib/concurrent/futures/process.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class _ThreadWakeup:
1919
_closed: bool
2020
_reader: Connection
2121
_writer: Connection
22-
def __init__(self) -> None: ...
2322
def close(self) -> None: ...
2423
def wakeup(self) -> None: ...
2524
def clear(self) -> None: ...

stdlib/contextlib.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ class redirect_stderr(_RedirectStream[_T_io]): ...
137137
# In reality this is a subclass of `AbstractContextManager`;
138138
# see #7961 for why we don't do that in the stub
139139
class ExitStack(metaclass=abc.ABCMeta):
140-
def __init__(self) -> None: ...
141140
def enter_context(self, cm: AbstractContextManager[_T]) -> _T: ...
142141
def push(self, exit: _CM_EF) -> _CM_EF: ...
143142
def callback(self, __callback: Callable[_P, _T], *args: _P.args, **kwds: _P.kwargs) -> Callable[_P, _T]: ...
@@ -156,7 +155,6 @@ _ACM_EF = TypeVar("_ACM_EF", bound=AbstractAsyncContextManager[Any] | _ExitCoroF
156155
# In reality this is a subclass of `AbstractAsyncContextManager`;
157156
# see #7961 for why we don't do that in the stub
158157
class AsyncExitStack(metaclass=abc.ABCMeta):
159-
def __init__(self) -> None: ...
160158
def enter_context(self, cm: AbstractContextManager[_T]) -> _T: ...
161159
async def enter_async_context(self, cm: AbstractAsyncContextManager[_T]) -> _T: ...
162160
def push(self, exit: _CM_EF) -> _CM_EF: ...

stdlib/csv.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,5 @@ class DictWriter(Generic[_T]):
146146

147147
class Sniffer:
148148
preferred: list[str]
149-
def __init__(self) -> None: ...
150149
def sniff(self, sample: str, delimiters: str | None = ...) -> type[Dialect]: ...
151150
def has_header(self, sample: str) -> bool: ...

stdlib/email/contentmanager.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ from email.message import Message
33
from typing import Any
44

55
class ContentManager:
6-
def __init__(self) -> None: ...
76
def get_content(self, msg: Message, *args: Any, **kw: Any) -> Any: ...
87
def set_content(self, msg: Message, obj: Any, *args: Any, **kw: Any) -> Any: ...
98
def add_get_handler(self, key: str, handler: Callable[..., Any]) -> None: ...

stdlib/formatter.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class AbstractFormatter:
6464
def assert_line_data(self, flag: int = ...) -> None: ...
6565

6666
class NullWriter:
67-
def __init__(self) -> None: ...
6867
def flush(self) -> None: ...
6968
def new_alignment(self, align: str | None) -> None: ...
7069
def new_font(self, font: _FontType) -> None: ...

stdlib/lib2to3/pgen2/grammar.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class Grammar:
1515
tokens: dict[int, int]
1616
symbol2label: dict[str, int]
1717
start: int
18-
def __init__(self) -> None: ...
1918
def dump(self, filename: StrPath) -> None: ...
2019
def load(self, filename: StrPath) -> None: ...
2120
def copy(self: Self) -> Self: ...

stdlib/lib2to3/pgen2/pgen.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class ParserGenerator:
3232

3333
class NFAState:
3434
arcs: list[tuple[str | None, NFAState]]
35-
def __init__(self) -> None: ...
3635
def addarc(self, next: NFAState, label: str | None = ...) -> None: ...
3736

3837
class DFAState:

stdlib/lib2to3/pgen2/tokenize.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ class Untokenizer:
8787
tokens: list[str]
8888
prev_row: int
8989
prev_col: int
90-
def __init__(self) -> None: ...
9190
def add_whitespace(self, start: _Coord) -> None: ...
9291
def untokenize(self, iterable: Iterable[_TokenInfo]) -> str: ...
9392
def compat(self, token: tuple[int, str], iterable: Iterable[_TokenInfo]) -> None: ...

stdlib/logging/__init__.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ _nameToLevel: dict[str, int]
8181

8282
class Filterer:
8383
filters: list[Filter]
84-
def __init__(self) -> None: ...
8584
def addFilter(self, filter: _FilterType) -> None: ...
8685
def removeFilter(self, filter: _FilterType) -> None: ...
8786
def filter(self, record: LogRecord) -> bool: ...

stdlib/multiprocessing/forkserver.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ MAXFDS_TO_SEND: int
99
SIGNED_STRUCT: Struct
1010

1111
class ForkServer:
12-
def __init__(self) -> None: ...
1312
def set_forkserver_preload(self, modules_names: list[str]) -> None: ...
1413
def get_inherited_fds(self) -> list[int] | None: ...
1514
def connect_to_new_process(self, fds: Sequence[int]) -> tuple[int, int]: ...

stdlib/multiprocessing/resource_tracker.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ from collections.abc import Sized
44
__all__ = ["ensure_running", "register", "unregister"]
55

66
class ResourceTracker:
7-
def __init__(self) -> None: ...
87
def getfd(self) -> int | None: ...
98
def ensure_running(self) -> None: ...
109
def register(self, name: Sized, rtype: Incomplete) -> None: ...

stdlib/multiprocessing/util.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,10 @@ def is_exiting() -> bool: ...
6969
class ForkAwareThreadLock:
7070
acquire: Callable[[bool, float], bool]
7171
release: Callable[[], None]
72-
def __init__(self) -> None: ...
7372
def __enter__(self) -> bool: ...
7473
def __exit__(self, *args: object) -> None: ...
7574

76-
class ForkAwareLocal(threading.local):
77-
def __init__(self) -> None: ...
75+
class ForkAwareLocal(threading.local): ...
7876

7977
MAXFD: int
8078

stdlib/pipes.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import os
33
__all__ = ["Template"]
44

55
class Template:
6-
def __init__(self) -> None: ...
76
def reset(self) -> None: ...
87
def clone(self) -> Template: ...
98
def debug(self, flag: bool) -> None: ...

stdlib/pydoc.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ class Doc:
6060
def getdocloc(self, object: object, basedir: str = ...) -> str | None: ...
6161

6262
class HTMLRepr(Repr):
63-
def __init__(self) -> None: ...
6463
def escape(self, text: str) -> str: ...
6564
def repr(self, object: object) -> str: ...
6665
def repr1(self, x: object, level: complex) -> str: ...
@@ -148,7 +147,6 @@ class HTMLDoc(Doc):
148147
def filelink(self, url: str, path: str) -> str: ...
149148

150149
class TextRepr(Repr):
151-
def __init__(self) -> None: ...
152150
def repr1(self, x: object, level: complex) -> str: ...
153151
def repr_string(self, x: str, level: complex) -> str: ...
154152
def repr_str(self, x: str, level: complex) -> str: ...

stdlib/reprlib.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class Repr:
2222
maxlong: int
2323
maxstring: int
2424
maxother: int
25-
def __init__(self) -> None: ...
2625
def repr(self, x: Any) -> str: ...
2726
def repr1(self, x: Any, level: int) -> str: ...
2827
def repr_tuple(self, x: tuple[Any, ...], level: int) -> str: ...

stdlib/select.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ if sys.platform != "win32":
2121
POLLWRNORM: int
2222

2323
class poll:
24-
def __init__(self) -> None: ...
2524
def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ...
2625
def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ...
2726
def unregister(self, fd: FileDescriptorLike) -> None: ...

stdlib/sre_parse.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class _State:
2727
groupdict: dict[str, int]
2828
groupwidths: list[int | None]
2929
lookbehindgroups: int | None
30-
def __init__(self) -> None: ...
3130
@property
3231
def groups(self) -> int: ...
3332
def opengroup(self, name: str | None = ...) -> int: ...

stdlib/symtable.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,5 @@ class Symbol:
5959
def get_namespace(self) -> SymbolTable: ...
6060

6161
class SymbolTableFactory:
62-
def __init__(self) -> None: ...
6362
def new(self, table: Any, filename: str) -> SymbolTable: ...
6463
def __call__(self, table: Any, filename: str) -> SymbolTable: ...

stdlib/threading.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ class _DummyThread(Thread):
102102
def __init__(self) -> None: ...
103103

104104
class Lock:
105-
def __init__(self) -> None: ...
106105
def __enter__(self) -> bool: ...
107106
def __exit__(
108107
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
@@ -112,7 +111,6 @@ class Lock:
112111
def locked(self) -> bool: ...
113112

114113
class _RLock:
115-
def __init__(self) -> None: ...
116114
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
117115
def release(self) -> None: ...
118116
__enter__ = acquire
@@ -148,7 +146,6 @@ class Semaphore:
148146
class BoundedSemaphore(Semaphore): ...
149147

150148
class Event:
151-
def __init__(self) -> None: ...
152149
def is_set(self) -> bool: ...
153150
def isSet(self) -> bool: ... # deprecated alias for is_set()
154151
def set(self) -> None: ...

stdlib/tokenize.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ class Untokenizer:
115115
prev_row: int
116116
prev_col: int
117117
encoding: str | None
118-
def __init__(self) -> None: ...
119118
def add_whitespace(self, start: _Position) -> None: ...
120119
def untokenize(self, iterable: Iterable[_Token]) -> str: ...
121120
def compat(self, token: Sequence[int | str], iterable: Iterable[_Token]) -> None: ...

stdlib/traceback.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ def walk_tb(tb: TracebackType | None) -> Iterator[tuple[FrameType, int]]: ...
9898

9999
if sys.version_info >= (3, 11):
100100
class _ExceptionPrintContext:
101-
def __init__(self) -> None: ...
102101
def indent(self) -> str: ...
103102
def emit(self, text_gen: str | Iterable[str], margin_char: str | None = ...) -> Generator[str, None, None]: ...
104103

stdlib/unittest/mock.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class _SentinelObject:
5555
def __init__(self, name: Any) -> None: ...
5656

5757
class _Sentinel:
58-
def __init__(self) -> None: ...
5958
def __getattr__(self, name: str) -> Any: ...
6059

6160
sentinel: Any

stdlib/xdrlib.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class Error(Exception):
1212
class ConversionError(Error): ...
1313

1414
class Packer:
15-
def __init__(self) -> None: ...
1615
def reset(self) -> None: ...
1716
def get_buffer(self) -> bytes: ...
1817
def get_buf(self) -> bytes: ...

stdlib/xml/dom/xmlbuilder.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class DOMBuilder:
5656
ACTION_APPEND_AS_CHILDREN: Literal[2]
5757
ACTION_INSERT_AFTER: Literal[3]
5858
ACTION_INSERT_BEFORE: Literal[4]
59-
def __init__(self) -> None: ...
6059
def setFeature(self, name: str, state: int) -> None: ...
6160
def supportsFeature(self, name: str) -> bool: ...
6261
def canSetFeature(self, name: str, state: int) -> bool: ...

stdlib/xml/sax/handler.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class ErrorHandler:
99
def warning(self, exception: BaseException) -> None: ...
1010

1111
class ContentHandler:
12-
def __init__(self) -> None: ...
1312
def setDocumentLocator(self, locator): ...
1413
def startDocument(self): ...
1514
def endDocument(self): ...

stdlib/xml/sax/xmlreader.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from collections.abc import Mapping
22

33
class XMLReader:
4-
def __init__(self) -> None: ...
54
def parse(self, source): ...
65
def getContentHandler(self): ...
76
def setContentHandler(self, handler): ...

stdlib/xmlrpc/server.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ class XMLRPCDocGenerator: # undocumented
127127
server_name: str
128128
server_documentation: str
129129
server_title: str
130-
def __init__(self) -> None: ...
131130
def set_server_title(self, server_title: str) -> None: ...
132131
def set_server_name(self, server_name: str) -> None: ...
133132
def set_server_documentation(self, server_documentation: str) -> None: ...

0 commit comments

Comments
 (0)