Skip to content

Commit 52967d2

Browse files
committed
typ: fix type annotations for poly roots methods
1 parent 5bad07d commit 52967d2

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

src/flint/flint_base/flint_base.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class flint_poly(flint_elem, Generic[Telem]):
8080
def is_one(self) -> bool: ...
8181
def is_constant(self) -> bool: ...
8282
def is_gen(self) -> bool: ...
83-
def roots(self) -> list[tuple[Telem, int]]: ...
83+
def roots(self) -> list[tuple[Telem, int]] | list[Telem]: ...
8484
# Should be list[arb]:
8585
def real_roots(self) -> list[Any]: ...
8686
# Should be list[acb]:

src/flint/flint_base/flint_context.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,3 @@ class PrecisionManager:
4848
def __call__(self, func: Callable[_P, _R]) -> Callable[_P, _R]: ...
4949
def __enter__(self) -> None: ...
5050
def __exit__(self, exc_type: object, value: object, traceback: object) -> None: ...
51-
52-
53-
thectx: FlintContext

src/flint/types/fmpq_poly.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
from typing import overload, Any, Sequence
1+
from typing import overload, Sequence
22
from flint.flint_base.flint_base import flint_poly
33
from flint.types.fmpz import fmpz, ifmpz
44
from flint.types.fmpq import fmpq, ifmpq
5+
from flint.types.acb import acb
56
from flint.types.fmpz_poly import fmpz_poly, ifmpz_poly
67

78

@@ -81,12 +82,12 @@ class fmpq_poly(flint_poly[fmpq]):
8182

8283
def factor(self, *, monic: bool = False) -> tuple[fmpq, list[tuple[fmpq_poly, int]]]: ...
8384
def factor_squarefree(self) -> tuple[fmpq, list[tuple[fmpq_poly, int]]]: ...
85+
def roots(self) -> list[tuple[fmpq, int]]: ...
8486

8587
def sqrt(self) -> fmpq_poly: ...
8688

8789
def deflation(self) -> tuple[fmpq_poly, int]: ...
88-
# XXX: acb
89-
def complex_roots(self, **kwargs) -> list[Any]: ...
90+
def complex_roots(self, **kwargs) -> list[acb]: ...
9091

9192
@staticmethod
9293
def bernoulli_poly(n: int, /) -> fmpq_poly: ...

src/flint/types/fmpz_poly.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import overload, Any, Sequence
1+
from typing import overload, Sequence
22
from flint.flint_base.flint_base import flint_poly
33
from flint.types.fmpz import fmpz, ifmpz
44
from flint.types.fmpq import fmpq
@@ -71,15 +71,15 @@ class fmpz_poly(flint_poly[fmpz]):
7171
def resultant(self, other: ifmpz_poly, /) -> fmpz: ...
7272
def factor(self) -> tuple[fmpz, list[tuple[fmpz_poly, int]]]: ...
7373
def factor_squarefree(self) -> tuple[fmpz, list[tuple[fmpz_poly, int]]]: ...
74+
def roots(self) -> list[tuple[fmpz, int]]: ...
7475
def sqrt(self) -> fmpz_poly: ...
7576
def deflation(self) -> tuple[fmpz_poly, int]: ...
7677
def deflation_monom(self) -> tuple[fmpz_poly, int, fmpz_poly]: ...
7778
def inflate(self, n: int, /) -> fmpz_poly: ...
7879
def deflate(self, n: int, /) -> fmpz_poly: ...
7980
def deflation_index(self) -> tuple[int, int]: ...
8081

81-
# XXX acb
82-
def complex_roots(self, verbose: bool = False) -> list[Any]: ...
82+
def complex_roots(self, verbose: bool = False) -> list[acb]: ...
8383
@staticmethod
8484
def cyclotomic(n: int, /) -> fmpz_poly: ...
8585
def is_cyclotomic(self) -> int: ...

src/flint/typing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def is_zero(self) -> bool: ...
130130
def is_one(self) -> bool: ...
131131
def is_constant(self) -> bool: ...
132132
def is_gen(self) -> bool: ...
133-
def roots(self) -> list[tuple[_Tscalar, int]]: ...
133+
def roots(self) -> list[tuple[_Tscalar, int]] | list[_Tscalar]: ...
134134
# Should be list[arb]:
135135
def real_roots(self) -> list[Any]: ...
136136
# Should be list[acb]:
@@ -144,6 +144,7 @@ def sqrt(self) -> Self: ...
144144
def gcd(self, other: Self | _Tscalar, /) -> Self: ...
145145
def factor(self) -> tuple[_Tscalar, list[tuple[Self, int]]]: ...
146146
def factor_squarefree(self) -> tuple[_Tscalar, list[tuple[Self, int]]]: ...
147+
def roots(self) -> list[tuple[_Tscalar, int]]: ...
147148
def deflation(self) -> tuple[Self, int]: ...
148149
def mul_low(self, other: Self, n: int) -> Self: ...
149150
def pow_trunc(self, e: int, n: int) -> Self: ...

0 commit comments

Comments
 (0)