diff --git a/stdlib/_dummy_thread.pyi b/stdlib/_dummy_thread.pyi index 8935c1d71..6e936726a 100644 --- a/stdlib/_dummy_thread.pyi +++ b/stdlib/_dummy_thread.pyi @@ -9,7 +9,7 @@ def get_ident() -> int: ... def allocate_lock() -> LockType: ... def stack_size(size: int | None = ...) -> int: ... -class LockType(object): +class LockType: locked_status: bool def __init__(self) -> None: ... def acquire(self, waitflag: bool | None = ..., timeout: int = ...) -> bool: ... diff --git a/stdlib/_dummy_threading.pyi b/stdlib/_dummy_threading.pyi index 64998d86b..075ea4637 100644 --- a/stdlib/_dummy_threading.pyi +++ b/stdlib/_dummy_threading.pyi @@ -28,7 +28,7 @@ TIMEOUT_MAX: float class ThreadError(Exception): ... -class local(object): +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/_random.pyi b/stdlib/_random.pyi index 654277ec4..9aff4b3cb 100644 --- a/stdlib/_random.pyi +++ b/stdlib/_random.pyi @@ -1,7 +1,7 @@ # Actually Tuple[(int,) * 625] _State = tuple[int, ...] -class Random(object): +class Random: def __init__(self, seed: object = ...) -> None: ... def seed(self, __n: object = ...) -> None: ... def getstate(self) -> _State: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index cf5799238..56c5a4d28 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -138,7 +138,7 @@ class classmethod(Generic[_R]): # Special, only valid as a decorator. __qualname__: str __wrapped__: Callable[..., _R] -class type(object): +class type: __base__: type __bases__: tuple[type, ...] __basicsize__: int @@ -173,7 +173,7 @@ class type(object): def __or__(self, __t: Any) -> types.UnionType: ... def __ror__(self, __t: Any) -> types.UnionType: ... -class super(object): +class super: @overload def __init__(self, __t: Any, __obj: Any) -> None: ... @overload @@ -729,7 +729,7 @@ class bool(int): def __getnewargs__(self) -> tuple[int]: ... @final -class slice(object): +class slice: start: Any step: Any stop: Any @@ -951,7 +951,7 @@ class range(Sequence[int]): def __repr__(self) -> str: ... def __reversed__(self) -> Iterator[int]: ... -class property(object): +class property: fget: Callable[[Any], Any] | None fset: Callable[[Any, Any], None] | None fdel: Callable[[Any], None] | None @@ -1500,7 +1500,7 @@ class ellipsis: ... Ellipsis: ellipsis -class BaseException(object): +class BaseException: args: tuple[Any, ...] __cause__: BaseException | None __context__: BaseException | None diff --git a/stdlib/bz2.pyi b/stdlib/bz2.pyi index bb1b4cf3c..6aeaa3da4 100644 --- a/stdlib/bz2.pyi +++ b/stdlib/bz2.pyi @@ -128,13 +128,13 @@ class BZ2File(BaseStream, IO[bytes]): def writelines(self, seq: Iterable[ReadableBuffer]) -> None: ... @final -class BZ2Compressor(object): +class BZ2Compressor: def __init__(self, compresslevel: int = ...) -> None: ... def compress(self, __data: bytes) -> bytes: ... def flush(self) -> bytes: ... @final -class BZ2Decompressor(object): +class BZ2Decompressor: def decompress(self, data: bytes, max_length: int = ...) -> bytes: ... @property def eof(self) -> bool: ... diff --git a/stdlib/cgi.pyi b/stdlib/cgi.pyi index 3821de46e..c2c3ac261 100644 --- a/stdlib/cgi.pyi +++ b/stdlib/cgi.pyi @@ -57,7 +57,7 @@ class MiniFieldStorage: _list = list -class FieldStorage(object): +class FieldStorage: FieldStorageClass: _type | None keep_blank_values: int strict_parsing: int diff --git a/stdlib/csv.pyi b/stdlib/csv.pyi index 3211e688a..63999be05 100644 --- a/stdlib/csv.pyi +++ b/stdlib/csv.pyi @@ -100,7 +100,7 @@ class DictWriter(Generic[_T]): def writerow(self, rowdict: Mapping[_T, Any]) -> Any: ... def writerows(self, rowdicts: Iterable[Mapping[_T, Any]]) -> None: ... -class Sniffer(object): +class Sniffer: preferred: list[str] def __init__(self) -> None: ... def sniff(self, sample: str, delimiters: str | None = ...) -> Type[Dialect]: ... diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index 179e1cae5..7f2eba011 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -28,7 +28,7 @@ RTLD_GLOBAL: int RTLD_LOCAL: int DEFAULT_MODE: int -class CDLL(object): +class CDLL: _func_flags_: ClassVar[int] _func_restype_: ClassVar[_CData] _name: str diff --git a/stdlib/decimal.pyi b/stdlib/decimal.pyi index ac04557c6..07f9ca1bf 100644 --- a/stdlib/decimal.pyi +++ b/stdlib/decimal.pyi @@ -49,7 +49,7 @@ def setcontext(__context: Context) -> None: ... def getcontext() -> Context: ... def localcontext(ctx: Context | None = ...) -> _ContextManager: ... -class Decimal(object): +class Decimal: def __new__(cls: Type[_DecimalT], value: _DecimalNew = ..., context: Context | None = ...) -> _DecimalT: ... @classmethod def from_float(cls, __f: float) -> Decimal: ... @@ -151,7 +151,7 @@ class Decimal(object): def __deepcopy__(self, __memo: Any) -> Decimal: ... def __format__(self, __specifier: str, __context: Context | None = ...) -> str: ... -class _ContextManager(object): +class _ContextManager: new_context: Context saved_context: Context def __init__(self, new_context: Context) -> None: ... @@ -160,7 +160,7 @@ class _ContextManager(object): _TrapType = Type[DecimalException] -class Context(object): +class Context: prec: int rounding: str Emin: int diff --git a/stdlib/difflib.pyi b/stdlib/difflib.pyi index 944a63966..d259e77df 100644 --- a/stdlib/difflib.pyi +++ b/stdlib/difflib.pyi @@ -70,7 +70,7 @@ def ndiff( a: Sequence[str], b: Sequence[str], linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ... ) -> Iterator[str]: ... -class HtmlDiff(object): +class HtmlDiff: def __init__( self, tabsize: int = ..., diff --git a/stdlib/hashlib.pyi b/stdlib/hashlib.pyi index e39f2f253..fad3c5aad 100644 --- a/stdlib/hashlib.pyi +++ b/stdlib/hashlib.pyi @@ -2,7 +2,7 @@ import sys from _typeshed import ReadableBuffer, Self from typing import AbstractSet -class _Hash(object): +class _Hash: @property def digest_size(self) -> int: ... @property @@ -49,7 +49,7 @@ def pbkdf2_hmac( hash_name: str, password: ReadableBuffer, salt: ReadableBuffer, iterations: int, dklen: int | None = ... ) -> bytes: ... -class _VarLenHash(object): +class _VarLenHash: digest_size: int block_size: int name: str diff --git a/stdlib/logging/__init__.pyi b/stdlib/logging/__init__.pyi index d580c6681..d0d50041a 100644 --- a/stdlib/logging/__init__.pyi +++ b/stdlib/logging/__init__.pyi @@ -27,14 +27,14 @@ def currentframe() -> FrameType: ... _levelToName: dict[int, str] _nameToLevel: dict[str, int] -class Filterer(object): +class Filterer: filters: list[Filter] def __init__(self) -> None: ... def addFilter(self, filter: _FilterType) -> None: ... def removeFilter(self, filter: _FilterType) -> None: ... def filter(self, record: LogRecord) -> bool: ... -class Manager(object): # undocumented +class Manager: # undocumented root: RootLogger disable: int emittedNoHandlerWarning: bool @@ -749,7 +749,7 @@ class RootLogger(Logger): root: RootLogger -class PercentStyle(object): # undocumented +class PercentStyle: # undocumented default_format: str asctime_format: str asctime_search: str diff --git a/stdlib/lzma.pyi b/stdlib/lzma.pyi index e1da3024c..e4bd977d7 100644 --- a/stdlib/lzma.pyi +++ b/stdlib/lzma.pyi @@ -41,7 +41,7 @@ PRESET_EXTREME: int # from _lzma.c @final -class LZMADecompressor(object): +class LZMADecompressor: def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ... def decompress(self, data: bytes, max_length: int = ...) -> bytes: ... @property @@ -55,7 +55,7 @@ class LZMADecompressor(object): # from _lzma.c @final -class LZMACompressor(object): +class LZMACompressor: def __init__( self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ... ) -> None: ... diff --git a/stdlib/multiprocessing/context.pyi b/stdlib/multiprocessing/context.pyi index e65a38781..83e1b7884 100644 --- a/stdlib/multiprocessing/context.pyi +++ b/stdlib/multiprocessing/context.pyi @@ -19,7 +19,7 @@ class BufferTooShort(ProcessError): ... class TimeoutError(ProcessError): ... class AuthenticationError(ProcessError): ... -class BaseContext(object): +class BaseContext: Process: Type[BaseProcess] ProcessError: Type[Exception] BufferTooShort: Type[Exception] diff --git a/stdlib/multiprocessing/dummy/connection.pyi b/stdlib/multiprocessing/dummy/connection.pyi index 0f7a20693..9500a3836 100644 --- a/stdlib/multiprocessing/dummy/connection.pyi +++ b/stdlib/multiprocessing/dummy/connection.pyi @@ -7,7 +7,7 @@ families: list[None] _Address = Union[str, tuple[str, int]] -class Connection(object): +class Connection: _in: Any _out: Any recv: Any @@ -22,7 +22,7 @@ class Connection(object): def close(self) -> None: ... def poll(self, timeout: float = ...) -> bool: ... -class Listener(object): +class Listener: _backlog_queue: Queue[Any] | None @property def address(self) -> Queue[Any] | None: ... diff --git a/stdlib/multiprocessing/managers.pyi b/stdlib/multiprocessing/managers.pyi index 830f63e14..79310614e 100644 --- a/stdlib/multiprocessing/managers.pyi +++ b/stdlib/multiprocessing/managers.pyi @@ -27,7 +27,7 @@ class Namespace: _Namespace = Namespace -class Token(object): +class Token: typeid: str | bytes | None address: tuple[str | bytes, int] id: str | bytes | int | None @@ -36,7 +36,7 @@ class Token(object): def __getstate__(self) -> tuple[str | bytes | None, tuple[str | bytes, int], str | bytes | int | None]: ... def __setstate__(self, state: tuple[str | bytes | None, tuple[str | bytes, int], str | bytes | int | None]) -> None: ... -class BaseProxy(object): +class BaseProxy: _address_to_local: dict[Any, Any] _mutex: Any def __init__( diff --git a/stdlib/pickletools.pyi b/stdlib/pickletools.pyi index da05ff0aa..04a695f5f 100644 --- a/stdlib/pickletools.pyi +++ b/stdlib/pickletools.pyi @@ -9,7 +9,7 @@ TAKEN_FROM_ARGUMENT4: int TAKEN_FROM_ARGUMENT4U: int TAKEN_FROM_ARGUMENT8U: int -class ArgumentDescriptor(object): +class ArgumentDescriptor: name: str n: int reader: _Reader @@ -106,7 +106,7 @@ def read_long4(f: IO[bytes]) -> int: ... long4: ArgumentDescriptor -class StackObject(object): +class StackObject: name: str obtype: Type[Any] | tuple[Type[Any], ...] doc: str @@ -131,7 +131,7 @@ anyobject: StackObject markobject: StackObject stackslice: StackObject -class OpcodeInfo(object): +class OpcodeInfo: name: str code: str arg: ArgumentDescriptor | None diff --git a/stdlib/pyexpat/__init__.pyi b/stdlib/pyexpat/__init__.pyi index 37424f20c..5aca55c2b 100644 --- a/stdlib/pyexpat/__init__.pyi +++ b/stdlib/pyexpat/__init__.pyi @@ -23,7 +23,7 @@ XML_PARAM_ENTITY_PARSING_ALWAYS: int _Model = tuple[int, int, Optional[str], tuple[Any, ...]] @final -class XMLParserType(object): +class XMLParserType: def Parse(self, __data: str | bytes, __isfinal: bool = ...) -> int: ... def ParseFile(self, __file: SupportsRead[bytes]) -> int: ... def SetBase(self, __base: str) -> None: ... diff --git a/stdlib/select.pyi b/stdlib/select.pyi index 5650ed4c9..e57504b5b 100644 --- a/stdlib/select.pyi +++ b/stdlib/select.pyi @@ -33,7 +33,7 @@ error = OSError if sys.platform != "linux" and sys.platform != "win32": # BSD only - class kevent(object): + class kevent: data: Any fflags: int filter: int @@ -50,7 +50,7 @@ if sys.platform != "linux" and sys.platform != "win32": udata: Any = ..., ) -> None: ... # BSD only - class kqueue(object): + class kqueue: closed: bool def __init__(self) -> None: ... def close(self) -> None: ... @@ -100,7 +100,7 @@ if sys.platform != "linux" and sys.platform != "win32": KQ_NOTE_WRITE: int if sys.platform == "linux": - class epoll(object): + class epoll: def __init__(self, sizehint: int = ..., flags: int = ...) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( diff --git a/stdlib/sqlite3/dbapi2.pyi b/stdlib/sqlite3/dbapi2.pyi index 0c52c1c2e..ea9098940 100644 --- a/stdlib/sqlite3/dbapi2.pyi +++ b/stdlib/sqlite3/dbapi2.pyi @@ -117,7 +117,7 @@ def register_adapter(__type: Type[_T], __caster: Callable[[_T], int | float | st def register_converter(__name: str, __converter: Callable[[bytes], Any]) -> None: ... if sys.version_info < (3, 8): - class Cache(object): + class Cache: def __init__(self, *args, **kwargs) -> None: ... def display(self, *args, **kwargs) -> None: ... def get(self, *args, **kwargs) -> None: ... @@ -126,7 +126,7 @@ class _AggregateProtocol(Protocol): def step(self, value: int) -> None: ... def finalize(self) -> int: ... -class Connection(object): +class Connection: DataError: Any DatabaseError: Any Error: Any @@ -221,12 +221,12 @@ class OperationalError(DatabaseError): ... OptimizedUnicode = str -class PrepareProtocol(object): +class PrepareProtocol: def __init__(self, *args: Any, **kwargs: Any) -> None: ... class ProgrammingError(DatabaseError): ... -class Row(object): +class Row: def __init__(self, *args: Any, **kwargs: Any) -> None: ... def keys(self): ... def __eq__(self, other): ... @@ -241,7 +241,7 @@ class Row(object): def __ne__(self, other): ... if sys.version_info < (3, 8): - class Statement(object): + class Statement: def __init__(self, *args, **kwargs): ... class Warning(Exception): ... diff --git a/stdlib/symtable.pyi b/stdlib/symtable.pyi index 58fb8c8ae..bc25a4c46 100644 --- a/stdlib/symtable.pyi +++ b/stdlib/symtable.pyi @@ -3,7 +3,7 @@ from typing import Any, Sequence def symtable(code: str, filename: str, compile_type: str) -> SymbolTable: ... -class SymbolTable(object): +class SymbolTable: def __init__(self, raw_table: Any, filename: str) -> None: ... def get_type(self) -> str: ... def get_id(self) -> int: ... @@ -29,7 +29,7 @@ class Function(SymbolTable): class Class(SymbolTable): def get_methods(self) -> tuple[str, ...]: ... -class Symbol(object): +class Symbol: if sys.version_info >= (3, 8): def __init__( self, name: str, flags: int, namespaces: Sequence[SymbolTable] | None = ..., *, module_scope: bool = ... @@ -51,7 +51,7 @@ class Symbol(object): def get_namespaces(self) -> Sequence[SymbolTable]: ... def get_namespace(self) -> SymbolTable: ... -class SymbolTableFactory(object): +class SymbolTableFactory: def __init__(self) -> None: ... def new(self, table: Any, filename: str) -> SymbolTable: ... def __call__(self, table: Any, filename: str) -> SymbolTable: ... diff --git a/stdlib/threading.pyi b/stdlib/threading.pyi index d6ac9f725..3e91221ba 100644 --- a/stdlib/threading.pyi +++ b/stdlib/threading.pyi @@ -34,7 +34,7 @@ TIMEOUT_MAX: float class ThreadError(Exception): ... -class local(object): +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/turtle.pyi b/stdlib/turtle.pyi index 9d2087792..e5efcb4f6 100644 --- a/stdlib/turtle.pyi +++ b/stdlib/turtle.pyi @@ -20,7 +20,7 @@ Vec2D = tuple[float, float] class ScrolledCanvas(Frame): ... -class TurtleScreenBase(object): +class TurtleScreenBase: cv: Canvas canvwidth: int canvheight: int @@ -36,7 +36,7 @@ class TurtleScreenBase(object): class Terminator(Exception): ... class TurtleGraphicsError(Exception): ... -class Shape(object): +class Shape: def __init__(self, type_: str, data: _PolygonCoords | PhotoImage | None = ...) -> None: ... def addcomponent(self, poly: _PolygonCoords, fill: _Color, outline: _Color | None = ...) -> None: ... @@ -94,7 +94,7 @@ class TurtleScreen(TurtleScreenBase): def onkeypress(self, fun: Callable[[], Any], key: str | None = ...) -> None: ... onkeyrelease = onkey -class TNavigator(object): +class TNavigator: START_ORIENTATION: dict[str, Vec2D] DEFAULT_MODE: str DEFAULT_ANGLEOFFSET: int @@ -138,7 +138,7 @@ class TNavigator(object): setposition = goto seth = setheading -class TPen(object): +class TPen: def __init__(self, resizemode: str = ...) -> None: ... @overload def resizemode(self, rmode: None = ...) -> str: ... diff --git a/stdlib/unicodedata.pyi b/stdlib/unicodedata.pyi index 66c93f743..ead25ba40 100644 --- a/stdlib/unicodedata.pyi +++ b/stdlib/unicodedata.pyi @@ -24,7 +24,7 @@ def name(__chr: str, __default: _T = ...) -> str | _T: ... def normalize(__form: str, __unistr: str) -> str: ... def numeric(__chr: str, __default: _T = ...) -> float | _T: ... -class UCD(object): +class UCD: # The methods below are constructed from the same array in C # (unicodedata_functions) and hence identical to the methods above. unidata_version: str diff --git a/stdlib/unittest/runner.pyi b/stdlib/unittest/runner.pyi index bf8f3c05c..85481880a 100644 --- a/stdlib/unittest/runner.pyi +++ b/stdlib/unittest/runner.pyi @@ -17,7 +17,7 @@ class TextTestResult(unittest.result.TestResult): def printErrors(self) -> None: ... def printErrorList(self, flavour: str, errors: tuple[unittest.case.TestCase, str]) -> None: ... -class TextTestRunner(object): +class TextTestRunner: resultclass: _ResultClassType def __init__( self, diff --git a/stdlib/zipimport.pyi b/stdlib/zipimport.pyi index 3acdc729a..3435092a4 100644 --- a/stdlib/zipimport.pyi +++ b/stdlib/zipimport.pyi @@ -9,7 +9,7 @@ if sys.version_info >= (3, 7): class ZipImportError(ImportError): ... -class zipimporter(object): +class zipimporter: archive: str prefix: str def __init__(self, path: str | bytes | os.PathLike[Any]) -> None: ... diff --git a/stubs/DateTimeRange/datetimerange/__init__.pyi b/stubs/DateTimeRange/datetimerange/__init__.pyi index b38cad3bf..324216b8b 100644 --- a/stubs/DateTimeRange/datetimerange/__init__.pyi +++ b/stubs/DateTimeRange/datetimerange/__init__.pyi @@ -3,7 +3,7 @@ from typing import Iterable from dateutil.relativedelta import relativedelta -class DateTimeRange(object): +class DateTimeRange: NOT_A_TIME_STR: str start_time_format: str end_time_format: str diff --git a/stubs/bleach/bleach/html5lib_shim.pyi b/stubs/bleach/bleach/html5lib_shim.pyi index 3d69fc0da..52a028156 100644 --- a/stubs/bleach/bleach/html5lib_shim.pyi +++ b/stubs/bleach/bleach/html5lib_shim.pyi @@ -1,16 +1,16 @@ from collections.abc import Generator, Iterable from typing import Any -class HTMLParser(object): # actually html5lib.HTMLParser +class HTMLParser: # actually html5lib.HTMLParser def __getattr__(self, __name: str) -> Any: ... # incomplete -class Filter(object): # actually html5lib.filters.base.Filter +class Filter: # actually html5lib.filters.base.Filter def __getattr__(self, __name: str) -> Any: ... # incomplete -class SanitizerFilter(object): # actually html5lib.filters.sanitizer.Filter +class SanitizerFilter: # actually html5lib.filters.sanitizer.Filter def __getattr__(self, __name: str) -> Any: ... # incomplete -class HTMLSerializer(object): # actually html5lib.serializer.HTMLSerializer +class HTMLSerializer: # actually html5lib.serializer.HTMLSerializer def __getattr__(self, __name: str) -> Any: ... # incomplete class BleachHTMLParser(HTMLParser): diff --git a/stubs/bleach/bleach/linkifier.pyi b/stubs/bleach/bleach/linkifier.pyi index 05a672838..cb3013cac 100644 --- a/stubs/bleach/bleach/linkifier.pyi +++ b/stubs/bleach/bleach/linkifier.pyi @@ -21,7 +21,7 @@ def build_email_re(tlds: Iterable[str] = ...) -> Pattern[str]: ... EMAIL_RE: Pattern[str] -class Linker(object): +class Linker: def __init__( self, callbacks: Iterable[_Callback] = ..., diff --git a/stubs/bleach/bleach/sanitizer.pyi b/stubs/bleach/bleach/sanitizer.pyi index 4adf96e47..76fe8f208 100644 --- a/stubs/bleach/bleach/sanitizer.pyi +++ b/stubs/bleach/bleach/sanitizer.pyi @@ -15,7 +15,7 @@ INVISIBLE_REPLACEMENT_CHAR: str # A html5lib Filter class _Filter = Any -class Cleaner(object): +class Cleaner: tags: Container[str] attributes: _Attributes styles: Container[str] diff --git a/stubs/decorator/decorator.pyi b/stubs/decorator/decorator.pyi index 622726106..5fa6a275f 100644 --- a/stubs/decorator/decorator.pyi +++ b/stubs/decorator/decorator.pyi @@ -30,7 +30,7 @@ DEF: Pattern[str] _dict = dict # conflicts with attribute name -class FunctionMaker(object): +class FunctionMaker: args: list[Text] varargs: Text | None varkw: Text | None diff --git a/stubs/freezegun/freezegun/api.pyi b/stubs/freezegun/freezegun/api.pyi index d2aaaf4a1..3ad350e2d 100644 --- a/stubs/freezegun/freezegun/api.pyi +++ b/stubs/freezegun/freezegun/api.pyi @@ -6,17 +6,17 @@ from typing import Any, Type, TypeVar, Union, overload _T = TypeVar("_T") _Freezable = Union[str, datetime, date, timedelta] -class TickingDateTimeFactory(object): +class TickingDateTimeFactory: def __init__(self, time_to_freeze: datetime, start: datetime) -> None: ... def __call__(self) -> datetime: ... -class FrozenDateTimeFactory(object): +class FrozenDateTimeFactory: def __init__(self, time_to_freeze: datetime) -> None: ... def __call__(self) -> datetime: ... def tick(self, delta: float | Real | timedelta = ...) -> None: ... def move_to(self, target_datetime: _Freezable | None) -> None: ... -class StepTickTimeFactory(object): +class StepTickTimeFactory: def __init__(self, time_to_freeze: datetime, step_width: float) -> None: ... def __call__(self) -> datetime: ... def tick(self, delta: timedelta | None = ...) -> None: ... diff --git a/stubs/pycurl/pycurl.pyi b/stubs/pycurl/pycurl.pyi index c3517e112..e73b4e125 100644 --- a/stubs/pycurl/pycurl.pyi +++ b/stubs/pycurl/pycurl.pyi @@ -18,7 +18,7 @@ def version_info() -> tuple[int, str, int, str, int, str, int, str, tuple[str, . class error(Exception): ... -class Curl(object): +class Curl: def close(self) -> None: ... def setopt(self, option: int, value: Any) -> None: ... def setopt_string(self, option: int, value: str) -> None: ... @@ -34,7 +34,7 @@ class Curl(object): # TODO(MichalPokorny): wat? USERPWD: int -class CurlMulti(object): +class CurlMulti: def close(self) -> None: ... def add_handle(self, obj: Curl) -> None: ... def remove_handle(self, obj: Curl) -> None: ... @@ -44,7 +44,7 @@ class CurlMulti(object): def info_read(self, max_objects: int = ...) -> tuple[int, list[Any], list[Any]]: ... def socket_action(self, sockfd: int, ev_bitmask: int) -> tuple[int, int]: ... -class CurlShare(object): +class CurlShare: def close(self) -> None: ... def setopt(self, option: int, value: Any) -> Any: ... diff --git a/stubs/redis/redis/client.pyi b/stubs/redis/redis/client.pyi index 21988ccd2..5aba69a20 100644 --- a/stubs/redis/redis/client.pyi +++ b/stubs/redis/redis/client.pyi @@ -689,7 +689,7 @@ class Pipeline(Redis[_StrType], Generic[_StrType]): def cluster(self, cluster_arg: str, *args: Any) -> Pipeline[_StrType]: ... # type: ignore[override] def client(self) -> Any: ... -class Monitor(object): +class Monitor: command_re: Pattern[str] monitor_re: Pattern[str] def __init__(self, connection_pool) -> None: ... diff --git a/tests/check_new_syntax.py b/tests/check_new_syntax.py index 1b8c3372b..e40cfa04b 100755 --- a/tests/check_new_syntax.py +++ b/tests/check_new_syntax.py @@ -128,6 +128,15 @@ def check_new_syntax(tree: ast.AST, path: Path) -> list[str]: UnionFinder().visit(node.returns) self.generic_visit(node) + class ObjectClassdefFinder(ast.NodeVisitor): + def visit_ClassDef(self, node: ast.ClassDef) -> None: + if any(isinstance(base, ast.Name) and base.id == "object" for base in node.bases): + errors.append( + f"{path}:{node.lineno}: Do not inherit from `object` explicitly, " + f"as all classes implicitly inherit from `object` in Python 3" + ) + self.generic_visit(node) + class IfFinder(ast.NodeVisitor): def visit_If(self, node: ast.If) -> None: if ( @@ -146,6 +155,9 @@ def check_new_syntax(tree: ast.AST, path: Path) -> list[str]: if path != Path("stdlib/typing_extensions.pyi"): OldSyntaxFinder().visit(tree) + if not python_2_support_required: + ObjectClassdefFinder().visit(tree) + IfFinder().visit(tree) return errors