Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,14 @@ Contributors (0.10.0):

- Vitaly Magerya (VM)
- Oscar Benjamin (OB)
- Ilia Gradina (IG)

Changes (0.10.0):

- [gh-433](https://github.com/flintlib/python-flint/pull/433),
Define the input type aliases in the type stubs (such as `iarb` and
`ifmpz`) after the classes they reference, so that the ty type checker
resolves them instead of treating them as `Unknown`. (IG)
- [gh-424](https://github.com/flintlib/python-flint/pull/424),
Drop support for FLINT versions older than 3.4.0 and remove the associated
compatibility code. (OB)
Expand Down
4 changes: 3 additions & 1 deletion src/flint/types/acb.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ ifmpz = int | fmpz_t
ifmpq = int | fmpz_t | fmpq_t
iarf = int | float | fmpz_t | fmpq_t | arf
iarb = int | float | fmpz_t | fmpq_t | arf | arb
iacb = int | float | complex | fmpz_t | fmpq_t | arf | arb | acb


class _MpcLike(Protocol):
Expand Down Expand Up @@ -289,3 +288,6 @@ class acb(flint_scalar):
def coulomb(self, l: iacb, eta: iacb) -> tuple[acb, acb, acb, acb]: ...
def coulomb_f(self, l: iacb, eta: iacb) -> acb: ...
def coulomb_g(self, l: iacb, eta: iacb) -> acb: ...


iacb = int | float | complex | fmpz_t | fmpq_t | arf | arb | acb
4 changes: 3 additions & 1 deletion src/flint/types/acb_poly.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ ifmpz = int | fmpz
ifmpq = int | fmpz | fmpq
iarf = int | float | fmpz | fmpq | arb
iacb = int | float | complex | str | fmpz | fmpq | arb | acb
iacb_poly = acb_poly | iacb | fmpz_poly | fmpq_poly | arb_poly


class acb_poly(flint_poly[acb]):
Expand Down Expand Up @@ -80,3 +79,6 @@ class acb_poly(flint_poly[acb]):
def roots(self, tol: iarf | None = None, maxprec: int | None = None) -> list[acb]: ... # type: ignore[override]
def complex_roots(self, tol: iarf | None = None, maxprec: int | None = None) -> list[acb]: ...
def root_bound(self) -> arb: ...


iacb_poly = acb_poly | iacb | fmpz_poly | fmpq_poly | arb_poly
4 changes: 3 additions & 1 deletion src/flint/types/acb_series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ ifmpz = int | fmpz
ifmpq = int | fmpz | fmpq
iarf = int | float | fmpz | fmpq | arb
iacb = int | float | complex | str | fmpz | fmpq | arb | acb
iacb_series = acb_series | iacb | fmpz_poly | fmpq_poly | fmpz_series | fmpq_series | arb_poly | arb_series | acb_poly


class acb_series(flint_series[acb]):
Expand Down Expand Up @@ -121,3 +120,6 @@ class acb_series(flint_series[acb]):
def li(self, offset: bool = ...) -> acb_series: ...

def lambertw(self, branch: int = ...) -> acb_series: ...


iacb_series = acb_series | iacb | fmpz_poly | fmpq_poly | fmpz_series | fmpq_series | arb_poly | arb_series | acb_poly
4 changes: 3 additions & 1 deletion src/flint/types/arb.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ _str = str
ifmpz = int | fmpz_t
ifmpq = int | fmpz_t | fmpq_t
iarf = int | float | fmpz_t | fmpq_t | arf
iarb = int | float | fmpz_t | fmpq_t | arf | arb


class _MpfLike(Protocol):
Expand Down Expand Up @@ -279,3 +278,6 @@ class arb(flint_scalar):
def coulomb(self, l: iarb, eta: iarb) -> tuple[arb, arb]: ...
def coulomb_f(self, l: iarb, eta: iarb) -> arb: ...
def coulomb_g(self, l: iarb, eta: iarb) -> arb: ...


iarb = int | float | fmpz_t | fmpq_t | arf | arb
4 changes: 3 additions & 1 deletion src/flint/types/arb_poly.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ from .fmpz_poly import fmpz_poly
ifmpz = int | fmpz
ifmpq = int | fmpz | fmpq
iarf = int | float | fmpz | fmpq | arb
iarb_poly = arb_poly | int | float | fmpz | fmpq | arb | fmpz_poly | fmpq_poly


class arb_poly(flint_poly[arb]):
Expand Down Expand Up @@ -123,3 +122,6 @@ class arb_poly(flint_poly[arb]):
def __call__(self, t: acb | complex, /) -> acb: ...

def unique_fmpz_poly(self) -> fmpz_poly | None: ...


iarb_poly = arb_poly | int | float | fmpz | fmpq | arb | fmpz_poly | fmpq_poly
4 changes: 3 additions & 1 deletion src/flint/types/arb_series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ from .fmpz_series import fmpz_series
ifmpz = int | fmpz
ifmpq = int | fmpz | fmpq
iarf = int | float | fmpz | fmpq | arb
iarf_series = arb_series | iarf | fmpz_poly | fmpq_poly | fmpz_series | fmpq_series | arb_poly
iacb_series = acb_series | acb | complex | acb_poly


Expand Down Expand Up @@ -156,3 +155,6 @@ class arb_series(flint_series[arb]):

@staticmethod
def find_roots(f: Callable[[arb_series], arb_series], a: iarf, b: iarf, maxn: int = ...) -> list[tuple[arb, arb]]: ...


iarf_series = arb_series | iarf | fmpz_poly | fmpq_poly | fmpz_series | fmpq_series | arb_poly
6 changes: 4 additions & 2 deletions src/flint/types/arf.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ from .fmpq import fmpq
_str = str
ifmpz = int | fmpz
ifmpq = int | fmpz | fmpq
iarf_cmp = int | float | fmpz | fmpq | arf
iarf_arith = int | float | fmpz | arf


class arf(flint_scalar):
Expand Down Expand Up @@ -55,3 +53,7 @@ class arf(flint_scalar):
def __rmul__(self, other: iarf_arith, /) -> arf: ...
def __truediv__(self, other: iarf_arith, /) -> arf: ...
def __rtruediv__(self, other: iarf_arith, /) -> arf: ...


iarf_cmp = int | float | fmpz | fmpq | arf
iarf_arith = int | float | fmpz | arf
4 changes: 3 additions & 1 deletion src/flint/types/fmpq.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ from .fmpz import fmpz

_str = str
ifmpz = int | fmpz
ifmpq = int | fmpz | fmpq


class fmpq(flint_scalar):
Expand Down Expand Up @@ -93,3 +92,6 @@ class fmpq(flint_scalar):

@staticmethod
def dedekind_sum(n: ifmpz, k: ifmpz) -> fmpq: ...


ifmpq = int | fmpz | fmpq
6 changes: 3 additions & 3 deletions src/flint/types/fmpq_poly.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ from flint.types.acb import acb
from flint.types.fmpz_poly import fmpz_poly, ifmpz_poly


ifmpq_poly = fmpq_poly | ifmpq | ifmpz_poly


class fmpq_poly(flint_poly[fmpq]):
"""
The *fmpq_poly* type represents dense univariate polynomials
Expand Down Expand Up @@ -95,3 +92,6 @@ class fmpq_poly(flint_poly[fmpq]):
def euler_poly(n: int, /) -> fmpq_poly: ...
@staticmethod
def legendre_p(n: int, /) -> fmpq_poly: ...


ifmpq_poly = fmpq_poly | ifmpq | ifmpz_poly
6 changes: 3 additions & 3 deletions src/flint/types/fmpq_series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ from flint.types.fmpq_poly import fmpq_poly
from flint.types.fmpz_series import fmpz_series, ifmpz_series


ifmpq_series = fmpq_series | fmpq_poly | ifmpz_series


class fmpq_series(flint_series[fmpq]):
"""Approximate truncated power series with rational coefficients."""

Expand Down Expand Up @@ -76,3 +73,6 @@ class fmpq_series(flint_series[fmpq]):
def sinh(self) -> fmpq_series: ...
def cosh(self) -> fmpq_series: ...
def tanh(self) -> fmpq_series: ...


ifmpq_series = fmpq_series | fmpq_poly | ifmpz_series
1 change: 0 additions & 1 deletion src/flint/types/fmpz.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ cdef inline int fmpz_set_pylong(fmpz_t x, obj):
cdef slong longval
cdef slong size
cdef bytes b
cdef ulong w
cdef ulong *words
cdef int i

Expand Down
3 changes: 2 additions & 1 deletion src/flint/types/fmpz.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from ..flint_base.flint_base import flint_scalar

_str = str
ifmpz = int | fmpz

class fmpz(flint_scalar):
def __init__(self, arg: ifmpz | _str = 0, /): ...
Expand Down Expand Up @@ -110,3 +109,5 @@ class fmpz(flint_scalar):
def root(self, n: int) -> fmpz: ...

def jacobi(self, other: ifmpz, /) -> int: ...

ifmpz = int | fmpz
4 changes: 3 additions & 1 deletion src/flint/types/fmpz_mod.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ from .fmpq import fmpq

ifmpz = int | fmpz
ifmpq = int | fmpz | fmpq
ifmpz_mod = ifmpz | fmpz_mod


class fmpz_mod_ctx:
Expand Down Expand Up @@ -64,3 +63,6 @@ class fmpz_mod(flint_scalar):
def __invert__(self) -> fmpz_mod: ...

def sqrt(self) -> fmpz_mod: ...


ifmpz_mod = ifmpz | fmpz_mod
4 changes: 2 additions & 2 deletions src/flint/types/fmpz_mod_poly.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ from flint.types.fmpz import fmpz
from flint.types.fmpz_poly import fmpz_poly
from flint.types.fmpz_mod import fmpz_mod, fmpz_mod_ctx, ifmpz, ifmpz_mod

ifmpz_mod_poly = ifmpz_mod | fmpz_mod_poly | fmpz_poly

class fmpz_mod_poly_ctx:
r"""
Context object for creating :class:`~.fmpz_mod_poly` initialised
Expand Down Expand Up @@ -147,3 +145,5 @@ class fmpz_mod_poly(flint_poly[fmpz_mod]):
) -> list[tuple[fmpz_mod, int]]: ...
@overload
def roots(self, multiplicities: Literal[False]) -> list[fmpz_mod]: ...

ifmpz_mod_poly = ifmpz_mod | fmpz_mod_poly | fmpz_poly
4 changes: 2 additions & 2 deletions src/flint/types/fmpz_poly.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ from flint.types.arf import arf
from flint.types.arb import arb
from flint.types.acb import acb

ifmpz_poly = fmpz_poly | ifmpz

class fmpz_poly(flint_poly[fmpz]):
"""
The *fmpz_poly* type represents dense univariate polynomials over
Expand Down Expand Up @@ -94,3 +92,5 @@ class fmpz_poly(flint_poly[fmpz]):
@staticmethod
def hilbert_class_poly(D: int, /) -> fmpz_poly: ...
def height_bits(self, signed: bool = False) -> int: ...

ifmpz_poly = fmpz_poly | ifmpz
6 changes: 3 additions & 3 deletions src/flint/types/fmpz_series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ from flint.types.fmpz import fmpz, ifmpz
from flint.types.fmpz_poly import fmpz_poly, ifmpz_poly


ifmpz_series = fmpz_series | ifmpz_poly


class fmpz_series(flint_series[fmpz]):

def __init__(self,
Expand Down Expand Up @@ -44,3 +41,6 @@ class fmpz_series(flint_series[fmpz]):
def __call__(self, other: ifmpz_series, /) -> fmpz_series: ...

def reversion(self) -> fmpz_series: ...


ifmpz_series = fmpz_series | ifmpz_poly
3 changes: 2 additions & 1 deletion src/flint/types/fq_default.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class fq_default_type(Enum):
FMPZ_MOD = 5

ifmpz_mod = ifmpz | fmpz_mod
ifq_default = fq_default | fmpz_mod_poly | nmod_poly | fmpz_poly | ifmpz_mod

class fq_default_ctx:
r"""Context object for creating :class:`~.fq_default`."""
Expand Down Expand Up @@ -72,3 +71,5 @@ class fq_default(flint_scalar):
def trace(self) -> fmpz: ...
def norm(self) -> fmpz: ...
def frobenius(self, e: int = ...) -> fq_default: ...

ifq_default = fq_default | fmpz_mod_poly | nmod_poly | fmpz_poly | ifmpz_mod
3 changes: 2 additions & 1 deletion src/flint/types/fq_default_poly.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ from .fmpz_mod_poly import fmpz_mod_poly
from .fq_default import fq_default_type, fq_default_ctx, fq_default, ifq_default

ifmpz_mod = int | fmpz | fmpz_mod
ifq_default_poly = fq_default_poly | ifq_default | ifmpz_poly

class fq_default_poly_ctx:
r"""Context object for creating :class:`~.fq_default_poly` initialised
Expand Down Expand Up @@ -141,3 +140,5 @@ class fq_default_poly(flint_poly[fq_default]):
) -> tuple[fq_default, list[tuple[fq_default_poly, int]]]: ...
def factor(self) -> tuple[fq_default, list[tuple[fq_default_poly, int]]]: ...
def roots(self, multiplicities=True) -> list[tuple[fq_default, int]]: ...

ifq_default_poly = fq_default_poly | ifq_default | ifmpz_poly
3 changes: 2 additions & 1 deletion src/flint/types/nmod.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ from .fmpq import fmpq
_str = str
ifmpz = int | fmpz
ifmpq = int | fmpz | fmpq
inmod = int | fmpz | fmpq | nmod

class nmod(flint_scalar):
def __init__(self, val: inmod, mod: int): ...
Expand Down Expand Up @@ -35,3 +34,5 @@ class nmod(flint_scalar):
def __invert__(self) -> nmod: ...

def sqrt(self) -> nmod: ...

inmod = int | fmpz | fmpq | nmod
4 changes: 2 additions & 2 deletions src/flint/types/nmod_poly.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ from flint.flint_base.flint_base import flint_poly
from flint.types.nmod import inmod, nmod
from flint.types.fmpz_poly import fmpz_poly

inmod_poly = nmod_poly | fmpz_poly | inmod

class nmod_poly(flint_poly[nmod]):
"""Dense univariate polynomials over Z/nZ for word-size n."""

Expand Down Expand Up @@ -73,3 +71,5 @@ class nmod_poly(flint_poly[nmod]):
def sqrt(self) -> nmod_poly: ...
def deflation(self) -> tuple[nmod_poly, int]: ...
def roots(self) -> list[tuple[nmod, int]]: ...

inmod_poly = nmod_poly | fmpz_poly | inmod
Loading