We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@type_check_only
this builds upon #97
additionally allow Protocols with only __call__ implemented and @type_check_only as the only class decorator
Protocol
__call__
if the protocol is generic, then all params must be bound (or have a default), because these will be substituted into the inlined method
it will be inlined into some class as method, when accessed as e.g.
from typing import Protocol, type_check_only __all__ = ["A"] @type_check_only class _IOpMethod[OtherT](Protocol): def __call__[SelfT](self, lhs: SelfT, rhs: OtherT | SelfT, /) -> SelfT: ... class A[T]: __iadd__: _IOpMethod[T] __isub__: _IOpMethod[T]
which results in something like
from typing import Protocol from typing_extensions import Self __all__ = ["A"] class A[T]: def __iadd__(self, rhs: T | Self, /) -> Self: ...
note that the lhs param in _IOpMethod.__call__ was renamed to self, and was stripped of its annotation (following the rules in #97)
lhs
_IOpMethod.__call__
self
The text was updated successfully, but these errors were encountered:
types-scipy-sparse
scipy-stubs
No branches or pull requests
this builds upon #97
additionally allow
Protocol
s with only__call__
implemented and@type_check_only
as the only class decoratorif the protocol is generic, then all params must be bound (or have a default), because these will
be substituted into the inlined method
it will be inlined into some class as method, when accessed as e.g.
which results in something like
note that the
lhs
param in_IOpMethod.__call__
was renamed toself
, and was stripped of its annotation (following the rules in #97)The text was updated successfully, but these errors were encountered: