diff --git a/stdlib/decimal.pyi b/stdlib/decimal.pyi index c888e5874..89512dbbc 100644 --- a/stdlib/decimal.pyi +++ b/stdlib/decimal.pyi @@ -146,8 +146,8 @@ class Decimal: def scaleb(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... def shift(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... def __reduce__(self) -> tuple[type[Decimal], tuple[str]]: ... - def __copy__(self) -> Decimal: ... - def __deepcopy__(self, __memo: Any) -> Decimal: ... + def __copy__(self: Self) -> Self: ... + def __deepcopy__(self: Self, __memo: Any) -> Self: ... def __format__(self, __specifier: str, __context: Context | None = ...) -> str: ... class _ContextManager: diff --git a/stubs/Pygments/pygments/token.pyi b/stubs/Pygments/pygments/token.pyi index 94468ba3e..9fb24b751 100644 --- a/stubs/Pygments/pygments/token.pyi +++ b/stubs/Pygments/pygments/token.pyi @@ -1,4 +1,6 @@ +from _typeshed import Self from collections.abc import Mapping +from typing import Any class _TokenType(tuple[str, ...]): parent: _TokenType | None @@ -6,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): ... - def __deepcopy__(self, memo): ... + def __copy__(self: Self) -> Self: ... + def __deepcopy__(self: Self, memo: Any) -> Self: ... Token: _TokenType Text: _TokenType diff --git a/stubs/babel/babel/support.pyi b/stubs/babel/babel/support.pyi index a9e393225..09ccd93ab 100644 --- a/stubs/babel/babel/support.pyi +++ b/stubs/babel/babel/support.pyi @@ -44,8 +44,8 @@ class LazyProxy: def __delitem__(self, key) -> None: ... def __getitem__(self, key): ... def __setitem__(self, key, value) -> None: ... - def __copy__(self): ... - def __deepcopy__(self, memo): ... + def __copy__(self) -> LazyProxy: ... + def __deepcopy__(self, memo: Any) -> LazyProxy: ... class NullTranslations(gettext.NullTranslations): DEFAULT_DOMAIN: Any diff --git a/stubs/invoke/invoke/tasks.pyi b/stubs/invoke/invoke/tasks.pyi index 7e4d5e5b4..cc20ae2ff 100644 --- a/stubs/invoke/invoke/tasks.pyi +++ b/stubs/invoke/invoke/tasks.pyi @@ -1,3 +1,4 @@ +from _typeshed import Self from typing import Any from .config import Config @@ -61,7 +62,7 @@ class Call: self, task: Task, called_as: str | None = ..., args: tuple[Any, ...] | None = ..., kwargs: dict[str, Any] | None = ... ) -> None: ... def __getattr__(self, name: str) -> Any: ... - def __deepcopy__(self, memo: Any) -> Task: ... + def __deepcopy__(self: 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/protobuf/google/protobuf/message.pyi b/stubs/protobuf/google/protobuf/message.pyi index c346b5363..e292803dc 100644 --- a/stubs/protobuf/google/protobuf/message.pyi +++ b/stubs/protobuf/google/protobuf/message.pyi @@ -12,7 +12,7 @@ _M = TypeVar("_M", bound=Message) # message type (of self) class Message: DESCRIPTOR: Descriptor - def __deepcopy__(self, memo=...): ... + def __deepcopy__(self: Self, memo: Any = ...) -> Self: ... def __eq__(self, other_msg): ... def __ne__(self, other_msg): ... def MergeFrom(self: Self, other_msg: Self) -> None: ... diff --git a/stubs/stripe/stripe/stripe_object.pyi b/stubs/stripe/stripe/stripe_object.pyi index 76def4e09..f9de1deeb 100644 --- a/stubs/stripe/stripe/stripe_object.pyi +++ b/stubs/stripe/stripe/stripe_object.pyi @@ -51,5 +51,5 @@ class StripeObject(dict[Any, Any]): @property def stripe_id(self): ... def serialize(self, previous): ... - def __copy__(self): ... - def __deepcopy__(self, memo): ... + def __copy__(self) -> StripeObject: ... + def __deepcopy__(self, memo: Any) -> StripeObject: ...