Skip to content

Commit 505ea72

Browse files
authored
Never explicitly inherit from object in Python 3-only stubs (#6777)
1 parent d43cd99 commit 505ea72

35 files changed

+79
-67
lines changed

stdlib/_dummy_thread.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def get_ident() -> int: ...
99
def allocate_lock() -> LockType: ...
1010
def stack_size(size: int | None = ...) -> int: ...
1111

12-
class LockType(object):
12+
class LockType:
1313
locked_status: bool
1414
def __init__(self) -> None: ...
1515
def acquire(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ...

stdlib/_dummy_threading.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ TIMEOUT_MAX: float
2828

2929
class ThreadError(Exception): ...
3030

31-
class local(object):
31+
class local:
3232
def __getattribute__(self, name: str) -> Any: ...
3333
def __setattr__(self, name: str, value: Any) -> None: ...
3434
def __delattr__(self, name: str) -> None: ...

stdlib/_random.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Actually Tuple[(int,) * 625]
22
_State = tuple[int, ...]
33

4-
class Random(object):
4+
class Random:
55
def __init__(self, seed: object = ...) -> None: ...
66
def seed(self, __n: object = ...) -> None: ...
77
def getstate(self) -> _State: ...

stdlib/builtins.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class classmethod(Generic[_R]): # Special, only valid as a decorator.
138138
__qualname__: str
139139
__wrapped__: Callable[..., _R]
140140

141-
class type(object):
141+
class type:
142142
__base__: type
143143
__bases__: tuple[type, ...]
144144
__basicsize__: int
@@ -173,7 +173,7 @@ class type(object):
173173
def __or__(self, __t: Any) -> types.UnionType: ...
174174
def __ror__(self, __t: Any) -> types.UnionType: ...
175175

176-
class super(object):
176+
class super:
177177
@overload
178178
def __init__(self, __t: Any, __obj: Any) -> None: ...
179179
@overload
@@ -729,7 +729,7 @@ class bool(int):
729729
def __getnewargs__(self) -> tuple[int]: ...
730730

731731
@final
732-
class slice(object):
732+
class slice:
733733
start: Any
734734
step: Any
735735
stop: Any
@@ -951,7 +951,7 @@ class range(Sequence[int]):
951951
def __repr__(self) -> str: ...
952952
def __reversed__(self) -> Iterator[int]: ...
953953

954-
class property(object):
954+
class property:
955955
fget: Callable[[Any], Any] | None
956956
fset: Callable[[Any, Any], None] | None
957957
fdel: Callable[[Any], None] | None
@@ -1500,7 +1500,7 @@ class ellipsis: ...
15001500

15011501
Ellipsis: ellipsis
15021502

1503-
class BaseException(object):
1503+
class BaseException:
15041504
args: tuple[Any, ...]
15051505
__cause__: BaseException | None
15061506
__context__: BaseException | None

stdlib/bz2.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ class BZ2File(BaseStream, IO[bytes]):
128128
def writelines(self, seq: Iterable[ReadableBuffer]) -> None: ...
129129

130130
@final
131-
class BZ2Compressor(object):
131+
class BZ2Compressor:
132132
def __init__(self, compresslevel: int = ...) -> None: ...
133133
def compress(self, __data: bytes) -> bytes: ...
134134
def flush(self) -> bytes: ...
135135

136136
@final
137-
class BZ2Decompressor(object):
137+
class BZ2Decompressor:
138138
def decompress(self, data: bytes, max_length: int = ...) -> bytes: ...
139139
@property
140140
def eof(self) -> bool: ...

stdlib/cgi.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class MiniFieldStorage:
5757

5858
_list = list
5959

60-
class FieldStorage(object):
60+
class FieldStorage:
6161
FieldStorageClass: _type | None
6262
keep_blank_values: int
6363
strict_parsing: int

stdlib/csv.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class DictWriter(Generic[_T]):
100100
def writerow(self, rowdict: Mapping[_T, Any]) -> Any: ...
101101
def writerows(self, rowdicts: Iterable[Mapping[_T, Any]]) -> None: ...
102102

103-
class Sniffer(object):
103+
class Sniffer:
104104
preferred: list[str]
105105
def __init__(self) -> None: ...
106106
def sniff(self, sample: str, delimiters: str | None = ...) -> Type[Dialect]: ...

stdlib/ctypes/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RTLD_GLOBAL: int
2828
RTLD_LOCAL: int
2929
DEFAULT_MODE: int
3030

31-
class CDLL(object):
31+
class CDLL:
3232
_func_flags_: ClassVar[int]
3333
_func_restype_: ClassVar[_CData]
3434
_name: str

stdlib/decimal.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def setcontext(__context: Context) -> None: ...
4949
def getcontext() -> Context: ...
5050
def localcontext(ctx: Context | None = ...) -> _ContextManager: ...
5151

52-
class Decimal(object):
52+
class Decimal:
5353
def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Context | None = ...) -> _DecimalT: ...
5454
@classmethod
5555
def from_float(cls, __f: float) -> Decimal: ...
@@ -151,7 +151,7 @@ class Decimal(object):
151151
def __deepcopy__(self, __memo: Any) -> Decimal: ...
152152
def __format__(self, __specifier: str, __context: Context | None = ...) -> str: ...
153153

154-
class _ContextManager(object):
154+
class _ContextManager:
155155
new_context: Context
156156
saved_context: Context
157157
def __init__(self, new_context: Context) -> None: ...
@@ -160,7 +160,7 @@ class _ContextManager(object):
160160

161161
_TrapType = Type[DecimalException]
162162

163-
class Context(object):
163+
class Context:
164164
prec: int
165165
rounding: str
166166
Emin: int

stdlib/difflib.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def ndiff(
7070
a: Sequence[str], b: Sequence[str], linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ...
7171
) -> Iterator[str]: ...
7272

73-
class HtmlDiff(object):
73+
class HtmlDiff:
7474
def __init__(
7575
self,
7676
tabsize: int = ...,

stdlib/hashlib.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import sys
22
from _typeshed import ReadableBuffer, Self
33
from typing import AbstractSet
44

5-
class _Hash(object):
5+
class _Hash:
66
@property
77
def digest_size(self) -> int: ...
88
@property
@@ -49,7 +49,7 @@ def pbkdf2_hmac(
4949
hash_name: str, password: ReadableBuffer, salt: ReadableBuffer, iterations: int, dklen: int | None = ...
5050
) -> bytes: ...
5151

52-
class _VarLenHash(object):
52+
class _VarLenHash:
5353
digest_size: int
5454
block_size: int
5555
name: str

stdlib/logging/__init__.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ def currentframe() -> FrameType: ...
2727
_levelToName: dict[int, str]
2828
_nameToLevel: dict[str, int]
2929

30-
class Filterer(object):
30+
class Filterer:
3131
filters: list[Filter]
3232
def __init__(self) -> None: ...
3333
def addFilter(self, filter: _FilterType) -> None: ...
3434
def removeFilter(self, filter: _FilterType) -> None: ...
3535
def filter(self, record: LogRecord) -> bool: ...
3636

37-
class Manager(object): # undocumented
37+
class Manager: # undocumented
3838
root: RootLogger
3939
disable: int
4040
emittedNoHandlerWarning: bool
@@ -749,7 +749,7 @@ class RootLogger(Logger):
749749

750750
root: RootLogger
751751

752-
class PercentStyle(object): # undocumented
752+
class PercentStyle: # undocumented
753753
default_format: str
754754
asctime_format: str
755755
asctime_search: str

stdlib/lzma.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ PRESET_EXTREME: int
4141

4242
# from _lzma.c
4343
@final
44-
class LZMADecompressor(object):
44+
class LZMADecompressor:
4545
def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ...
4646
def decompress(self, data: bytes, max_length: int = ...) -> bytes: ...
4747
@property
@@ -55,7 +55,7 @@ class LZMADecompressor(object):
5555

5656
# from _lzma.c
5757
@final
58-
class LZMACompressor(object):
58+
class LZMACompressor:
5959
def __init__(
6060
self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
6161
) -> None: ...

stdlib/multiprocessing/context.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class BufferTooShort(ProcessError): ...
1919
class TimeoutError(ProcessError): ...
2020
class AuthenticationError(ProcessError): ...
2121

22-
class BaseContext(object):
22+
class BaseContext:
2323
Process: Type[BaseProcess]
2424
ProcessError: Type[Exception]
2525
BufferTooShort: Type[Exception]

stdlib/multiprocessing/dummy/connection.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ families: list[None]
77

88
_Address = Union[str, tuple[str, int]]
99

10-
class Connection(object):
10+
class Connection:
1111
_in: Any
1212
_out: Any
1313
recv: Any
@@ -22,7 +22,7 @@ class Connection(object):
2222
def close(self) -> None: ...
2323
def poll(self, timeout: float = ...) -> bool: ...
2424

25-
class Listener(object):
25+
class Listener:
2626
_backlog_queue: Queue[Any] | None
2727
@property
2828
def address(self) -> Queue[Any] | None: ...

stdlib/multiprocessing/managers.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Namespace:
2727

2828
_Namespace = Namespace
2929

30-
class Token(object):
30+
class Token:
3131
typeid: str | bytes | None
3232
address: tuple[str | bytes, int]
3333
id: str | bytes | int | None
@@ -36,7 +36,7 @@ class Token(object):
3636
def __getstate__(self) -> tuple[str | bytes | None, tuple[str | bytes, int], str | bytes | int | None]: ...
3737
def __setstate__(self, state: tuple[str | bytes | None, tuple[str | bytes, int], str | bytes | int | None]) -> None: ...
3838

39-
class BaseProxy(object):
39+
class BaseProxy:
4040
_address_to_local: dict[Any, Any]
4141
_mutex: Any
4242
def __init__(

stdlib/pickletools.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ TAKEN_FROM_ARGUMENT4: int
99
TAKEN_FROM_ARGUMENT4U: int
1010
TAKEN_FROM_ARGUMENT8U: int
1111

12-
class ArgumentDescriptor(object):
12+
class ArgumentDescriptor:
1313
name: str
1414
n: int
1515
reader: _Reader
@@ -106,7 +106,7 @@ def read_long4(f: IO[bytes]) -> int: ...
106106

107107
long4: ArgumentDescriptor
108108

109-
class StackObject(object):
109+
class StackObject:
110110
name: str
111111
obtype: Type[Any] | tuple[Type[Any], ...]
112112
doc: str
@@ -131,7 +131,7 @@ anyobject: StackObject
131131
markobject: StackObject
132132
stackslice: StackObject
133133

134-
class OpcodeInfo(object):
134+
class OpcodeInfo:
135135
name: str
136136
code: str
137137
arg: ArgumentDescriptor | None

stdlib/pyexpat/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ XML_PARAM_ENTITY_PARSING_ALWAYS: int
2323
_Model = tuple[int, int, Optional[str], tuple[Any, ...]]
2424

2525
@final
26-
class XMLParserType(object):
26+
class XMLParserType:
2727
def Parse(self, __data: str | bytes, __isfinal: bool = ...) -> int: ...
2828
def ParseFile(self, __file: SupportsRead[bytes]) -> int: ...
2929
def SetBase(self, __base: str) -> None: ...

stdlib/select.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ error = OSError
3333

3434
if sys.platform != "linux" and sys.platform != "win32":
3535
# BSD only
36-
class kevent(object):
36+
class kevent:
3737
data: Any
3838
fflags: int
3939
filter: int
@@ -50,7 +50,7 @@ if sys.platform != "linux" and sys.platform != "win32":
5050
udata: Any = ...,
5151
) -> None: ...
5252
# BSD only
53-
class kqueue(object):
53+
class kqueue:
5454
closed: bool
5555
def __init__(self) -> None: ...
5656
def close(self) -> None: ...
@@ -100,7 +100,7 @@ if sys.platform != "linux" and sys.platform != "win32":
100100
KQ_NOTE_WRITE: int
101101

102102
if sys.platform == "linux":
103-
class epoll(object):
103+
class epoll:
104104
def __init__(self, sizehint: int = ..., flags: int = ...) -> None: ...
105105
def __enter__(self: Self) -> Self: ...
106106
def __exit__(

stdlib/sqlite3/dbapi2.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def register_adapter(__type: Type[_T], __caster: Callable[[_T], int | float | st
117117
def register_converter(__name: str, __converter: Callable[[bytes], Any]) -> None: ...
118118

119119
if sys.version_info < (3, 8):
120-
class Cache(object):
120+
class Cache:
121121
def __init__(self, *args, **kwargs) -> None: ...
122122
def display(self, *args, **kwargs) -> None: ...
123123
def get(self, *args, **kwargs) -> None: ...
@@ -126,7 +126,7 @@ class _AggregateProtocol(Protocol):
126126
def step(self, value: int) -> None: ...
127127
def finalize(self) -> int: ...
128128

129-
class Connection(object):
129+
class Connection:
130130
DataError: Any
131131
DatabaseError: Any
132132
Error: Any
@@ -221,12 +221,12 @@ class OperationalError(DatabaseError): ...
221221

222222
OptimizedUnicode = str
223223

224-
class PrepareProtocol(object):
224+
class PrepareProtocol:
225225
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
226226

227227
class ProgrammingError(DatabaseError): ...
228228

229-
class Row(object):
229+
class Row:
230230
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
231231
def keys(self): ...
232232
def __eq__(self, other): ...
@@ -241,7 +241,7 @@ class Row(object):
241241
def __ne__(self, other): ...
242242

243243
if sys.version_info < (3, 8):
244-
class Statement(object):
244+
class Statement:
245245
def __init__(self, *args, **kwargs): ...
246246

247247
class Warning(Exception): ...

stdlib/symtable.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from typing import Any, Sequence
33

44
def symtable(code: str, filename: str, compile_type: str) -> SymbolTable: ...
55

6-
class SymbolTable(object):
6+
class SymbolTable:
77
def __init__(self, raw_table: Any, filename: str) -> None: ...
88
def get_type(self) -> str: ...
99
def get_id(self) -> int: ...
@@ -29,7 +29,7 @@ class Function(SymbolTable):
2929
class Class(SymbolTable):
3030
def get_methods(self) -> tuple[str, ...]: ...
3131

32-
class Symbol(object):
32+
class Symbol:
3333
if sys.version_info >= (3, 8):
3434
def __init__(
3535
self, name: str, flags: int, namespaces: Sequence[SymbolTable] | None = ..., *, module_scope: bool = ...
@@ -51,7 +51,7 @@ class Symbol(object):
5151
def get_namespaces(self) -> Sequence[SymbolTable]: ...
5252
def get_namespace(self) -> SymbolTable: ...
5353

54-
class SymbolTableFactory(object):
54+
class SymbolTableFactory:
5555
def __init__(self) -> None: ...
5656
def new(self, table: Any, filename: str) -> SymbolTable: ...
5757
def __call__(self, table: Any, filename: str) -> SymbolTable: ...

stdlib/threading.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ TIMEOUT_MAX: float
3434

3535
class ThreadError(Exception): ...
3636

37-
class local(object):
37+
class local:
3838
def __getattribute__(self, name: str) -> Any: ...
3939
def __setattr__(self, name: str, value: Any) -> None: ...
4040
def __delattr__(self, name: str) -> None: ...

0 commit comments

Comments
 (0)