Skip to content

Commit 502bf69

Browse files
committed
typ: remove references to Self in base classes
1 parent d5f1a12 commit 502bf69

File tree

3 files changed

+20
-26
lines changed

3 files changed

+20
-26
lines changed

src/flint/flint_base/flint_base.pyi

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ class flint_scalar(flint_elem):
3636
def is_zero(self) -> bool: ...
3737
def __pos__(self) -> Self: ...
3838
def __neg__(self) -> Self: ...
39-
def __add__(self, other: Self | int, /) -> Self: ...
39+
def __add__(self, other: int, /) -> Self: ...
4040
def __radd__(self, other: int, /) -> Self: ...
41-
def __sub__(self, other: Self | int, /) -> Self: ...
41+
def __sub__(self, other: int, /) -> Self: ...
4242
def __rsub__(self, other: int, /) -> Self: ...
43-
def __mul__(self, other: Self | int, /) -> Self: ...
43+
def __mul__(self, other: int, /) -> Self: ...
4444
def __rmul__(self, other: int, /) -> Self: ...
45-
def __truediv__(self, other: Self | int, /) -> Self: ...
45+
def __truediv__(self, other: int, /) -> Self: ...
4646
def __rtruediv__(self, other: int, /) -> Self: ...
4747
def __pow__(self, other: int, /) -> Self: ...
4848
def __rpow__(self, other: int, /) -> Self: ...
@@ -58,25 +58,22 @@ class flint_poly(flint_elem, Generic[Telem]):
5858
def length(self) -> int: ...
5959
def degree(self) -> int: ...
6060
def coeffs(self) -> list[Telem]: ...
61-
@overload
6261
def __call__(self, other: Telem | int, /) -> Telem: ...
63-
@overload
64-
def __call__(self, other: Self, /) -> Self: ...
6562
def __pos__(self) -> Self: ...
6663
def __neg__(self) -> Self: ...
67-
def __add__(self, other: Telem | int | Self, /) -> Self: ...
64+
def __add__(self, other: Telem | int, /) -> Self: ...
6865
def __radd__(self, other: Telem | int, /) -> Self: ...
69-
def __sub__(self, other: Telem | int | Self, /) -> Self: ...
66+
def __sub__(self, other: Telem | int, /) -> Self: ...
7067
def __rsub__(self, other: Telem | int, /) -> Self: ...
71-
def __mul__(self, other: Telem | int | Self, /) -> Self: ...
68+
def __mul__(self, other: Telem | int, /) -> Self: ...
7269
def __rmul__(self, other: Telem | int, /) -> Self: ...
73-
def __truediv__(self, other: Telem | int | Self, /) -> Self: ...
70+
def __truediv__(self, other: Telem | int, /) -> Self: ...
7471
def __rtruediv__(self, other: Telem | int, /) -> Self: ...
75-
def __floordiv__(self, other: Telem | int | Self, /) -> Self: ...
72+
def __floordiv__(self, other: Telem | int, /) -> Self: ...
7673
def __rfloordiv__(self, other: Telem | int, /) -> Self: ...
77-
def __mod__(self, other: Telem | int | Self, /) -> Self: ...
74+
def __mod__(self, other: Telem | int, /) -> Self: ...
7875
def __rmod__(self, other: Telem | int, /) -> Self: ...
79-
def __divmod__(self, other: Telem | int | Self, /) -> tuple[Self, Self]: ...
76+
def __divmod__(self, other: Telem | int, /) -> tuple[Self, Self]: ...
8077
def __rdivmod__(self, other: Telem | int, /) -> tuple[Self, Self]: ...
8178
def __pow__(self, other: int, /) -> Self: ...
8279
def is_zero(self) -> bool: ...
@@ -130,41 +127,38 @@ class flint_mpoly(flint_elem, Generic[Tctx, Telem, Telem_coerce]):
130127
def coeffs(self) -> list[Telem]: ...
131128
def __pos__(self) -> Self: ...
132129
def __neg__(self) -> Self: ...
133-
def __add__(self, other: Self | Telem | Telem_coerce | int) -> Self: ...
130+
def __add__(self, other: Telem | Telem_coerce | int) -> Self: ...
134131
def __radd__(self, other: Telem | Telem_coerce | int) -> Self: ...
135-
def __sub__(self, other: Self | Telem | Telem_coerce | int) -> Self: ...
132+
def __sub__(self, other: Telem | Telem_coerce | int) -> Self: ...
136133
def __rsub__(self, other: Telem | Telem_coerce | int) -> Self: ...
137-
def __mul__(self, other: Self | Telem | Telem_coerce | int) -> Self: ...
134+
def __mul__(self, other: Telem | Telem_coerce | int) -> Self: ...
138135
def __rmul__(self, other: Telem | Telem_coerce | int) -> Self: ...
139-
def __truediv__(self, other: Self | Telem | Telem_coerce | int) -> Self: ...
136+
def __truediv__(self, other: Telem | Telem_coerce | int) -> Self: ...
140137
def __rtruediv__(self, other: Telem | Telem_coerce | int) -> Self: ...
141-
def __floordiv__(self, other: Self | Telem | Telem_coerce | int) -> Self: ...
138+
def __floordiv__(self, other: Telem | Telem_coerce | int) -> Self: ...
142139
def __rfloordiv__(self, other: Telem | Telem_coerce | int) -> Self: ...
143-
def __mod__(self, other: Self | Telem | Telem_coerce | int) -> Self: ...
140+
def __mod__(self, other: Telem | Telem_coerce | int) -> Self: ...
144141
def __rmod__(self, other: Telem | Telem_coerce | int) -> Self: ...
145142
def __divmod__(
146-
self, other: Self | Telem | Telem_coerce | int
143+
self, other: Telem | Telem_coerce | int
147144
) -> tuple[Self, Self]: ...
148145
def __rdivmod__(self, other: Telem | Telem_coerce | int) -> tuple[Self, Self]: ...
149146
def __pow__(self, other: Telem | Telem_coerce | int) -> Self: ...
150147
def __rpow__(self, other: Telem | Telem_coerce | int) -> Self: ...
151148
def iadd(self, other: Telem | Telem_coerce | int) -> None: ...
152149
def isub(self, other: Telem | Telem_coerce | int) -> None: ...
153150
def imul(self, other: Telem | Telem_coerce | int) -> None: ...
154-
def gcd(self, other: Self) -> Self: ...
155151
def term_content(self) -> Self: ...
156152
def factor(self) -> tuple[Telem, Sequence[tuple[Self, int]]]: ...
157153
def factor_squarefree(self) -> tuple[Telem, Sequence[tuple[Self, int]]]: ...
158154
def sqrt(self) -> Self: ...
159-
def resultant(self, other: Self, var: _str | int) -> Self: ...
160155
def discriminant(self, var: _str | int) -> Self: ...
161156
def deflation_index(self) -> tuple[list[int], list[int]]: ...
162157
def deflation(self) -> tuple[Self, list[int]]: ...
163158
def deflation_monom(self) -> tuple[Self, list[int], Self]: ...
164159
def inflate(self, N: list[int]) -> Self: ...
165160
def deflate(self, N: list[int]) -> Self: ...
166161
def subs(self, mapping: dict[_str | int, Telem | Telem_coerce | int]) -> Self: ...
167-
def compose(self, *args: Self, ctx: Tctx | None = None) -> Self: ...
168162
def __call__(self, *args: Telem | Telem_coerce) -> Telem: ...
169163
def derivative(self, var: _str | int) -> Self: ...
170164
def unused_gens(self) -> tuple[_str, ...]: ...

src/flint/test/test_all.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2622,7 +2622,7 @@ def _all_polys() -> list[tuple[Any, Any, bool, flint.fmpz]]:
26222622

26232623

26242624
Tpoly = TypeVar("Tpoly", bound=typ.epoly_p)
2625-
Tc = TypeVar("Tc", bound=flint_base.flint_scalar)
2625+
Tc = TypeVar("Tc", bound=typ.scalar_p)
26262626
TS = Callable[[Tc | int], Tc]
26272627
TP = Callable[[Tpoly | Sequence[Tc | int] | Tc | int], Tpoly]
26282628
_PolyTestCase = tuple[TP[Tpoly,Tc], TS[Tc], bool, flint.fmpz]

src/flint/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def infer_generator_mapping(
251251
@classmethod
252252
def from_context(
253253
cls,
254-
ctx: flint_mpoly_context,
254+
ctx: flint_mpoly_context, # make a protocol for this?
255255
names: str | Iterable[str | tuple[str, int]] | tuple[str, int] | None = None,
256256
ordering: Ordering | str = Ordering.lex,
257257
) -> Self: ...

0 commit comments

Comments
 (0)