diff --git a/stubs/DateTimeRange/datetimerange/__init__.pyi b/stubs/DateTimeRange/datetimerange/__init__.pyi index f39ced9de560..7f1d403af849 100644 --- a/stubs/DateTimeRange/datetimerange/__init__.pyi +++ b/stubs/DateTimeRange/datetimerange/__init__.pyi @@ -1,7 +1,7 @@ import datetime -from _typeshed import Self from collections.abc import Iterable from typing import ClassVar +from typing_extensions import Self from dateutil.relativedelta import relativedelta @@ -33,9 +33,9 @@ class DateTimeRange: def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... def __add__(self, other: datetime.timedelta) -> DateTimeRange: ... - def __iadd__(self: Self, other: datetime.timedelta) -> Self: ... + def __iadd__(self, other: datetime.timedelta) -> Self: ... def __sub__(self, other: datetime.timedelta) -> DateTimeRange: ... - def __isub__(self: Self, other: datetime.timedelta) -> Self: ... + def __isub__(self, other: datetime.timedelta) -> Self: ... def __contains__(self, x: datetime.timedelta | datetime.datetime | DateTimeRange | str) -> bool: ... @property def start_datetime(self) -> datetime.datetime: ... diff --git a/stubs/ExifRead/exifread/utils.pyi b/stubs/ExifRead/exifread/utils.pyi index 878c3adfac1a..d534019c3683 100644 --- a/stubs/ExifRead/exifread/utils.pyi +++ b/stubs/ExifRead/exifread/utils.pyi @@ -1,7 +1,7 @@ -from _typeshed import Self from collections.abc import Mapping from fractions import Fraction from typing import Any, TypeVar, overload +from typing_extensions import Self _T = TypeVar("_T") @@ -14,7 +14,7 @@ def make_string_uc(seq: str | list[int]) -> str: ... def get_gps_coords(tags: Mapping[str, Any]) -> tuple[float, float]: ... class Ratio(Fraction): - def __new__(cls: type[Self], numerator: int = ..., denominator: int | None = ...) -> Self: ... + def __new__(cls, numerator: int = ..., denominator: int | None = ...) -> Self: ... @property def num(self) -> int: ... @property diff --git a/stubs/JACK-Client/jack/__init__.pyi b/stubs/JACK-Client/jack/__init__.pyi index 8a904b7c75c7..cbe7c6c82d0c 100644 --- a/stubs/JACK-Client/jack/__init__.pyi +++ b/stubs/JACK-Client/jack/__init__.pyi @@ -1,8 +1,7 @@ import sys -from _typeshed import Self from collections.abc import Callable, Generator, Iterable, Iterator, Sequence from typing import Any, NoReturn, overload -from typing_extensions import Literal +from typing_extensions import Literal, Self import numpy from _cffi_backend import _CDataBase @@ -80,7 +79,7 @@ class Client: servername: str | None = ..., session_id: str | None = ..., ) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, *args: object) -> None: ... @property def name(self) -> str: ... diff --git a/stubs/Markdown/markdown/core.pyi b/stubs/Markdown/markdown/core.pyi index 96aa61a37d5f..394417945f90 100644 --- a/stubs/Markdown/markdown/core.pyi +++ b/stubs/Markdown/markdown/core.pyi @@ -1,7 +1,6 @@ -from _typeshed import Self from collections.abc import Callable, Mapping, Sequence from typing import Any, ClassVar, Protocol -from typing_extensions import Literal +from typing_extensions import Literal, Self from xml.etree.ElementTree import Element from .blockparser import BlockParser @@ -45,7 +44,7 @@ class Markdown: def registerExtensions(self, extensions: Sequence[Extension | str], configs: Mapping[str, Mapping[str, Any]]) -> Markdown: ... def build_extension(self, ext_name: str, configs: Mapping[str, str]) -> Extension: ... def registerExtension(self, extension: Extension) -> Markdown: ... - def reset(self: Self) -> Self: ... + def reset(self) -> Self: ... def set_output_format(self, format: Literal["xhtml", "html"]) -> Markdown: ... def is_block_level(self, tag: str) -> bool: ... def convert(self, source: str) -> str: ... diff --git a/stubs/Pillow/PIL/Image.pyi b/stubs/Pillow/PIL/Image.pyi index 7ea7e46f7213..31b71700d2cf 100644 --- a/stubs/Pillow/PIL/Image.pyi +++ b/stubs/Pillow/PIL/Image.pyi @@ -1,9 +1,9 @@ -from _typeshed import Incomplete, Self, SupportsRead, SupportsWrite +from _typeshed import Incomplete, SupportsRead, SupportsWrite from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence from enum import IntEnum from pathlib import Path from typing import Any, ClassVar, Protocol, SupportsBytes -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from PIL.PyAccess import PyAccess @@ -171,7 +171,7 @@ class Image: def height(self) -> int: ... @property def size(self) -> tuple[int, int]: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, *args: object) -> None: ... def close(self) -> None: ... def __eq__(self, other: object) -> bool: ... diff --git a/stubs/Pillow/PIL/ImageFile.pyi b/stubs/Pillow/PIL/ImageFile.pyi index 678b045083f5..b4c6ebdc07be 100644 --- a/stubs/Pillow/PIL/ImageFile.pyi +++ b/stubs/Pillow/PIL/ImageFile.pyi @@ -1,5 +1,6 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from typing import Any, NoReturn +from typing_extensions import Self from .Image import Image @@ -40,7 +41,7 @@ class Parser: def reset(self) -> None: ... decode: Any def feed(self, data) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, *args: object) -> None: ... def close(self) -> Image: ... diff --git a/stubs/Pillow/PIL/ImageFilter.pyi b/stubs/Pillow/PIL/ImageFilter.pyi index 1182f89adc21..bbb647a4b901 100644 --- a/stubs/Pillow/PIL/ImageFilter.pyi +++ b/stubs/Pillow/PIL/ImageFilter.pyi @@ -1,7 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable, Iterable, Sequence from typing import Any -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from .Image import Image @@ -122,14 +122,14 @@ class Color3DLUT(MultibandFilter): ) -> None: ... @classmethod def generate( - cls: type[Self], + cls, size: int | tuple[int, int, int], callback: Callable[[float, float, float], Iterable[float]], channels: int = ..., target_mode: str | None = ..., ) -> Self: ... def transform( - self: Self, + self, callback: Callable[..., Iterable[float]], with_normals: bool = ..., channels: Literal[3, 4] | None = ..., diff --git a/stubs/PyMySQL/pymysql/connections.pyi b/stubs/PyMySQL/pymysql/connections.pyi index 5cf640bf366d..e17b91807b65 100644 --- a/stubs/PyMySQL/pymysql/connections.pyi +++ b/stubs/PyMySQL/pymysql/connections.pyi @@ -1,7 +1,8 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Mapping from socket import socket as _socket from typing import Any, AnyStr, Generic, TypeVar, overload +from typing_extensions import Self from .charset import charset_by_id as charset_by_id, charset_by_name as charset_by_name from .constants import CLIENT as CLIENT, COMMAND as COMMAND, FIELD_TYPE as FIELD_TYPE, SERVER_STATUS as SERVER_STATUS @@ -197,7 +198,7 @@ class Connection(Generic[_C]): def get_proto_info(self): ... def get_server_info(self): ... def show_warnings(self): ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, *exc_info: object) -> None: ... Warning: Any Error: Any diff --git a/stubs/PyMySQL/pymysql/cursors.pyi b/stubs/PyMySQL/pymysql/cursors.pyi index df03886315da..4f2d374b97ae 100644 --- a/stubs/PyMySQL/pymysql/cursors.pyi +++ b/stubs/PyMySQL/pymysql/cursors.pyi @@ -1,6 +1,6 @@ -from _typeshed import Self from collections.abc import Iterable, Iterator from typing import Any +from typing_extensions import Self from .connections import Connection @@ -24,7 +24,7 @@ class Cursor: def executemany(self, query: str, args: Iterable[object]) -> int | None: ... def callproc(self, procname: str, args: Iterable[Any] = ...) -> Any: ... def scroll(self, value: int, mode: str = ...) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, *exc_info: object) -> None: ... # Methods returning result tuples are below. def fetchone(self) -> tuple[Any, ...] | None: ... diff --git a/stubs/Pygments/pygments/token.pyi b/stubs/Pygments/pygments/token.pyi index 9fb24b751762..cd63f2b61158 100644 --- a/stubs/Pygments/pygments/token.pyi +++ b/stubs/Pygments/pygments/token.pyi @@ -1,6 +1,6 @@ -from _typeshed import Self from collections.abc import Mapping from typing import Any +from typing_extensions import Self class _TokenType(tuple[str, ...]): parent: _TokenType | None @@ -8,8 +8,8 @@ class _TokenType(tuple[str, ...]): subtypes: set[_TokenType] def __contains__(self, val: _TokenType) -> bool: ... # type: ignore[override] def __getattr__(self, name: str) -> _TokenType: ... - def __copy__(self: Self) -> Self: ... - def __deepcopy__(self: Self, memo: Any) -> Self: ... + def __copy__(self) -> Self: ... + def __deepcopy__(self, memo: Any) -> Self: ... Token: _TokenType Text: _TokenType diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/base.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/base.pyi index 79013d653491..9d7376520a9f 100644 --- a/stubs/SQLAlchemy/sqlalchemy/engine/base.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/engine/base.pyi @@ -1,10 +1,10 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from _typeshed.dbapi import DBAPIConnection from abc import abstractmethod from collections.abc import Callable, Mapping from types import TracebackType from typing import Any, TypeVar, overload -from typing_extensions import Concatenate, ParamSpec, TypeAlias +from typing_extensions import Concatenate, ParamSpec, Self, TypeAlias from ..log import Identified, _EchoFlag, echo_property from ..pool import Pool @@ -40,7 +40,7 @@ class Connection(Connectable): _allow_revalidate: bool = ..., ) -> None: ... def schema_for_object(self, obj) -> str | None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/mock.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/mock.pyi index dc685760d8c0..bfd8007258db 100644 --- a/stubs/SQLAlchemy/sqlalchemy/engine/mock.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/engine/mock.pyi @@ -1,7 +1,7 @@ -from _typeshed import Self from abc import abstractmethod from collections.abc import Mapping from typing import Any, overload +from typing_extensions import Self from .base import _Executable from .cursor import CursorResult @@ -11,7 +11,7 @@ from .url import URL class MockConnection(Connectable): def __init__(self, dialect: Dialect, execute) -> None: ... @property - def engine(self: Self) -> Self: ... # type: ignore[override] + def engine(self) -> Self: ... # type: ignore[override] @property def dialect(self) -> Dialect: ... @property diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/result.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/result.pyi index c3fb605ae078..7328eb5e2f4f 100644 --- a/stubs/SQLAlchemy/sqlalchemy/engine/result.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/engine/result.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Generator, KeysView from typing import Any +from typing_extensions import Self from ..sql.base import InPlaceGenerative from .row import Row @@ -38,8 +39,8 @@ class _WithKeys: class Result(_WithKeys, ResultInternal): def __init__(self, cursor_metadata) -> None: ... def close(self) -> None: ... - def yield_per(self: Self, num: int) -> Self: ... - def unique(self: Self, strategy: Incomplete | None = ...) -> Self: ... + def yield_per(self, num: int) -> Self: ... + def unique(self, strategy: Incomplete | None = ...) -> Self: ... def columns(self, *col_expressions): ... def scalars(self, index: int = ...) -> ScalarResult: ... def mappings(self) -> MappingResult: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/url.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/url.pyi index 30625dfcec8a..cb70b3cce3b6 100644 --- a/stubs/SQLAlchemy/sqlalchemy/engine/url.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/engine/url.pyi @@ -1,7 +1,7 @@ -from _typeshed import Self, SupportsItems +from _typeshed import SupportsItems from collections.abc import Iterable, Mapping, Sequence from typing import Any, NamedTuple -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias from ..util import immutabledict from .interfaces import Dialect @@ -31,7 +31,7 @@ class URL(_URLTuple): query: _Query | None = ..., ) -> URL: ... def set( - self: Self, + self, drivername: str | None = ..., username: str | None = ..., password: str | object | None = ..., @@ -40,16 +40,16 @@ class URL(_URLTuple): database: str | None = ..., query: _Query | None = ..., ) -> Self: ... - def update_query_string(self: Self, query_string: str, append: bool = ...) -> Self: ... - def update_query_pairs(self: Self, key_value_pairs: Iterable[tuple[str, str]], append: bool = ...) -> Self: ... - def update_query_dict(self: Self, query_parameters: SupportsItems[str, str | Sequence[str]], append: bool = ...) -> Self: ... + def update_query_string(self, query_string: str, append: bool = ...) -> Self: ... + def update_query_pairs(self, key_value_pairs: Iterable[tuple[str, str]], append: bool = ...) -> Self: ... + def update_query_dict(self, query_parameters: SupportsItems[str, str | Sequence[str]], append: bool = ...) -> Self: ... def difference_update_query(self, names: Iterable[str]) -> URL: ... @property def normalized_query(self) -> immutabledict[str, tuple[str, ...]]: ... def __to_string__(self, hide_password: bool = ...) -> str: ... def render_as_string(self, hide_password: bool = ...) -> str: ... - def __copy__(self: Self) -> Self: ... - def __deepcopy__(self: Self, memo: object) -> Self: ... + def __copy__(self) -> Self: ... + def __deepcopy__(self, memo: object) -> Self: ... def __hash__(self) -> int: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/engine/util.pyi b/stubs/SQLAlchemy/sqlalchemy/engine/util.pyi index f711f0c83d0a..0fdef74350e3 100644 --- a/stubs/SQLAlchemy/sqlalchemy/engine/util.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/engine/util.pyi @@ -1,12 +1,12 @@ -from _typeshed import Self from collections.abc import Callable from types import TracebackType from typing import Any +from typing_extensions import Self def connection_memoize(key: str) -> Callable[..., Any]: ... class TransactionalContext: - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, type_: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/session.pyi b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/session.pyi index da62a7d9d6a3..a7353820c5e2 100644 --- a/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/session.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/ext/asyncio/session.pyi @@ -1,5 +1,6 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from typing import Any +from typing_extensions import Self from ...util import memoized_property from .base import ReversibleProxy, StartableContext @@ -53,7 +54,7 @@ class AsyncSession(ReversibleProxy): async def close(self): ... @classmethod async def close_all(cls): ... - async def __aenter__(self: Self) -> Self: ... + async def __aenter__(self) -> Self: ... async def __aexit__(self, type_, value, traceback) -> None: ... # proxied from Session identity_map: Any diff --git a/stubs/SQLAlchemy/sqlalchemy/log.pyi b/stubs/SQLAlchemy/sqlalchemy/log.pyi index 54b045cbc314..e4ccc821e6a5 100644 --- a/stubs/SQLAlchemy/sqlalchemy/log.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/log.pyi @@ -1,7 +1,6 @@ -from _typeshed import Self from logging import Logger from typing import Any, TypeVar, overload -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias _ClsT = TypeVar("_ClsT", bound=type) _EchoFlag: TypeAlias = bool | Literal["debug"] | None @@ -33,7 +32,7 @@ def instance_logger(instance: Identified, echoflag: _EchoFlag = ...) -> None: .. class echo_property: __doc__: str @overload - def __get__(self: Self, instance: None, owner: object) -> Self: ... + def __get__(self, instance: None, owner: object) -> Self: ... @overload def __get__(self, instance: Identified, owner: object) -> _EchoFlag: ... def __set__(self, instance: Identified, value: _EchoFlag) -> None: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/query.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/query.pyi index 1e643cb7720d..ab769f034319 100644 --- a/stubs/SQLAlchemy/sqlalchemy/orm/query.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/orm/query.pyi @@ -1,7 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Iterator from typing import Any, Generic, TypeVar -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from ..sql.annotation import SupportsCloneAnnotations from ..sql.base import Executable @@ -30,74 +30,69 @@ class Query(_SelectFromElements, SupportsCloneAnnotations, HasPrefixes, HasSuffi @property def selectable(self): ... def __clause_element__(self): ... - def only_return_tuples(self: Self, value) -> Self: ... + def only_return_tuples(self, value) -> Self: ... @property def is_single_entity(self): ... - def enable_eagerloads(self: Self, value) -> Self: ... + def enable_eagerloads(self, value) -> Self: ... def with_labels(self): ... apply_labels: Any @property def get_label_style(self): ... def set_label_style(self, style): ... - def enable_assertions(self: Self, value) -> Self: ... + def enable_assertions(self, value) -> Self: ... @property def whereclause(self): ... def with_polymorphic( - self: Self, cls_or_mappers, selectable: Incomplete | None = ..., polymorphic_on: Incomplete | None = ... + self, cls_or_mappers, selectable: Incomplete | None = ..., polymorphic_on: Incomplete | None = ... ) -> Self: ... - def yield_per(self: Self, count) -> Self: ... + def yield_per(self, count) -> Self: ... def get(self, ident): ... @property def lazy_loaded_from(self): ... - def correlate(self: Self, *fromclauses) -> Self: ... - def autoflush(self: Self, setting) -> Self: ... - def populate_existing(self: Self) -> Self: ... + def correlate(self, *fromclauses) -> Self: ... + def autoflush(self, setting) -> Self: ... + def populate_existing(self) -> Self: ... def with_parent(self, instance, property: Incomplete | None = ..., from_entity: Incomplete | None = ...): ... - def add_entity(self: Self, entity, alias: Incomplete | None = ...) -> Self: ... - def with_session(self: Self, session) -> Self: ... + def add_entity(self, entity, alias: Incomplete | None = ...) -> Self: ... + def with_session(self, session) -> Self: ... def from_self(self, *entities): ... def values(self, *columns): ... def value(self, column): ... - def with_entities(self: Self, *entities) -> Self: ... - def add_columns(self: Self, *column) -> Self: ... + def with_entities(self, *entities) -> Self: ... + def add_columns(self, *column) -> Self: ... def add_column(self, column): ... - def options(self: Self, *args) -> Self: ... + def options(self, *args) -> Self: ... def with_transformation(self, fn): ... def get_execution_options(self): ... - def execution_options(self: Self, **kwargs) -> Self: ... + def execution_options(self, **kwargs) -> Self: ... def with_for_update( - self: Self, - read: bool = ..., - nowait: bool = ..., - of: Incomplete | None = ..., - skip_locked: bool = ..., - key_share: bool = ..., + self, read: bool = ..., nowait: bool = ..., of: Incomplete | None = ..., skip_locked: bool = ..., key_share: bool = ... ) -> Self: ... - def params(self: Self, *args, **kwargs) -> Self: ... + def params(self, *args, **kwargs) -> Self: ... def where(self, *criterion): ... - def filter(self: Self, *criterion) -> Self: ... - def filter_by(self: Self, **kwargs) -> Self: ... - def order_by(self: Self, *clauses) -> Self: ... - def group_by(self: Self, *clauses) -> Self: ... - def having(self: Self, criterion) -> Self: ... + def filter(self, *criterion) -> Self: ... + def filter_by(self, **kwargs) -> Self: ... + def order_by(self, *clauses) -> Self: ... + def group_by(self, *clauses) -> Self: ... + def having(self, criterion) -> Self: ... def union(self, *q): ... def union_all(self, *q): ... def intersect(self, *q): ... def intersect_all(self, *q): ... def except_(self, *q): ... def except_all(self, *q): ... - def join(self: Self, target, *props, **kwargs) -> Self: ... - def outerjoin(self: Self, target, *props, **kwargs) -> Self: ... - def reset_joinpoint(self: Self) -> Self: ... - def select_from(self: Self, *from_obj) -> Self: ... - def select_entity_from(self: Self, from_obj) -> Self: ... + def join(self, target, *props, **kwargs) -> Self: ... + def outerjoin(self, target, *props, **kwargs) -> Self: ... + def reset_joinpoint(self) -> Self: ... + def select_from(self, *from_obj) -> Self: ... + def select_entity_from(self, from_obj) -> Self: ... def __getitem__(self, item): ... - def slice(self: Self, start, stop) -> Self: ... - def limit(self: Self, limit) -> Self: ... - def offset(self: Self, offset) -> Self: ... - def distinct(self: Self, *expr) -> Self: ... + def slice(self, start, stop) -> Self: ... + def limit(self, limit) -> Self: ... + def offset(self, offset) -> Self: ... + def distinct(self, *expr) -> Self: ... def all(self) -> list[_T]: ... - def from_statement(self: Self, statement) -> Self: ... + def from_statement(self, statement) -> Self: ... def first(self) -> _T | None: ... def one_or_none(self): ... def one(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/orm/session.pyi b/stubs/SQLAlchemy/sqlalchemy/orm/session.pyi index f5ca6a284fb3..09e4acb21134 100644 --- a/stubs/SQLAlchemy/sqlalchemy/orm/session.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/orm/session.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Mapping from typing import Any, TypeVar, overload +from typing_extensions import Self from ..engine.base import Connection from ..engine.result import Result @@ -105,7 +106,7 @@ class Session(_SessionClassMethods): query_cls: Incomplete | None = ..., ) -> None: ... connection_callable: Any - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, type_, value, traceback) -> None: ... @property def transaction(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/base.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/base.pyi index 54b1d90ee954..885aac1d0045 100644 --- a/stubs/SQLAlchemy/sqlalchemy/sql/base.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/sql/base.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import MutableMapping from typing import Any, ClassVar +from typing_extensions import Self from .. import util from ..util import HasMemoized, hybridmethod, memoized_property @@ -98,8 +99,8 @@ class Executable(roles.StatementRole, Generative): is_text: bool is_delete: bool is_dml: bool - def options(self: Self, *options) -> Self: ... - def execution_options(self: Self, **kw) -> Self: ... + def options(self, *options) -> Self: ... + def execution_options(self, **kw) -> Self: ... def get_execution_options(self): ... def execute(self, *multiparams, **params): ... def scalar(self, *multiparams, **params): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi index b6a4034d2efb..93c53c0c5c65 100644 --- a/stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/sql/elements.pyi @@ -1,6 +1,6 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from typing import Any, Generic, TypeVar -from typing_extensions import Literal +from typing_extensions import Literal, Self from .. import util from ..util import HasMemoized, memoized_property @@ -138,7 +138,7 @@ class TextClause( key: Any text: Any def __init__(self, text: str, bind: Incomplete | None = None) -> None: ... - def bindparams(self: Self, *binds, **names_to_values) -> Self: ... + def bindparams(self, *binds, **names_to_values) -> Self: ... def columns(self, *cols, **types): ... @property def type(self): ... diff --git a/stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi b/stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi index cdf9bf417aa5..eb24ab00c8f7 100644 --- a/stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi @@ -1,5 +1,6 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from typing import Any +from typing_extensions import Self from .. import util from ..util import HasMemoized, memoized_property @@ -38,14 +39,14 @@ class Selectable(ReturnsRows): def corresponding_column(self, column, require_embedded: bool = ...): ... class HasPrefixes: - def prefix_with(self: Self, *expr, **kw) -> Self: ... + def prefix_with(self, *expr, **kw) -> Self: ... class HasSuffixes: - def suffix_with(self: Self, *expr, **kw) -> Self: ... + def suffix_with(self, *expr, **kw) -> Self: ... class HasHints: def with_statement_hint(self, text, dialect_name: str = ...): ... - def with_hint(self: Self, selectable, text: str, dialect_name: str = ...) -> Self: ... + def with_hint(self, selectable, text: str, dialect_name: str = ...) -> Self: ... class FromClause(roles.AnonymizedFromClauseRole, Selectable): __visit_name__: str @@ -191,9 +192,9 @@ class Values(Generative, FromClause): name: Any literal_binds: Any def __init__(self, *columns, **kw) -> None: ... - def alias(self: Self, name: Incomplete | None, **kw) -> Self: ... # type: ignore[override] - def lateral(self: Self, name: Incomplete | None = ...) -> Self: ... - def data(self: Self, values) -> Self: ... + def alias(self, name: Incomplete | None, **kw) -> Self: ... # type: ignore[override] + def lateral(self, name: Incomplete | None = ...) -> Self: ... + def data(self, values) -> Self: ... class SelectBase( roles.SelectStatementRole, @@ -251,22 +252,17 @@ class GenerativeSelect(DeprecatedSelectBaseGenerations, SelectBase): bind: Incomplete | None = ..., ) -> None: ... def with_for_update( - self: Self, - nowait: bool = ..., - read: bool = ..., - of: Incomplete | None = ..., - skip_locked: bool = ..., - key_share: bool = ..., + self, nowait: bool = ..., read: bool = ..., of: Incomplete | None = ..., skip_locked: bool = ..., key_share: bool = ... ) -> Self: ... def get_label_style(self): ... def set_label_style(self, style): ... def apply_labels(self): ... - def limit(self: Self, limit: Incomplete | None) -> Self: ... - def fetch(self: Self, count: Incomplete | None, with_ties: bool = ..., percent: bool = ...) -> Self: ... - def offset(self: Self, offset: Incomplete | None) -> Self: ... - def slice(self: Self, start: Incomplete | None, stop: Incomplete | None) -> Self: ... - def order_by(self: Self, *clauses) -> Self: ... - def group_by(self: Self, *clauses) -> Self: ... + def limit(self, limit: Incomplete | None) -> Self: ... + def fetch(self, count: Incomplete | None, with_ties: bool = ..., percent: bool = ...) -> Self: ... + def offset(self, offset: Incomplete | None) -> Self: ... + def slice(self, start: Incomplete | None, stop: Incomplete | None) -> Self: ... + def order_by(self, *clauses) -> Self: ... + def group_by(self, *clauses) -> Self: ... class CompoundSelectState(CompileState): ... @@ -344,11 +340,9 @@ class Select( @property def column_descriptions(self): ... def from_statement(self, statement): ... - def join(self: Self, target, onclause: Incomplete | None = ..., isouter: bool = ..., full: bool = ...) -> Self: ... + def join(self, target, onclause: Incomplete | None = ..., isouter: bool = ..., full: bool = ...) -> Self: ... def outerjoin_from(self, from_, target, onclause: Incomplete | None = ..., full: bool = ...): ... - def join_from( - self: Self, from_, target, onclause: Incomplete | None = ..., isouter: bool = ..., full: bool = ... - ) -> Self: ... + def join_from(self, from_, target, onclause: Incomplete | None = ..., isouter: bool = ..., full: bool = ...) -> Self: ... def outerjoin(self, target, onclause: Incomplete | None = ..., full: bool = ...): ... def get_final_froms(self): ... @property @@ -359,18 +353,18 @@ class Select( def inner_columns(self): ... def is_derived_from(self, fromclause): ... def get_children(self, **kwargs): ... - def add_columns(self: Self, *columns) -> Self: ... + def add_columns(self, *columns) -> Self: ... def column(self, column): ... def reduce_columns(self, only_synonyms: bool = ...): ... - def with_only_columns(self: Self, *columns, **kw) -> Self: ... + def with_only_columns(self, *columns, **kw) -> Self: ... @property def whereclause(self): ... - def where(self: Self, *whereclause) -> Self: ... - def having(self: Self, having) -> Self: ... - def distinct(self: Self, *expr) -> Self: ... - def select_from(self: Self, *froms) -> Self: ... - def correlate(self: Self, *fromclauses) -> Self: ... - def correlate_except(self: Self, *fromclauses) -> Self: ... + def where(self, *whereclause) -> Self: ... + def having(self, having) -> Self: ... + def distinct(self, *expr) -> Self: ... + def select_from(self, *froms) -> Self: ... + def correlate(self, *fromclauses) -> Self: ... + def correlate_except(self, *fromclauses) -> Self: ... @HasMemoized.memoized_attribute def selected_columns(self): ... def self_group(self, against: Incomplete | None = ...): ... @@ -394,10 +388,10 @@ class ScalarSelect(roles.InElementRole, Generative, Grouping): def columns(self) -> None: ... @property def c(self): ... - def where(self: Self, crit) -> Self: ... + def where(self, crit) -> Self: ... def self_group(self, **kwargs): ... - def correlate(self: Self, *fromclauses) -> Self: ... - def correlate_except(self: Self, *fromclauses) -> Self: ... + def correlate(self, *fromclauses) -> Self: ... + def correlate_except(self, *fromclauses) -> Self: ... class Exists(UnaryExpression): inherit_cache: bool @@ -418,7 +412,7 @@ class TextualSelect(SelectBase): def __init__(self, text, columns, positional: bool = ...) -> None: ... @HasMemoized.memoized_attribute def selected_columns(self): ... - def bindparams(self: Self, *binds, **bind_as_values) -> Self: ... + def bindparams(self, *binds, **bind_as_values) -> Self: ... TextAsFrom = TextualSelect diff --git a/stubs/SQLAlchemy/sqlalchemy/util/_collections.pyi b/stubs/SQLAlchemy/sqlalchemy/util/_collections.pyi index c345cfd901fb..432e6e1dc756 100644 --- a/stubs/SQLAlchemy/sqlalchemy/util/_collections.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/util/_collections.pyi @@ -1,7 +1,8 @@ import collections.abc -from _typeshed import Incomplete, Self, SupportsKeysAndGetItem +from _typeshed import Incomplete, SupportsKeysAndGetItem from collections.abc import Callable, Iterable, Iterator, Mapping from typing import Any, Generic, NoReturn, TypeVar, overload +from typing_extensions import Self from ..cimmutabledict import immutabledict as immutabledict @@ -82,21 +83,21 @@ class OrderedSet(set[_T], Generic[_T]): def __getitem__(self, key: int) -> _T: ... def __iter__(self) -> Iterator[_T]: ... def __add__(self, other: Iterable[_S]) -> OrderedSet[_S | _T]: ... - def update(self: Self, iterable: Iterable[_T]) -> Self: ... # type: ignore[override] + def update(self, iterable: Iterable[_T]) -> Self: ... # type: ignore[override] __ior__ = update # type: ignore[assignment] def union(self, other: Iterable[_S]) -> OrderedSet[_S | _T]: ... # type: ignore[override] __or__ = union # type: ignore[assignment] # pyright: ignore[reportGeneralTypeIssues] - def intersection(self: Self, other: Iterable[Any]) -> Self: ... # type: ignore[override] - __and__ = intersection # type: ignore[assignment] # pyright: ignore[reportGeneralTypeIssues] + def intersection(self, other: Iterable[Any]) -> Self: ... # type: ignore[override] + __and__ = intersection def symmetric_difference(self, other: Iterable[_S]) -> OrderedSet[_S | _T]: ... __xor__ = symmetric_difference # type: ignore[assignment] # pyright: ignore[reportGeneralTypeIssues] - def difference(self: Self, other: Iterable[Any]) -> Self: ... # type: ignore[override] - __sub__ = difference # type: ignore[assignment] # pyright: ignore[reportGeneralTypeIssues] - def intersection_update(self: Self, other: Iterable[Any]) -> Self: ... # type: ignore[override] + def difference(self, other: Iterable[Any]) -> Self: ... # type: ignore[override] + __sub__ = difference + def intersection_update(self, other: Iterable[Any]) -> Self: ... # type: ignore[override] __iand__ = intersection_update # type: ignore[assignment] - def symmetric_difference_update(self: Self, other: Iterable[_T]) -> Self: ... # type: ignore[override] + def symmetric_difference_update(self, other: Iterable[_T]) -> Self: ... # type: ignore[override] __ixor__ = symmetric_difference_update # type: ignore[assignment] - def difference_update(self: Self, other: Iterable[Any]) -> Self: ... # type: ignore[override] + def difference_update(self, other: Iterable[Any]) -> Self: ... # type: ignore[override] __isub__ = difference_update # type: ignore[assignment] class IdentitySet: diff --git a/stubs/SQLAlchemy/sqlalchemy/util/langhelpers.pyi b/stubs/SQLAlchemy/sqlalchemy/util/langhelpers.pyi index 4c3949000381..c38631426b18 100644 --- a/stubs/SQLAlchemy/sqlalchemy/util/langhelpers.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/util/langhelpers.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable from typing import Any, Generic, TypeVar, overload +from typing_extensions import Self from . import compat @@ -70,7 +71,7 @@ class memoized_property(Generic[_R]): __name__: str def __init__(self, fget: Callable[..., _R], doc: str | None = ...) -> None: ... @overload - def __get__(self: Self, obj: None, cls: object) -> Self: ... + def __get__(self, obj: None, cls: object) -> Self: ... @overload def __get__(self, obj: object, cls: object) -> _R: ... @classmethod @@ -85,7 +86,7 @@ class HasMemoized: __name__: str def __init__(self, fget: Callable[..., _R], doc: str | None = ...) -> None: ... @overload - def __get__(self: Self, obj: None, cls: object) -> Self: ... + def __get__(self, obj: None, cls: object) -> Self: ... @overload def __get__(self, obj: object, cls: object) -> _R: ... @@ -119,7 +120,7 @@ class hybridproperty(Generic[_R]): def __get__(self, instance: None, owner: Any) -> _R: ... @overload def __get__(self, instance: object, owner: object) -> _R: ... - def classlevel(self: Self, func: Callable[..., _R]) -> Self: ... + def classlevel(self, func: Callable[..., _R]) -> Self: ... class hybridmethod: func: Any diff --git a/stubs/aiofiles/aiofiles/base.pyi b/stubs/aiofiles/aiofiles/base.pyi index 8919031e216c..cc9baf4a99f9 100644 --- a/stubs/aiofiles/aiofiles/base.pyi +++ b/stubs/aiofiles/aiofiles/base.pyi @@ -1,7 +1,7 @@ -from _typeshed import Self from collections.abc import Coroutine, Generator, Iterator from types import CodeType, FrameType, TracebackType, coroutine from typing import Any, Generic, TypeVar +from typing_extensions import Self _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) @@ -10,7 +10,7 @@ _T_contra = TypeVar("_T_contra", contravariant=True) class AsyncBase(Generic[_T]): def __init__(self, file: str, loop: Any, executor: Any) -> None: ... - def __aiter__(self: Self) -> Self: ... + def __aiter__(self) -> Self: ... async def __anext__(self) -> _T: ... class AiofilesContextManager(Generic[_T_co, _T_contra, _V_co]): diff --git a/stubs/aws-xray-sdk/aws_xray_sdk/core/models/trace_header.pyi b/stubs/aws-xray-sdk/aws_xray_sdk/core/models/trace_header.pyi index ba1d9b06a909..cb34fbaab771 100644 --- a/stubs/aws-xray-sdk/aws_xray_sdk/core/models/trace_header.pyi +++ b/stubs/aws-xray-sdk/aws_xray_sdk/core/models/trace_header.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from typing import Any +from typing_extensions import Self log: Any ROOT: str @@ -13,7 +13,7 @@ class TraceHeader: self, root: str | None = ..., parent: str | None = ..., sampled: bool | None = ..., data: dict[str, Any] | None = ... ) -> None: ... @classmethod - def from_header_str(cls: type[Self], header) -> Self: ... + def from_header_str(cls, header) -> Self: ... def to_header_str(self): ... @property def root(self): ... diff --git a/stubs/beautifulsoup4/bs4/__init__.pyi b/stubs/beautifulsoup4/bs4/__init__.pyi index f22af5493bec..21ed6f204cdb 100644 --- a/stubs/beautifulsoup4/bs4/__init__.pyi +++ b/stubs/beautifulsoup4/bs4/__init__.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, Self, SupportsRead +from _typeshed import Incomplete, SupportsRead from collections.abc import Sequence from typing import Any +from typing_extensions import Self from .builder import ParserRejectedMarkup as ParserRejectedMarkup, TreeBuilder, XMLParsedAsHTMLWarning as XMLParsedAsHTMLWarning from .element import ( @@ -45,7 +46,7 @@ class BeautifulSoup(Tag): element_classes: dict[type[PageElement], type[Any]] | None = ..., **kwargs, ) -> None: ... - def __copy__(self: Self) -> Self: ... + def __copy__(self) -> Self: ... hidden: bool current_data: Any currentTag: Any diff --git a/stubs/beautifulsoup4/bs4/element.pyi b/stubs/beautifulsoup4/bs4/element.pyi index 5aef46e4e10c..f7fa39afae07 100644 --- a/stubs/beautifulsoup4/bs4/element.pyi +++ b/stubs/beautifulsoup4/bs4/element.pyi @@ -1,8 +1,8 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable, Iterable, Iterator from re import Pattern from typing import Any, Generic, TypeVar, overload -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias from . import BeautifulSoup from .builder import TreeBuilder @@ -14,7 +14,7 @@ whitespace_re: Pattern[str] PYTHON_SPECIFIC_ENCODINGS: set[str] class NamespacedAttribute(str): - def __new__(cls: type[Self], prefix: str, name: str | None = ..., namespace: str | None = ...) -> Self: ... + def __new__(cls, prefix: str, name: str | None = ..., namespace: str | None = ...) -> Self: ... class AttributeValueWithCharsetSubstitution(str): ... @@ -57,13 +57,13 @@ class PageElement: getText = get_text @property def text(self) -> str: ... - def replace_with(self: Self, *args: PageElement | str) -> Self: ... + def replace_with(self, *args: PageElement | str) -> Self: ... replaceWith = replace_with - def unwrap(self: Self) -> Self: ... + def unwrap(self) -> Self: ... replace_with_children = unwrap replaceWithChildren = unwrap def wrap(self, wrap_inside: _PageElementT) -> _PageElementT: ... - def extract(self: Self, _self_index: int | None = ...) -> Self: ... + def extract(self, _self_index: int | None = ...) -> Self: ... def insert(self, position: int, new_child: PageElement | str) -> None: ... def append(self, tag: PageElement | str) -> None: ... def extend(self, tags: Iterable[PageElement | str]) -> None: ... @@ -182,8 +182,8 @@ class NavigableString(str, PageElement): PREFIX: str SUFFIX: str known_xml: bool | None - def __new__(cls: type[Self], value: str | bytes) -> Self: ... - def __copy__(self: Self) -> Self: ... + def __new__(cls, value: str | bytes) -> Self: ... + def __copy__(self) -> Self: ... def __getnewargs__(self) -> tuple[str]: ... def output_ready(self, formatter: Formatter | str | None = ...) -> str: ... @property @@ -260,7 +260,7 @@ class Tag(PageElement): namespaces: dict[str, str] | None = ..., ) -> None: ... parserClass: type[BeautifulSoup] | None - def __copy__(self: Self) -> Self: ... + def __copy__(self) -> Self: ... @property def is_empty_element(self) -> bool: ... @property diff --git a/stubs/caldav/caldav/davclient.pyi b/stubs/caldav/caldav/davclient.pyi index ab99a10c51ac..002bd44f15d2 100644 --- a/stubs/caldav/caldav/davclient.pyi +++ b/stubs/caldav/caldav/davclient.pyi @@ -1,7 +1,6 @@ -from _typeshed import Self from collections.abc import Iterable, Mapping from typing import Any -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias from urllib.parse import ParseResult, SplitResult from requests.auth import AuthBase @@ -50,7 +49,7 @@ class DAVClient: ssl_verify_cert: bool | str = ..., ssl_cert: str | tuple[str, str] | None = ..., ) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ... def principal(self, *, url: str | ParseResult | SplitResult | URL | None = ...) -> Principal: ... def calendar( diff --git a/stubs/caldav/caldav/elements/base.pyi b/stubs/caldav/caldav/elements/base.pyi index 84e229ea66b3..c55dbf7d0dac 100644 --- a/stubs/caldav/caldav/elements/base.pyi +++ b/stubs/caldav/caldav/elements/base.pyi @@ -1,7 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Iterable from typing import Any, ClassVar -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias _Element: TypeAlias = Any # actually lxml.etree._Element @@ -12,10 +12,10 @@ class BaseElement: attributes: Incomplete | None caldav_class: Incomplete | None def __init__(self, name: str | None = ..., value: str | bytes | None = ...) -> None: ... - def __add__(self: Self, other: BaseElement) -> Self: ... + def __add__(self, other: BaseElement) -> Self: ... def xmlelement(self) -> _Element: ... def xmlchildren(self, root: _Element) -> None: ... - def append(self: Self, element: BaseElement | Iterable[BaseElement]) -> Self: ... + def append(self, element: BaseElement | Iterable[BaseElement]) -> Self: ... class NamedBaseElement(BaseElement): def __init__(self, name: str | None = ...) -> None: ... diff --git a/stubs/caldav/caldav/objects.pyi b/stubs/caldav/caldav/objects.pyi index ba748e7cf0f2..310ad7210518 100644 --- a/stubs/caldav/caldav/objects.pyi +++ b/stubs/caldav/caldav/objects.pyi @@ -1,8 +1,8 @@ import datetime -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Iterable, Iterator, Mapping, Sequence from typing import Any, TypeVar, overload -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from urllib.parse import ParseResult, SplitResult from vobject.base import VBase @@ -41,8 +41,8 @@ class DAVObject: def get_properties( self, props: Incomplete | None = ..., depth: int = ..., parse_response_xml: bool = ..., parse_props: bool = ... ): ... - def set_properties(self: Self, props: Incomplete | None = ...) -> Self: ... - def save(self: Self) -> Self: ... + def set_properties(self, props: Incomplete | None = ...) -> Self: ... + def save(self) -> Self: ... def delete(self) -> None: ... class CalendarSet(DAVObject): @@ -208,18 +208,18 @@ class CalendarObjectResource(DAVObject): props: Incomplete | None = ..., ) -> None: ... def add_organizer(self) -> None: ... - def split_expanded(self: Self) -> list[Self]: ... + def split_expanded(self) -> list[Self]: ... def expand_rrule(self, start: datetime.datetime, end: datetime.datetime) -> None: ... def add_attendee(self, attendee, no_default_parameters: bool = ..., **parameters) -> None: ... def is_invite_request(self) -> bool: ... def accept_invite(self, calendar: Incomplete | None = ...) -> None: ... def decline_invite(self, calendar: Incomplete | None = ...) -> None: ... def tentatively_accept_invite(self, calendar: Incomplete | None = ...) -> None: ... - def copy(self: Self, keep_uid: bool = ..., new_parent: Incomplete | None = ...) -> Self: ... - def load(self: Self) -> Self: ... + def copy(self, keep_uid: bool = ..., new_parent: Incomplete | None = ...) -> Self: ... + def load(self) -> Self: ... def change_attendee_status(self, attendee: Incomplete | None = ..., **kwargs) -> None: ... def save( - self: Self, + self, no_overwrite: bool = ..., no_create: bool = ..., obj_type: str | None = ..., diff --git a/stubs/click-spinner/click_spinner/__init__.pyi b/stubs/click-spinner/click_spinner/__init__.pyi index 68a1ba1521bf..8b3a64fcb9f1 100644 --- a/stubs/click-spinner/click_spinner/__init__.pyi +++ b/stubs/click-spinner/click_spinner/__init__.pyi @@ -1,9 +1,8 @@ import threading -from _typeshed import Self from collections.abc import Iterator from types import TracebackType from typing import Protocol -from typing_extensions import Literal +from typing_extensions import Literal, Self __version__: str @@ -24,7 +23,7 @@ class Spinner: def start(self) -> None: ... def stop(self) -> None: ... def init_spin(self) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> Literal[False]: ... diff --git a/stubs/croniter/croniter/croniter.pyi b/stubs/croniter/croniter/croniter.pyi index 45b8d5c32869..a0823b8c45c3 100644 --- a/stubs/croniter/croniter/croniter.pyi +++ b/stubs/croniter/croniter/croniter.pyi @@ -1,10 +1,10 @@ import datetime -from _typeshed import ReadableBuffer, Self +from _typeshed import ReadableBuffer from collections import OrderedDict from collections.abc import Iterator from re import Match, Pattern from typing import Any, overload -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias _RetType: TypeAlias = type[float | datetime.datetime] @@ -69,7 +69,7 @@ class croniter(Iterator[Any]): def get_prev(self, ret_type: _RetType | None = ...) -> Any: ... def get_current(self, ret_type: _RetType | None = ...) -> Any: ... def set_current(self, start_time: float | datetime.datetime | None, force: bool = ...) -> float: ... - def __iter__(self: Self) -> Self: ... + def __iter__(self) -> Self: ... def next( self, ret_type: _RetType | None = ..., start_time: float | datetime.datetime | None = ..., is_prev: bool | None = ... ) -> Any: ... diff --git a/stubs/dateparser/dateparser/conf.pyi b/stubs/dateparser/dateparser/conf.pyi index 4d2153dd5042..08883e8846a8 100644 --- a/stubs/dateparser/dateparser/conf.pyi +++ b/stubs/dateparser/dateparser/conf.pyi @@ -1,8 +1,9 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from typing import Any +from typing_extensions import Self class Settings: - def __new__(cls: type[Self], *args, **kw) -> Self: ... + def __new__(cls, *args, **kw) -> Self: ... def __init__(self, settings: Incomplete | None = ...) -> None: ... @classmethod def get_key(cls, settings: Incomplete | None = ...): ... diff --git a/stubs/docutils/docutils/__init__.pyi b/stubs/docutils/docutils/__init__.pyi index cfa9914a6a4e..1a2f9df43aea 100644 --- a/stubs/docutils/docutils/__init__.pyi +++ b/stubs/docutils/docutils/__init__.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from typing import Any, ClassVar, NamedTuple +from typing_extensions import Self __docformat__: str __version__: str @@ -14,13 +14,7 @@ class _VersionInfo(NamedTuple): class VersionInfo(_VersionInfo): def __new__( - cls: type[Self], - major: int = ..., - minor: int = ..., - micro: int = ..., - releaselevel: str = ..., - serial: int = ..., - release: bool = ..., + cls, major: int = ..., minor: int = ..., micro: int = ..., releaselevel: str = ..., serial: int = ..., release: bool = ... ) -> Self: ... __version_info__: VersionInfo diff --git a/stubs/docutils/docutils/nodes.pyi b/stubs/docutils/docutils/nodes.pyi index 5281bdca1705..80ee6bbe792b 100644 --- a/stubs/docutils/docutils/nodes.pyi +++ b/stubs/docutils/docutils/nodes.pyi @@ -1,9 +1,9 @@ import xml.dom.minidom -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from abc import abstractmethod from collections.abc import Callable, Generator, Iterable, Sequence from typing import Any, ClassVar, Protocol, TypeVar, overload -from typing_extensions import Literal +from typing_extensions import Literal, Self from docutils.transforms import Transformer @@ -26,9 +26,9 @@ class Node: # (although it's not used in the docutils implementation) because it # makes Mypy reject Node() with "Cannot instantiate abstract class". @abstractmethod - def copy(self: Self) -> Self: ... + def copy(self) -> Self: ... @abstractmethod - def deepcopy(self: Self) -> Self: ... + def deepcopy(self) -> Self: ... @abstractmethod def pformat(self, indent: str = ..., level: int = ...) -> str: ... @abstractmethod @@ -97,9 +97,9 @@ class Element(Node): def __delitem__(self, key: str | int | slice) -> None: ... def __add__(self, other: list[Node]) -> list[Node]: ... def __radd__(self, other: list[Node]) -> list[Node]: ... - def __iadd__(self: Self, other: Node | Iterable[Node]) -> Self: ... - def copy(self: Self) -> Self: ... - def deepcopy(self: Self) -> Self: ... + def __iadd__(self, other: Node | Iterable[Node]) -> Self: ... + def copy(self) -> Self: ... + def deepcopy(self) -> Self: ... def pformat(self, indent: str = ..., level: int = ...) -> str: ... def astext(self) -> str: ... def __getattr__(self, __name: str) -> Incomplete: ... @@ -109,11 +109,11 @@ class Text(Node, str): children: tuple[()] # we omit the rawsource parameter because it has been deprecated and is ignored - def __new__(cls: type[Self], data: str) -> Self: ... + def __new__(cls, data: str) -> Self: ... def __init__(self, data: str) -> None: ... def shortrepr(self, maxlen: int = ...) -> str: ... - def copy(self: Self) -> Self: ... - def deepcopy(self: Self) -> Self: ... + def copy(self) -> Self: ... + def deepcopy(self) -> Self: ... def pformat(self, indent: str = ..., level: int = ...) -> str: ... def astext(self) -> str: ... def rstrip(self, chars: str | None = ...) -> str: ... @@ -124,8 +124,8 @@ class Root: ... class document(Root, Structural, Element): transformer: Transformer - def copy(self: Self) -> Self: ... - def deepcopy(self: Self) -> Self: ... + def copy(self) -> Self: ... + def deepcopy(self) -> Self: ... def pformat(self, indent: str = ..., level: int = ...) -> str: ... def astext(self) -> str: ... def __getattr__(self, __name: str) -> Incomplete: ... diff --git a/stubs/entrypoints/entrypoints.pyi b/stubs/entrypoints/entrypoints.pyi index ce9eb7869e94..08e89ec5ad10 100644 --- a/stubs/entrypoints/entrypoints.pyi +++ b/stubs/entrypoints/entrypoints.pyi @@ -1,8 +1,8 @@ import sys -from _typeshed import Self from collections.abc import Iterator, Sequence from configparser import ConfigParser from typing import Any +from typing_extensions import Self if sys.version_info >= (3, 8): from re import Pattern @@ -36,14 +36,14 @@ class EntryPoint: ) -> None: ... def load(self) -> Any: ... @classmethod - def from_string(cls: type[Self], epstr: str, name: str, distro: Distribution | None = ...) -> Self: ... + def from_string(cls, epstr: str, name: str, distro: Distribution | None = ...) -> Self: ... class Distribution: name: str version: str def __init__(self, name: str, version: str) -> None: ... @classmethod - def from_name_version(cls: type[Self], name: str) -> Self: ... + def from_name_version(cls, name: str) -> Self: ... def iter_files_distros( path: Sequence[str] | None = ..., repeated_distro: str = ... diff --git a/stubs/fpdf2/fpdf/drawing.pyi b/stubs/fpdf2/fpdf/drawing.pyi index 7a78abebf57a..24a1b543c93e 100644 --- a/stubs/fpdf2/fpdf/drawing.pyi +++ b/stubs/fpdf2/fpdf/drawing.pyi @@ -1,11 +1,11 @@ import decimal -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections import OrderedDict from collections.abc import Callable, Generator, Iterator from contextlib import contextmanager from re import Pattern from typing import Any, ClassVar, NamedTuple, TypeVar -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias from .syntax import Name, Raw @@ -38,7 +38,7 @@ class _DeviceRGBBase(NamedTuple): class DeviceRGB(_DeviceRGBBase): OPERATOR: ClassVar[str] - def __new__(cls: type[Self], r: Number, g: Number, b: Number, a: Number | None = ...) -> Self: ... + def __new__(cls, r: Number, g: Number, b: Number, a: Number | None = ...) -> Self: ... @property def colors(self) -> tuple[Number, Number, Number]: ... def serialize(self) -> str: ... @@ -49,7 +49,7 @@ class _DeviceGrayBase(NamedTuple): class DeviceGray(_DeviceGrayBase): OPERATOR: ClassVar[str] - def __new__(cls: type[Self], g: Number, a: Number | None = ...) -> Self: ... + def __new__(cls, g: Number, a: Number | None = ...) -> Self: ... @property def colors(self) -> tuple[Number]: ... def serialize(self) -> str: ... @@ -63,7 +63,7 @@ class _DeviceCMYKBase(NamedTuple): class DeviceCMYK(_DeviceCMYKBase): OPERATOR: ClassVar[str] - def __new__(cls: type[Self], c: Number, m: Number, y: Number, k: Number, a: Number | None = ...) -> Self: ... + def __new__(cls, c: Number, m: Number, y: Number, k: Number, a: Number | None = ...) -> Self: ... @property def colors(self) -> tuple[Number, Number, Number, Number]: ... def serialize(self) -> str: ... @@ -128,7 +128,7 @@ class GraphicsStyle: @classmethod def merge(cls, parent, child): ... def __init__(self) -> None: ... - def __deepcopy__(self: Self, memo) -> Self: ... + def __deepcopy__(self, memo) -> Self: ... @property def allow_transparency(self): ... @allow_transparency.setter @@ -322,7 +322,7 @@ class DrawingContext: class PaintedPath: def __init__(self, x: int = ..., y: int = ...) -> None: ... - def __deepcopy__(self: Self, memo) -> Self: ... + def __deepcopy__(self, memo) -> Self: ... @property def style(self): ... @property @@ -342,26 +342,26 @@ class PaintedPath: @clipping_path.setter def clipping_path(self, new_clipath) -> None: ... @contextmanager - def transform_group(self: Self, transform) -> Iterator[Self]: ... + def transform_group(self, transform) -> Iterator[Self]: ... def add_path_element(self, item, _copy: bool = ...) -> None: ... def remove_last_path_element(self) -> None: ... - def rectangle(self: Self, x, y, w, h, rx: int = ..., ry: int = ...) -> Self: ... - def circle(self: Self, cx, cy, r) -> Self: ... - def ellipse(self: Self, cx, cy, rx, ry) -> Self: ... - def move_to(self: Self, x, y) -> Self: ... - def move_relative(self: Self, x, y) -> Self: ... - def line_to(self: Self, x, y) -> Self: ... - def line_relative(self: Self, dx, dy) -> Self: ... - def horizontal_line_to(self: Self, x) -> Self: ... - def horizontal_line_relative(self: Self, dx) -> Self: ... - def vertical_line_to(self: Self, y) -> Self: ... - def vertical_line_relative(self: Self, dy) -> Self: ... - def curve_to(self: Self, x1, y1, x2, y2, x3, y3) -> Self: ... - def curve_relative(self: Self, dx1, dy1, dx2, dy2, dx3, dy3) -> Self: ... - def quadratic_curve_to(self: Self, x1, y1, x2, y2) -> Self: ... - def quadratic_curve_relative(self: Self, dx1, dy1, dx2, dy2) -> Self: ... - def arc_to(self: Self, rx, ry, rotation, large_arc, positive_sweep, x, y) -> Self: ... - def arc_relative(self: Self, rx, ry, rotation, large_arc, positive_sweep, dx, dy) -> Self: ... + def rectangle(self, x, y, w, h, rx: int = ..., ry: int = ...) -> Self: ... + def circle(self, cx, cy, r) -> Self: ... + def ellipse(self, cx, cy, rx, ry) -> Self: ... + def move_to(self, x, y) -> Self: ... + def move_relative(self, x, y) -> Self: ... + def line_to(self, x, y) -> Self: ... + def line_relative(self, dx, dy) -> Self: ... + def horizontal_line_to(self, x) -> Self: ... + def horizontal_line_relative(self, dx) -> Self: ... + def vertical_line_to(self, y) -> Self: ... + def vertical_line_relative(self, dy) -> Self: ... + def curve_to(self, x1, y1, x2, y2, x3, y3) -> Self: ... + def curve_relative(self, dx1, dy1, dx2, dy2, dx3, dy3) -> Self: ... + def quadratic_curve_to(self, x1, y1, x2, y2) -> Self: ... + def quadratic_curve_relative(self, dx1, dy1, dx2, dy2) -> Self: ... + def arc_to(self, rx, ry, rotation, large_arc, positive_sweep, x, y) -> Self: ... + def arc_relative(self, rx, ry, rotation, large_arc, positive_sweep, dx, dy) -> Self: ... def close(self) -> None: ... def render( self, gsd_registry, style, last_item, initial_point, debug_stream: Incomplete | None = ..., pfx: Incomplete | None = ... @@ -380,7 +380,7 @@ class GraphicsContext: style: GraphicsStyle path_items: list[Incomplete] def __init__(self) -> None: ... - def __deepcopy__(self: Self, memo) -> Self: ... + def __deepcopy__(self, memo) -> Self: ... @property def transform(self) -> Transform | None: ... @transform.setter diff --git a/stubs/fpdf2/fpdf/enums.pyi b/stubs/fpdf2/fpdf/enums.pyi index 395e28103fd4..9f82c6008301 100644 --- a/stubs/fpdf2/fpdf/enums.pyi +++ b/stubs/fpdf2/fpdf/enums.pyi @@ -1,6 +1,5 @@ -from _typeshed import Self from enum import Enum, Flag, IntEnum, IntFlag -from typing_extensions import Literal +from typing_extensions import Literal, Self from .syntax import Name @@ -10,11 +9,11 @@ class SignatureFlag(IntEnum): class CoerciveEnum(Enum): @classmethod - def coerce(cls: type[Self], value: Self | str) -> Self: ... + def coerce(cls, value: Self | str) -> Self: ... class CoerciveIntEnum(IntEnum): @classmethod - def coerce(cls: type[Self], value: Self | str | int) -> Self: ... + def coerce(cls, value: Self | str | int) -> Self: ... class CharVPos(CoerciveEnum): SUP: str diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/global_cache.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/global_cache.pyi index 58ab248b8b54..8a495a68c568 100644 --- a/stubs/google-cloud-ndb/google/cloud/ndb/global_cache.pyi +++ b/stubs/google-cloud-ndb/google/cloud/ndb/global_cache.pyi @@ -1,6 +1,7 @@ import abc -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from typing import Any +from typing_extensions import Self ConnectionError: Any @@ -38,7 +39,7 @@ class _InProcessGlobalCache(GlobalCache): class RedisCache(GlobalCache): transient_errors: Any @classmethod - def from_environment(cls: type[Self], strict_read: bool = ..., strict_write: bool = ...) -> Self: ... + def from_environment(cls, strict_read: bool = ..., strict_write: bool = ...) -> Self: ... redis: Any strict_read: Any strict_write: Any @@ -60,9 +61,7 @@ class MemcacheCache(GlobalCache): def __eq__(self, other): ... transient_errors: Any @classmethod - def from_environment( - cls: type[Self], max_pool_size: int = ..., strict_read: bool = ..., strict_write: bool = ... - ) -> Self: ... + def from_environment(cls, max_pool_size: int = ..., strict_read: bool = ..., strict_write: bool = ...) -> Self: ... client: Any strict_read: Any strict_write: Any diff --git a/stubs/google-cloud-ndb/google/cloud/ndb/model.pyi b/stubs/google-cloud-ndb/google/cloud/ndb/model.pyi index 8cd1415a21e0..10ba251a8acb 100644 --- a/stubs/google-cloud-ndb/google/cloud/ndb/model.pyi +++ b/stubs/google-cloud-ndb/google/cloud/ndb/model.pyi @@ -1,8 +1,7 @@ import datetime -from _typeshed import Self from collections.abc import Callable, Iterable, Sequence from typing import Any, NoReturn -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from google.cloud.ndb import exceptions, key as key_module, query as query_module, tasklets as tasklets_module @@ -27,7 +26,7 @@ class _NotEqualMixin: _Direction: TypeAlias = Literal["asc", "desc"] class IndexProperty(_NotEqualMixin): - def __new__(cls: type[Self], name: str, direction: _Direction) -> Self: ... + def __new__(cls, name: str, direction: _Direction) -> Self: ... @property def name(self) -> str: ... @property @@ -36,7 +35,7 @@ class IndexProperty(_NotEqualMixin): def __hash__(self) -> int: ... class Index(_NotEqualMixin): - def __new__(cls: type[Self], kind: str, properties: list[IndexProperty], ancestor: bool) -> Self: ... + def __new__(cls, kind: str, properties: list[IndexProperty], ancestor: bool) -> Self: ... @property def kind(self) -> str: ... @property @@ -59,7 +58,7 @@ class IndexState(_NotEqualMixin): class ModelAdapter: # This actually returns NoReturn, but mypy can't handle that - def __new__(cls: type[Self], *args, **kwargs) -> Self: ... + def __new__(cls, *args, **kwargs) -> Self: ... def make_connection(*args, **kwargs) -> NoReturn: ... diff --git a/stubs/httplib2/httplib2/__init__.pyi b/stubs/httplib2/httplib2/__init__.pyi index 44240e42283e..485c09178822 100644 --- a/stubs/httplib2/httplib2/__init__.pyi +++ b/stubs/httplib2/httplib2/__init__.pyi @@ -1,7 +1,8 @@ import http.client -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Generator from typing import Any, ClassVar +from typing_extensions import Self from .error import * @@ -184,4 +185,4 @@ class Response(dict[str, Any]): previous: Any def __init__(self, info) -> None: ... @property - def dict(self: Self) -> Self: ... + def dict(self) -> Self: ... diff --git a/stubs/ibm-db/ibm_db.pyi b/stubs/ibm-db/ibm_db.pyi index af58121341d6..ba3063500733 100644 --- a/stubs/ibm-db/ibm_db.pyi +++ b/stubs/ibm-db/ibm_db.pyi @@ -1,6 +1,5 @@ -from _typeshed import Self from typing import Any, overload -from typing_extensions import final +from typing_extensions import Self, final ATTR_CASE: int CASE_LOWER: int @@ -85,7 +84,7 @@ WCHAR_YES: int @final class IBM_DBClientInfo: - def __new__(cls: type[Self], *args: object, **kwargs: object) -> Self: ... + def __new__(cls, *args: object, **kwargs: object) -> Self: ... APPL_CODEPAGE: int CONN_CODEPAGE: int DATA_SOURCE_NAME: str @@ -97,11 +96,11 @@ class IBM_DBClientInfo: @final class IBM_DBConnection: - def __new__(cls: type[Self], *args: object, **kwargs: object) -> Self: ... + def __new__(cls, *args: object, **kwargs: object) -> Self: ... @final class IBM_DBServerInfo: - def __new__(cls: type[Self], *args: object, **kwargs: object) -> Self: ... + def __new__(cls, *args: object, **kwargs: object) -> Self: ... DBMS_NAME: str DBMS_VER: str DB_CODEPAGE: int @@ -127,7 +126,7 @@ class IBM_DBServerInfo: @final class IBM_DBStatement: - def __new__(cls: type[Self], *args: object, **kwargs: object) -> Self: ... + def __new__(cls, *args: object, **kwargs: object) -> Self: ... def active(__connection: IBM_DBConnection | None) -> bool: ... def autocommit(__connection: IBM_DBConnection, __value: int = ...) -> int | bool: ... diff --git a/stubs/influxdb-client/influxdb_client/client/flux_csv_parser.pyi b/stubs/influxdb-client/influxdb_client/client/flux_csv_parser.pyi index 932ffa0d9678..0a96f5f6eb10 100644 --- a/stubs/influxdb-client/influxdb_client/client/flux_csv_parser.pyi +++ b/stubs/influxdb-client/influxdb_client/client/flux_csv_parser.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Generator from enum import Enum +from typing_extensions import Self from influxdb_client.client.flux_table import TableList @@ -44,9 +45,9 @@ class FluxCsvParser: query_options: Incomplete | None = ..., response_metadata_mode: FluxResponseMetadataMode = ..., ) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, exc_type, exc_val, exc_tb) -> None: ... - async def __aenter__(self: Self) -> Self: ... + async def __aenter__(self) -> Self: ... async def __aexit__(self, exc_type, exc_val, exc_tb) -> None: ... def generator(self) -> Generator[Incomplete, None, None]: ... def generator_async(self): ... diff --git a/stubs/influxdb-client/influxdb_client/client/influxdb_client.pyi b/stubs/influxdb-client/influxdb_client/client/influxdb_client.pyi index 6cc070cd5221..6b5254989aad 100644 --- a/stubs/influxdb-client/influxdb_client/client/influxdb_client.pyi +++ b/stubs/influxdb-client/influxdb_client/client/influxdb_client.pyi @@ -1,4 +1,5 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete +from typing_extensions import Self from influxdb_client import HealthCheck, InvokableScriptsApi, Ready from influxdb_client.client._base import _BaseClient @@ -41,7 +42,7 @@ class InfluxDBClient(_BaseClient): retries: bool | Incomplete = ..., profilers: Incomplete | None = ..., ) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ... @classmethod def from_config_file(cls, config_file: str = ..., debug: Incomplete | None = ..., enable_gzip: bool = ..., **kwargs): ... diff --git a/stubs/influxdb-client/influxdb_client/client/influxdb_client_async.pyi b/stubs/influxdb-client/influxdb_client/client/influxdb_client_async.pyi index 14605d16d290..daad06d7b3a1 100644 --- a/stubs/influxdb-client/influxdb_client/client/influxdb_client_async.pyi +++ b/stubs/influxdb-client/influxdb_client/client/influxdb_client_async.pyi @@ -1,4 +1,5 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete +from typing_extensions import Self from influxdb_client.client._base import _BaseClient from influxdb_client.client.delete_api_async import DeleteApiAsync @@ -35,7 +36,7 @@ class InfluxDBClientAsync(_BaseClient): retries: bool | Incomplete = ..., profilers: Incomplete | None = ..., ) -> None: ... - async def __aenter__(self: Self) -> Self: ... + async def __aenter__(self) -> Self: ... async def __aexit__(self, exc_type: object, exc: object, tb: object) -> None: ... async def close(self) -> None: ... @classmethod diff --git a/stubs/influxdb-client/influxdb_client/client/write/point.pyi b/stubs/influxdb-client/influxdb_client/client/write/point.pyi index a3aadf750e37..d18ecc289a74 100644 --- a/stubs/influxdb-client/influxdb_client/client/write/point.pyi +++ b/stubs/influxdb-client/influxdb_client/client/write/point.pyi @@ -1,9 +1,9 @@ -from _typeshed import Incomplete, Self, SupportsGetItem, SupportsItems +from _typeshed import Incomplete, SupportsGetItem, SupportsItems from collections.abc import Iterable from datetime import datetime, timedelta from numbers import Integral from typing import Any -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from influxdb_client.domain.write_precision import _WritePrecision @@ -29,9 +29,9 @@ class Point: fields: SupportsItems[str, Literal["int", "uint", "float"]] = ..., ) -> Point: ... def __init__(self, measurement_name: str) -> None: ... - def time(self: Self, time: _Time, write_precision: _WritePrecision = ...) -> Self: ... - def tag(self: Self, key: str, value: _Value) -> Self: ... - def field(self: Self, field: str, value: _Value) -> Self: ... + def time(self, time: _Time, write_precision: _WritePrecision = ...) -> Self: ... + def tag(self, key: str, value: _Value) -> Self: ... + def field(self, field: str, value: _Value) -> Self: ... def to_line_protocol(self, precision: _WritePrecision | None = ...) -> str: ... @property def write_precision(self) -> _WritePrecision: ... diff --git a/stubs/invoke/invoke/tasks.pyi b/stubs/invoke/invoke/tasks.pyi index 3da35f6c9d69..0240aca9f6bb 100644 --- a/stubs/invoke/invoke/tasks.pyi +++ b/stubs/invoke/invoke/tasks.pyi @@ -1,7 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable, Iterable from typing import Any, Generic, TypeVar, overload -from typing_extensions import ParamSpec +from typing_extensions import ParamSpec, Self from .config import Config from .context import Context @@ -105,7 +105,7 @@ class Call: kwargs: dict[str, Any] | None = ..., ) -> None: ... def __getattr__(self, name: str) -> Any: ... - def __deepcopy__(self: Self, memo: Any) -> Self: ... + def __deepcopy__(self, memo: Any) -> Self: ... def __eq__(self, other: Call) -> bool: ... # type: ignore[override] def make_context(self, config: Config) -> Context: ... def clone_data(self): ... diff --git a/stubs/jsonschema/jsonschema/exceptions.pyi b/stubs/jsonschema/jsonschema/exceptions.pyi index 2698976bcd21..a61828da1554 100644 --- a/stubs/jsonschema/jsonschema/exceptions.pyi +++ b/stubs/jsonschema/jsonschema/exceptions.pyi @@ -1,8 +1,8 @@ -from _typeshed import Incomplete, Self, SupportsRichComparison +from _typeshed import Incomplete, SupportsRichComparison from collections import deque from collections.abc import Callable, Container, Iterable, Sequence from typing import Any -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias from jsonschema import _utils, protocols from jsonschema._types import TypeChecker @@ -40,7 +40,7 @@ class _Error(Exception): type_checker: _utils.Unset | TypeChecker = ..., ) -> None: ... @classmethod - def create_from(cls: type[Self], other: _Error) -> Self: ... + def create_from(cls, other: _Error) -> Self: ... @property def absolute_path(self) -> Sequence[str | int]: ... @property diff --git a/stubs/ldap3/ldap3/core/connection.pyi b/stubs/ldap3/ldap3/core/connection.pyi index fe7acb4673d2..0e5b29c7ab58 100644 --- a/stubs/ldap3/ldap3/core/connection.pyi +++ b/stubs/ldap3/ldap3/core/connection.pyi @@ -1,7 +1,7 @@ from _collections_abc import Generator, dict_keys -from _typeshed import Incomplete, ReadableBuffer, Self +from _typeshed import Incomplete, ReadableBuffer from types import TracebackType -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from pyasn1.type.base import Asn1Item @@ -115,7 +115,7 @@ class Connection: def stream(self, value) -> None: ... @property def usage(self): ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> Literal[False] | None: ... diff --git a/stubs/ldap3/ldap3/core/exceptions.pyi b/stubs/ldap3/ldap3/core/exceptions.pyi index 862291cd3299..7da6a70afa1f 100644 --- a/stubs/ldap3/ldap3/core/exceptions.pyi +++ b/stubs/ldap3/ldap3/core/exceptions.pyi @@ -1,12 +1,13 @@ import socket -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from typing import Any +from typing_extensions import Self class LDAPException(Exception): ... class LDAPOperationResult(LDAPException): def __new__( - cls: type[Self], + cls, result: Incomplete | None = ..., description: Incomplete | None = ..., dn: Incomplete | None = ..., diff --git a/stubs/mock/mock/mock.pyi b/stubs/mock/mock/mock.pyi index cff36eb815b4..2723619a3572 100644 --- a/stubs/mock/mock/mock.pyi +++ b/stubs/mock/mock/mock.pyi @@ -1,9 +1,9 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable, Coroutine, Mapping, Sequence from contextlib import AbstractContextManager from types import TracebackType from typing import Any, Generic, TypeVar, overload -from typing_extensions import Literal +from typing_extensions import Literal, Self _F = TypeVar("_F", bound=Callable[..., Any]) _AF = TypeVar("_AF", bound=Callable[..., Coroutine[Any, Any, Any]]) @@ -45,7 +45,7 @@ DEFAULT: _SentinelObject class _Call(tuple[Any, ...]): def __new__( - cls: type[Self], + cls, value: Any = ..., name: Incomplete | None = ..., parent: Incomplete | None = ..., @@ -85,7 +85,7 @@ class Base: # something that can't be expressed with our static type system. class NonCallableMock(Base, Any): def __new__( - cls: type[Self], + cls, spec: list[str] | object | type[object] | None = ..., wraps: Incomplete | None = ..., name: str | None = ..., @@ -373,7 +373,7 @@ class _SpecState: def mock_open(mock: Incomplete | None = ..., read_data: Any = ...) -> Any: ... class PropertyMock(Mock): - def __get__(self: Self, obj: _T, obj_type: type[_T] | None = ...) -> Self: ... + def __get__(self, obj: _T, obj_type: type[_T] | None = ...) -> Self: ... def __set__(self, obj: Any, value: Any) -> None: ... def seal(mock: Any) -> None: ... diff --git a/stubs/mypy-extensions/mypy_extensions.pyi b/stubs/mypy-extensions/mypy_extensions.pyi index 195d1cbcaa3a..7bc5c1fbfd4d 100644 --- a/stubs/mypy-extensions/mypy_extensions.pyi +++ b/stubs/mypy-extensions/mypy_extensions.pyi @@ -1,10 +1,10 @@ import abc import sys from _collections_abc import dict_items, dict_keys, dict_values -from _typeshed import IdentityFunction, Self +from _typeshed import IdentityFunction from collections.abc import Mapping from typing import Any, ClassVar, Generic, TypeVar, overload, type_check_only -from typing_extensions import Never +from typing_extensions import Never, Self _T = TypeVar("_T") _U = TypeVar("_U") @@ -16,20 +16,20 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta): __total__: ClassVar[bool] # Unlike typing(_extensions).TypedDict, # subclasses of mypy_extensions.TypedDict do NOT have the __required_keys__ and __optional_keys__ ClassVars - def copy(self: Self) -> Self: ... + def copy(self) -> Self: ... # Using Never so that only calls using mypy plugin hook that specialize the signature # can go through. def setdefault(self, k: Never, default: object) -> object: ... # Mypy plugin hook for 'pop' expects that 'default' has a type variable type. def pop(self, k: Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse] - def update(self: Self, __m: Self) -> None: ... + def update(self, __m: Self) -> None: ... def items(self) -> dict_items[str, object]: ... def keys(self) -> dict_keys[str, object]: ... def values(self) -> dict_values[str, object]: ... def __delitem__(self, k: Never) -> None: ... if sys.version_info >= (3, 9): - def __or__(self: Self, __other: Self) -> Self: ... - def __ior__(self: Self, __other: Self) -> Self: ... + def __or__(self, __other: Self) -> Self: ... + def __ior__(self, __other: Self) -> Self: ... def TypedDict(typename: str, fields: dict[str, type[Any]], total: bool = ...) -> type[dict[str, Any]]: ... @overload diff --git a/stubs/mysqlclient/MySQLdb/connections.pyi b/stubs/mysqlclient/MySQLdb/connections.pyi index c03fcc594e07..d1034859a71d 100644 --- a/stubs/mysqlclient/MySQLdb/connections.pyi +++ b/stubs/mysqlclient/MySQLdb/connections.pyi @@ -1,6 +1,6 @@ -from _typeshed import Self from types import TracebackType from typing import Any +from typing_extensions import Self from . import _mysql, cursors from ._exceptions import ( @@ -27,7 +27,7 @@ class Connection(_mysql.connection): encoding: str messages: Any def __init__(self, *args, **kwargs) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None ) -> None: ... diff --git a/stubs/netaddr/netaddr/eui/__init__.pyi b/stubs/netaddr/netaddr/eui/__init__.pyi index 35340d741295..9d2b963e02dc 100644 --- a/stubs/netaddr/netaddr/eui/__init__.pyi +++ b/stubs/netaddr/netaddr/eui/__init__.pyi @@ -1,6 +1,5 @@ -from _typeshed import Self from typing import ClassVar, SupportsInt, overload -from typing_extensions import Literal, SupportsIndex +from typing_extensions import Literal, Self, SupportsIndex from netaddr.core import DictDotLookup from netaddr.ip import IPAddress @@ -76,8 +75,8 @@ class EUI(BaseIdentifier): def words(self) -> tuple[int, ...]: ... @property def bin(self) -> str: ... - def eui64(self: Self) -> Self: ... - def modified_eui64(self: Self) -> Self: ... + def eui64(self) -> Self: ... + def modified_eui64(self) -> Self: ... def ipv6(self, prefix: str | SupportsInt | SupportsIndex) -> IPAddress: ... def ipv6_link_local(self) -> IPAddress: ... @property diff --git a/stubs/netaddr/netaddr/ip/__init__.pyi b/stubs/netaddr/netaddr/ip/__init__.pyi index c05525246d8a..b688de8582b7 100644 --- a/stubs/netaddr/netaddr/ip/__init__.pyi +++ b/stubs/netaddr/netaddr/ip/__init__.pyi @@ -1,8 +1,8 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from abc import abstractmethod from collections.abc import Iterable, Iterator from typing import SupportsInt, overload -from typing_extensions import Literal, SupportsIndex, TypeAlias +from typing_extensions import Literal, Self, SupportsIndex, TypeAlias from netaddr.core import DictDotLookup from netaddr.strategy.ipv6 import ipv6_verbose @@ -45,12 +45,12 @@ class IPAddress(BaseIP): def netmask_bits(self) -> int: ... def is_hostmask(self) -> bool: ... def is_netmask(self) -> bool: ... - def __iadd__(self: Self, num: int) -> Self: ... - def __isub__(self: Self, num: int) -> Self: ... - def __add__(self: Self, num: int) -> Self: ... + def __iadd__(self, num: int) -> Self: ... + def __isub__(self, num: int) -> Self: ... + def __add__(self, num: int) -> Self: ... __radd__ = __add__ - def __sub__(self: Self, num: int) -> Self: ... - def __rsub__(self: Self, num: int) -> Self: ... + def __sub__(self, num: int) -> Self: ... + def __rsub__(self, num: int) -> Self: ... def key(self) -> tuple[int, ...]: ... def sort_key(self) -> tuple[int, ...]: ... def __int__(self) -> int: ... @@ -68,14 +68,14 @@ class IPAddress(BaseIP): def bin(self) -> str: ... @property def reverse_dns(self) -> str: ... - def ipv4(self: Self) -> Self: ... - def ipv6(self: Self, ipv4_compatible: bool = ...) -> Self: ... + def ipv4(self) -> Self: ... + def ipv6(self, ipv4_compatible: bool = ...) -> Self: ... def format(self, dialect: type[ipv6_verbose] | None = ...) -> str: ... - def __or__(self: Self, other: str | SupportsInt | SupportsIndex) -> Self: ... - def __and__(self: Self, other: str | SupportsInt | SupportsIndex) -> Self: ... - def __xor__(self: Self, other: str | SupportsInt | SupportsIndex) -> Self: ... - def __lshift__(self: Self, numbits: int) -> Self: ... - def __rshift__(self: Self, numbits: int) -> Self: ... + def __or__(self, other: str | SupportsInt | SupportsIndex) -> Self: ... + def __and__(self, other: str | SupportsInt | SupportsIndex) -> Self: ... + def __xor__(self, other: str | SupportsInt | SupportsIndex) -> Self: ... + def __lshift__(self, numbits: int) -> Self: ... + def __rshift__(self, numbits: int) -> Self: ... def __bool__(self) -> bool: ... class IPListMixin: @@ -122,18 +122,18 @@ class IPNetwork(BaseIP, IPListMixin): def hostmask(self) -> IPAddress: ... @property def cidr(self) -> IPNetwork: ... - def __iadd__(self: Self, num: int) -> Self: ... - def __isub__(self: Self, num: int) -> Self: ... + def __iadd__(self, num: int) -> Self: ... + def __isub__(self, num: int) -> Self: ... # runtime overrides __contains__ with incompatible type for "other" def __contains__(self, other: BaseIP | _IPNetworkAddr) -> bool: ... # type: ignore[override] def key(self) -> tuple[int, ...]: ... def sort_key(self) -> tuple[int, ...]: ... - def ipv4(self: Self) -> Self: ... - def ipv6(self: Self, ipv4_compatible: bool = ...) -> Self: ... - def previous(self: Self, step: int = ...) -> Self: ... - def next(self: Self, step: int = ...) -> Self: ... + def ipv4(self) -> Self: ... + def ipv6(self, ipv4_compatible: bool = ...) -> Self: ... + def previous(self, step: int = ...) -> Self: ... + def next(self, step: int = ...) -> Self: ... def supernet(self, prefixlen: int = ...) -> list[IPNetwork]: ... - def subnet(self: Self, prefixlen: int, count: int | None = ..., fmt: object | None = ...) -> Iterator[Self]: ... + def subnet(self, prefixlen: int, count: int | None = ..., fmt: object | None = ...) -> Iterator[Self]: ... def iter_hosts(self) -> Iterator[IPAddress]: ... class IPRange(BaseIP, IPListMixin): diff --git a/stubs/netaddr/netaddr/ip/sets.pyi b/stubs/netaddr/netaddr/ip/sets.pyi index 36c7e0dff24e..ac6e2cb1b12d 100644 --- a/stubs/netaddr/netaddr/ip/sets.pyi +++ b/stubs/netaddr/netaddr/ip/sets.pyi @@ -1,7 +1,6 @@ -from _typeshed import Self from collections.abc import Iterable, Iterator from typing import NoReturn -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias from netaddr.ip import IPAddress, IPNetwork, IPRange, _IPNetworkAddr @@ -19,7 +18,7 @@ class IPSet: def remove(self, addr: IPRange | _IPNetworkAddr | int, flags: int = ...) -> None: ... def pop(self) -> IPNetwork: ... def isdisjoint(self, other: IPSet) -> bool: ... - def copy(self: Self) -> Self: ... + def copy(self) -> Self: ... def update(self, iterable: _IPIterable, flags: int = ...) -> None: ... def clear(self) -> None: ... def __eq__(self, other: object) -> bool: ... @@ -30,7 +29,7 @@ class IPSet: def __gt__(self, other: IPSet) -> bool: ... def issuperset(self, other: IPSet) -> bool: ... __ge__ = issuperset - def union(self: Self, other: IPSet) -> Self: ... + def union(self, other: IPSet) -> Self: ... __or__ = union def intersection(self, other: IPSet) -> IPSet: ... __and__ = intersection diff --git a/stubs/opentracing/opentracing/mocktracer/context.pyi b/stubs/opentracing/opentracing/mocktracer/context.pyi index ef8ed9214465..3264dd824567 100644 --- a/stubs/opentracing/opentracing/mocktracer/context.pyi +++ b/stubs/opentracing/opentracing/mocktracer/context.pyi @@ -1,4 +1,4 @@ -from _typeshed import Self +from typing_extensions import Self import opentracing @@ -8,4 +8,4 @@ class SpanContext(opentracing.SpanContext): def __init__(self, trace_id: int | None = ..., span_id: int | None = ..., baggage: dict[str, str] | None = ...) -> None: ... @property def baggage(self) -> dict[str, str]: ... - def with_baggage_item(self: Self, key: str, value: str) -> Self: ... + def with_baggage_item(self, key: str, value: str) -> Self: ... diff --git a/stubs/opentracing/opentracing/mocktracer/span.pyi b/stubs/opentracing/opentracing/mocktracer/span.pyi index a54b4d636b5d..9d310d5bf8ae 100644 --- a/stubs/opentracing/opentracing/mocktracer/span.pyi +++ b/stubs/opentracing/opentracing/mocktracer/span.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from typing import Any +from typing_extensions import Self from ..span import Span from ..tracer import Tracer @@ -27,10 +27,10 @@ class MockSpan(Span): def tracer(self) -> MockTracer: ... @property def context(self) -> SpanContext: ... - def set_operation_name(self: Self, operation_name: str) -> Self: ... - def set_tag(self: Self, key: str, value: str | bool | float) -> Self: ... - def log_kv(self: Self, key_values: dict[str, Any], timestamp: float | None = ...) -> Self: ... - def set_baggage_item(self: Self, key: str, value: str) -> Self: ... + def set_operation_name(self, operation_name: str) -> Self: ... + def set_tag(self, key: str, value: str | bool | float) -> Self: ... + def log_kv(self, key_values: dict[str, Any], timestamp: float | None = ...) -> Self: ... + def set_baggage_item(self, key: str, value: str) -> Self: ... class LogData: key_values: dict[str, Any] diff --git a/stubs/opentracing/opentracing/scope.pyi b/stubs/opentracing/opentracing/scope.pyi index d3ed839fe188..e312df143498 100644 --- a/stubs/opentracing/opentracing/scope.pyi +++ b/stubs/opentracing/opentracing/scope.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from types import TracebackType +from typing_extensions import Self from .scope_manager import ScopeManager from .span import Span @@ -11,7 +11,7 @@ class Scope: @property def manager(self) -> ScopeManager: ... def close(self) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... diff --git a/stubs/opentracing/opentracing/span.pyi b/stubs/opentracing/opentracing/span.pyi index 6a6eb637e064..74a6dc5d2347 100644 --- a/stubs/opentracing/opentracing/span.pyi +++ b/stubs/opentracing/opentracing/span.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from types import TracebackType from typing import Any +from typing_extensions import Self from .tracer import Tracer @@ -15,15 +16,15 @@ class Span: def context(self) -> SpanContext: ... @property def tracer(self) -> Tracer: ... - def set_operation_name(self: Self, operation_name: str) -> Self: ... + def set_operation_name(self, operation_name: str) -> Self: ... def finish(self, finish_time: float | None = ...) -> None: ... - def set_tag(self: Self, key: str, value: str | bool | float) -> Self: ... - def log_kv(self: Self, key_values: dict[str, Any], timestamp: float | None = ...) -> Self: ... - def set_baggage_item(self: Self, key: str, value: str) -> Self: ... + def set_tag(self, key: str, value: str | bool | float) -> Self: ... + def log_kv(self, key_values: dict[str, Any], timestamp: float | None = ...) -> Self: ... + def set_baggage_item(self, key: str, value: str) -> Self: ... def get_baggage_item(self, key: str) -> str | None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... - def log_event(self: Self, event: Any, payload: Incomplete | None = ...) -> Self: ... - def log(self: Self, **kwargs: Any) -> Self: ... + def log_event(self, event: Any, payload: Incomplete | None = ...) -> Self: ... + def log(self, **kwargs: Any) -> Self: ... diff --git a/stubs/paramiko/paramiko/_winapi.pyi b/stubs/paramiko/paramiko/_winapi.pyi index d4dc8166a956..2943652ef6d3 100644 --- a/stubs/paramiko/paramiko/_winapi.pyi +++ b/stubs/paramiko/paramiko/_winapi.pyi @@ -1,9 +1,10 @@ import builtins import ctypes import sys -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from types import TracebackType from typing import Any +from typing_extensions import Self if sys.platform == "win32": def format_system_message(errno: int) -> str | None: ... @@ -34,7 +35,7 @@ if sys.platform == "win32": filemap: Any = ... view: Any = ... def __init__(self, name: str, length: int, security_attributes: Incomplete | None = ...) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def seek(self, pos: int) -> None: ... def write(self, msg: bytes) -> None: ... def read(self, n: int) -> bytes: ... diff --git a/stubs/paramiko/paramiko/config.pyi b/stubs/paramiko/paramiko/config.pyi index b0b6078f410c..a7c30feaff58 100644 --- a/stubs/paramiko/paramiko/config.pyi +++ b/stubs/paramiko/paramiko/config.pyi @@ -1,7 +1,7 @@ -from _typeshed import Self from collections.abc import Iterable from re import Pattern from typing import IO +from typing_extensions import Self from paramiko.ssh_exception import ConfigParseError as ConfigParseError, CouldNotCanonicalize as CouldNotCanonicalize @@ -12,11 +12,11 @@ class SSHConfig: TOKENS_BY_CONFIG_KEY: dict[str, list[str]] def __init__(self) -> None: ... @classmethod - def from_text(cls: type[Self], text: str) -> Self: ... + def from_text(cls, text: str) -> Self: ... @classmethod - def from_path(cls: type[Self], path: str) -> Self: ... + def from_path(cls, path: str) -> Self: ... @classmethod - def from_file(cls: type[Self], flo: IO[str]) -> Self: ... + def from_file(cls, flo: IO[str]) -> Self: ... def parse(self, file_obj: IO[str]) -> None: ... def lookup(self, hostname: str) -> SSHConfigDict: ... def canonicalize(self, hostname: str, options: SSHConfigDict, domains: Iterable[str]) -> str: ... diff --git a/stubs/paramiko/paramiko/hostkeys.pyi b/stubs/paramiko/paramiko/hostkeys.pyi index 96d9d4816aab..c48011a5941d 100644 --- a/stubs/paramiko/paramiko/hostkeys.pyi +++ b/stubs/paramiko/paramiko/hostkeys.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from collections.abc import Iterator, Mapping, MutableMapping +from typing_extensions import Self from paramiko.pkey import PKey @@ -42,5 +42,5 @@ class HostKeyEntry: key: PKey def __init__(self, hostnames: list[str] | None = ..., key: PKey | None = ...) -> None: ... @classmethod - def from_line(cls: type[Self], line: str, lineno: int | None = ...) -> Self | None: ... + def from_line(cls, line: str, lineno: int | None = ...) -> Self | None: ... def to_line(self) -> str | None: ... diff --git a/stubs/paramiko/paramiko/pkey.pyi b/stubs/paramiko/paramiko/pkey.pyi index 3d58dc9b0802..9daefd8766e6 100644 --- a/stubs/paramiko/paramiko/pkey.pyi +++ b/stubs/paramiko/paramiko/pkey.pyi @@ -1,6 +1,6 @@ -from _typeshed import Self from re import Pattern from typing import IO +from typing_extensions import Self from paramiko.message import Message @@ -24,9 +24,9 @@ class PKey: def sign_ssh_data(self, data: bytes, algorithm: str | None = ...) -> Message: ... def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ... @classmethod - def from_private_key_file(cls: type[Self], filename: str, password: str | None = ...) -> Self: ... + def from_private_key_file(cls, filename: str, password: str | None = ...) -> Self: ... @classmethod - def from_private_key(cls: type[Self], file_obj: IO[str], password: str | None = ...) -> Self: ... + def from_private_key(cls, file_obj: IO[str], password: str | None = ...) -> Self: ... def write_private_key_file(self, filename: str, password: str | None = ...) -> None: ... def write_private_key(self, file_obj: IO[str], password: str | None = ...) -> None: ... def load_certificate(self, value: Message | str) -> None: ... @@ -37,10 +37,10 @@ class PublicBlob: comment: str def __init__(self, type_: str, blob: bytes, comment: str | None = ...) -> None: ... @classmethod - def from_file(cls: type[Self], filename: str) -> Self: ... + def from_file(cls, filename: str) -> Self: ... @classmethod - def from_string(cls: type[Self], string: str) -> Self: ... + def from_string(cls, string: str) -> Self: ... @classmethod - def from_message(cls: type[Self], message: Message) -> Self: ... + def from_message(cls, message: Message) -> Self: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... diff --git a/stubs/paramiko/paramiko/sftp_attr.pyi b/stubs/paramiko/paramiko/sftp_attr.pyi index 3a397ff7168c..b97f99df637a 100644 --- a/stubs/paramiko/paramiko/sftp_attr.pyi +++ b/stubs/paramiko/paramiko/sftp_attr.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from os import stat_result +from typing_extensions import Self class SFTPAttributes: FLAG_SIZE: int @@ -18,5 +18,5 @@ class SFTPAttributes: attr: dict[str, str] def __init__(self) -> None: ... @classmethod - def from_stat(cls: type[Self], obj: stat_result, filename: str | None = ...) -> Self: ... + def from_stat(cls, obj: stat_result, filename: str | None = ...) -> Self: ... def asbytes(self) -> bytes: ... diff --git a/stubs/paramiko/paramiko/sftp_client.pyi b/stubs/paramiko/paramiko/sftp_client.pyi index ebaa92cb7ca4..54d543b39427 100644 --- a/stubs/paramiko/paramiko/sftp_client.pyi +++ b/stubs/paramiko/paramiko/sftp_client.pyi @@ -1,8 +1,7 @@ -from _typeshed import Self from collections.abc import Callable, Iterator from logging import Logger from typing import IO -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias from paramiko.channel import Channel from paramiko.sftp import BaseSFTP @@ -22,9 +21,7 @@ class SFTPClient(BaseSFTP, ClosingContextManager): logger: Logger def __init__(self, sock: Channel) -> None: ... @classmethod - def from_transport( - cls: type[Self], t: Transport, window_size: int | None = ..., max_packet_size: int | None = ... - ) -> Self | None: ... + def from_transport(cls, t: Transport, window_size: int | None = ..., max_packet_size: int | None = ...) -> Self | None: ... def close(self) -> None: ... def get_channel(self) -> Channel | None: ... def listdir(self, path: str = ...) -> list[str]: ... diff --git a/stubs/paramiko/paramiko/util.pyi b/stubs/paramiko/paramiko/util.pyi index 723bbde7bdc1..7f94a074f851 100644 --- a/stubs/paramiko/paramiko/util.pyi +++ b/stubs/paramiko/paramiko/util.pyi @@ -1,8 +1,8 @@ -from _typeshed import Self from hashlib import _Hash from logging import Logger, LogRecord from types import TracebackType from typing import IO, AnyStr, Protocol +from typing_extensions import Self from paramiko.config import SSHConfig, SSHConfigDict from paramiko.hostkeys import HostKeys @@ -32,7 +32,7 @@ def get_logger(name: str) -> Logger: ... def constant_time_bytes_eq(a: AnyStr, b: AnyStr) -> bool: ... class ClosingContextManager: - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... diff --git a/stubs/parsimonious/parsimonious/expressions.pyi b/stubs/parsimonious/parsimonious/expressions.pyi index 482390b14f63..eef53891639e 100644 --- a/stubs/parsimonious/parsimonious/expressions.pyi +++ b/stubs/parsimonious/parsimonious/expressions.pyi @@ -1,9 +1,8 @@ import collections.abc -from _typeshed import Self from collections.abc import Callable, Mapping from re import Pattern from typing import Any -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias from parsimonious.exceptions import ParseError from parsimonious.grammar import Grammar @@ -25,7 +24,7 @@ class Expression(StrAndRepr): name: str identity_tuple: tuple[str] def __init__(self, name: str = ...) -> None: ... - def resolve_refs(self: Self, rule_map: Mapping[str, Expression]) -> Self: ... + def resolve_refs(self, rule_map: Mapping[str, Expression]) -> Self: ... def parse(self, text: str, pos: int = ...) -> Node: ... def match(self, text: str, pos: int = ...) -> Node: ... def match_core(self, text: str, pos: int, cache: Mapping[tuple[int, int], Node], error: ParseError) -> Node: ... diff --git a/stubs/passlib/passlib/context.pyi b/stubs/passlib/passlib/context.pyi index d672e5b4a9a0..f2c511a36039 100644 --- a/stubs/passlib/passlib/context.pyi +++ b/stubs/passlib/passlib/context.pyi @@ -1,5 +1,6 @@ -from _typeshed import Incomplete, Self, StrOrBytesPath, SupportsItems +from _typeshed import Incomplete, StrOrBytesPath, SupportsItems from typing import Any +from typing_extensions import Self class CryptPolicy: @classmethod @@ -26,9 +27,9 @@ class CryptPolicy: class CryptContext: @classmethod - def from_string(cls: type[Self], source: str | bytes, section: str = ..., encoding: str = ...) -> Self: ... + def from_string(cls, source: str | bytes, section: str = ..., encoding: str = ...) -> Self: ... @classmethod - def from_path(cls: type[Self], path: StrOrBytesPath, section: str = ..., encoding: str = ...) -> Self: ... + def from_path(cls, path: StrOrBytesPath, section: str = ..., encoding: str = ...) -> Self: ... def copy(self, **kwds: Any) -> CryptContext: ... def using(self, **kwds: Any) -> CryptContext: ... def replace(self, **kwds): ... diff --git a/stubs/passlib/passlib/handlers/pbkdf2.pyi b/stubs/passlib/passlib/handlers/pbkdf2.pyi index c28854b56114..280849de8fb4 100644 --- a/stubs/passlib/passlib/handlers/pbkdf2.pyi +++ b/stubs/passlib/passlib/handlers/pbkdf2.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from typing import ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh from passlib.utils.handlers import PrefixWrapper @@ -13,7 +13,7 @@ class Pbkdf2DigestHandler(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.Gen max_rounds: ClassVar[int] rounds_cost: ClassVar[str] @classmethod - def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override] + def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override] # dynamically created by create_pbkdf2_hash() class pbkdf2_sha1(Pbkdf2DigestHandler): diff --git a/stubs/passlib/passlib/handlers/phpass.pyi b/stubs/passlib/passlib/handlers/phpass.pyi index 93a24edb7c47..02419bdc8fec 100644 --- a/stubs/passlib/passlib/handlers/phpass.pyi +++ b/stubs/passlib/passlib/handlers/phpass.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from typing import ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -17,4 +17,4 @@ class phpass(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # ident_values: ClassVar[tuple[str, ...]] ident_aliases: ClassVar[dict[str, str]] @classmethod - def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override] + def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override] diff --git a/stubs/passlib/passlib/handlers/sha1_crypt.pyi b/stubs/passlib/passlib/handlers/sha1_crypt.pyi index 601f616bfb20..14ea298da770 100644 --- a/stubs/passlib/passlib/handlers/sha1_crypt.pyi +++ b/stubs/passlib/passlib/handlers/sha1_crypt.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from typing import Any, ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -18,6 +18,6 @@ class sha1_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler max_rounds: ClassVar[int] rounds_cost: ClassVar[str] @classmethod - def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override] + def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override] def to_string(self, config: bool = ...) -> str: ... backends: ClassVar[tuple[str, ...]] diff --git a/stubs/passlib/passlib/handlers/sha2_crypt.pyi b/stubs/passlib/passlib/handlers/sha2_crypt.pyi index 849d7f677af9..82ba37af28af 100644 --- a/stubs/passlib/passlib/handlers/sha2_crypt.pyi +++ b/stubs/passlib/passlib/handlers/sha2_crypt.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from typing import ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -13,7 +13,7 @@ class _SHA2_Common(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandl implicit_rounds: bool def __init__(self, implicit_rounds: bool | None = ..., **kwds) -> None: ... @classmethod - def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override] + def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override] backends: ClassVar[tuple[str, ...]] class sha256_crypt(_SHA2_Common): diff --git a/stubs/passlib/passlib/handlers/sun_md5_crypt.pyi b/stubs/passlib/passlib/handlers/sun_md5_crypt.pyi index 9436095c31db..43cb4a06c827 100644 --- a/stubs/passlib/passlib/handlers/sun_md5_crypt.pyi +++ b/stubs/passlib/passlib/handlers/sun_md5_crypt.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from typing import ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -20,5 +20,5 @@ class sun_md5_crypt(uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignor @classmethod def identify(cls, hash): ... @classmethod - def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override] + def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override] def to_string(self, _withchk: bool = ...) -> str: ... diff --git a/stubs/passlib/passlib/ifc.pyi b/stubs/passlib/passlib/ifc.pyi index 7f477cfee654..aec4570c8574 100644 --- a/stubs/passlib/passlib/ifc.pyi +++ b/stubs/passlib/passlib/ifc.pyi @@ -1,7 +1,6 @@ -from _typeshed import Self from abc import ABCMeta, abstractmethod from typing import Any, ClassVar -from typing_extensions import Literal +from typing_extensions import Literal, Self class PasswordHash(metaclass=ABCMeta): is_disabled: ClassVar[bool] @@ -18,7 +17,7 @@ class PasswordHash(metaclass=ABCMeta): def verify(cls, secret: str | bytes, hash: str | bytes, **context_kwds): ... @classmethod @abstractmethod - def using(cls: type[Self], relaxed: bool = ..., **kwds: Any) -> type[Self]: ... + def using(cls, relaxed: bool = ..., **kwds: Any) -> type[Self]: ... @classmethod def needs_update(cls, hash: str, secret: str | bytes | None = ...) -> bool: ... @classmethod diff --git a/stubs/passlib/passlib/utils/handlers.pyi b/stubs/passlib/passlib/utils/handlers.pyi index 59416d7e2bc1..89ede12fddbc 100644 --- a/stubs/passlib/passlib/utils/handlers.pyi +++ b/stubs/passlib/passlib/utils/handlers.pyi @@ -1,6 +1,7 @@ import abc -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from typing import Any, ClassVar +from typing_extensions import Self from passlib.ifc import PasswordHash from passlib.utils.binary import BASE64_CHARS, HASH64_CHARS, LOWER_HEX_CHARS, PADDED_BASE64_CHARS, UPPER_HEX_CHARS @@ -20,13 +21,13 @@ def render_mc3(ident, rounds, salt, checksum, sep=..., rounds_base: int = ...): class MinimalHandler(PasswordHash, metaclass=abc.ABCMeta): @classmethod - def using(cls: Self, relaxed: bool = ...) -> type[Self]: ... # type: ignore[override] + def using(cls, relaxed: bool = ...) -> type[Self]: ... # type: ignore[override] class TruncateMixin(MinimalHandler, metaclass=abc.ABCMeta): truncate_error: ClassVar[bool] truncate_verify_reject: ClassVar[bool] @classmethod - def using(cls: type[Self], truncate_error: object = ..., *, relaxed: bool = ...) -> type[Self]: ... # type: ignore[override] + def using(cls, truncate_error: object = ..., *, relaxed: bool = ...) -> type[Self]: ... # type: ignore[override] class GenericHandler(MinimalHandler): setting_kwds: ClassVar[tuple[str, ...]] @@ -40,7 +41,7 @@ class GenericHandler(MinimalHandler): @classmethod def identify(cls, hash: str | bytes) -> bool: ... @classmethod - def from_string(cls: type[Self], hash: str | bytes, **context: Any) -> Self: ... + def from_string(cls, hash: str | bytes, **context: Any) -> Self: ... def to_string(self) -> str: ... @classmethod def hash(cls, secret: str | bytes, **kwds: Any) -> str: ... diff --git a/stubs/peewee/peewee.pyi b/stubs/peewee/peewee.pyi index 8433d59fb1f7..a58a53a98e68 100644 --- a/stubs/peewee/peewee.pyi +++ b/stubs/peewee/peewee.pyi @@ -1,9 +1,10 @@ import itertools import logging import threading -from _typeshed import Incomplete, Self, SupportsKeysAndGetItem +from _typeshed import Incomplete, SupportsKeysAndGetItem from collections.abc import Generator, Iterable from typing import ClassVar, NamedTuple, TypeVar +from typing_extensions import Self class NullHandler(logging.Handler): def emit(self, record) -> None: ... @@ -21,7 +22,7 @@ class attrdict(dict[str, _VT]): def __getattr__(self, attr: str) -> _VT: ... def __setattr__(self, attr: str, value: _VT) -> None: ... # calls dict.update() - def __iadd__(self: Self, rhs: SupportsKeysAndGetItem[str, _VT] | Iterable[tuple[str, _VT]]) -> Self: ... + def __iadd__(self, rhs: SupportsKeysAndGetItem[str, _VT] | Iterable[tuple[str, _VT]]) -> Self: ... def __add__(self, rhs: SupportsKeysAndGetItem[str, _VT] | Iterable[tuple[str, _VT]]) -> attrdict[_VT]: ... OP: Incomplete diff --git a/stubs/pika/pika/adapters/asyncio_connection.pyi b/stubs/pika/pika/adapters/asyncio_connection.pyi index 57a3257cd565..621eb6fa2743 100644 --- a/stubs/pika/pika/adapters/asyncio_connection.pyi +++ b/stubs/pika/pika/adapters/asyncio_connection.pyi @@ -1,7 +1,8 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from asyncio import AbstractEventLoop from collections.abc import Callable from logging import Logger +from typing_extensions import Self from ..connection import Parameters from .base_connection import BaseConnection @@ -11,7 +12,7 @@ LOGGER: Logger class AsyncioConnection(BaseConnection): def __init__( - self: Self, + self, parameters: Parameters | None = ..., on_open_callback: Callable[[Self], object] | None = ..., on_open_error_callback: Callable[[Self, BaseException], object] | None = ..., diff --git a/stubs/pika/pika/adapters/base_connection.pyi b/stubs/pika/pika/adapters/base_connection.pyi index 3cf7ed97f354..db129fa75c6b 100644 --- a/stubs/pika/pika/adapters/base_connection.pyi +++ b/stubs/pika/pika/adapters/base_connection.pyi @@ -1,6 +1,7 @@ import abc -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable +from typing_extensions import Self from ..adapters.utils import nbio_interface from ..connection import Connection @@ -9,7 +10,7 @@ LOGGER: Incomplete class BaseConnection(Connection, metaclass=abc.ABCMeta): def __init__( - self: Self, + self, parameters, on_open_callback: Callable[[Self], object] | None, on_open_error_callback: Callable[[Self, BaseException], object] | None, diff --git a/stubs/pika/pika/adapters/blocking_connection.pyi b/stubs/pika/pika/adapters/blocking_connection.pyi index c0907f2f37d9..5f330829c7a9 100644 --- a/stubs/pika/pika/adapters/blocking_connection.pyi +++ b/stubs/pika/pika/adapters/blocking_connection.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Generator, Sequence from typing import NamedTuple +from typing_extensions import Self from ..connection import Parameters from ..data import _ArgumentMapping @@ -55,7 +56,7 @@ class BlockingConnection: def __init__( self, parameters: Parameters | Sequence[Parameters] | None = ..., _impl_class: Incomplete | None = ... ) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, exc_type: object, value: object, traceback: object) -> None: ... def add_on_connection_blocked_callback(self, callback) -> None: ... def add_on_connection_unblocked_callback(self, callback) -> None: ... diff --git a/stubs/pika/pika/channel.pyi b/stubs/pika/pika/channel.pyi index 30631f00fdaa..3f28e847c17f 100644 --- a/stubs/pika/pika/channel.pyi +++ b/stubs/pika/pika/channel.pyi @@ -1,8 +1,8 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable from logging import Logger from typing import Any -from typing_extensions import Final +from typing_extensions import Final, Self from .callback import CallbackManager from .connection import Connection @@ -25,7 +25,7 @@ class Channel: connection: Connection flow_active: bool - def __init__(self: Self, connection: Connection, channel_number: int, on_open_callback: Callable[[Self], object]) -> None: ... + def __init__(self, connection: Connection, channel_number: int, on_open_callback: Callable[[Self], object]) -> None: ... def __int__(self) -> int: ... def add_callback(self, callback, replies, one_shot: bool = ...) -> None: ... def add_on_cancel_callback(self, callback) -> None: ... diff --git a/stubs/pika/pika/connection.pyi b/stubs/pika/pika/connection.pyi index 97a10c698fa8..21024b427b72 100644 --- a/stubs/pika/pika/connection.pyi +++ b/stubs/pika/pika/connection.pyi @@ -1,8 +1,8 @@ import abc -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable from logging import Logger -from typing_extensions import Final +from typing_extensions import Final, Self from .callback import CallbackManager from .channel import Channel @@ -150,23 +150,21 @@ class Connection(AbstractBase, metaclass=abc.ABCMeta): server_properties: Incomplete known_hosts: Incomplete def __init__( - self: Self, + self, parameters: Parameters | None = ..., on_open_callback: Callable[[Self], object] | None = ..., on_open_error_callback: Callable[[Self, BaseException], object] | None = ..., on_close_callback: Callable[[Self, BaseException], object] | None = ..., internal_connection_workflow: bool = ..., ) -> None: ... - def add_on_close_callback(self: Self, callback: Callable[[Self, BaseException], object]) -> None: ... - def add_on_connection_blocked_callback( - self: Self, callback: Callable[[Self, Method[SpecConnection.Blocked]], object] - ) -> None: ... + def add_on_close_callback(self, callback: Callable[[Self, BaseException], object]) -> None: ... + def add_on_connection_blocked_callback(self, callback: Callable[[Self, Method[SpecConnection.Blocked]], object]) -> None: ... def add_on_connection_unblocked_callback( - self: Self, callback: Callable[[Self, Method[SpecConnection.Unblocked]], object] + self, callback: Callable[[Self, Method[SpecConnection.Unblocked]], object] ) -> None: ... - def add_on_open_callback(self: Self, callback: Callable[[Self], object]) -> None: ... + def add_on_open_callback(self, callback: Callable[[Self], object]) -> None: ... def add_on_open_error_callback( - self: Self, callback: Callable[[Self, BaseException], object], remove_default: bool = ... + self, callback: Callable[[Self, BaseException], object], remove_default: bool = ... ) -> None: ... def channel( self, channel_number: int | None = ..., on_open_callback: Callable[[Channel], object] | None = ... diff --git a/stubs/pika/pika/spec.pyi b/stubs/pika/pika/spec.pyi index d0b6bf1227c8..c213867c06e6 100644 --- a/stubs/pika/pika/spec.pyi +++ b/stubs/pika/pika/spec.pyi @@ -1,6 +1,6 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from typing import ClassVar -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from .amqp_object import Class, Method, Properties @@ -339,7 +339,7 @@ class Exchange(Class): def __init__(self) -> None: ... @property def synchronous(self) -> Literal[False]: ... - def decode(self: Self, encoded: bytes, offset: int = ...) -> Self: ... + def decode(self, encoded: bytes, offset: int = ...) -> Self: ... def encode(self) -> list[bytes]: ... class Delete(Method): @@ -450,7 +450,7 @@ class Queue(Class): ) -> None: ... @property def synchronous(self) -> Literal[True]: ... - def decode(self: Self, encoded: bytes, offset: int = ...) -> Self: ... + def decode(self, encoded: bytes, offset: int = ...) -> Self: ... def encode(self) -> list[bytes]: ... class DeclareOk(Method): @@ -461,7 +461,7 @@ class Queue(Class): def __init__(self, queue: _str, message_count: int, consumer_count: int) -> None: ... @property def synchronous(self) -> Literal[False]: ... - def decode(self: Self, encoded: bytes, offset: int = ...) -> Self: ... + def decode(self, encoded: bytes, offset: int = ...) -> Self: ... def encode(self) -> list[bytes]: ... class Bind(Method): diff --git a/stubs/protobuf/google/protobuf/message.pyi b/stubs/protobuf/google/protobuf/message.pyi index 8a90d7c96102..798d00268724 100644 --- a/stubs/protobuf/google/protobuf/message.pyi +++ b/stubs/protobuf/google/protobuf/message.pyi @@ -1,6 +1,6 @@ -from _typeshed import Self from collections.abc import Sequence from typing import Any, TypeVar +from typing_extensions import Self from .descriptor import Descriptor, FieldDescriptor from .internal.extension_dict import _ExtensionDict, _ExtensionFieldDescriptor @@ -13,11 +13,11 @@ _M = TypeVar("_M", bound=Message) # message type (of self) class Message: DESCRIPTOR: Descriptor - def __deepcopy__(self: Self, memo: Any = ...) -> Self: ... + def __deepcopy__(self, memo: Any = ...) -> Self: ... def __eq__(self, other_msg): ... def __ne__(self, other_msg): ... - def MergeFrom(self: Self, other_msg: Self) -> None: ... - def CopyFrom(self: Self, other_msg: Self) -> None: ... + def MergeFrom(self, other_msg: Self) -> None: ... + def CopyFrom(self, other_msg: Self) -> None: ... def Clear(self) -> None: ... def SetInParent(self) -> None: ... def IsInitialized(self) -> bool: ... @@ -34,7 +34,7 @@ class Message: def Extensions(self: _M) -> _ExtensionDict[_M]: ... def ByteSize(self) -> int: ... @classmethod - def FromString(cls: type[Self], s: bytes) -> Self: ... + def FromString(cls, s: bytes) -> Self: ... # Intentionally left out typing on these three methods, because they are # stringly typed and it is not useful to call them on a Message directly. # We prefer more specific typing on individual subclasses of Message diff --git a/stubs/psutil/psutil/__init__.pyi b/stubs/psutil/psutil/__init__.pyi index 81f8d95c288f..f713d1bb943f 100644 --- a/stubs/psutil/psutil/__init__.pyi +++ b/stubs/psutil/psutil/__init__.pyi @@ -1,9 +1,9 @@ import sys -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable, Iterable, Iterator from contextlib import AbstractContextManager from typing import Any, overload -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from psutil._common import ( AIX as AIX, @@ -217,7 +217,7 @@ class Process: class Popen(Process): def __init__(self, *args, **kwargs) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, *args, **kwargs) -> None: ... def __getattribute__(self, name: str) -> Any: ... diff --git a/stubs/psycopg2/psycopg2/_psycopg.pyi b/stubs/psycopg2/psycopg2/_psycopg.pyi index f9bd4e3ebe25..8f8565689077 100644 --- a/stubs/psycopg2/psycopg2/_psycopg.pyi +++ b/stubs/psycopg2/psycopg2/_psycopg.pyi @@ -1,8 +1,7 @@ -from _typeshed import Self from collections.abc import Callable, Iterable, Mapping, Sequence from types import TracebackType from typing import Any, TypeVar, overload -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias import psycopg2 import psycopg2.extensions @@ -105,11 +104,11 @@ class cursor: def scroll(self, value, mode=...): ... def setinputsizes(self, sizes): ... def setoutputsize(self, size, column=...): ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... - def __iter__(self: Self) -> Self: ... + def __iter__(self) -> Self: ... def __next__(self) -> tuple[Any, ...]: ... _Cursor: TypeAlias = cursor @@ -462,7 +461,7 @@ class connection: def tpc_recover(self) -> list[Xid]: ... def tpc_rollback(self, __xid: str | bytes | Xid = ...) -> None: ... def xid(self, format_id, gtrid, bqual) -> Xid: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, __type: object, __name: object, __tb: object) -> None: ... class lobject: diff --git a/stubs/pyRFC3339/pyrfc3339/utils.pyi b/stubs/pyRFC3339/pyrfc3339/utils.pyi index d71f3c94e039..492d3c221546 100644 --- a/stubs/pyRFC3339/pyrfc3339/utils.pyi +++ b/stubs/pyRFC3339/pyrfc3339/utils.pyi @@ -1,13 +1,13 @@ -from _typeshed import Self from datetime import datetime, timedelta, tzinfo from typing import Any +from typing_extensions import Self class FixedOffset(tzinfo): def __init__(self, hours: float, minutes: float) -> None: ... def dst(self, dt: datetime | None) -> timedelta: ... def utcoffset(self, dt: datetime | None) -> timedelta: ... def tzname(self, dt: datetime | None) -> str: ... - def __deepcopy__(self: Self, memo: dict[int, Any]) -> Self: ... + def __deepcopy__(self, memo: dict[int, Any]) -> Self: ... def timedelta_seconds(td: timedelta) -> int: ... def timezone(utcoffset: float) -> str: ... diff --git a/stubs/pyasn1/pyasn1/type/univ.pyi b/stubs/pyasn1/pyasn1/type/univ.pyi index c2e3ff45ab1b..7ac15848ac0d 100644 --- a/stubs/pyasn1/pyasn1/type/univ.pyi +++ b/stubs/pyasn1/pyasn1/type/univ.pyi @@ -1,7 +1,7 @@ -from _typeshed import Incomplete, ReadableBuffer, Self, SupportsRichComparison, SupportsTrunc +from _typeshed import Incomplete, ReadableBuffer, SupportsRichComparison, SupportsTrunc from collections.abc import Callable, Generator from typing import SupportsInt -from typing_extensions import SupportsIndex, TypeAlias +from typing_extensions import Self, SupportsIndex, TypeAlias from pyasn1.type import base, constraint, namedtype, namedval from pyasn1.type.tag import TagSet @@ -34,7 +34,7 @@ class Integer(base.SimpleAsn1Type): def __mod__(self, value): ... def __rmod__(self, value): ... # Accepts everything builtins.pow does - def __pow__(self: Self, value: complex, modulo: int | None = ...) -> Self: ... + def __pow__(self, value: complex, modulo: int | None = ...) -> Self: ... def __rpow__(self, value): ... def __floordiv__(self, value): ... def __rfloordiv__(self, value): ... @@ -190,7 +190,7 @@ class Real(base.SimpleAsn1Type): def __mod__(self, value): ... def __rmod__(self, value): ... # Accepts everything builtins.pow with a float base does - def __pow__(self: Self, value: complex, modulo: int | None = ...) -> Self: ... + def __pow__(self, value: complex, modulo: int | None = ...) -> Self: ... def __rpow__(self, value): ... def __truediv__(self, value): ... def __rtruediv__(self, value): ... diff --git a/stubs/pycurl/pycurl.pyi b/stubs/pycurl/pycurl.pyi index 65fdf8b5c708..2a531b2b602e 100644 --- a/stubs/pycurl/pycurl.pyi +++ b/stubs/pycurl/pycurl.pyi @@ -1,6 +1,6 @@ import sys -from _typeshed import Incomplete, Self -from typing_extensions import final +from _typeshed import Incomplete +from typing_extensions import Self, final version: str @@ -27,7 +27,7 @@ class Curl: def unsetopt(self, option: int) -> Incomplete: ... def pause(self, bitmask: Incomplete) -> Incomplete: ... def errstr(self) -> str: ... - def duphandle(self: Self) -> Self: ... + def duphandle(self) -> Self: ... def errstr_raw(self) -> bytes: ... def set_ca_certs(self, __value: bytes | str) -> None: ... diff --git a/stubs/pyinstaller/PyInstaller/isolated/_parent.pyi b/stubs/pyinstaller/PyInstaller/isolated/_parent.pyi index 40924db08580..2f0b295d7315 100644 --- a/stubs/pyinstaller/PyInstaller/isolated/_parent.pyi +++ b/stubs/pyinstaller/PyInstaller/isolated/_parent.pyi @@ -1,8 +1,7 @@ -from _typeshed import Self from collections.abc import Callable from types import TracebackType from typing import TypeVar -from typing_extensions import ParamSpec +from typing_extensions import ParamSpec, Self _AC = TypeVar("_AC", bound=Callable[..., object]) _R = TypeVar("_R") @@ -10,7 +9,7 @@ _P = ParamSpec("_P") class Python: def __init__(self, strict_mode: bool | None = None) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... diff --git a/stubs/pynput/pynput/_util.pyi b/stubs/pynput/pynput/_util.pyi index 4202bcb5464e..87788dd6da92 100644 --- a/stubs/pynput/pynput/_util.pyi +++ b/stubs/pynput/pynput/_util.pyi @@ -1,11 +1,10 @@ import sys import threading -from _typeshed import Self from collections.abc import Callable from queue import Queue from types import ModuleType, TracebackType from typing import Any, ClassVar, Generic, TypeVar -from typing_extensions import ParamSpec, TypedDict +from typing_extensions import ParamSpec, Self, TypedDict _T = TypeVar("_T") _AbstractListener_T = TypeVar("_AbstractListener_T", bound=AbstractListener) @@ -37,7 +36,7 @@ class AbstractListener(threading.Thread): @property def running(self) -> bool: ... def stop(self) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... @@ -60,11 +59,11 @@ class Events(Generic[_T, _AbstractListener_T]): _listener: _AbstractListener_T # undocumented start: Callable[[], None] def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... - def __iter__(self: Self) -> Self: ... + def __iter__(self) -> Self: ... def __next__(self) -> _T: ... def get(self, timeout: float | None = ...) -> _T | None: ... def _event_mapper(self, event: Callable[_P, object]) -> Callable[_P, None]: ... diff --git a/stubs/pynput/pynput/keyboard/_base.pyi b/stubs/pynput/pynput/keyboard/_base.pyi index 0ab78d393a92..a67c0d0ec506 100644 --- a/stubs/pynput/pynput/keyboard/_base.pyi +++ b/stubs/pynput/pynput/keyboard/_base.pyi @@ -1,9 +1,9 @@ import contextlib import enum import sys -from _typeshed import Self from collections.abc import Callable, Iterable, Iterator from typing import Any, ClassVar +from typing_extensions import Self from pynput._util import AbstractListener @@ -16,13 +16,13 @@ class KeyCode: def __init__(self, vk: str | None = ..., char: str | None = ..., is_dead: bool = ..., **kwargs: str) -> None: ... def __eq__(self, other: object) -> bool: ... def __hash__(self) -> int: ... - def join(self: Self, key: Self) -> Self: ... + def join(self, key: Self) -> Self: ... @classmethod - def from_vk(cls: type[Self], vk: int, **kwargs: Any) -> Self: ... + def from_vk(cls, vk: int, **kwargs: Any) -> Self: ... @classmethod - def from_char(cls: type[Self], char: str, **kwargs: Any) -> Self: ... + def from_char(cls, char: str, **kwargs: Any) -> Self: ... @classmethod - def from_dead(cls: type[Self], char: str, **kwargs: Any) -> Self: ... + def from_dead(cls, char: str, **kwargs: Any) -> Self: ... class Key(enum.Enum): alt: int diff --git a/stubs/pynput/pynput/mouse/_base.pyi b/stubs/pynput/pynput/mouse/_base.pyi index dae183d15307..409da415df22 100644 --- a/stubs/pynput/pynput/mouse/_base.pyi +++ b/stubs/pynput/pynput/mouse/_base.pyi @@ -1,9 +1,9 @@ import enum import sys -from _typeshed import Self from collections.abc import Callable from types import TracebackType from typing import Any +from typing_extensions import Self from pynput._util import AbstractListener @@ -55,7 +55,7 @@ class Controller: def release(self, button: Button) -> None: ... def move(self, dx: int, dy: int) -> None: ... def click(self, button: Button, count: int = ...) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... diff --git a/stubs/pyserial/serial/threaded/__init__.pyi b/stubs/pyserial/serial/threaded/__init__.pyi index 93ebbac85ee5..95770e266051 100644 --- a/stubs/pyserial/serial/threaded/__init__.pyi +++ b/stubs/pyserial/serial/threaded/__init__.pyi @@ -1,6 +1,7 @@ import threading -from _typeshed import ReadableBuffer, Self +from _typeshed import ReadableBuffer from collections.abc import Callable +from typing_extensions import Self from serial import Serial @@ -39,6 +40,6 @@ class ReaderThread(threading.Thread): def stop(self) -> None: ... def write(self, data: ReadableBuffer) -> int: ... def close(self) -> None: ... - def connect(self: Self) -> tuple[Self, Protocol]: ... + def connect(self) -> tuple[Self, Protocol]: ... def __enter__(self) -> Protocol: ... def __exit__(self, __exc_type: object, __exc_val: object, __exc_tb: object) -> None: ... diff --git a/stubs/pyserial/serial/tools/miniterm.pyi b/stubs/pyserial/serial/tools/miniterm.pyi index b61668f5a2d3..70b4b49e8fc8 100644 --- a/stubs/pyserial/serial/tools/miniterm.pyi +++ b/stubs/pyserial/serial/tools/miniterm.pyi @@ -1,9 +1,9 @@ import codecs import sys import threading -from _typeshed import Self from collections.abc import Iterable from typing import Any, BinaryIO, TextIO +from typing_extensions import Self from serial import Serial @@ -19,7 +19,7 @@ class ConsoleBase: def write_bytes(self, byte_string: bytes) -> None: ... def write(self, text: str) -> None: ... def cancel(self) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, *args: object, **kwargs: object) -> None: ... if sys.platform == "win32": diff --git a/stubs/pysftp/pysftp/__init__.pyi b/stubs/pysftp/pysftp/__init__.pyi index 89d52ead34bd..6e42892a6320 100644 --- a/stubs/pysftp/pysftp/__init__.pyi +++ b/stubs/pysftp/pysftp/__init__.pyi @@ -1,10 +1,9 @@ -from _typeshed import Self from collections.abc import Callable, Sequence from contextlib import AbstractContextManager from stat import S_IMODE as S_IMODE from types import TracebackType from typing import IO -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias import paramiko from paramiko import AuthenticationException as AuthenticationException @@ -123,7 +122,7 @@ class Connection: @property def remote_server_key(self) -> paramiko.PKey: ... def __del__(self) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, etype: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... diff --git a/stubs/python-crontab/cronlog.pyi b/stubs/python-crontab/cronlog.pyi index 3faad0b0f60c..f21d45161808 100644 --- a/stubs/python-crontab/cronlog.pyi +++ b/stubs/python-crontab/cronlog.pyi @@ -1,7 +1,8 @@ -from _typeshed import Self, StrOrBytesPath +from _typeshed import StrOrBytesPath from codecs import StreamReaderWriter from collections.abc import Generator, Iterator from types import TracebackType +from typing_extensions import Self MATCHER: str @@ -12,7 +13,7 @@ class LogReader: read: int pipe: StreamReaderWriter | None def __init__(self, filename: StrOrBytesPath, mass: int = ...) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, error_type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... diff --git a/stubs/python-crontab/crontab.pyi b/stubs/python-crontab/crontab.pyi index 083a6fad2f33..d0335e8365a3 100644 --- a/stubs/python-crontab/crontab.pyi +++ b/stubs/python-crontab/crontab.pyi @@ -1,6 +1,6 @@ import re import subprocess -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from builtins import range as _range from collections import OrderedDict from collections.abc import Callable, Generator, Iterable, Iterator @@ -8,7 +8,7 @@ from datetime import datetime from logging import Logger from types import TracebackType from typing import Any -from typing_extensions import SupportsIndex, TypeAlias +from typing_extensions import Self, SupportsIndex, TypeAlias from cronlog import CronLog @@ -46,7 +46,7 @@ class CronTab: def __init__( self, user: _User = ..., tab: str | None = ..., tabfile: str | None = ..., log: CronLog | str | None = ... ) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... @@ -115,7 +115,7 @@ class CronItem: def __hash__(self) -> int: ... def __eq__(self, other: object) -> bool: ... @classmethod - def from_line(cls: type[Self], line: str, user: str | None = ..., cron: Incomplete | None = ...) -> Self: ... + def from_line(cls, line: str, user: str | None = ..., cron: Incomplete | None = ...) -> Self: ... def delete(self) -> None: ... def set_command(self, cmd: str, parse_stdin: bool = ...) -> None: ... def set_comment(self, cmt: str, pre_comment: bool = ...) -> None: ... @@ -257,5 +257,5 @@ class OrderedVariableList(OrderedDict[Incomplete, Incomplete]): def __init__(self, *args: Any, **kw: Any) -> None: ... @property def previous(self) -> Incomplete: ... - def all(self: Self) -> Self: ... + def all(self) -> Self: ... def __getitem__(self, key: Incomplete) -> Incomplete: ... diff --git a/stubs/python-dateutil/dateutil/_common.pyi b/stubs/python-dateutil/dateutil/_common.pyi index 081bebecd309..dd7eff9b63f5 100644 --- a/stubs/python-dateutil/dateutil/_common.pyi +++ b/stubs/python-dateutil/dateutil/_common.pyi @@ -1,8 +1,8 @@ -from _typeshed import Self +from typing_extensions import Self class weekday: def __init__(self, weekday: int, n: int | None = ...) -> None: ... - def __call__(self: Self, n: int) -> Self: ... + def __call__(self, n: int) -> Self: ... def __eq__(self, other: object) -> bool: ... def __hash__(self) -> int: ... weekday: int diff --git a/stubs/python-dateutil/dateutil/relativedelta.pyi b/stubs/python-dateutil/dateutil/relativedelta.pyi index 20f7c68337b0..d0e0bd7eccf7 100644 --- a/stubs/python-dateutil/dateutil/relativedelta.pyi +++ b/stubs/python-dateutil/dateutil/relativedelta.pyi @@ -1,12 +1,9 @@ -from _typeshed import Self from datetime import date, datetime, timedelta from typing import SupportsFloat, TypeVar, overload -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias from ._common import weekday -# We need the extra "Self" TypeVar to avoid overlapping __add__/__radd__ complaints from mypy -_SelfT = TypeVar("_SelfT", bound=relativedelta) _DateT = TypeVar("_DateT", date, datetime) # Work around attribute and type having the same name. _Weekday: TypeAlias = weekday @@ -64,36 +61,36 @@ class relativedelta: def weeks(self) -> int: ... @weeks.setter def weeks(self, value: int) -> None: ... - def normalized(self: Self) -> Self: ... + def normalized(self) -> Self: ... # TODO: use Union when mypy will handle it properly in overloaded operator # methods (#2129, #1442, #1264 in mypy) @overload - def __add__(self: _SelfT, other: relativedelta) -> _SelfT: ... # noqa: Y019 + def __add__(self, other: relativedelta) -> Self: ... @overload - def __add__(self: _SelfT, other: timedelta) -> _SelfT: ... # noqa: Y019 + def __add__(self, other: timedelta) -> Self: ... @overload def __add__(self, other: _DateT) -> _DateT: ... @overload - def __radd__(self: _SelfT, other: relativedelta) -> _SelfT: ... # noqa: Y019 + def __radd__(self, other: relativedelta) -> Self: ... @overload - def __radd__(self: _SelfT, other: timedelta) -> _SelfT: ... # noqa: Y019 + def __radd__(self, other: timedelta) -> Self: ... @overload def __radd__(self, other: _DateT) -> _DateT: ... @overload - def __rsub__(self: Self, other: relativedelta) -> Self: ... + def __rsub__(self, other: relativedelta) -> Self: ... @overload - def __rsub__(self: Self, other: timedelta) -> Self: ... + def __rsub__(self, other: timedelta) -> Self: ... @overload def __rsub__(self, other: _DateT) -> _DateT: ... - def __sub__(self: Self, other: relativedelta) -> Self: ... - def __neg__(self: Self) -> Self: ... + def __sub__(self, other: relativedelta) -> Self: ... + def __neg__(self) -> Self: ... def __bool__(self) -> bool: ... def __nonzero__(self) -> bool: ... - def __mul__(self: Self, other: SupportsFloat) -> Self: ... - def __rmul__(self: Self, other: SupportsFloat) -> Self: ... + def __mul__(self, other: SupportsFloat) -> Self: ... + def __rmul__(self, other: SupportsFloat) -> Self: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... - def __div__(self: Self, other: SupportsFloat) -> Self: ... - def __truediv__(self: Self, other: SupportsFloat) -> Self: ... - def __abs__(self: Self) -> Self: ... + def __div__(self, other: SupportsFloat) -> Self: ... + def __truediv__(self, other: SupportsFloat) -> Self: ... + def __abs__(self) -> Self: ... def __hash__(self) -> int: ... diff --git a/stubs/python-jose/jose/backends/base.pyi b/stubs/python-jose/jose/backends/base.pyi index ea7f34f5bdeb..26313de27590 100644 --- a/stubs/python-jose/jose/backends/base.pyi +++ b/stubs/python-jose/jose/backends/base.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from typing import Any +from typing_extensions import Self class Key: # Enable when we can use stubs from installed dependencies, @@ -8,7 +8,7 @@ class Key: def __init__(self, key, algorithm) -> None: ... def sign(self, msg: bytes) -> bytes: ... def verify(self, msg: bytes, sig: bytes) -> bool: ... - def public_key(self: Self) -> Self: ... + def public_key(self) -> Self: ... def to_pem(self) -> bytes: ... def to_dict(self) -> dict[str, Any]: ... def encrypt(self, plain_text: str | bytes, aad: bytes | None = ...) -> tuple[bytes, bytes, bytes | None]: ... diff --git a/stubs/python-jose/jose/backends/ecdsa_backend.pyi b/stubs/python-jose/jose/backends/ecdsa_backend.pyi index 9a78fb36b379..fea488c785ad 100644 --- a/stubs/python-jose/jose/backends/ecdsa_backend.pyi +++ b/stubs/python-jose/jose/backends/ecdsa_backend.pyi @@ -1,7 +1,7 @@ -from _typeshed import Self from collections.abc import Callable from hashlib import _Hash from typing import Any +from typing_extensions import Self from .base import Key @@ -20,6 +20,6 @@ class ECDSAECKey(Key): def sign(self, msg): ... def verify(self, msg, sig): ... def is_public(self) -> bool: ... - def public_key(self: Self) -> Self: ... + def public_key(self) -> Self: ... def to_pem(self): ... def to_dict(self) -> dict[str, Any]: ... diff --git a/stubs/python-jose/jose/backends/rsa_backend.pyi b/stubs/python-jose/jose/backends/rsa_backend.pyi index cb04422873e7..39e9b1715729 100644 --- a/stubs/python-jose/jose/backends/rsa_backend.pyi +++ b/stubs/python-jose/jose/backends/rsa_backend.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from typing import Any +from typing_extensions import Self from .base import Key @@ -20,7 +20,7 @@ class RSAKey(Key): def sign(self, msg: bytes) -> bytes: ... def verify(self, msg: bytes, sig: bytes) -> bool: ... def is_public(self) -> bool: ... - def public_key(self: Self) -> Self: ... + def public_key(self) -> Self: ... def to_pem(self, pem_format: str = ...) -> bytes: ... def to_dict(self) -> dict[str, Any]: ... def wrap_key(self, key_data: bytes) -> bytes: ... diff --git a/stubs/pywin32/_win32typing.pyi b/stubs/pywin32/_win32typing.pyi index e5b43e94b004..9d730bbd483a 100644 --- a/stubs/pywin32/_win32typing.pyi +++ b/stubs/pywin32/_win32typing.pyi @@ -1,8 +1,8 @@ # Not available at runtime. Contains type definitions that are otherwise not exposed and not part of a specific module. -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Iterable from typing import overload -from typing_extensions import Literal, final +from typing_extensions import Literal, Self, final class ArgNotFound: ... class PyOleEmpty: ... @@ -923,7 +923,7 @@ class PyHANDLE: def handle(self) -> int: ... def Close(self) -> None: ... def close(self) -> None: ... - def Detach(self: Self) -> Self: ... + def Detach(self) -> Self: ... @final class PyHDESK: diff --git a/stubs/redis/redis/asyncio/client.pyi b/stubs/redis/redis/asyncio/client.pyi index 197501b63850..f1b2dcb1a3d2 100644 --- a/stubs/redis/redis/asyncio/client.pyi +++ b/stubs/redis/redis/asyncio/client.pyi @@ -1,8 +1,8 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Mapping, MutableMapping, Sequence from datetime import datetime, timedelta from typing import Any, ClassVar, Generic, NoReturn, Protocol, overload -from typing_extensions import Literal, TypeAlias, TypedDict +from typing_extensions import Literal, Self, TypeAlias, TypedDict from redis import RedisError from redis.asyncio.connection import ConnectCallbackT, Connection, ConnectionPool @@ -67,7 +67,7 @@ class Redis(AbstractRedis, RedisModuleCommands, AsyncCoreCommands[_StrType], Asy credential_provider: CredentialProvider | None = ..., ) -> None: ... def __await__(self): ... - async def initialize(self: Self) -> Self: ... + async def initialize(self) -> Self: ... def set_response_callback(self, command: str, callback: ResponseCallbackT): ... def load_external_module(self, funcname, func) -> None: ... def pipeline(self, transaction: bool = ..., shard_hint: str | None = ...) -> Pipeline[_StrType]: ... @@ -92,7 +92,7 @@ class Redis(AbstractRedis, RedisModuleCommands, AsyncCoreCommands[_StrType], Asy def pubsub(self, **kwargs) -> PubSub: ... def monitor(self) -> Monitor: ... def client(self) -> Redis[_StrType]: ... - async def __aenter__(self: Self) -> Self: ... + async def __aenter__(self) -> Self: ... async def __aexit__(self, exc_type, exc_value, traceback) -> None: ... def __del__(self, _warnings: Any = ...) -> None: ... async def close(self, close_connection_pool: bool | None = ...) -> None: ... @@ -116,7 +116,7 @@ class Monitor: connection: Any def __init__(self, connection_pool: ConnectionPool) -> None: ... async def connect(self) -> None: ... - async def __aenter__(self: Self) -> Self: ... + async def __aenter__(self) -> Self: ... async def __aexit__(self, *args) -> None: ... async def next_command(self) -> MonitorCommandInfo: ... def listen(self) -> AsyncIterator[MonitorCommandInfo]: ... @@ -142,7 +142,7 @@ class PubSub: ignore_subscribe_messages: bool = ..., encoder: Incomplete | None = ..., ) -> None: ... - async def __aenter__(self: Self) -> Self: ... + async def __aenter__(self) -> Self: ... async def __aexit__(self, exc_type, exc_value, traceback) -> None: ... def __del__(self) -> None: ... async def reset(self) -> None: ... @@ -191,7 +191,7 @@ class Pipeline(Redis[_StrType], Generic[_StrType]): transaction: bool, shard_hint: str | None, ) -> None: ... - async def __aenter__(self: Self) -> Self: ... + async def __aenter__(self) -> Self: ... async def __aexit__(self, exc_type, exc_value, traceback) -> None: ... def __await__(self): ... def __len__(self) -> int: ... diff --git a/stubs/redis/redis/asyncio/cluster.pyi b/stubs/redis/redis/asyncio/cluster.pyi index a68e81c6620a..a5a3f5630805 100644 --- a/stubs/redis/redis/asyncio/cluster.pyi +++ b/stubs/redis/redis/asyncio/cluster.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Awaitable, Callable, Mapping from typing import Any, Generic +from typing_extensions import Self from redis.asyncio.client import ResponseCallbackT from redis.asyncio.connection import BaseParser, Connection, Encoder @@ -72,11 +73,11 @@ class RedisCluster(AbstractRedis, AbstractRedisCluster, Generic[_StrType]): # T ssl_check_hostname: bool = ..., ssl_keyfile: str | None = ..., ) -> None: ... - async def initialize(self: Self) -> Self: ... + async def initialize(self) -> Self: ... async def close(self) -> None: ... - async def __aenter__(self: Self) -> Self: ... + async def __aenter__(self) -> Self: ... async def __aexit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ... - def __await__(self: Self) -> Awaitable[Self]: ... + def __await__(self) -> Awaitable[Self]: ... def __del__(self) -> None: ... async def on_connect(self, connection: Connection) -> None: ... def get_nodes(self) -> list[ClusterNode]: ... @@ -94,7 +95,7 @@ class RedisCluster(AbstractRedis, AbstractRedisCluster, Generic[_StrType]): # T async def execute_command(self, *args: EncodableT, **kwargs: Any) -> Any: ... def pipeline(self, transaction: Any | None = ..., shard_hint: Any | None = ...) -> ClusterPipeline[_StrType]: ... @classmethod - def from_url(cls: type[Self], url: str, **kwargs) -> Self: ... + def from_url(cls, url: str, **kwargs) -> Self: ... class ClusterNode: host: str @@ -143,17 +144,17 @@ class NodesManager: class ClusterPipeline(AbstractRedis, AbstractRedisCluster, Generic[_StrType]): # TODO: AsyncRedisClusterCommands def __init__(self, client: RedisCluster[_StrType]) -> None: ... - async def initialize(self: Self) -> Self: ... - async def __aenter__(self: Self) -> Self: ... + async def initialize(self) -> Self: ... + async def __aenter__(self) -> Self: ... async def __aexit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ... - def __await__(self: Self) -> Awaitable[Self]: ... - def __enter__(self: Self) -> Self: ... + def __await__(self) -> Awaitable[Self]: ... + def __enter__(self) -> Self: ... def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ... def __bool__(self) -> bool: ... def __len__(self) -> int: ... - def execute_command(self: Self, *args: KeyT | EncodableT, **kwargs: Any) -> Self: ... + def execute_command(self, *args: KeyT | EncodableT, **kwargs: Any) -> Self: ... async def execute(self, raise_on_error: bool = ..., allow_redirections: bool = ...) -> list[Any]: ... - def mset_nonatomic(self: Self, mapping: Mapping[AnyKeyT, EncodableT]) -> Self: ... + def mset_nonatomic(self, mapping: Mapping[AnyKeyT, EncodableT]) -> Self: ... class PipelineCommand: args: Any diff --git a/stubs/redis/redis/asyncio/lock.pyi b/stubs/redis/redis/asyncio/lock.pyi index c9d3a93b665c..aa90042b44ae 100644 --- a/stubs/redis/redis/asyncio/lock.pyi +++ b/stubs/redis/redis/asyncio/lock.pyi @@ -1,8 +1,8 @@ import threading -from _typeshed import Self from collections.abc import Awaitable from types import SimpleNamespace, TracebackType from typing import Any, ClassVar +from typing_extensions import Self from redis.asyncio import Redis from redis.commands.core import AsyncScript @@ -33,7 +33,7 @@ class Lock: thread_local: bool = ..., ) -> None: ... def register_scripts(self) -> None: ... - async def __aenter__(self: Self) -> Self: ... + async def __aenter__(self) -> Self: ... async def __aexit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... diff --git a/stubs/redis/redis/client.pyi b/stubs/redis/redis/client.pyi index 39cdfa0a99d0..c69590db46eb 100644 --- a/stubs/redis/redis/client.pyi +++ b/stubs/redis/redis/client.pyi @@ -1,11 +1,11 @@ import threading -from _typeshed import Incomplete, Self, SupportsItems +from _typeshed import Incomplete, SupportsItems from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence from datetime import datetime, timedelta from re import Pattern from types import TracebackType from typing import Any, ClassVar, Generic, TypeVar, overload -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from redis import RedisError @@ -340,7 +340,7 @@ class PubSub: ignore_subscribe_messages: bool = ..., encoder: Incomplete | None = ..., ) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None ) -> None: ... @@ -726,7 +726,7 @@ class Monitor: command_re: Pattern[str] monitor_re: Pattern[str] def __init__(self, connection_pool) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, *args: object) -> None: ... def next_command(self) -> dict[str, Any]: ... def listen(self) -> Iterable[dict[str, Any]]: ... diff --git a/stubs/redis/redis/cluster.pyi b/stubs/redis/redis/cluster.pyi index c321db066d46..de4acb86dba9 100644 --- a/stubs/redis/redis/cluster.pyi +++ b/stubs/redis/redis/cluster.pyi @@ -1,9 +1,9 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable, Iterable, Sequence from threading import Lock from types import TracebackType from typing import Any, ClassVar, Generic, NoReturn, Protocol -from typing_extensions import Literal +from typing_extensions import Literal, Self from redis.client import CaseInsensitiveDict, PubSub, Redis, _ParseResponseOptions from redis.commands import CommandsParser, RedisClusterCommands @@ -71,14 +71,14 @@ class RedisCluster(AbstractRedisCluster, RedisClusterCommands[_StrType], Generic url: str | None = ..., **kwargs, ) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> None: ... def __del__(self) -> None: ... def disconnect_connection_pools(self) -> None: ... @classmethod - def from_url(cls: type[Self], url: str, **kwargs) -> Self: ... + def from_url(cls, url: str, **kwargs) -> Self: ... def on_connect(self, connection: Connection) -> None: ... def get_redis_connection(self, node: ClusterNode) -> Redis[Any]: ... def get_node( diff --git a/stubs/redis/redis/connection.pyi b/stubs/redis/redis/connection.pyi index b58b81c19b88..576c144fe194 100644 --- a/stubs/redis/redis/connection.pyi +++ b/stubs/redis/redis/connection.pyi @@ -1,9 +1,9 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable, Iterable, Mapping from queue import Queue from socket import socket from typing import Any, ClassVar -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias from .credentials import CredentialProvider from .retry import Retry @@ -202,7 +202,7 @@ class ConnectionPool: max_connections: int pid: int @classmethod - def from_url(cls: type[Self], url: str, *, db: int = ..., decode_components: bool = ..., **kwargs) -> Self: ... + def from_url(cls, url: str, *, db: int = ..., decode_components: bool = ..., **kwargs) -> Self: ... def __init__( self, connection_class: type[Connection] = ..., max_connections: int | None = ..., **connection_kwargs ) -> None: ... diff --git a/stubs/redis/redis/lock.pyi b/stubs/redis/redis/lock.pyi index 358f33596ea6..bb0b74183e02 100644 --- a/stubs/redis/redis/lock.pyi +++ b/stubs/redis/redis/lock.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from types import TracebackType from typing import Any, ClassVar, Protocol +from typing_extensions import Self from redis.client import Redis @@ -26,7 +27,7 @@ class Lock: thread_local: bool = ..., ) -> None: ... def register_scripts(self) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None ) -> bool | None: ... diff --git a/stubs/regex/regex/_regex.pyi b/stubs/regex/regex/_regex.pyi index 60cd19e6c402..a8744d0d9049 100644 --- a/stubs/regex/regex/_regex.pyi +++ b/stubs/regex/regex/_regex.pyi @@ -3,9 +3,8 @@ # For example: `Pattern` and `Match` are not exported # and are redefined in `regex.regex module. -from _typeshed import Self from typing import Any, AnyStr, Generic -from typing_extensions import final +from typing_extensions import Self, final from .regex import Match, Pattern @@ -13,7 +12,7 @@ from .regex import Match, Pattern class Splitter(Generic[AnyStr]): @property def pattern(self) -> Pattern[AnyStr]: ... - def __iter__(self: Self) -> Self: ... + def __iter__(self) -> Self: ... def __next__(self) -> AnyStr | Any: ... def split(self) -> AnyStr | Any: ... @@ -21,7 +20,7 @@ class Splitter(Generic[AnyStr]): class Scanner(Generic[AnyStr]): @property def pattern(self) -> Pattern[AnyStr]: ... - def __iter__(self: Self) -> Self: ... + def __iter__(self) -> Self: ... def __next__(self) -> Match[AnyStr]: ... def match(self) -> Match[AnyStr] | None: ... def search(self) -> Match[AnyStr] | None: ... diff --git a/stubs/regex/regex/regex.pyi b/stubs/regex/regex/regex.pyi index b354eb09a354..6a6d25f47cfe 100644 --- a/stubs/regex/regex/regex.pyi +++ b/stubs/regex/regex/regex.pyi @@ -1,8 +1,8 @@ import sys -from _typeshed import ReadableBuffer, Self +from _typeshed import ReadableBuffer from collections.abc import Callable, Mapping from typing import Any, AnyStr, Generic, TypeVar, overload -from typing_extensions import Literal, final +from typing_extensions import Literal, Self, final from . import _regex from ._regex_core import * @@ -565,8 +565,8 @@ class Pattern(Generic[AnyStr]): concurrent: bool | None = ..., timeout: float | None = ..., ) -> _regex.Scanner[bytes]: ... - def __copy__(self: Self) -> Self: ... - def __deepcopy__(self: Self) -> Self: ... + def __copy__(self) -> Self: ... + def __deepcopy__(self) -> Self: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... @@ -644,7 +644,7 @@ class Match(Generic[AnyStr]): def __getitem__(self, __key: Literal[0]) -> AnyStr: ... @overload def __getitem__(self, __key: int | str) -> AnyStr | Any: ... - def __copy__(self: Self) -> Self: ... - def __deepcopy__(self: Self) -> Self: ... + def __copy__(self) -> Self: ... + def __deepcopy__(self) -> Self: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... diff --git a/stubs/requests/requests/models.pyi b/stubs/requests/requests/models.pyi index e5836186999c..cfbca9088a2a 100644 --- a/stubs/requests/requests/models.pyi +++ b/stubs/requests/requests/models.pyi @@ -1,8 +1,8 @@ import datetime -from _typeshed import Self from collections.abc import Callable, Iterator from json import JSONDecoder from typing import Any +from typing_extensions import Self from urllib3 import exceptions as urllib3_exceptions, fields, filepost, util @@ -106,7 +106,7 @@ class Response: def __bool__(self) -> bool: ... def __nonzero__(self) -> bool: ... def __iter__(self) -> Iterator[bytes]: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, *args: object) -> None: ... @property def next(self) -> PreparedRequest | None: ... diff --git a/stubs/requests/requests/sessions.pyi b/stubs/requests/requests/sessions.pyi index 95cb7381e986..b0688d8e4406 100644 --- a/stubs/requests/requests/sessions.pyi +++ b/stubs/requests/requests/sessions.pyi @@ -1,7 +1,7 @@ -from _typeshed import Incomplete, Self, SupportsItems, SupportsRead +from _typeshed import Incomplete, SupportsItems, SupportsRead from collections.abc import Callable, Iterable, Mapping, MutableMapping from typing import Any -from typing_extensions import TypeAlias, TypedDict +from typing_extensions import Self, TypeAlias, TypedDict from urllib3._collections import RecentlyUsedContainer @@ -133,7 +133,7 @@ class Session(SessionRedirectMixin): adapters: MutableMapping[Any, Any] redirect_cache: RecentlyUsedContainer[Any, Any] def __init__(self) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, *args) -> None: ... def prepare_request(self, request: Request) -> PreparedRequest: ... def request( diff --git a/stubs/setuptools/pkg_resources/__init__.pyi b/stubs/setuptools/pkg_resources/__init__.pyi index efa7329beb0c..490184c91f89 100644 --- a/stubs/setuptools/pkg_resources/__init__.pyi +++ b/stubs/setuptools/pkg_resources/__init__.pyi @@ -1,11 +1,11 @@ import importlib.abc import types import zipimport -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from abc import ABCMeta from collections.abc import Callable, Generator, Iterable, Sequence from typing import IO, Any, TypeVar, overload -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias _Version: TypeAlias = Incomplete # from packaging.version @@ -55,7 +55,7 @@ class Environment: def remove(self, dist: Distribution) -> None: ... def can_add(self, dist: Distribution) -> bool: ... def __add__(self, other: Distribution | Environment) -> Environment: ... - def __iadd__(self: Self, other: Distribution | Environment) -> Self: ... + def __iadd__(self, other: Distribution | Environment) -> Self: ... @overload def best_match(self, req: Requirement, working_set: WorkingSet, *, replace_conflicting: bool = ...) -> Distribution: ... @overload diff --git a/stubs/setuptools/setuptools/_distutils/version.pyi b/stubs/setuptools/setuptools/_distutils/version.pyi index 7e807d7d0711..b6662d04f02f 100644 --- a/stubs/setuptools/setuptools/_distutils/version.pyi +++ b/stubs/setuptools/setuptools/_distutils/version.pyi @@ -1,26 +1,26 @@ -from _typeshed import Self from re import Pattern +from typing_extensions import Self class Version: def __init__(self, vstring: str | None = ...) -> None: ... def __eq__(self, other: object) -> bool: ... - def __lt__(self: Self, other: Self | str) -> bool: ... - def __le__(self: Self, other: Self | str) -> bool: ... - def __gt__(self: Self, other: Self | str) -> bool: ... - def __ge__(self: Self, other: Self | str) -> bool: ... + def __lt__(self, other: Self | str) -> bool: ... + def __le__(self, other: Self | str) -> bool: ... + def __gt__(self, other: Self | str) -> bool: ... + def __ge__(self, other: Self | str) -> bool: ... class StrictVersion(Version): version_re: Pattern[str] version: tuple[int, int, int] prerelease: tuple[str, int] | None def __init__(self, vstring: str | None = ...) -> None: ... - def parse(self: Self, vstring: str) -> Self: ... - def _cmp(self: Self, other: Self | str) -> bool: ... + def parse(self, vstring: str) -> Self: ... + def _cmp(self, other: Self | str) -> bool: ... class LooseVersion(Version): component_re: Pattern[str] vstring: str version: tuple[str | int, ...] def __init__(self, vstring: str | None = ...) -> None: ... - def parse(self: Self, vstring: str) -> Self: ... - def _cmp(self: Self, other: Self | str) -> bool: ... + def parse(self, vstring: str) -> Self: ... + def _cmp(self, other: Self | str) -> bool: ... diff --git a/stubs/setuptools/setuptools/command/test.pyi b/stubs/setuptools/setuptools/command/test.pyi index e61fbca6328c..0ee33879b6c8 100644 --- a/stubs/setuptools/setuptools/command/test.pyi +++ b/stubs/setuptools/setuptools/command/test.pyi @@ -1,7 +1,8 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable from types import ModuleType from typing import Any, Generic, TypeVar, overload +from typing_extensions import Self from unittest import TestLoader, TestSuite from setuptools import Command @@ -16,7 +17,7 @@ class NonDataProperty(Generic[_T]): fget: Callable[..., _T] def __init__(self, fget: Callable[..., _T]) -> None: ... @overload - def __get__(self: Self, obj: None, objtype: object = ...) -> Self: ... + def __get__(self, obj: None, objtype: object = ...) -> Self: ... @overload def __get__(self, obj: Any, objtype: object = ...) -> _T: ... diff --git a/stubs/slumber/slumber/__init__.pyi b/stubs/slumber/slumber/__init__.pyi index b03c170ca4ca..f35d7855ed00 100644 --- a/stubs/slumber/slumber/__init__.pyi +++ b/stubs/slumber/slumber/__init__.pyi @@ -1,5 +1,5 @@ -from _typeshed import Self from typing import Any +from typing_extensions import Self from requests import Response, Session from requests.sessions import _Auth, _Data, _Files @@ -14,8 +14,8 @@ class ResourceAttributesMixin: class Resource(ResourceAttributesMixin): def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def __call__(self: Self, id: str | None = ..., format: str | None = ..., url_override: str | None = ...) -> Self: ... - def as_raw(self: Self) -> Self: ... + def __call__(self, id: str | None = ..., format: str | None = ..., url_override: str | None = ...) -> Self: ... + def as_raw(self) -> Self: ... def get(self, **kwargs: Any) -> Response: ... def options(self, **kwargs: Any) -> Response: ... def head(self, **kwargs: Any) -> Response: ... diff --git a/stubs/stripe/stripe/api_resources/abstract/api_resource.pyi b/stubs/stripe/stripe/api_resources/abstract/api_resource.pyi index 88918e8c030b..8891f1133801 100644 --- a/stubs/stripe/stripe/api_resources/abstract/api_resource.pyi +++ b/stubs/stripe/stripe/api_resources/abstract/api_resource.pyi @@ -1,12 +1,13 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete +from typing_extensions import Self from stripe import api_requestor as api_requestor, error as error from stripe.stripe_object import StripeObject as StripeObject class APIResource(StripeObject): @classmethod - def retrieve(cls: type[Self], id, api_key: Incomplete | None = ..., **params) -> Self: ... - def refresh(self: Self) -> Self: ... + def retrieve(cls, id, api_key: Incomplete | None = ..., **params) -> Self: ... + def refresh(self) -> Self: ... @classmethod def class_url(cls) -> str: ... def instance_url(self) -> str: ... diff --git a/stubs/stripe/stripe/api_resources/abstract/createable_api_resource.pyi b/stubs/stripe/stripe/api_resources/abstract/createable_api_resource.pyi index 41e18a574765..1191ea7ff600 100644 --- a/stubs/stripe/stripe/api_resources/abstract/createable_api_resource.pyi +++ b/stubs/stripe/stripe/api_resources/abstract/createable_api_resource.pyi @@ -1,4 +1,5 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete +from typing_extensions import Self from stripe import api_requestor as api_requestor from stripe.api_resources.abstract.api_resource import APIResource as APIResource @@ -6,7 +7,7 @@ from stripe.api_resources.abstract.api_resource import APIResource as APIResourc class CreateableAPIResource(APIResource): @classmethod def create( - cls: type[Self], + cls, api_key: Incomplete | None = ..., idempotency_key: str | None = ..., stripe_version: Incomplete | None = ..., diff --git a/stubs/stripe/stripe/api_resources/abstract/deletable_api_resource.pyi b/stubs/stripe/stripe/api_resources/abstract/deletable_api_resource.pyi index 154355211a46..b82f72b7b91f 100644 --- a/stubs/stripe/stripe/api_resources/abstract/deletable_api_resource.pyi +++ b/stubs/stripe/stripe/api_resources/abstract/deletable_api_resource.pyi @@ -1,7 +1,7 @@ -from _typeshed import Self +from typing_extensions import Self from stripe.api_resources.abstract.api_resource import APIResource as APIResource class DeletableAPIResource(APIResource): @classmethod - def delete(cls: type[Self], sid: str = ..., **params) -> Self: ... + def delete(cls, sid: str = ..., **params) -> Self: ... diff --git a/stubs/stripe/stripe/api_resources/abstract/searchable_api_resource.pyi b/stubs/stripe/stripe/api_resources/abstract/searchable_api_resource.pyi index e8cf8ce998dd..cf683861319e 100644 --- a/stubs/stripe/stripe/api_resources/abstract/searchable_api_resource.pyi +++ b/stubs/stripe/stripe/api_resources/abstract/searchable_api_resource.pyi @@ -1,11 +1,11 @@ -from _typeshed import Self from collections.abc import Iterator +from typing_extensions import Self from stripe.api_resources.abstract.api_resource import APIResource as APIResource from stripe.api_resources.search_result_object import SearchResultObject class SearchableAPIResource(APIResource): @classmethod - def search(cls: type[Self], *args: str | None, **kwargs) -> SearchResultObject[Self]: ... + def search(cls, *args: str | None, **kwargs) -> SearchResultObject[Self]: ... @classmethod - def search_auto_paging_iter(cls: type[Self], *args: str | None, **kwargs) -> Iterator[Self]: ... + def search_auto_paging_iter(cls, *args: str | None, **kwargs) -> Iterator[Self]: ... diff --git a/stubs/stripe/stripe/api_resources/abstract/updateable_api_resource.pyi b/stubs/stripe/stripe/api_resources/abstract/updateable_api_resource.pyi index b7ee885f22f3..ffbcbb141a65 100644 --- a/stubs/stripe/stripe/api_resources/abstract/updateable_api_resource.pyi +++ b/stubs/stripe/stripe/api_resources/abstract/updateable_api_resource.pyi @@ -1,8 +1,8 @@ -from _typeshed import Self +from typing_extensions import Self from stripe.api_resources.abstract.api_resource import APIResource as APIResource class UpdateableAPIResource(APIResource): @classmethod - def modify(cls: type[Self], sid: str, **params) -> Self: ... - def save(self: Self, idempotency_key: str | None = ...) -> Self: ... + def modify(cls, sid: str, **params) -> Self: ... + def save(self, idempotency_key: str | None = ...) -> Self: ... diff --git a/stubs/stripe/stripe/api_resources/application_fee_refund.pyi b/stubs/stripe/stripe/api_resources/application_fee_refund.pyi index ffac515a5292..865bb0fc9ed9 100644 --- a/stubs/stripe/stripe/api_resources/application_fee_refund.pyi +++ b/stubs/stripe/stripe/api_resources/application_fee_refund.pyi @@ -1,5 +1,6 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from typing import NoReturn +from typing_extensions import Self from stripe.api_resources import ApplicationFee as ApplicationFee from stripe.api_resources.abstract import UpdateableAPIResource as UpdateableAPIResource @@ -7,7 +8,7 @@ from stripe.api_resources.abstract import UpdateableAPIResource as UpdateableAPI class ApplicationFeeRefund(UpdateableAPIResource): OBJECT_NAME: str @classmethod - def modify(cls: type[Self], fee, sid: str, **params) -> Self: ... # type: ignore[override] + def modify(cls, fee, sid: str, **params) -> Self: ... # type: ignore[override] def instance_url(self) -> str: ... @classmethod def retrieve(cls, id, api_key: Incomplete | None = ..., **params) -> NoReturn: ... diff --git a/stubs/stripe/stripe/api_resources/invoice.pyi b/stubs/stripe/stripe/api_resources/invoice.pyi index e399ed65bbc4..50d8c9f312a8 100644 --- a/stubs/stripe/stripe/api_resources/invoice.pyi +++ b/stubs/stripe/stripe/api_resources/invoice.pyi @@ -1,4 +1,5 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete +from typing_extensions import Self from stripe import api_requestor as api_requestor from stripe.api_resources.abstract import ( @@ -12,11 +13,11 @@ from stripe.api_resources.abstract import ( class Invoice(CreateableAPIResource, DeletableAPIResource, ListableAPIResource, SearchableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def finalize_invoice(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... - def mark_uncollectible(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... - def pay(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... - def send_invoice(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... - def void_invoice(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... + def finalize_invoice(self, idempotency_key: str | None = ..., **params) -> Self: ... + def mark_uncollectible(self, idempotency_key: str | None = ..., **params) -> Self: ... + def pay(self, idempotency_key: str | None = ..., **params) -> Self: ... + def send_invoice(self, idempotency_key: str | None = ..., **params) -> Self: ... + def void_invoice(self, idempotency_key: str | None = ..., **params) -> Self: ... @classmethod def upcoming( cls, diff --git a/stubs/stripe/stripe/api_resources/payment_method.pyi b/stubs/stripe/stripe/api_resources/payment_method.pyi index 4a8f17435945..47310ad782b6 100644 --- a/stubs/stripe/stripe/api_resources/payment_method.pyi +++ b/stubs/stripe/stripe/api_resources/payment_method.pyi @@ -1,4 +1,4 @@ -from _typeshed import Self +from typing_extensions import Self from stripe.api_resources.abstract import ( CreateableAPIResource as CreateableAPIResource, @@ -9,5 +9,5 @@ from stripe.api_resources.abstract import ( class PaymentMethod(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): OBJECT_NAME: str - def attach(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... - def detach(self: Self, idempotency_key: str | None = ..., **params) -> Self: ... + def attach(self, idempotency_key: str | None = ..., **params) -> Self: ... + def detach(self, idempotency_key: str | None = ..., **params) -> Self: ... diff --git a/stubs/stripe/stripe/api_resources/search_result_object.pyi b/stubs/stripe/stripe/api_resources/search_result_object.pyi index f6b858c27def..e447b5824575 100644 --- a/stubs/stripe/stripe/api_resources/search_result_object.pyi +++ b/stubs/stripe/stripe/api_resources/search_result_object.pyi @@ -1,7 +1,6 @@ -from _typeshed import Self from collections.abc import Iterator from typing import Any, ClassVar, Generic, TypeVar -from typing_extensions import Literal +from typing_extensions import Literal, Self from stripe.stripe_object import StripeObject @@ -16,7 +15,7 @@ class SearchResultObject(StripeObject, Generic[_T]): total_count: int def search( - self: Self, api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ..., **params + self, api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ..., **params ) -> Self: ... def __getitem__(self, k: str) -> Any: ... def __iter__(self) -> Iterator[_T]: ... @@ -24,10 +23,10 @@ class SearchResultObject(StripeObject, Generic[_T]): def auto_paging_iter(self) -> Iterator[_T]: ... @classmethod def empty_search_result( - cls: type[Self], api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ... + cls, api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ... ) -> Self: ... @property def is_empty(self) -> bool: ... def next_search_result_page( - self: Self, api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ..., **params + self, api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ..., **params ) -> Self: ... diff --git a/stubs/stripe/stripe/api_resources/test_helpers/test_clock.pyi b/stubs/stripe/stripe/api_resources/test_helpers/test_clock.pyi index 86495c375ab0..3caf15ecc1ac 100644 --- a/stubs/stripe/stripe/api_resources/test_helpers/test_clock.pyi +++ b/stubs/stripe/stripe/api_resources/test_helpers/test_clock.pyi @@ -1,6 +1,5 @@ -from _typeshed import Self from typing import Any -from typing_extensions import Literal +from typing_extensions import Literal, Self from stripe.api_resources.abstract import CreateableAPIResource, DeletableAPIResource, ListableAPIResource @@ -8,4 +7,4 @@ class TestClock(CreateableAPIResource, DeletableAPIResource, ListableAPIResource OBJECT_NAME: Literal["test_helpers.test_clock"] @classmethod - def advance(cls: type[Self], idempotency_key: str | None = ..., **params: Any) -> Self: ... + def advance(cls, idempotency_key: str | None = ..., **params: Any) -> Self: ... diff --git a/stubs/stripe/stripe/stripe_object.pyi b/stubs/stripe/stripe/stripe_object.pyi index 5c1adfc987aa..cfb021b26aaa 100644 --- a/stubs/stripe/stripe/stripe_object.pyi +++ b/stubs/stripe/stripe/stripe_object.pyi @@ -1,6 +1,7 @@ import json -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from typing import Any +from typing_extensions import Self from stripe import api_requestor as api_requestor @@ -29,7 +30,7 @@ class StripeObject(dict[Any, Any]): def __reduce__(self): ... @classmethod def construct_from( - cls: type[Self], + cls, values: Any, key: str | None, stripe_version: Incomplete | None = ..., diff --git a/stubs/tensorflow/tensorflow/__init__.pyi b/stubs/tensorflow/tensorflow/__init__.pyi index 62cab55b71a2..c6d0ba98d265 100644 --- a/stubs/tensorflow/tensorflow/__init__.pyi +++ b/stubs/tensorflow/tensorflow/__init__.pyi @@ -1,11 +1,11 @@ -from _typeshed import Incomplete, Self, Unused +from _typeshed import Incomplete, Unused from abc import ABCMeta from builtins import bool as _bool from collections.abc import Callable, Iterable, Iterator, Sequence from contextlib import contextmanager from enum import Enum from typing import Any, NoReturn, overload -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias import numpy @@ -222,7 +222,7 @@ class Graph: def add_to_collection(self, name: str, value: object) -> None: ... def add_to_collections(self, names: Iterable[str] | str, value: object) -> None: ... @contextmanager - def as_default(self: Self) -> Iterator[Self]: ... + def as_default(self) -> Iterator[Self]: ... def finalize(self) -> None: ... def get_tensor_by_name(self, name: str) -> Tensor: ... def get_operation_by_name(self, name: str) -> Operation: ... diff --git a/stubs/toml/toml/tz.pyi b/stubs/toml/toml/tz.pyi index 398a3e5cd777..054226bf76d4 100644 --- a/stubs/toml/toml/tz.pyi +++ b/stubs/toml/toml/tz.pyi @@ -1,10 +1,10 @@ -from _typeshed import Self from datetime import datetime, timedelta, tzinfo from typing import Any +from typing_extensions import Self class TomlTz(tzinfo): def __init__(self, toml_offset: str) -> None: ... - def __deepcopy__(self: Self, memo: Any) -> Self: ... + def __deepcopy__(self, memo: Any) -> Self: ... def tzname(self, dt: datetime | None) -> str: ... def utcoffset(self, dt: datetime | None) -> timedelta: ... def dst(self, dt: datetime | None) -> timedelta: ... diff --git a/stubs/tqdm/tqdm/asyncio.pyi b/stubs/tqdm/tqdm/asyncio.pyi index f0f3a07531a8..488fadbfe1a6 100644 --- a/stubs/tqdm/tqdm/asyncio.pyi +++ b/stubs/tqdm/tqdm/asyncio.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, Self, SupportsWrite +from _typeshed import Incomplete, SupportsWrite from collections.abc import Awaitable, Callable, Generator, Iterable, Iterator, Mapping from typing import Generic, NoReturn, TypeVar, overload +from typing_extensions import Self from .std import tqdm as std_tqdm @@ -13,7 +14,7 @@ class tqdm_asyncio(Generic[_T], std_tqdm[_T]): iterable_next: Callable[[], _T | Awaitable[_T]] iterable_iterator: Iterator[_T] - def __aiter__(self: Self) -> Self: ... + def __aiter__(self) -> Self: ... async def __anext__(self) -> Awaitable[_T]: ... def send(self, *args, **kwargs): ... @classmethod diff --git a/stubs/tqdm/tqdm/dask.pyi b/stubs/tqdm/tqdm/dask.pyi index dbd7e6b246b7..5e55eadb802c 100644 --- a/stubs/tqdm/tqdm/dask.pyi +++ b/stubs/tqdm/tqdm/dask.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete, Self +from _typeshed import Incomplete from collections.abc import Callable from typing import ClassVar +from typing_extensions import Self __all__ = ["TqdmCallback"] @@ -15,7 +16,7 @@ class _Callback: posttask: Incomplete | None, finish: Incomplete | None, ) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, *args) -> None: ... def register(self) -> None: ... def unregister(self) -> None: ... diff --git a/stubs/tqdm/tqdm/std.pyi b/stubs/tqdm/tqdm/std.pyi index bd1526e200aa..a5dc22b3d4c6 100644 --- a/stubs/tqdm/tqdm/std.pyi +++ b/stubs/tqdm/tqdm/std.pyi @@ -1,8 +1,8 @@ import contextlib -from _typeshed import Incomplete, Self, SupportsWrite +from _typeshed import Incomplete, SupportsWrite from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping from typing import Any, ClassVar, Generic, NoReturn, TypeVar, overload -from typing_extensions import Literal +from typing_extensions import Literal, Self from ._monitor import TMonitor from .utils import Comparable @@ -121,7 +121,7 @@ class tqdm(Generic[_T], Iterable[_T], Comparable): gui: bool = ..., **kwargs, ) -> None: ... - def __new__(cls: type[Self], *_, **__) -> Self: ... + def __new__(cls, *_, **__) -> Self: ... @classmethod def write(cls, s: str, file: SupportsWrite[str] | None = ..., end: str = ..., nolock: bool = ...) -> None: ... @classmethod @@ -199,7 +199,7 @@ class tqdm(Generic[_T], Iterable[_T], Comparable): def __len__(self) -> int: ... def __reversed__(self) -> Iterator[_T]: ... def __contains__(self, item: object) -> bool: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__(self, exc_type: object, exc_value: object, traceback: object) -> None: ... def __del__(self) -> None: ... def __hash__(self) -> int: ... diff --git a/stubs/untangle/untangle.pyi b/stubs/untangle/untangle.pyi index b2d7c960f269..f706aee02c94 100644 --- a/stubs/untangle/untangle.pyi +++ b/stubs/untangle/untangle.pyi @@ -1,6 +1,6 @@ -from _typeshed import Self from collections.abc import Iterator, Mapping from typing import Any +from typing_extensions import Self from xml.sax import handler def is_string(x: object) -> bool: ... @@ -17,7 +17,7 @@ class Element: def __getitem__(self, key: str) -> Any | None: ... def __getattr__(self, key: str) -> Element: ... def __hasattribute__(self, name: str) -> bool: ... - def __iter__(self: Self) -> Iterator[Self]: ... + def __iter__(self) -> Iterator[Self]: ... def __bool__(self) -> bool: ... __nonzero__ = __bool__ def __eq__(self, val: object) -> bool: ... diff --git a/stubs/urllib3/urllib3/connectionpool.pyi b/stubs/urllib3/urllib3/connectionpool.pyi index b0987dbe6dcc..4d27996de248 100644 --- a/stubs/urllib3/urllib3/connectionpool.pyi +++ b/stubs/urllib3/urllib3/connectionpool.pyi @@ -1,10 +1,9 @@ import queue -from _typeshed import Self from collections.abc import Mapping from logging import Logger from types import TracebackType from typing import Any, ClassVar -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from . import connection, exceptions, request, response from .connection import BaseSSLError as BaseSSLError, ConnectionError as ConnectionError, HTTPException as HTTPException @@ -47,7 +46,7 @@ class ConnectionPool: host: str port: int | None def __init__(self, host: str, port: int | None = ...) -> None: ... - def __enter__(self: Self) -> Self: ... + def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> Literal[False]: ... diff --git a/stubs/urllib3/urllib3/response.pyi b/stubs/urllib3/urllib3/response.pyi index ac72ced0aac7..a4f76d312fbc 100644 --- a/stubs/urllib3/urllib3/response.pyi +++ b/stubs/urllib3/urllib3/response.pyi @@ -1,9 +1,8 @@ import io -from _typeshed import Self from collections.abc import Iterable, Iterator, Mapping from http.client import HTTPMessage as _HttplibHTTPMessage, HTTPResponse as _HttplibHTTPResponse from typing import IO, Any -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Self, TypeAlias from urllib3.connectionpool import HTTPConnection @@ -83,7 +82,7 @@ class HTTPResponse(io.IOBase): def read(self, amt: int | None = ..., decode_content: bool | None = ..., cache_content: bool = ...) -> bytes: ... def stream(self, amt: int | None = ..., decode_content: bool | None = ...) -> Iterator[bytes]: ... @classmethod - def from_httplib(cls: type[Self], r: _HttplibHTTPResponse, **response_kw: Any) -> Self: ... + def from_httplib(cls, r: _HttplibHTTPResponse, **response_kw: Any) -> Self: ... def getheaders(self) -> HTTPHeaderDict: ... def getheader(self, name, default=...) -> str | None: ... def info(self) -> HTTPHeaderDict: ... diff --git a/stubs/urllib3/urllib3/util/retry.pyi b/stubs/urllib3/urllib3/util/retry.pyi index bd1a5ff44cf3..8fdb97685e79 100644 --- a/stubs/urllib3/urllib3/util/retry.pyi +++ b/stubs/urllib3/urllib3/util/retry.pyi @@ -1,9 +1,8 @@ import logging -from _typeshed import Self from collections.abc import Collection from types import TracebackType from typing import Any, ClassVar, NamedTuple -from typing_extensions import Literal +from typing_extensions import Literal, Self from .. import exceptions from ..connectionpool import ConnectionPool @@ -62,7 +61,7 @@ class Retry: remove_headers_on_redirect: Collection[str] = ..., method_whitelist: Collection[str] | None = ..., ) -> None: ... - def new(self: Self, **kw: Any) -> Self: ... + def new(self, **kw: Any) -> Self: ... @classmethod def from_int( cls, retries: Retry | bool | int | None, redirect: bool | int | None = ..., default: Retry | bool | int | None = ...