diff --git a/src/flint/flint_base/flint_base.pyi b/src/flint/flint_base/flint_base.pyi index 760baa41..df189363 100644 --- a/src/flint/flint_base/flint_base.pyi +++ b/src/flint/flint_base/flint_base.pyi @@ -173,7 +173,7 @@ class flint_mpoly_context(flint_elem, Generic[Tmpoly, Telem, Telem_coerce]): def from_dict(self, d: Mapping[tuple[int, ...], Telem_coerce], /) -> Tmpoly: ... def constant(self, z: Telem_coerce, /) -> Tmpoly: ... def name(self, i: int, /) -> str: ... - def names(self) -> tuple[str]: ... + def names(self) -> tuple[str, ...]: ... def gens(self) -> tuple[Tmpoly, ...]: ... def variable_to_index(self, var: str, /) -> int: ... def term( diff --git a/src/flint/flint_base/flint_base.pyx b/src/flint/flint_base/flint_base.pyx index caf6e8ef..375486dc 100644 --- a/src/flint/flint_base/flint_base.pyx +++ b/src/flint/flint_base/flint_base.pyx @@ -959,7 +959,7 @@ cdef class flint_mpoly(flint_elem): ('x0', 'x3') """ names = self.context().names() - return tuple(names[i] for i, x in enumerate(self.degrees()) if not x) + return tuple(names[i] for i, x in enumerate(self.degrees()) if x <= 0) def project_to_context(self, other_ctx, mapping: dict[str | int, str | int] = None): """ diff --git a/src/flint/test/test_all.py b/src/flint/test/test_all.py index 4f32b8d4..d2f92a1f 100644 --- a/src/flint/test/test_all.py +++ b/src/flint/test/test_all.py @@ -3267,6 +3267,8 @@ def quick_poly(): ) new_poly = quick_poly().project_to_context(ctx1) assert ctx1.drop_gens(new_poly.unused_gens()) == ctx + assert quick_poly().unused_gens() == () + assert (0*quick_poly()).unused_gens() == ('x0', 'x1') assert new_poly.project_to_context(ctx) == quick_poly() new_poly = quick_poly().project_to_context(ctx2) diff --git a/src/flint/types/fmpq_mpoly.pyi b/src/flint/types/fmpq_mpoly.pyi index 58b388b1..6dec549b 100644 --- a/src/flint/types/fmpq_mpoly.pyi +++ b/src/flint/types/fmpq_mpoly.pyi @@ -24,7 +24,7 @@ class fmpq_mpoly_ctx(flint_mpoly_context[fmpq_mpoly, fmpq, ifmpq]): def from_dict(self, d: Mapping[tuple[int, ...], ifmpq], /) -> fmpq_mpoly: ... def constant(self, q: ifmpq, /) -> fmpq_mpoly: ... def name(self, i: int, /) -> str: ... - def names(self) -> tuple[str]: ... + def names(self) -> tuple[str, ...]: ... def gens(self) -> tuple[fmpq_mpoly, ...]: ... def variable_to_index(self, var: str, /) -> int: ... def term( diff --git a/src/flint/types/fmpz_mod_mpoly.pyi b/src/flint/types/fmpz_mod_mpoly.pyi index 17080081..9f04af4f 100644 --- a/src/flint/types/fmpz_mod_mpoly.pyi +++ b/src/flint/types/fmpz_mod_mpoly.pyi @@ -36,7 +36,7 @@ class fmpz_mod_mpoly_ctx(flint_mod_mpoly_context[fmpz_mod_mpoly, fmpz_mod, ifmpz def constant(self, z: ifmpz_mod) -> fmpz_mod_mpoly: ... def name(self, i: int, /) -> str: ... - def names(self) -> tuple[str]: ... + def names(self) -> tuple[str, ...]: ... def gens(self) -> tuple[fmpz_mod_mpoly, ...]: ... def variable_to_index(self, var: str, /) -> int: ... def term( diff --git a/src/flint/types/fmpz_mpoly.pyi b/src/flint/types/fmpz_mpoly.pyi index 91d2a2c7..862aa9fa 100644 --- a/src/flint/types/fmpz_mpoly.pyi +++ b/src/flint/types/fmpz_mpoly.pyi @@ -22,7 +22,7 @@ class fmpz_mpoly_ctx(flint_mpoly_context[fmpz_mpoly, fmpz, ifmpz]): def from_dict(self, d: Mapping[tuple[int, ...], ifmpz], /) -> fmpz_mpoly: ... def constant(self, z: ifmpz, /) -> fmpz_mpoly: ... def name(self, i: int, /) -> str: ... - def names(self) -> tuple[str]: ... + def names(self) -> tuple[str, ...]: ... def gens(self) -> tuple[fmpz_mpoly, ...]: ... def variable_to_index(self, var: str, /) -> int: ... def term( diff --git a/src/flint/types/nmod_mpoly.pyi b/src/flint/types/nmod_mpoly.pyi index 43ea7d74..183d045a 100644 --- a/src/flint/types/nmod_mpoly.pyi +++ b/src/flint/types/nmod_mpoly.pyi @@ -37,7 +37,7 @@ class nmod_mpoly_ctx(flint_mod_mpoly_context[nmod_mpoly, nmod, inmod]): def constant(self, z: inmod) -> nmod_mpoly: ... def name(self, i: int, /) -> str: ... - def names(self) -> tuple[str]: ... + def names(self) -> tuple[str, ...]: ... def gens(self) -> tuple[nmod_mpoly, ...]: ... def variable_to_index(self, var: str, /) -> int: ... def term( diff --git a/src/flint/typing.py b/src/flint/typing.py index 11c71180..94c4edf3 100644 --- a/src/flint/typing.py +++ b/src/flint/typing.py @@ -243,7 +243,7 @@ def gen(self, i: int, /) -> _Tmpoly_p: ... def from_dict(self, d: Mapping[tuple[int, ...], _Tscalar_contra | int], /) -> _Tmpoly_p: ... def constant(self, z: _Tscalar_contra | int, /) -> _Tmpoly_p: ... def name(self, i: int, /) -> str: ... - def names(self) -> tuple[str]: ... + def names(self) -> tuple[str, ...]: ... def gens(self) -> tuple[_Tmpoly_p, ...]: ... def variable_to_index(self, var: str, /) -> int: ... def term(