_IntegerBase.pyi 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. from typing import Optional, Union, Callable
  2. RandFunc = Callable[[int],int]
  3. class IntegerBase:
  4. def __int__(self) -> int: ...
  5. def __str__(self) -> str: ...
  6. def __repr__(self) -> str: ...
  7. def to_bytes(self, block_size: Optional[int]=0) -> bytes: ...
  8. @staticmethod
  9. def from_bytes(byte_string: bytes) -> IntegerBase: ...
  10. def __eq__(self, term: object) -> bool: ...
  11. def __ne__(self, term: object) -> bool: ...
  12. def __lt__(self, term: Union[IntegerBase, int]) -> bool: ...
  13. def __le__(self, term: Union[IntegerBase, int]) -> bool: ...
  14. def __gt__(self, term: Union[IntegerBase, int]) -> bool: ...
  15. def __ge__(self, term: Union[IntegerBase, int]) -> bool: ...
  16. def __nonzero__(self) -> bool: ...
  17. def is_negative(self) -> bool: ...
  18. def __add__(self, term: Union[IntegerBase, int]) -> IntegerBase: ...
  19. def __sub__(self, term: Union[IntegerBase, int]) -> IntegerBase: ...
  20. def __mul__(self, term: Union[IntegerBase, int]) -> IntegerBase: ...
  21. def __floordiv__(self, divisor: Union[IntegerBase, int]) -> IntegerBase: ...
  22. def __mod__(self, divisor: Union[IntegerBase, int]) -> IntegerBase: ...
  23. def inplace_pow(self, exponent: int, modulus: Optional[Union[IntegerBase, int]]=None) -> IntegerBase: ...
  24. def __pow__(self, exponent: int, modulus: Optional[int]) -> IntegerBase: ...
  25. def __abs__(self) -> IntegerBase: ...
  26. def sqrt(self, modulus: Optional[int]) -> IntegerBase: ...
  27. def __iadd__(self, term: Union[IntegerBase, int]) -> IntegerBase: ...
  28. def __isub__(self, term: Union[IntegerBase, int]) -> IntegerBase: ...
  29. def __imul__(self, term: Union[IntegerBase, int]) -> IntegerBase: ...
  30. def __imod__(self, divisor: Union[IntegerBase, int]) -> IntegerBase: ...
  31. def __and__(self, term: Union[IntegerBase, int]) -> IntegerBase: ...
  32. def __or__(self, term: Union[IntegerBase, int]) -> IntegerBase: ...
  33. def __rshift__(self, pos: Union[IntegerBase, int]) -> IntegerBase: ...
  34. def __irshift__(self, pos: Union[IntegerBase, int]) -> IntegerBase: ...
  35. def __lshift__(self, pos: Union[IntegerBase, int]) -> IntegerBase: ...
  36. def __ilshift__(self, pos: Union[IntegerBase, int]) -> IntegerBase: ...
  37. def get_bit(self, n: int) -> bool: ...
  38. def is_odd(self) -> bool: ...
  39. def is_even(self) -> bool: ...
  40. def size_in_bits(self) -> int: ...
  41. def size_in_bytes(self) -> int: ...
  42. def is_perfect_square(self) -> bool: ...
  43. def fail_if_divisible_by(self, small_prime: Union[IntegerBase, int]) -> None: ...
  44. def multiply_accumulate(self, a: Union[IntegerBase, int], b: Union[IntegerBase, int]) -> IntegerBase: ...
  45. def set(self, source: Union[IntegerBase, int]) -> IntegerBase: ...
  46. def inplace_inverse(self, modulus: Union[IntegerBase, int]) -> IntegerBase: ...
  47. def inverse(self, modulus: Union[IntegerBase, int]) -> IntegerBase: ...
  48. def gcd(self, term: Union[IntegerBase, int]) -> IntegerBase: ...
  49. def lcm(self, term: Union[IntegerBase, int]) -> IntegerBase: ...
  50. @staticmethod
  51. def jacobi_symbol(a: Union[IntegerBase, int], n: Union[IntegerBase, int]) -> IntegerBase: ...
  52. @staticmethod
  53. def _tonelli_shanks(n: Union[IntegerBase, int], p: Union[IntegerBase, int]) -> IntegerBase : ...
  54. @classmethod
  55. def random(cls, **kwargs: Union[int,RandFunc]) -> IntegerBase : ...
  56. @classmethod
  57. def random_range(cls, **kwargs: Union[int,RandFunc]) -> IntegerBase : ...