_typing.py 407 B

12345678910111213141516
  1. from typing import TypeVar, Protocol
  2. T = TypeVar('T')
  3. class RingElement(Protocol):
  4. """A ring element.
  5. Must support ``+``, ``-``, ``*``, ``**`` and ``-``.
  6. """
  7. def __add__(self: T, other: T, /) -> T: ...
  8. def __sub__(self: T, other: T, /) -> T: ...
  9. def __mul__(self: T, other: T, /) -> T: ...
  10. def __pow__(self: T, other: int, /) -> T: ...
  11. def __neg__(self: T, /) -> T: ...