diff --git a/src/sage/algebras/clifford_algebra_element.pxd b/src/sage/algebras/clifford_algebra_element.pxd index be08e06f922..14d5a7a625c 100644 --- a/src/sage/algebras/clifford_algebra_element.pxd +++ b/src/sage/algebras/clifford_algebra_element.pxd @@ -5,8 +5,8 @@ from sage.modules.with_basis.indexed_element cimport IndexedFreeModuleElement from sage.data_structures.bitset cimport FrozenBitset cdef class CliffordAlgebraElement(IndexedFreeModuleElement): - cdef CliffordAlgebraElement _mul_self_term(self, FrozenBitset supp, coeff) noexcept - cdef CliffordAlgebraElement _mul_term_self(self, FrozenBitset supp, coeff) noexcept + cdef CliffordAlgebraElement _mul_self_term(self, FrozenBitset supp, coeff) + cdef CliffordAlgebraElement _mul_term_self(self, FrozenBitset supp, coeff) cdef class ExteriorAlgebraElement(CliffordAlgebraElement): pass diff --git a/src/sage/algebras/clifford_algebra_element.pyx b/src/sage/algebras/clifford_algebra_element.pyx index 5719f8f9f5c..52b994f48af 100644 --- a/src/sage/algebras/clifford_algebra_element.pyx +++ b/src/sage/algebras/clifford_algebra_element.pyx @@ -65,7 +65,7 @@ cdef class CliffordAlgebraElement(IndexedFreeModuleElement): """ return repr_from_monomials(self.list(), self._parent._latex_term, True) - cdef _mul_(self, other) noexcept: + cdef _mul_(self, other): """ Return ``self`` multiplied by ``other``. @@ -176,7 +176,7 @@ cdef class CliffordAlgebraElement(IndexedFreeModuleElement): return self.__class__(self.parent(), d) - cdef CliffordAlgebraElement _mul_self_term(self, FrozenBitset supp, coeff) noexcept: + cdef CliffordAlgebraElement _mul_self_term(self, FrozenBitset supp, coeff): r""" Multiply ``self * term`` with the ``term`` having support ``supp`` and coefficient ``coeff``. @@ -224,7 +224,7 @@ cdef class CliffordAlgebraElement(IndexedFreeModuleElement): return type(self)(self._parent, {supp: coeff}) * self - cdef CliffordAlgebraElement _mul_term_self(self, FrozenBitset supp, coeff) noexcept: + cdef CliffordAlgebraElement _mul_term_self(self, FrozenBitset supp, coeff): r""" Multiply ``term * self`` with the ``term`` having support ``supp`` and coefficient ``coeff``. @@ -400,7 +400,7 @@ cdef class ExteriorAlgebraElement(CliffordAlgebraElement): """ An element of an exterior algebra. """ - cdef _mul_(self, other) noexcept: + cdef _mul_(self, other): """ Return ``self`` multiplied by ``other``. @@ -520,7 +520,7 @@ cdef class ExteriorAlgebraElement(CliffordAlgebraElement): return self.__class__(P, d) - cdef CliffordAlgebraElement _mul_self_term(self, FrozenBitset supp, coeff) noexcept: + cdef CliffordAlgebraElement _mul_self_term(self, FrozenBitset supp, coeff): r""" Multiply ``self * term`` with the ``term`` having support ``supp`` and coefficient ``coeff``. @@ -610,7 +610,7 @@ cdef class ExteriorAlgebraElement(CliffordAlgebraElement): del d[k] return type(self)(self._parent, d) - cdef CliffordAlgebraElement _mul_term_self(self, FrozenBitset supp, coeff) noexcept: + cdef CliffordAlgebraElement _mul_term_self(self, FrozenBitset supp, coeff): r""" Multiply ``term * self`` with the ``term`` having support ``supp`` and coefficient ``coeff``. @@ -939,7 +939,7 @@ cdef class CohomologyRAAGElement(CliffordAlgebraElement): :class:`~sage.groups.raag.CohomologyRAAG` """ - cdef _mul_(self, other) noexcept: + cdef _mul_(self, other): """ Return ``self`` multiplied by ``other``. diff --git a/src/sage/algebras/exterior_algebra_groebner.pxd b/src/sage/algebras/exterior_algebra_groebner.pxd index bf5ee24ea22..2f2a0ff5cd8 100644 --- a/src/sage/algebras/exterior_algebra_groebner.pxd +++ b/src/sage/algebras/exterior_algebra_groebner.pxd @@ -8,7 +8,7 @@ from sage.structure.parent cimport Parent from sage.structure.element cimport MonoidElement cdef long degree(FrozenBitset X) noexcept -cdef CliffordAlgebraElement build_monomial(Parent E, FrozenBitset supp) noexcept +cdef CliffordAlgebraElement build_monomial(Parent E, FrozenBitset supp) cdef class GBElement: cdef CliffordAlgebraElement elt @@ -24,25 +24,25 @@ cdef class GroebnerStrategy: cdef Integer rank cdef public tuple groebner_basis - cdef inline GBElement build_elt(self, CliffordAlgebraElement f) noexcept - cdef inline GBElement prod_GB_term(self, GBElement f, FrozenBitset t) noexcept - cdef inline GBElement prod_term_GB(self, FrozenBitset t, GBElement f) noexcept + cdef inline GBElement build_elt(self, CliffordAlgebraElement f) + cdef inline GBElement prod_GB_term(self, GBElement f, FrozenBitset t) + cdef inline GBElement prod_term_GB(self, FrozenBitset t, GBElement f) cdef inline bint build_S_poly(self, GBElement f, GBElement g) noexcept - cdef inline FrozenBitset leading_support(self, CliffordAlgebraElement f) noexcept - cdef inline partial_S_poly_left(self, GBElement f, GBElement g) noexcept - cdef inline partial_S_poly_right(self, GBElement f, GBElement g) noexcept - cdef set preprocessing(self, list P, list G) noexcept - cdef list reduction(self, list P, list G) noexcept + cdef inline FrozenBitset leading_support(self, CliffordAlgebraElement f) + cdef inline partial_S_poly_left(self, GBElement f, GBElement g) + cdef inline partial_S_poly_right(self, GBElement f, GBElement g) + cdef set preprocessing(self, list P, list G) + cdef list reduction(self, list P, list G) - cpdef CliffordAlgebraElement reduce(self, CliffordAlgebraElement f) noexcept + cpdef CliffordAlgebraElement reduce(self, CliffordAlgebraElement f) cdef bint reduce_single(self, CliffordAlgebraElement f, CliffordAlgebraElement g) except -1 cdef int reduced_gb(self, list G) except -1 # These are the methods that determine the ordering of the monomials. # These must be implemented in subclasses. Declare them as "inline" there. - cdef Integer bitset_to_int(self, FrozenBitset X) noexcept - cdef FrozenBitset int_to_bitset(self, Integer n) noexcept + cdef Integer bitset_to_int(self, FrozenBitset X) + cdef FrozenBitset int_to_bitset(self, Integer n) cdef class GroebnerStrategyNegLex(GroebnerStrategy): pass diff --git a/src/sage/algebras/exterior_algebra_groebner.pyx b/src/sage/algebras/exterior_algebra_groebner.pyx index 3afc924e7ae..d296bae64f3 100644 --- a/src/sage/algebras/exterior_algebra_groebner.pyx +++ b/src/sage/algebras/exterior_algebra_groebner.pyx @@ -37,7 +37,7 @@ cdef inline long degree(FrozenBitset X) noexcept: return bitset_len(X._bitset) -cdef inline CliffordAlgebraElement build_monomial(Parent E, FrozenBitset supp) noexcept: +cdef inline CliffordAlgebraElement build_monomial(Parent E, FrozenBitset supp): """ Helper function for the fastest way to build a monomial. """ @@ -130,14 +130,14 @@ cdef class GroebnerStrategy: else: self.side = 2 - cdef inline FrozenBitset leading_support(self, CliffordAlgebraElement f) noexcept: + cdef inline FrozenBitset leading_support(self, CliffordAlgebraElement f): """ Return the leading support of the exterior algebra element ``f``. """ cdef dict mc = f._monomial_coefficients return self.int_to_bitset(max(self.bitset_to_int(k) for k in mc)) - cdef inline partial_S_poly_left(self, GBElement f, GBElement g) noexcept: + cdef inline partial_S_poly_left(self, GBElement f, GBElement g): r""" Compute one half of the `S`-polynomial for ``f`` and ``g``. @@ -154,7 +154,7 @@ cdef class GroebnerStrategy: ret.elt._monomial_coefficients[k] *= inv return ret - cdef inline partial_S_poly_right(self, GBElement f, GBElement g) noexcept: + cdef inline partial_S_poly_right(self, GBElement f, GBElement g): r""" Compute one half of the `S`-polynomial for ``f`` and ``g``. @@ -171,7 +171,7 @@ cdef class GroebnerStrategy: ret.elt._monomial_coefficients[k] *= inv return ret - cdef inline GBElement build_elt(self, CliffordAlgebraElement f) noexcept: + cdef inline GBElement build_elt(self, CliffordAlgebraElement f): """ Convert ``f`` into a ``GBElement``. """ @@ -181,7 +181,7 @@ cdef class GroebnerStrategy: cdef Integer r = max(self.bitset_to_int(k) for k in mc) return GBElement(f, self.int_to_bitset(r), r) - cdef inline GBElement prod_GB_term(self, GBElement f, FrozenBitset t) noexcept: + cdef inline GBElement prod_GB_term(self, GBElement f, FrozenBitset t): """ Return the GBElement corresponding to ``f * t``. @@ -193,7 +193,7 @@ cdef class GroebnerStrategy: cdef FrozenBitset ls = f.ls._union(t) return GBElement( ret, ls, self.bitset_to_int(ls)) - cdef inline GBElement prod_term_GB(self, FrozenBitset t, GBElement f) noexcept: + cdef inline GBElement prod_term_GB(self, FrozenBitset t, GBElement f): """ Return the GBElement corresponding to ``t * f``. @@ -220,7 +220,7 @@ cdef class GroebnerStrategy: return ( f.ls.intersection(g.ls)).isempty() - cdef inline set preprocessing(self, list P, list G) noexcept: + cdef inline set preprocessing(self, list P, list G): """ Perform the preprocessing step. """ @@ -266,7 +266,7 @@ cdef class GroebnerStrategy: break return L - cdef inline list reduction(self, list P, list G) noexcept: + cdef inline list reduction(self, list P, list G): """ Perform the reduction of ``P`` mod ``G`` in ``E``. """ @@ -451,7 +451,7 @@ cdef class GroebnerStrategy: cdef list G = [self.build_elt(f) for f in self.groebner_basis] self.reduced_gb(G) - cpdef CliffordAlgebraElement reduce(self, CliffordAlgebraElement f) noexcept: + cpdef CliffordAlgebraElement reduce(self, CliffordAlgebraElement f): """ Reduce ``f`` modulo the ideal with Gröbner basis ``G``. @@ -533,10 +533,10 @@ cdef class GroebnerStrategy: iaxpy(-coeff, gp._monomial_coefficients, f._monomial_coefficients) return was_reduced - cdef Integer bitset_to_int(self, FrozenBitset X) noexcept: + cdef Integer bitset_to_int(self, FrozenBitset X): raise NotImplementedError - cdef FrozenBitset int_to_bitset(self, Integer n) noexcept: + cdef FrozenBitset int_to_bitset(self, Integer n): raise NotImplementedError def sorted_monomials(self, as_dict=False): @@ -615,7 +615,7 @@ cdef class GroebnerStrategyNegLex(GroebnerStrategy): """ Gröbner basis strategy implementing neglex ordering. """ - cdef inline Integer bitset_to_int(self, FrozenBitset X) noexcept: + cdef inline Integer bitset_to_int(self, FrozenBitset X): """ Convert ``X`` to an :class:`Integer`. """ @@ -626,7 +626,7 @@ cdef class GroebnerStrategyNegLex(GroebnerStrategy): elt = bitset_next(X._bitset, elt + 1) return ret - cdef inline FrozenBitset int_to_bitset(self, Integer n) noexcept: + cdef inline FrozenBitset int_to_bitset(self, Integer n): """ Convert a nonnegative integer ``n`` to a :class:`FrozenBitset`. """ @@ -646,7 +646,7 @@ cdef class GroebnerStrategyDegRevLex(GroebnerStrategy): """ Gröbner basis strategy implementing degree revlex ordering. """ - cdef inline Integer bitset_to_int(self, FrozenBitset X) noexcept: + cdef inline Integer bitset_to_int(self, FrozenBitset X): """ Convert ``X`` to an :class:`Integer`. """ @@ -665,7 +665,7 @@ cdef class GroebnerStrategyDegRevLex(GroebnerStrategy): elt = bitset_next(X._bitset, elt + 1) return Integer(sum(n.binomial(i) for i in range(deg+1)) - t - 1) - cdef inline FrozenBitset int_to_bitset(self, Integer n) noexcept: + cdef inline FrozenBitset int_to_bitset(self, Integer n): """ Convert a nonnegative integer ``n`` to a :class:`FrozenBitset`. """ @@ -687,7 +687,7 @@ cdef class GroebnerStrategyDegLex(GroebnerStrategy): """ Gröbner basis strategy implementing degree lex ordering. """ - cdef inline Integer bitset_to_int(self, FrozenBitset X) noexcept: + cdef inline Integer bitset_to_int(self, FrozenBitset X): """ Convert ``X`` to an :class:`Integer`. """ @@ -706,7 +706,7 @@ cdef class GroebnerStrategyDegLex(GroebnerStrategy): elt = bitset_next(X._bitset, elt + 1) return Integer(sum(n.binomial(i) for i in range(deg+1)) - t - 1) - cdef inline FrozenBitset int_to_bitset(self, Integer n) noexcept: + cdef inline FrozenBitset int_to_bitset(self, Integer n): """ Convert a nonnegative integer ``n`` to a :class:`FrozenBitset`. """ diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pxd b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pxd index dd5f85be9fb..c13b8dbab07 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pxd +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pxd @@ -6,4 +6,4 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): cdef Matrix __matrix cdef FiniteDimensionalAlgebraElement __inverse -cpdef FiniteDimensionalAlgebraElement unpickle_FiniteDimensionalAlgebraElement(A, vec, mat) noexcept +cpdef FiniteDimensionalAlgebraElement unpickle_FiniteDimensionalAlgebraElement(A, vec, mat) diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx index 9b085f6fd8a..08feb228e5e 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx @@ -20,7 +20,7 @@ from sage.rings.integer import Integer from cpython.object cimport PyObject_RichCompare as richcmp -cpdef FiniteDimensionalAlgebraElement unpickle_FiniteDimensionalAlgebraElement(A, vec, mat) noexcept: +cpdef FiniteDimensionalAlgebraElement unpickle_FiniteDimensionalAlgebraElement(A, vec, mat): """ Helper for unpickling of finite dimensional algebra elements. @@ -365,7 +365,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): return self._vector.ncols() # (Rich) comparison - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): """ EXAMPLES:: @@ -400,7 +400,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ return richcmp(self._vector, right._vector, op) - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): """ EXAMPLES:: @@ -411,7 +411,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ return self._parent.element_class(self._parent, self._vector + other._vector) - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): """ EXAMPLES:: @@ -422,7 +422,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ return self._parent.element_class(self._parent, self._vector - other._vector) - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): """ EXAMPLES:: @@ -434,7 +434,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ return self._parent.element_class(self._parent, self._vector * (other)._matrix) - cpdef _lmul_(self, Element other) noexcept: + cpdef _lmul_(self, Element other): """ TESTS:: @@ -450,7 +450,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): .format(self.parent(), other.parent())) return self._parent.element_class(self._parent, self._vector * other) - cpdef _rmul_(self, Element other) noexcept: + cpdef _rmul_(self, Element other): """ TESTS:: diff --git a/src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pxd b/src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pxd index 19e98aa137d..e0908ab5884 100644 --- a/src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pxd +++ b/src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pxd @@ -1,4 +1,4 @@ -cdef _fmat(fvars, Nk_ij, one, a, b, c, d, x, y) noexcept -cpdef _backward_subs(factory, bint flatten=*) noexcept -cpdef executor(tuple params) noexcept -cpdef _solve_for_linear_terms(factory, list eqns=*) noexcept +cdef _fmat(fvars, Nk_ij, one, a, b, c, d, x, y) +cpdef _backward_subs(factory, bint flatten=*) +cpdef executor(tuple params) +cpdef _solve_for_linear_terms(factory, list eqns=*) diff --git a/src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx b/src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx index b79370c7f2c..a9b7eb50fab 100644 --- a/src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx +++ b/src/sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx @@ -32,7 +32,7 @@ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing # Fast class methods # ########################## -cpdef _solve_for_linear_terms(factory, list eqns=None) noexcept: +cpdef _solve_for_linear_terms(factory, list eqns=None): r""" Solve for a linear term occurring in a two-term equation, and for variables appearing in univariate single-term equations. @@ -107,7 +107,7 @@ cpdef _solve_for_linear_terms(factory, list eqns=None) noexcept: # assert _unflatten_coeffs(factory._field, factory.test_fvars[s]) == fvars[s], "OG value {}, Shared: {}".format(factory.test_fvars[s], fvars[s]) return linear_terms_exist -cpdef _backward_subs(factory, bint flatten=True) noexcept: +cpdef _backward_subs(factory, bint flatten=True): r""" Perform backward substitution on ``self.ideal_basis``, traversing variables in reverse lexicographical order. @@ -171,7 +171,7 @@ cpdef _backward_subs(factory, bint flatten=True) noexcept: fvars[sextuple] = res -cdef _fmat(fvars, _Nk_ij, id_anyon, a, b, c, d, x, y) noexcept: +cdef _fmat(fvars, _Nk_ij, id_anyon, a, b, c, d, x, y): """ Cython version of fmat class method. Using cdef for fastest dispatch """ @@ -214,7 +214,7 @@ cdef _fmat(fvars, _Nk_ij, id_anyon, a, b, c, d, x, y) noexcept: # Mappers # ############### -cdef req_cy(tuple basis, r_matrix, dict fvars, Nk_ij, id_anyon, tuple sextuple) noexcept: +cdef req_cy(tuple basis, r_matrix, dict fvars, Nk_ij, id_anyon, tuple sextuple): """ Given an FMatrix factory and a sextuple, return a hexagon equation as a polynomial object. @@ -232,7 +232,7 @@ cdef req_cy(tuple basis, r_matrix, dict fvars, Nk_ij, id_anyon, tuple sextuple) @cython.wraparound(False) @cython.nonecheck(False) @cython.cdivision(True) -cdef get_reduced_hexagons(factory, tuple mp_params) noexcept: +cdef get_reduced_hexagons(factory, tuple mp_params): """ Set up and reduce the hexagon equations corresponding to this worker. """ @@ -282,7 +282,7 @@ cdef get_reduced_hexagons(factory, tuple mp_params) noexcept: return collect_eqns(worker_results) -cdef MPolynomial_libsingular feq_cy(tuple basis, fvars, Nk_ij, id_anyon, zero, tuple nonuple, bint prune=False) noexcept: +cdef MPolynomial_libsingular feq_cy(tuple basis, fvars, Nk_ij, id_anyon, zero, tuple nonuple, bint prune=False): r""" Given an FMatrix factory and a nonuple, return a pentagon equation as a polynomial object. @@ -301,7 +301,7 @@ cdef MPolynomial_libsingular feq_cy(tuple basis, fvars, Nk_ij, id_anyon, zero, t @cython.wraparound(False) @cython.nonecheck(False) @cython.cdivision(True) -cdef get_reduced_pentagons(factory, tuple mp_params) noexcept: +cdef get_reduced_pentagons(factory, tuple mp_params): r""" Set up and reduce the pentagon equations corresponding to this worker. """ @@ -349,7 +349,7 @@ cdef get_reduced_pentagons(factory, tuple mp_params) noexcept: worker_results.append(red) return collect_eqns(worker_results) -cdef list update_reduce(factory, list eqns) noexcept: +cdef list update_reduce(factory, list eqns): r""" Substitute known values, known squares, and reduce. """ @@ -381,7 +381,7 @@ cdef list update_reduce(factory, list eqns) noexcept: res.append(red) return collect_eqns(res) -cdef list compute_gb(factory, tuple args) noexcept: +cdef list compute_gb(factory, tuple args): r""" Compute the reduced Groebner basis for given equations iterable. """ @@ -425,7 +425,7 @@ cdef list compute_gb(factory, tuple args) noexcept: # Reducers # ################ -cdef inline list collect_eqns(list eqns) noexcept: +cdef inline list collect_eqns(list eqns): r""" Helper function for returning processed results back to parent process. @@ -450,7 +450,7 @@ cdef dict mappers = { "pent_verify": pent_verify } -cpdef executor(tuple params) noexcept: +cpdef executor(tuple params): r""" Execute a function defined in this module (``sage.algebras.fusion_rings.fast_parallel_fmats_methods``) in a worker @@ -497,7 +497,7 @@ cpdef executor(tuple params) noexcept: # Verification # #################### -cdef feq_verif(factory, worker_results, fvars, Nk_ij, id_anyon, tuple nonuple, float tol=5e-8) noexcept: +cdef feq_verif(factory, worker_results, fvars, Nk_ij, id_anyon, tuple nonuple, float tol=5e-8): r""" Check the pentagon equation corresponding to the given nonuple. """ @@ -516,7 +516,7 @@ cdef feq_verif(factory, worker_results, fvars, Nk_ij, id_anyon, tuple nonuple, f @cython.wraparound(False) @cython.nonecheck(False) @cython.cdivision(True) -cdef pent_verify(factory, tuple mp_params) noexcept: +cdef pent_verify(factory, tuple mp_params): r""" Generate all the pentagon equations assigned to this process, and reduce them. diff --git a/src/sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pxd b/src/sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pxd index 9fde1f0c5e8..a992f0339a4 100644 --- a/src/sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pxd +++ b/src/sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pxd @@ -1,2 +1,2 @@ -cpdef _unflatten_entries(factory, list entries) noexcept -cpdef executor(tuple params) noexcept +cpdef _unflatten_entries(factory, list entries) +cpdef executor(tuple params) diff --git a/src/sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pyx b/src/sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pyx index bd809acd5cf..ad6e8a1621e 100644 --- a/src/sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pyx +++ b/src/sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pyx @@ -18,7 +18,7 @@ from sage.rings.qqbar import QQbar # Mappers # ############### -cdef mid_sig_ij(fusion_ring, row, col, a, b) noexcept: +cdef mid_sig_ij(fusion_ring, row, col, a, b): r""" Compute the (xi, yi), (xj, yj) entry of generator braiding the middle two strands in the tree b -> xi # yi -> (a # a) # (a # a), which results in @@ -48,7 +48,7 @@ cdef mid_sig_ij(fusion_ring, row, col, a, b) noexcept: entry += f1 * f2 * r * f3 * f4 return entry -cdef odd_one_out_ij(fusion_ring, xi, xj, a, b) noexcept: +cdef odd_one_out_ij(fusion_ring, xi, xj, a, b): r""" Compute the `xi`, `xj` entry of the braid generator on the two right-most strands, corresponding to the tree b -> (xi # a) -> (a # a) # a, which @@ -76,7 +76,7 @@ cdef odd_one_out_ij(fusion_ring, xi, xj, a, b) noexcept: cdef odd_one_out_ij_cache = dict() cdef mid_sig_ij_cache = dict() -cdef cached_mid_sig_ij(fusion_ring, row, col, a, b) noexcept: +cdef cached_mid_sig_ij(fusion_ring, row, col, a, b): r""" Cached version of :meth:`mid_sig_ij`. """ @@ -86,7 +86,7 @@ cdef cached_mid_sig_ij(fusion_ring, row, col, a, b) noexcept: mid_sig_ij_cache[row, col, a, b] = entry return entry -cdef cached_odd_one_out_ij(fusion_ring, xi, xj, a, b) noexcept: +cdef cached_odd_one_out_ij(fusion_ring, xi, xj, a, b): r""" Cached version of :meth:`odd_one_out_ij`. """ @@ -99,7 +99,7 @@ cdef cached_odd_one_out_ij(fusion_ring, xi, xj, a, b) noexcept: @cython.nonecheck(False) @cython.cdivision(True) -cdef sig_2k(fusion_ring, tuple args) noexcept: +cdef sig_2k(fusion_ring, tuple args): r""" Compute entries of the `2k`-th braid generator """ @@ -179,7 +179,7 @@ cdef sig_2k(fusion_ring, tuple args) noexcept: @cython.nonecheck(False) @cython.cdivision(True) -cdef odd_one_out(fusion_ring, tuple args) noexcept: +cdef odd_one_out(fusion_ring, tuple args): r""" Compute entries of the rightmost braid generator, in case we have an odd number of strands. @@ -263,7 +263,7 @@ cdef dict mappers = { "odd_one_out": odd_one_out } -cpdef executor(tuple params) noexcept: +cpdef executor(tuple params): r""" Execute a function registered in this module's ``mappers`` in a worker process, and supply the ``FusionRing`` parameter by @@ -305,7 +305,7 @@ cpdef executor(tuple params) noexcept: # Pickling circumvention helpers # ###################################### -cpdef _unflatten_entries(fusion_ring, list entries) noexcept: +cpdef _unflatten_entries(fusion_ring, list entries): r""" Restore cyclotomic coefficient object from its tuple of rational coefficients representation. diff --git a/src/sage/algebras/fusion_rings/poly_tup_engine.pxd b/src/sage/algebras/fusion_rings/poly_tup_engine.pxd index ac2c5041de9..50493691f29 100644 --- a/src/sage/algebras/fusion_rings/poly_tup_engine.pxd +++ b/src/sage/algebras/fusion_rings/poly_tup_engine.pxd @@ -3,21 +3,21 @@ from sage.rings.number_field.number_field_element cimport NumberFieldElement_abs from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomial_libsingular, MPolynomialRing_libsingular from sage.rings.polynomial.polydict cimport ETuple -cpdef tuple poly_to_tup(MPolynomial_libsingular poly) noexcept -cpdef MPolynomial_libsingular _tup_to_poly(tuple eq_tup, MPolynomialRing_libsingular parent) noexcept -cpdef tuple resize(tuple eq_tup, dict idx_map, int nvars) noexcept -cpdef list get_variables_degrees(list eqns, int nvars) noexcept -cpdef list variables(tuple eq_tup) noexcept -cpdef constant_coeff(tuple eq_tup, field) noexcept -cpdef tuple apply_coeff_map(tuple eq_tup, coeff_map) noexcept +cpdef tuple poly_to_tup(MPolynomial_libsingular poly) +cpdef MPolynomial_libsingular _tup_to_poly(tuple eq_tup, MPolynomialRing_libsingular parent) +cpdef tuple resize(tuple eq_tup, dict idx_map, int nvars) +cpdef list get_variables_degrees(list eqns, int nvars) +cpdef list variables(tuple eq_tup) +cpdef constant_coeff(tuple eq_tup, field) +cpdef tuple apply_coeff_map(tuple eq_tup, coeff_map) # cpdef bint tup_fixes_sq(tuple eq_tup) cdef bint tup_fixes_sq(tuple eq_tup) noexcept -cdef dict subs_squares(dict eq_dict, KSHandler known_sq) noexcept -cpdef dict compute_known_powers(max_degs, dict val_dict, one) noexcept -cdef dict subs(tuple poly_tup, dict known_powers, one) noexcept -cpdef tup_to_univ_poly(tuple eq_tup, univ_poly_ring) noexcept -cpdef tuple poly_tup_sortkey(tuple eq_tup) noexcept -cdef tuple reduce_poly_dict(dict eq_dict, ETuple nonz, KSHandler known_sq, NumberFieldElement_absolute one) noexcept -cdef tuple _flatten_coeffs(tuple eq_tup) noexcept -cpdef tuple _unflatten_coeffs(field, tuple eq_tup) noexcept +cdef dict subs_squares(dict eq_dict, KSHandler known_sq) +cpdef dict compute_known_powers(max_degs, dict val_dict, one) +cdef dict subs(tuple poly_tup, dict known_powers, one) +cpdef tup_to_univ_poly(tuple eq_tup, univ_poly_ring) +cpdef tuple poly_tup_sortkey(tuple eq_tup) +cdef tuple reduce_poly_dict(dict eq_dict, ETuple nonz, KSHandler known_sq, NumberFieldElement_absolute one) +cdef tuple _flatten_coeffs(tuple eq_tup) +cpdef tuple _unflatten_coeffs(field, tuple eq_tup) cdef int has_appropriate_linear_term(tuple eq_tup) noexcept diff --git a/src/sage/algebras/fusion_rings/poly_tup_engine.pyx b/src/sage/algebras/fusion_rings/poly_tup_engine.pyx index 27f4ff1eb71..e44fb68b836 100644 --- a/src/sage/algebras/fusion_rings/poly_tup_engine.pyx +++ b/src/sage/algebras/fusion_rings/poly_tup_engine.pyx @@ -12,7 +12,7 @@ Arithmetic Engine for Polynomials as Tuples # API # ########### -cpdef inline tuple poly_to_tup(MPolynomial_libsingular poly) noexcept: +cpdef inline tuple poly_to_tup(MPolynomial_libsingular poly): r""" Convert a polynomial object into the internal representation as tuple of ``(ETuple exp, NumberFieldElement coeff)`` pairs. @@ -28,7 +28,7 @@ cpdef inline tuple poly_to_tup(MPolynomial_libsingular poly) noexcept: """ return tuple(poly.dict().items()) -cpdef inline MPolynomial_libsingular _tup_to_poly(tuple eq_tup, MPolynomialRing_libsingular parent) noexcept: +cpdef inline MPolynomial_libsingular _tup_to_poly(tuple eq_tup, MPolynomialRing_libsingular parent): r""" Return a polynomial object from its tuple of pairs representation. @@ -74,7 +74,7 @@ cpdef inline MPolynomial_libsingular _tup_to_poly(tuple eq_tup, MPolynomialRing_ """ return parent._element_constructor_(dict(eq_tup), check=False) -cdef inline tuple _flatten_coeffs(tuple eq_tup) noexcept: +cdef inline tuple _flatten_coeffs(tuple eq_tup): r""" Flatten cyclotomic coefficients to a representation as a tuple of rational coefficients. @@ -88,7 +88,7 @@ cdef inline tuple _flatten_coeffs(tuple eq_tup) noexcept: flat.append((exp, tuple(cyc_coeff._coefficients()))) return tuple(flat) -cpdef tuple _unflatten_coeffs(field, tuple eq_tup) noexcept: +cpdef tuple _unflatten_coeffs(field, tuple eq_tup): r""" Restore cyclotomic coefficient object from its tuple of rational coefficients representation. @@ -149,7 +149,7 @@ cdef inline int has_appropriate_linear_term(tuple eq_tup) noexcept: # "Change rings" # ###################### -cpdef inline tup_to_univ_poly(tuple eq_tup, univ_poly_ring) noexcept: +cpdef inline tup_to_univ_poly(tuple eq_tup, univ_poly_ring): r""" Given a tuple of pairs representing a univariate polynomial and a univariate polynomial ring, return a univariate polynomial object. @@ -177,7 +177,7 @@ cpdef inline tup_to_univ_poly(tuple eq_tup, univ_poly_ring) noexcept: cdef NumberFieldElement_absolute c return univ_poly_ring({exp._data[1] if exp._nonzero else 0: c for exp, c in eq_tup}) -cpdef inline tuple resize(tuple eq_tup, dict idx_map, int nvars) noexcept: +cpdef inline tuple resize(tuple eq_tup, dict idx_map, int nvars): r""" Return a tuple representing a polynomial in a ring with ``len(sorted_vars)`` generators. @@ -218,7 +218,7 @@ cpdef inline tuple resize(tuple eq_tup, dict idx_map, int nvars) noexcept: # Convenience methods # ########################### -cdef inline ETuple degrees(tuple poly_tup) noexcept: +cdef inline ETuple degrees(tuple poly_tup): r""" Return the maximal degree of each variable in the polynomial. """ @@ -232,7 +232,7 @@ cdef inline ETuple degrees(tuple poly_tup) noexcept: max_degs = max_degs.emax( ( poly_tup[i])[0]) return max_degs -cpdef list get_variables_degrees(list eqns, int nvars) noexcept: +cpdef list get_variables_degrees(list eqns, int nvars): r""" Find maximum degrees for each variable in equations. @@ -257,7 +257,7 @@ cpdef list get_variables_degrees(list eqns, int nvars) noexcept: dense[max_deg._data[2*i]] = max_deg._data[2*i+1] return dense -cpdef list variables(tuple eq_tup) noexcept: +cpdef list variables(tuple eq_tup): """ Return indices of all variables appearing in eq_tup @@ -277,7 +277,7 @@ cpdef list variables(tuple eq_tup) noexcept: """ return degrees(eq_tup).nonzero_positions() -cpdef constant_coeff(tuple eq_tup, field) noexcept: +cpdef constant_coeff(tuple eq_tup, field): r""" Return the constant coefficient of the polynomial represented by given tuple. @@ -300,7 +300,7 @@ cpdef constant_coeff(tuple eq_tup, field) noexcept: return coeff return field.zero() -cpdef tuple apply_coeff_map(tuple eq_tup, coeff_map) noexcept: +cpdef tuple apply_coeff_map(tuple eq_tup, coeff_map): """ Apply ``coeff_map`` to coefficients. @@ -342,7 +342,7 @@ cdef inline bint tup_fixes_sq(tuple eq_tup) noexcept: # Simplification # ###################### -cdef dict subs_squares(dict eq_dict, KSHandler known_sq) noexcept: +cdef dict subs_squares(dict eq_dict, KSHandler known_sq): r""" Substitute for known squares into a given polynomial. @@ -379,7 +379,7 @@ cdef dict subs_squares(dict eq_dict, KSHandler known_sq) noexcept: subbed[exp] = coeff return subbed -cdef dict remove_gcf(dict eq_dict, ETuple nonz) noexcept: +cdef dict remove_gcf(dict eq_dict, ETuple nonz): r""" Return a dictionary of ``(ETuple, coeff)`` pairs describing the polynomial ``eq / GCF(eq)``. @@ -399,7 +399,7 @@ cdef dict remove_gcf(dict eq_dict, ETuple nonz) noexcept: ret[exp.esub(common_powers)] = c return ret -cdef tuple to_monic(dict eq_dict, one) noexcept: +cdef tuple to_monic(dict eq_dict, one): """ Return tuple of pairs ``(ETuple, coeff)`` describing the monic polynomial associated to ``eq_dict``. @@ -422,7 +422,7 @@ cdef tuple to_monic(dict eq_dict, one) noexcept: ret.append((ord_monoms[n-2-i], inv_lc * eq_dict[ord_monoms[n-2-i]])) return tuple(ret) -cdef tuple reduce_poly_dict(dict eq_dict, ETuple nonz, KSHandler known_sq, NumberFieldElement_absolute one) noexcept: +cdef tuple reduce_poly_dict(dict eq_dict, ETuple nonz, KSHandler known_sq, NumberFieldElement_absolute one): """ Return a tuple describing a monic polynomial with no known nonzero gcf and no known squares. @@ -437,7 +437,7 @@ cdef tuple reduce_poly_dict(dict eq_dict, ETuple nonz, KSHandler known_sq, Numbe # Substitution # #################### -cpdef dict compute_known_powers(max_degs, dict val_dict, one) noexcept: +cpdef dict compute_known_powers(max_degs, dict val_dict, one): """ Pre-compute powers of known values for efficiency when preparing to substitute into a list of polynomials. @@ -482,7 +482,7 @@ cpdef dict compute_known_powers(max_degs, dict val_dict, one) noexcept: known_powers[var_idx][power+1] = tup_mul(known_powers[var_idx][power], val_dict[var_idx]) return known_powers -cdef dict subs(tuple poly_tup, dict known_powers, one) noexcept: +cdef dict subs(tuple poly_tup, dict known_powers, one): """ Substitute given variables into a polynomial tuple. """ @@ -505,7 +505,7 @@ cdef dict subs(tuple poly_tup, dict known_powers, one) noexcept: subbed[shifted_exp] = coeff * c return subbed -cdef tuple tup_mul(tuple p1, tuple p2) noexcept: +cdef tuple tup_mul(tuple p1, tuple p2): r""" Multiplication of two polynomial tuples using schoolbook multiplication. """ @@ -524,7 +524,7 @@ cdef tuple tup_mul(tuple p1, tuple p2) noexcept: # Sorting # ############### -cdef tuple monom_sortkey(ETuple exp) noexcept: +cdef tuple monom_sortkey(ETuple exp): r""" Produce a sortkey for a monomial exponent with respect to degree reversed lexicographic ordering. @@ -535,7 +535,7 @@ cdef tuple monom_sortkey(ETuple exp) noexcept: cdef ETuple rev = exp.reversed().emul(-1) return (deg, rev) -cpdef tuple poly_tup_sortkey(tuple eq_tup) noexcept: +cpdef tuple poly_tup_sortkey(tuple eq_tup): r""" Return the sortkey of a polynomial represented as a tuple of ``(ETuple, coeff)`` pairs with respect to the degree diff --git a/src/sage/algebras/fusion_rings/shm_managers.pxd b/src/sage/algebras/fusion_rings/shm_managers.pxd index f1e2ed74714..5b1576bb677 100644 --- a/src/sage/algebras/fusion_rings/shm_managers.pxd +++ b/src/sage/algebras/fusion_rings/shm_managers.pxd @@ -9,9 +9,9 @@ cdef class KSHandler: cdef public object shm cdef bint contains(self, int idx) noexcept - cdef NumberFieldElement_absolute get(self, int idx) noexcept - cdef setitem(self, int idx, rhs) noexcept - cpdef update(self, list eqns) noexcept + cdef NumberFieldElement_absolute get(self, int idx) + cdef setitem(self, int idx, rhs) + cpdef update(self, list eqns) cdef class FvarsHandler: cdef dict sext_to_idx, obj_cache diff --git a/src/sage/algebras/fusion_rings/shm_managers.pyx b/src/sage/algebras/fusion_rings/shm_managers.pyx index dcfa274b5ea..40d2eb9c805 100644 --- a/src/sage/algebras/fusion_rings/shm_managers.pyx +++ b/src/sage/algebras/fusion_rings/shm_managers.pyx @@ -144,7 +144,7 @@ cdef class KSHandler: @cython.nonecheck(False) @cython.wraparound(False) @cython.boundscheck(False) - cdef NumberFieldElement_absolute get(self, int idx) noexcept: + cdef NumberFieldElement_absolute get(self, int idx): r""" Retrieve the known square corresponding to the given index, if it exists. @@ -175,7 +175,7 @@ cdef class KSHandler: self.obj_cache[idx] = cyc_coeff return cyc_coeff - cpdef update(self, list eqns) noexcept: + cpdef update(self, list eqns): r""" Update ```self``'s ``shared_memory``-backed dictionary of known squares. Keys are variable indices and corresponding values @@ -242,7 +242,7 @@ cdef class KSHandler: @cython.nonecheck(False) @cython.wraparound(False) @cython.infer_types(False) - cdef setitem(self, int idx, rhs) noexcept: + cdef setitem(self, int idx, rhs): """ Create an entry corresponding to the given index. diff --git a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pxd b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pxd index ddd77e94be7..d22fe4e9a40 100644 --- a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pxd +++ b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pxd @@ -13,5 +13,5 @@ from sage.algebras.letterplace.free_algebra_letterplace cimport FreeAlgebra_lett cdef class FreeAlgebraElement_letterplace(AlgebraElement): cdef MPolynomial_libsingular _poly - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept + cpdef _add_(self, other) + cpdef _mul_(self, other) diff --git a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx index 8a95262410e..0e23ed2feea 100644 --- a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx +++ b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx @@ -441,7 +441,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement): return True return False - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Implement comparisons, using the Cython richcmp convention. @@ -458,7 +458,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement): ################################ # Arithmetic - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ TESTS:: @@ -474,7 +474,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement): return FreeAlgebraElement_letterplace(self._parent, -self._poly, check=False) - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): """ Addition, under the side condition that either one summand is zero, or both summands have the same degree. @@ -508,7 +508,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement): self._poly + right._poly, check=False) - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): """ Difference, under the side condition that either one summand is zero or both have the same weighted degree. @@ -548,7 +548,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement): self._poly - right._poly, check=False) - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ Multiplication from the right with an element of the base ring. @@ -563,7 +563,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement): self._poly._lmul_(right), check=False) - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): """ Multiplication from the left with an element of the base ring. @@ -578,7 +578,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement): self._poly._rmul_(left), check=False) - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): """ Product of two free algebra elements in letterplace implementation. diff --git a/src/sage/algebras/letterplace/free_algebra_letterplace.pxd b/src/sage/algebras/letterplace/free_algebra_letterplace.pxd index a726262546b..47a7275aba0 100644 --- a/src/sage/algebras/letterplace/free_algebra_letterplace.pxd +++ b/src/sage/algebras/letterplace/free_algebra_letterplace.pxd @@ -29,6 +29,6 @@ cdef class FreeAlgebra_letterplace(Algebra): cdef int _ngens cdef int _nb_slackvars cdef object __monoid - cdef str exponents_to_string(self, E) noexcept - cdef str exponents_to_latex(self, E) noexcept + cdef str exponents_to_string(self, E) + cdef str exponents_to_latex(self, E) cdef tuple _degrees diff --git a/src/sage/algebras/letterplace/free_algebra_letterplace.pyx b/src/sage/algebras/letterplace/free_algebra_letterplace.pyx index 844a50137a7..278596cc177 100644 --- a/src/sage/algebras/letterplace/free_algebra_letterplace.pyx +++ b/src/sage/algebras/letterplace/free_algebra_letterplace.pyx @@ -137,7 +137,7 @@ freeAlgebra = singular_function("freeAlgebra") ##################### # Auxiliary functions -cdef MPolynomialRing_libsingular make_letterplace_ring(base_ring, blocks) noexcept: +cdef MPolynomialRing_libsingular make_letterplace_ring(base_ring, blocks): """ Create a polynomial ring in block order. @@ -563,7 +563,7 @@ cdef class FreeAlgebra_letterplace(Algebra): return self.__monoid # Auxiliar methods - cdef str exponents_to_string(self, E) noexcept: + cdef str exponents_to_string(self, E): """ This auxiliary method is used for the string representation of elements of this free algebra. @@ -605,7 +605,7 @@ cdef class FreeAlgebra_letterplace(Algebra): return '*'.join(out) # Auxiliar methods - cdef str exponents_to_latex(self, E) noexcept: + cdef str exponents_to_latex(self, E): r""" This auxiliary method is used for the representation of elements of this free algebra as a latex string. @@ -689,7 +689,7 @@ cdef class FreeAlgebra_letterplace(Algebra): ########################### # Coercion - cpdef _coerce_map_from_(self, S) noexcept: + cpdef _coerce_map_from_(self, S): """ A ring ``R`` coerces into self, if diff --git a/src/sage/algebras/lie_algebras/lie_algebra_element.pxd b/src/sage/algebras/lie_algebras/lie_algebra_element.pxd index 227ce2559f9..3677eb29587 100644 --- a/src/sage/algebras/lie_algebras/lie_algebra_element.pxd +++ b/src/sage/algebras/lie_algebras/lie_algebra_element.pxd @@ -4,24 +4,24 @@ from sage.structure.sage_object cimport SageObject from sage.modules.with_basis.indexed_element cimport IndexedFreeModuleElement cdef class LieAlgebraElement(IndexedFreeModuleElement): - cpdef lift(self) noexcept + cpdef lift(self) cdef class LieAlgebraElementWrapper(ElementWrapper): - cpdef _add_(self, right) noexcept - cpdef _sub_(self, right) noexcept + cpdef _add_(self, right) + cpdef _sub_(self, right) cdef class LieAlgebraMatrixWrapper(LieAlgebraElementWrapper): pass cdef class LieSubalgebraElementWrapper(LieAlgebraElementWrapper): cdef dict _monomial_coefficients - cpdef dict monomial_coefficients(self, bint copy=*) noexcept + cpdef dict monomial_coefficients(self, bint copy=*) cdef class StructureCoefficientsElement(LieAlgebraMatrixWrapper): - cpdef bracket(self, right) noexcept - cpdef _bracket_(self, right) noexcept - cpdef to_vector(self, bint sparse=*) noexcept - cpdef dict monomial_coefficients(self, bint copy=*) noexcept + cpdef bracket(self, right) + cpdef _bracket_(self, right) + cpdef to_vector(self, bint sparse=*) + cpdef dict monomial_coefficients(self, bint copy=*) # cpdef lift(self) cdef class UntwistedAffineLieAlgebraElement(Element): @@ -30,23 +30,23 @@ cdef class UntwistedAffineLieAlgebraElement(Element): cdef _d_coeff cdef long _hash - cpdef _add_(self, other) noexcept - cpdef _sub_(self, other) noexcept - cpdef _neg_(self) noexcept + cpdef _add_(self, other) + cpdef _sub_(self, other) + cpdef _neg_(self) - cpdef dict t_dict(self) noexcept - cpdef c_coefficient(self) noexcept - cpdef d_coefficient(self) noexcept + cpdef dict t_dict(self) + cpdef c_coefficient(self) + cpdef d_coefficient(self) - cpdef bracket(self, y) noexcept - cpdef _bracket_(self, y) noexcept - cpdef canonical_derivation(self) noexcept - cpdef monomial_coefficients(self, bint copy=*) noexcept + cpdef bracket(self, y) + cpdef _bracket_(self, y) + cpdef canonical_derivation(self) + cpdef monomial_coefficients(self, bint copy=*) cdef class LieObject(SageObject): cdef tuple _word cdef public tuple _index_word - cpdef tuple to_word(self) noexcept + cpdef tuple to_word(self) cdef class LieGenerator(LieObject): cdef public str _name @@ -57,7 +57,7 @@ cdef class LieBracket(LieObject): cdef public LieObject _right cdef long _hash - cpdef lift(self, dict UEA_gens_dict) noexcept + cpdef lift(self, dict UEA_gens_dict) cdef class GradedLieBracket(LieBracket): cdef public _grade diff --git a/src/sage/algebras/lie_algebras/lie_algebra_element.pyx b/src/sage/algebras/lie_algebras/lie_algebra_element.pyx index 9e46da295c4..635b30c49da 100644 --- a/src/sage/algebras/lie_algebras/lie_algebra_element.pyx +++ b/src/sage/algebras/lie_algebras/lie_algebra_element.pyx @@ -124,7 +124,7 @@ cdef class LieAlgebraElement(IndexedFreeModuleElement): return codomain.sum(base_map(c) * t._im_gens_(codomain, im_gens, names) for t, c in self._monomial_coefficients.items()) - cpdef lift(self) noexcept: + cpdef lift(self): """ Lift ``self`` to the universal enveloping algebra. @@ -276,7 +276,7 @@ cdef class LieAlgebraElementWrapper(ElementWrapper): """ return bool(self.value) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add ``self`` and ``rhs``. @@ -289,7 +289,7 @@ cdef class LieAlgebraElementWrapper(ElementWrapper): """ return type(self)(self._parent, self.value + right.value) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract ``self`` and ``rhs``. @@ -377,7 +377,7 @@ cdef class LieAlgebraElementWrapper(ElementWrapper): """ return self * (~x) - cpdef _acted_upon_(self, scalar, bint self_on_left) noexcept: + cpdef _acted_upon_(self, scalar, bint self_on_left): """ Return the action of a scalar on ``self``. @@ -573,7 +573,7 @@ cdef class LieSubalgebraElementWrapper(LieAlgebraElementWrapper): """ return self._parent.module()(self.value.to_vector(sparse=sparse)) - cpdef dict monomial_coefficients(self, bint copy=True) noexcept: + cpdef dict monomial_coefficients(self, bint copy=True): r""" Return a dictionary whose keys are indices of basis elements in the support of ``self`` and whose values are the @@ -606,7 +606,7 @@ cdef class LieSubalgebraElementWrapper(LieAlgebraElementWrapper): return dict(self._monomial_coefficients) return self._monomial_coefficients - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add ``self`` and ``rhs``. @@ -632,7 +632,7 @@ cdef class LieSubalgebraElementWrapper(LieAlgebraElementWrapper): ret._monomial_coefficients = mc return ret - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract ``self`` and ``rhs``. @@ -658,7 +658,7 @@ cdef class LieSubalgebraElementWrapper(LieAlgebraElementWrapper): ret._monomial_coefficients = mc return ret - cpdef _acted_upon_(self, scalar, bint self_on_left) noexcept: + cpdef _acted_upon_(self, scalar, bint self_on_left): """ Return the action of a scalar on ``self``. @@ -758,7 +758,7 @@ cdef class StructureCoefficientsElement(LieAlgebraMatrixWrapper): scalar_mult='·', strip_one=True)) - cpdef bracket(self, right) noexcept: + cpdef bracket(self, right): """ Return the Lie bracket ``[self, right]``. @@ -778,7 +778,7 @@ cdef class StructureCoefficientsElement(LieAlgebraMatrixWrapper): # We need this method because the LieAlgebra.bracket method (from the # category) calls this, where we are guaranteed to have the same parent. - cpdef _bracket_(self, right) noexcept: + cpdef _bracket_(self, right): """ Return the Lie bracket ``[self, right]``. @@ -833,7 +833,7 @@ cdef class StructureCoefficientsElement(LieAlgebraMatrixWrapper): if v != zero: yield (I[i], v) - cpdef to_vector(self, bint sparse=False) noexcept: + cpdef to_vector(self, bint sparse=False): """ Return ``self`` as a vector. @@ -866,7 +866,7 @@ cdef class StructureCoefficientsElement(LieAlgebraMatrixWrapper): gens = UEA.gens() return UEA.sum(c * gens[i] for i, c in self.value.items()) - cpdef dict monomial_coefficients(self, bint copy=True) noexcept: + cpdef dict monomial_coefficients(self, bint copy=True): """ Return the monomial coefficients of ``self`` as a dictionary. @@ -1073,7 +1073,7 @@ cdef class UntwistedAffineLieAlgebraElement(Element): lambda t: "t" + unicode_superscript(t), unicode_art('⋅'), unicode_art('⊗')) - cpdef dict t_dict(self) noexcept: + cpdef dict t_dict(self): r""" Return the ``dict``, whose keys are powers of `t` and values are elements of the classical Lie algebra, of ``self``. @@ -1089,7 +1089,7 @@ cdef class UntwistedAffineLieAlgebraElement(Element): """ return self._t_dict.copy() - cpdef c_coefficient(self) noexcept: + cpdef c_coefficient(self): r""" Return the coefficient of `c` of ``self``. @@ -1102,7 +1102,7 @@ cdef class UntwistedAffineLieAlgebraElement(Element): """ return self._c_coeff - cpdef d_coefficient(self) noexcept: + cpdef d_coefficient(self): r""" Return the coefficient of `d` of ``self``. @@ -1115,7 +1115,7 @@ cdef class UntwistedAffineLieAlgebraElement(Element): """ return self._d_coeff - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Return the rich comparison of ``self`` with ``other``. @@ -1178,7 +1178,7 @@ cdef class UntwistedAffineLieAlgebraElement(Element): """ return bool(self._t_dict) or bool(self._c_coeff) or bool(self._d_coeff) - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): """ Add ``self`` and ``other``. @@ -1194,7 +1194,7 @@ cdef class UntwistedAffineLieAlgebraElement(Element): self._c_coeff + rt._c_coeff, self._d_coeff + rt._d_coeff) - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): """ Subtract ``self`` and ``other``. @@ -1218,7 +1218,7 @@ cdef class UntwistedAffineLieAlgebraElement(Element): self._c_coeff - rt._c_coeff, self._d_coeff - rt._d_coeff) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Negate ``self``. @@ -1233,7 +1233,7 @@ cdef class UntwistedAffineLieAlgebraElement(Element): return type(self)(self._parent, negate(self._t_dict), -self._c_coeff, -self._d_coeff) - cpdef _acted_upon_(self, scalar, bint self_on_left) noexcept: + cpdef _acted_upon_(self, scalar, bint self_on_left): """ Return ``self`` acted upon by ``scalar``. @@ -1263,7 +1263,7 @@ cdef class UntwistedAffineLieAlgebraElement(Element): scalar * self._c_coeff, scalar * self._d_coeff) - cpdef monomial_coefficients(self, bint copy=True) noexcept: + cpdef monomial_coefficients(self, bint copy=True): """ Return the monomial coefficients of ``self``. @@ -1293,7 +1293,7 @@ cdef class UntwistedAffineLieAlgebraElement(Element): d['d'] = self._d_coeff return d - cpdef bracket(self, right) noexcept: + cpdef bracket(self, right): """ Return the Lie bracket ``[self, right]``. @@ -1316,7 +1316,7 @@ cdef class UntwistedAffineLieAlgebraElement(Element): self, right = coercion_model.canonical_coercion(self, right) return self._bracket_(right) - cpdef _bracket_(self, y) noexcept: + cpdef _bracket_(self, y): """ Return the Lie bracket ``[self, y]``. @@ -1384,7 +1384,7 @@ cdef class UntwistedAffineLieAlgebraElement(Element): return type(self)(self._parent, d, c, self._parent.base_ring().zero()) - cpdef canonical_derivation(self) noexcept: + cpdef canonical_derivation(self): r""" Return the canonical derivation `d` applied to ``self``. @@ -1524,7 +1524,7 @@ cdef class LieObject(SageObject): """ Abstract base class for :class:`LieGenerator` and :class:`LieBracket`. """ - cpdef tuple to_word(self) noexcept: + cpdef tuple to_word(self): """ Return the word ("flattening") of ``self``. @@ -1658,7 +1658,7 @@ cdef class LieGenerator(LieObject): """ return im_gens[names.index(self._name)] - cpdef tuple to_word(self) noexcept: + cpdef tuple to_word(self): """ Return the word ("flattening") of ``self``. @@ -1863,7 +1863,7 @@ cdef class LieBracket(LieObject): return codomain.bracket(self._left._im_gens_(codomain, im_gens, names), self._right._im_gens_(codomain, im_gens, names)) - cpdef lift(self, dict UEA_gens_dict) noexcept: + cpdef lift(self, dict UEA_gens_dict): """ Lift ``self`` to the universal enveloping algebra. @@ -1892,7 +1892,7 @@ cdef class LieBracket(LieObject): return l*r - r*l - cpdef tuple to_word(self) noexcept: + cpdef tuple to_word(self): """ Return the word ("flattening") of ``self``. diff --git a/src/sage/algebras/octonion_algebra.pxd b/src/sage/algebras/octonion_algebra.pxd index 459e8ea3070..78500729bdc 100644 --- a/src/sage/algebras/octonion_algebra.pxd +++ b/src/sage/algebras/octonion_algebra.pxd @@ -8,12 +8,12 @@ from sage.modules.free_module_element cimport FreeModuleElement cdef class Octonion_generic(AlgebraElement): cdef FreeModuleElement vec - cpdef Octonion_generic conjugate(self) noexcept - cpdef quadratic_form(self) noexcept - cpdef norm(self) noexcept - cpdef abs(self) noexcept - cpdef real_part(self) noexcept - cpdef Octonion_generic imag_part(self) noexcept + cpdef Octonion_generic conjugate(self) + cpdef quadratic_form(self) + cpdef norm(self) + cpdef abs(self) + cpdef real_part(self) + cpdef Octonion_generic imag_part(self) cdef class Octonion(Octonion_generic): pass diff --git a/src/sage/algebras/octonion_algebra.pyx b/src/sage/algebras/octonion_algebra.pyx index ee69aca6a7e..3c1d28c2106 100644 --- a/src/sage/algebras/octonion_algebra.pyx +++ b/src/sage/algebras/octonion_algebra.pyx @@ -117,7 +117,7 @@ cdef class Octonion_generic(AlgebraElement): """ return (self.__class__, (self._parent, self.vec)) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): r""" Compare ``self`` to ``other`` with type ``op``. @@ -148,7 +148,7 @@ cdef class Octonion_generic(AlgebraElement): """ return hash(self.vec) - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): r""" Return ``self`` plus ``other``. @@ -162,7 +162,7 @@ cdef class Octonion_generic(AlgebraElement): """ return self.__class__(self._parent, self.vec + ( other).vec) - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): r""" Return ``self`` minus ``other``. @@ -192,7 +192,7 @@ cdef class Octonion_generic(AlgebraElement): """ return self.__class__(self._parent, -self.vec) - cpdef _lmul_(self, Element other) noexcept: + cpdef _lmul_(self, Element other): r""" Return ``self * other`` for a scalar ``other``. @@ -206,7 +206,7 @@ cdef class Octonion_generic(AlgebraElement): """ return self.__class__(self._parent, self.vec * other) - cpdef _rmul_(self, Element other) noexcept: + cpdef _rmul_(self, Element other): r""" Return ``self * other`` for a scalar ``other``. @@ -220,7 +220,7 @@ cdef class Octonion_generic(AlgebraElement): """ return self.__class__(self._parent, other * self.vec) - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): r""" Return ``self`` multiplied by ``other``. @@ -268,7 +268,7 @@ cdef class Octonion_generic(AlgebraElement): ret[k] += cl * cr * coeff return self.__class__(P, P._module(ret)) - cpdef _div_(self, other) noexcept: + cpdef _div_(self, other): """ Return ``self`` divided by ``other``. @@ -357,7 +357,7 @@ cdef class Octonion_generic(AlgebraElement): raise ZeroDivisionError return self.quadratic_form().inverse_of_unit() * self.conjugate() - cpdef Octonion_generic conjugate(self) noexcept: + cpdef Octonion_generic conjugate(self): r""" Return the conjugate of ``self``. @@ -373,7 +373,7 @@ cdef class Octonion_generic(AlgebraElement): v.set_unsafe(0, -v.get_unsafe(0)) return self.__class__(self._parent, v) - cpdef quadratic_form(self) noexcept: + cpdef quadratic_form(self): r""" Return the quadratic form of ``self``. @@ -396,7 +396,7 @@ cdef class Octonion_generic(AlgebraElement): ret += -( table[i])[i][1] * self.vec.get_unsafe(i) ** 2 return ret - cpdef norm(self) noexcept: + cpdef norm(self): r""" Return the norm of ``self``. @@ -424,7 +424,7 @@ cdef class Octonion_generic(AlgebraElement): """ return sqrt(self.quadratic_form()) - cpdef abs(self) noexcept: + cpdef abs(self): r""" Return the absolute value of ``self``. @@ -447,7 +447,7 @@ cdef class Octonion_generic(AlgebraElement): """ return self.norm() - cpdef real_part(self) noexcept: + cpdef real_part(self): r""" Return the real part of ``self``. @@ -467,7 +467,7 @@ cdef class Octonion_generic(AlgebraElement): """ return self.vec.get_unsafe(0) - cpdef Octonion_generic imag_part(self) noexcept: + cpdef Octonion_generic imag_part(self): r""" Return the imginary part of ``self``. @@ -543,7 +543,7 @@ cdef class Octonion(Octonion_generic): This is an element of the octonion algebra with parameters `a = b = c = -1`, which is a classical octonion number. """ - cpdef quadratic_form(self) noexcept: + cpdef quadratic_form(self): r""" Return the quadratic form of ``self``. @@ -562,7 +562,7 @@ cdef class Octonion(Octonion_generic): """ return self.vec * self.vec - cpdef norm(self) noexcept: + cpdef norm(self): r""" Return the norm of ``self``. diff --git a/src/sage/algebras/quatalg/quaternion_algebra_element.pxd b/src/sage/algebras/quatalg/quaternion_algebra_element.pxd index 5a4f811443a..93c98b3e045 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra_element.pxd +++ b/src/sage/algebras/quatalg/quaternion_algebra_element.pxd @@ -8,10 +8,10 @@ from sage.categories.morphism cimport Morphism cdef class QuaternionAlgebraElement_abstract(AlgebraElement): cpdef bint is_constant(self) noexcept - cdef _do_print(self, x, y, z, w) noexcept - cpdef conjugate(self) noexcept - cpdef reduced_norm(self) noexcept - cpdef reduced_trace(self) noexcept + cdef _do_print(self, x, y, z, w) + cpdef conjugate(self) + cpdef reduced_norm(self) + cpdef reduced_trace(self) cdef class QuaternionAlgebraElement_generic(QuaternionAlgebraElement_abstract): cdef object x, y, z, w @@ -21,8 +21,8 @@ cdef class QuaternionAlgebraElement_generic(QuaternionAlgebraElement_abstract): cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstract): cdef fmpz_poly_t x, y, z, w, a, b, modulus cdef mpz_t d - cdef inline canonicalize(self) noexcept + cdef inline canonicalize(self) cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abstract): cdef mpz_t x, y, z, w, a, b, d - cdef inline canonicalize(self) noexcept + cdef inline canonicalize(self) diff --git a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx index f6fa8ef3b35..d17566c8c22 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx +++ b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx @@ -54,7 +54,7 @@ from sage.libs.flint.ntl_interface cimport * cdef mpz_t T1, T2, t3, t4, t5, t6, t7, t8, s1, s2, U1, U2 cdef fmpz_poly_t fT1, fT2, ft3, ft4, ft5, ft6, ft7, ft8, fs1, fs2, fU1, fU2 -cdef _clear_globals() noexcept: +cdef _clear_globals(): """ Clear all global variables allocated for optimization of quaternion algebra arithmetic. @@ -91,7 +91,7 @@ cdef _clear_globals() noexcept: fmpz_poly_clear(fU1) fmpz_poly_clear(fU2) -cdef _init_globals() noexcept: +cdef _init_globals(): """ Initialize all global variables allocated for optimization of quaternion algebra arithmetic, and register a hook to eventually @@ -138,7 +138,7 @@ cdef _init_globals() noexcept: # Initialize module-scope global C variables. _init_globals() -cdef to_quaternion(R, x) noexcept: +cdef to_quaternion(R, x): """ Internal function used implicitly by quaternion algebra creation. @@ -162,7 +162,7 @@ cdef to_quaternion(R, x) noexcept: else: return R(x), R(0), R(0), R(0) -cdef inline print_coeff(y, i, bint atomic) noexcept: +cdef inline print_coeff(y, i, bint atomic): """ Internal function used implicitly by all quaternion algebra printing. @@ -336,7 +336,7 @@ cdef class QuaternionAlgebraElement_abstract(AlgebraElement): """ return self[0] or self[1] or self[2] or self[3] - cdef _do_print(self, x, y, z, w) noexcept: + cdef _do_print(self, x, y, z, w): """ Used internally by the print function. @@ -385,7 +385,7 @@ cdef class QuaternionAlgebraElement_abstract(AlgebraElement): """ return self._do_print(self[0], self[1], self[2], self[3]) - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): """ Comparing elements. @@ -413,7 +413,7 @@ cdef class QuaternionAlgebraElement_abstract(AlgebraElement): return res return rich_to_bool(op, 0) - cpdef conjugate(self) noexcept: + cpdef conjugate(self): """ Return the conjugate of the quaternion: if `\\theta = x + yi + zj + wk`, return `x - yi - zj - wk`; that is, return theta.reduced_trace() - theta. @@ -437,7 +437,7 @@ cdef class QuaternionAlgebraElement_abstract(AlgebraElement): """ return self.__class__(self._parent, (self[0], -self[1], -self[2], -self[3]), check=False) - cpdef reduced_trace(self) noexcept: + cpdef reduced_trace(self): """ Return the reduced trace of self: if `\\theta = x + yi + zj + wk`, then `\\theta` has reduced trace `2x`. @@ -452,7 +452,7 @@ cdef class QuaternionAlgebraElement_abstract(AlgebraElement): """ return 2*self[0] - cpdef reduced_norm(self) noexcept: + cpdef reduced_norm(self): """ Return the reduced norm of self: if `\\theta = x + yi + zj + wk`, then `\\theta` has reduced norm `x^2 - ay^2 - bz^2 + @@ -509,7 +509,7 @@ cdef class QuaternionAlgebraElement_abstract(AlgebraElement): """ return ~self.reduced_norm() * self.conjugate() - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): """ Return left*self, where left is in the base ring. @@ -524,7 +524,7 @@ cdef class QuaternionAlgebraElement_abstract(AlgebraElement): """ return self.__class__(self._parent, (left*self[0], left*self[1], left*self[2], left*self[3]), check=False) - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ Return self*right, where right is in the base ring. @@ -539,7 +539,7 @@ cdef class QuaternionAlgebraElement_abstract(AlgebraElement): """ return self.__class__(self._parent, (self[0]*right, self[1]*right, self[2]*right, self[3]*right), check=False) - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Return quotient of self by right. @@ -794,7 +794,7 @@ cdef class QuaternionAlgebraElement_generic(QuaternionAlgebraElement_abstract): return (unpickle_QuaternionAlgebraElement_generic_v0, (self._parent, (self.x, self.y, self.z, self.w))) - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): """ Return the sum of self and _right. @@ -810,7 +810,7 @@ cdef class QuaternionAlgebraElement_generic(QuaternionAlgebraElement_abstract): # TODO -- make this, etc. use __new__ return QuaternionAlgebraElement_generic(self._parent, (self.x + right.x, self.y + right.y, self.z + right.z, self.w + right.w), check=False) - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): """ Return the difference of self and _right. @@ -825,7 +825,7 @@ cdef class QuaternionAlgebraElement_generic(QuaternionAlgebraElement_abstract): cdef QuaternionAlgebraElement_generic right = _right return QuaternionAlgebraElement_generic(self._parent, (self.x - right.x, self.y - right.y, self.z - right.z, self.w - right.w), check=False) - cpdef _mul_(self, _right) noexcept: + cpdef _mul_(self, _right): """ Return the product of self and _right. @@ -989,7 +989,7 @@ cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abst """ return bool(mpz_sgn(self.x) or mpz_sgn(self.y) or mpz_sgn(self.z) or mpz_sgn(self.w)) - cpdef _richcmp_(self, _right, int op) noexcept: + cpdef _richcmp_(self, _right, int op): """ Compare two quaternions. @@ -1150,7 +1150,7 @@ cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abst return (unpickle_QuaternionAlgebraElement_rational_field_v0, (self._parent, (self[0], self[1], self[2], self[3]))) - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): """ EXAMPLES:: @@ -1206,7 +1206,7 @@ cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abst mpz_set(result.b, self.b) return result - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): """ EXAMPLES:: @@ -1247,7 +1247,7 @@ cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abst mpz_set(result.b, self.b) return result - cpdef _mul_(self, _right) noexcept: + cpdef _mul_(self, _right): """ EXAMPLES:: @@ -1360,7 +1360,7 @@ cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abst return result - cpdef reduced_norm(self) noexcept: + cpdef reduced_norm(self): """ Return the reduced norm of ``self``. @@ -1401,7 +1401,7 @@ cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abst return result - cpdef conjugate(self) noexcept: + cpdef conjugate(self): """ Return the conjugate of this quaternion. @@ -1432,7 +1432,7 @@ cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abst return result - cpdef reduced_trace(self) noexcept: + cpdef reduced_trace(self): """ Return the reduced trace of ``self``. @@ -1456,7 +1456,7 @@ cdef class QuaternionAlgebraElement_rational_field(QuaternionAlgebraElement_abst mpq_canonicalize(result.value) return result - cdef inline canonicalize(self) noexcept: + cdef inline canonicalize(self): """ Put the representation of this quaternion element into smallest form. For `a = (1/d)(x + yi + zj + wk)` we @@ -1812,7 +1812,7 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra return (unpickle_QuaternionAlgebraElement_number_field_v0, (self._parent, (self[0], self[1], self[2], self[3]))) - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): """ Add self and _right: @@ -1886,7 +1886,7 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra return result - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): """ Subtract _right from self. @@ -1937,7 +1937,7 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra return result - cpdef _mul_(self, _right) noexcept: + cpdef _mul_(self, _right): """ Multiply self and _right. @@ -2085,7 +2085,7 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra return result - cdef inline canonicalize(self) noexcept: + cdef inline canonicalize(self): """ Put the representation of this quaternion element into smallest form. For a = `(1/d)(x + yi + zj + wk)` we diff --git a/src/sage/arith/functions.pxd b/src/sage/arith/functions.pxd index 58ad13a30b7..9ddfc38b38b 100644 --- a/src/sage/arith/functions.pxd +++ b/src/sage/arith/functions.pxd @@ -1,3 +1,3 @@ -cpdef LCM_list(v) noexcept +cpdef LCM_list(v) -cdef LCM_generic(itr, ret) noexcept +cdef LCM_generic(itr, ret) diff --git a/src/sage/arith/functions.pyx b/src/sage/arith/functions.pyx index 5bf17e813b4..f0c7c03220e 100644 --- a/src/sage/arith/functions.pyx +++ b/src/sage/arith/functions.pyx @@ -124,7 +124,7 @@ def lcm(a, b=None): raise TypeError(f"unable to find lcm of {a!r} and {b!r}") -cpdef LCM_list(v) noexcept: +cpdef LCM_list(v): """ Return the LCM of an iterable ``v``. @@ -206,7 +206,7 @@ cpdef LCM_list(v) noexcept: return z -cdef LCM_generic(itr, ret) noexcept: +cdef LCM_generic(itr, ret): """ Return the least common multiple of the element ``ret`` and the elements in the iterable ``itr``. diff --git a/src/sage/arith/multi_modular.pxd b/src/sage/arith/multi_modular.pxd index 62534fce43c..300bbf29008 100644 --- a/src/sage/arith/multi_modular.pxd +++ b/src/sage/arith/multi_modular.pxd @@ -14,7 +14,7 @@ cdef class MultiModularBasis_base(): cdef mod_int _new_random_prime(self, set known_primes) except 1 cdef mod_int last_prime(self) noexcept - cdef _realloc_to_new_count(self, new_count) noexcept + cdef _realloc_to_new_count(self, new_count) cdef int _extend_moduli_to_height_c(self, mpz_t height) except -1 cdef void _refresh_products(self, int start) noexcept cdef void _refresh_prod(self) noexcept diff --git a/src/sage/arith/multi_modular.pyx b/src/sage/arith/multi_modular.pyx index 1c81d755cbe..f9252624eec 100644 --- a/src/sage/arith/multi_modular.pyx +++ b/src/sage/arith/multi_modular.pyx @@ -101,7 +101,7 @@ cdef class MultiModularBasis_base(): mpz_init(self.product) mpz_init(self.half_product) - cdef _realloc_to_new_count(self, new_count) noexcept: + cdef _realloc_to_new_count(self, new_count): self.moduli = check_reallocarray(self.moduli, new_count, sizeof(mod_int)) self.partial_products = check_reallocarray(self.partial_products, new_count, sizeof(mpz_t)) self.C = check_reallocarray(self.C, new_count, sizeof(mod_int)) diff --git a/src/sage/arith/power.pxd b/src/sage/arith/power.pxd index 33f043e9551..7651245d2eb 100644 --- a/src/sage/arith/power.pxd +++ b/src/sage/arith/power.pxd @@ -7,12 +7,12 @@ ctypedef fused ulong_or_object: object -cpdef generic_power(a, n) noexcept -cdef generic_power_long(a, long n) noexcept -cdef generic_power_pos(a, ulong_or_object n) noexcept # n > 0 +cpdef generic_power(a, n) +cdef generic_power_long(a, long n) +cdef generic_power_pos(a, ulong_or_object n) # n > 0 -cdef inline invert(a) noexcept: +cdef inline invert(a): """ Return ``a^(-1)``. """ @@ -21,7 +21,7 @@ cdef inline invert(a) noexcept: return PyNumber_TrueDivide(type(a)(1), a) -cdef inline one(a) noexcept: +cdef inline one(a): """ Return ``a^0``. """ diff --git a/src/sage/arith/power.pyx b/src/sage/arith/power.pyx index 2b4cbd099d1..e9a1f7972eb 100644 --- a/src/sage/arith/power.pyx +++ b/src/sage/arith/power.pyx @@ -20,7 +20,7 @@ from cysignals.signals cimport sig_check from sage.arith.long cimport integer_check_long -cpdef generic_power(a, n) noexcept: +cpdef generic_power(a, n): """ Return `a^n`. @@ -88,7 +88,7 @@ cpdef generic_power(a, n) noexcept: return generic_power_pos(a, n) -cdef generic_power_long(a, long n) noexcept: +cdef generic_power_long(a, long n): """ As ``generic_power`` but where ``n`` is a C long. """ @@ -102,7 +102,7 @@ cdef generic_power_long(a, long n) noexcept: return generic_power_pos(a, u) -cdef generic_power_pos(a, ulong_or_object n) noexcept: +cdef generic_power_pos(a, ulong_or_object n): """ Return `a^n` where `n > 0`. """ diff --git a/src/sage/calculus/interpolation.pxd b/src/sage/calculus/interpolation.pxd index 2d729228149..9d60459a03b 100644 --- a/src/sage/calculus/interpolation.pxd +++ b/src/sage/calculus/interpolation.pxd @@ -8,5 +8,5 @@ cdef class Spline: cdef int started cdef object v - cdef start_interp(self) noexcept - cdef stop_interp(self) noexcept + cdef start_interp(self) + cdef stop_interp(self) diff --git a/src/sage/calculus/interpolation.pyx b/src/sage/calculus/interpolation.pyx index a12f372d139..c2acab64fd9 100644 --- a/src/sage/calculus/interpolation.pyx +++ b/src/sage/calculus/interpolation.pyx @@ -243,7 +243,7 @@ cdef class Spline: """ return str(self.v) - cdef start_interp(self) noexcept: + cdef start_interp(self): if self.started: sig_free(self.x) sig_free(self.y) @@ -271,7 +271,7 @@ cdef class Spline: gsl_spline_init (self.spline, self.x, self.y, n) self.started = 1 - cdef stop_interp(self) noexcept: + cdef stop_interp(self): if not self.started: return sig_free(self.x) diff --git a/src/sage/calculus/ode.pyx b/src/sage/calculus/ode.pyx index d7d0fc133f8..081b4f6bd83 100644 --- a/src/sage/calculus/ode.pyx +++ b/src/sage/calculus/ode.pyx @@ -33,7 +33,7 @@ cdef class PyFunctionWrapper: cdef object the_parameters cdef int y_n - cdef set_yn(self,x) noexcept: + cdef set_yn(self,x): self.y_n = x cdef class ode_system: diff --git a/src/sage/calculus/riemann.pyx b/src/sage/calculus/riemann.pyx index 0b80a29da70..a4f9545bffb 100644 --- a/src/sage/calculus/riemann.pyx +++ b/src/sage/calculus/riemann.pyx @@ -291,7 +291,7 @@ cdef class Riemann_Map: """ return "A Riemann or Ahlfors mapping of a figure to the unit circle." - cdef _generate_theta_array(self) noexcept: + cdef _generate_theta_array(self): """ Generates the essential data for the Riemann map, primarily the Szegő kernel and boundary correspondence. @@ -515,7 +515,7 @@ cdef class Riemann_Map: return np.column_stack( [self.tk2, self.theta_array[boundary]]).tolist() - cdef _generate_interior_mapper(self) noexcept: + cdef _generate_interior_mapper(self): """ Generates the data necessary to use the :meth:`riemann_map` function. As much setup as possible is done here to minimize the computation @@ -568,7 +568,7 @@ cdef class Riemann_Map: cdef np.ndarray[double complex, ndim=1] pq = self.cps[:,list(range(N))+[0]].flatten() self.pre_q_vector = pq - cpdef riemann_map(self, COMPLEX_T pt) noexcept: + cpdef riemann_map(self, COMPLEX_T pt): """ Return the Riemann mapping of a point. @@ -619,7 +619,7 @@ cdef class Riemann_Map: self.pre_q_vector - pt1) return -np.dot(self.p_vector, q_vector) - cdef _generate_inverse_mapper(self) noexcept: + cdef _generate_inverse_mapper(self): """ Generates the data necessary to use the :meth:`inverse_riemann_map` function. As much setup as possible is @@ -656,7 +656,7 @@ cdef class Riemann_Map: for i in range(N): self.cosalpha[k, i] = cos(-theta_array[k, i]) - cpdef inverse_riemann_map(self, COMPLEX_T pt) noexcept: + cpdef inverse_riemann_map(self, COMPLEX_T pt): """ Return the inverse Riemann mapping of a point. @@ -764,7 +764,7 @@ cdef class Riemann_Map: pointsize=thickness) return sum(plots) - cpdef compute_on_grid(self, plot_range, int x_points) noexcept: + cpdef compute_on_grid(self, plot_range, int x_points): """ Compute the Riemann map on a grid of points. @@ -1060,7 +1060,7 @@ cdef class Riemann_Map: (ymin, ymax),options)) return g -cdef comp_pt(clist, loop=True) noexcept: +cdef comp_pt(clist, loop=True): """ Utility function to convert the list of complex numbers ``xderivs = get_derivatives(z_values, xstep, ystep)[0]`` to the plottable @@ -1090,7 +1090,7 @@ cdef comp_pt(clist, loop=True) noexcept: return list2 cpdef get_derivatives(np.ndarray[COMPLEX_T, ndim=2] z_values, FLOAT_T xstep, - FLOAT_T ystep) noexcept: + FLOAT_T ystep): """ Computes the r*e^(I*theta) form of derivatives from the grid of points. The derivatives are computed using quick-and-dirty taylor expansion and @@ -1146,7 +1146,7 @@ cpdef get_derivatives(np.ndarray[COMPLEX_T, ndim=2] z_values, FLOAT_T xstep, cpdef complex_to_spiderweb(np.ndarray[COMPLEX_T, ndim = 2] z_values, np.ndarray[FLOAT_T, ndim = 2] dr, np.ndarray[FLOAT_T, ndim = 2] dtheta, - spokes, circles, rgbcolor, thickness, withcolor, min_mag) noexcept: + spokes, circles, rgbcolor, thickness, withcolor, min_mag): """ Converts a grid of complex numbers into a matrix containing rgb data for the Riemann spiderweb plot. @@ -1263,7 +1263,7 @@ cpdef complex_to_spiderweb(np.ndarray[COMPLEX_T, ndim = 2] z_values, return rgb -cpdef complex_to_rgb(np.ndarray[COMPLEX_T, ndim = 2] z_values) noexcept: +cpdef complex_to_rgb(np.ndarray[COMPLEX_T, ndim = 2] z_values): r""" Convert from a (Numpy) array of complex numbers to its corresponding matrix of RGB values. For internal use of :meth:`~Riemann_Map.plot_colored` @@ -1368,7 +1368,7 @@ cpdef complex_to_rgb(np.ndarray[COMPLEX_T, ndim = 2] z_values) noexcept: sig_off() return rgb -cpdef analytic_boundary(FLOAT_T t, int n, FLOAT_T epsilon) noexcept: +cpdef analytic_boundary(FLOAT_T t, int n, FLOAT_T epsilon): """ Provides an exact (for n = infinity) Riemann boundary correspondence for the ellipse with axes 1 + epsilon and 1 - epsilon. The @@ -1417,7 +1417,7 @@ cpdef analytic_boundary(FLOAT_T t, int n, FLOAT_T epsilon) noexcept: return result -cpdef cauchy_kernel(t, args) noexcept: +cpdef cauchy_kernel(t, args): """ Intermediate function for the integration in :meth:`~Riemann_Map.analytic_interior`. @@ -1463,7 +1463,7 @@ cpdef cauchy_kernel(t, args) noexcept: return None -cpdef analytic_interior(COMPLEX_T z, int n, FLOAT_T epsilon) noexcept: +cpdef analytic_interior(COMPLEX_T z, int n, FLOAT_T epsilon): """ Provides a nearly exact computation of the Riemann Map of an interior point of the ellipse with axes 1 + epsilon and 1 - epsilon. It is diff --git a/src/sage/categories/action.pxd b/src/sage/categories/action.pxd index a22a37cc22a..5883adebc97 100644 --- a/src/sage/categories/action.pxd +++ b/src/sage/categories/action.pxd @@ -8,10 +8,10 @@ cdef class Action(Functor): cdef readonly op cdef readonly bint _is_left cdef US - cdef underlying_set(self) noexcept + cdef underlying_set(self) - cdef _act_convert(self, g, x) noexcept - cpdef _act_(self, g, x) noexcept + cdef _act_convert(self, g, x) + cpdef _act_(self, g, x) cdef class InverseAction(Action): diff --git a/src/sage/categories/action.pyx b/src/sage/categories/action.pyx index 3b3ba9d463b..27cf3e0b26c 100644 --- a/src/sage/categories/action.pyx +++ b/src/sage/categories/action.pyx @@ -66,7 +66,7 @@ from sage.categories import homset from weakref import ref -cdef inline category(x) noexcept: +cdef inline category(x): try: return x.category() except AttributeError: @@ -178,7 +178,7 @@ cdef class Action(Functor): else: raise TypeError("actions should be called with 1 or 2 arguments") - cdef _act_convert(self, g, x) noexcept: + cdef _act_convert(self, g, x): """ Let ``g`` act on ``x`` under this action, converting ``g`` and ``x`` to the correct parents first. @@ -190,7 +190,7 @@ cdef class Action(Functor): x = U(x) return self._act_(g, x) - cpdef _act_(self, g, x) noexcept: + cpdef _act_(self, g, x): """ Let ``g`` act on ``x`` under this action. @@ -251,7 +251,7 @@ cdef class Action(Functor): def actor(self): return self.G - cdef underlying_set(self) noexcept: + cdef underlying_set(self): """ The set on which the actor acts (it is not necessarily the codomain of the action). @@ -410,7 +410,7 @@ cdef class InverseAction(Action): """ return (type(self), (self._action,)) - cpdef _act_(self, g, x) noexcept: + cpdef _act_(self, g, x): if self.S_precomposition is not None: x = self.S_precomposition(x) return self._action._act_(~g, x) @@ -498,7 +498,7 @@ cdef class PrecomposedAction(Action): """ return (type(self), (self._action, self.G_precomposition, self.S_precomposition)) - cpdef _act_(self, g, x) noexcept: + cpdef _act_(self, g, x): if self.G_precomposition is not None: g = self.G_precomposition._call_(g) if self.S_precomposition is not None: @@ -569,7 +569,7 @@ cdef class ActionEndomorphism(Morphism): self._action = action self._g = g - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for pickling and copying. @@ -591,7 +591,7 @@ cdef class ActionEndomorphism(Morphism): slots['_g'] = self._g return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for pickling and copying. @@ -612,7 +612,7 @@ cdef class ActionEndomorphism(Morphism): self._g = _slots['_g'] Morphism._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): return self._action._act_(self._g, x) def _repr_(self): diff --git a/src/sage/categories/category_cy_helper.pxd b/src/sage/categories/category_cy_helper.pxd index c7bf3759712..f50ce4e8226 100644 --- a/src/sage/categories/category_cy_helper.pxd +++ b/src/sage/categories/category_cy_helper.pxd @@ -1,7 +1,7 @@ -cpdef tuple _sort_uniq(categories) noexcept +cpdef tuple _sort_uniq(categories) cdef class AxiomContainer(dict): pass -cpdef tuple canonicalize_axioms(AxiomContainer all_axioms, axioms) noexcept +cpdef tuple canonicalize_axioms(AxiomContainer all_axioms, axioms) from sage.misc.classcall_metaclass cimport ClasscallMetaclass -cpdef tuple _flatten_categories(categories, ClasscallMetaclass JoinCategory) noexcept -cpdef tuple join_as_tuple(tuple categories, tuple axioms, tuple ignore_axioms) noexcept +cpdef tuple _flatten_categories(categories, ClasscallMetaclass JoinCategory) +cpdef tuple join_as_tuple(tuple categories, tuple axioms, tuple ignore_axioms) diff --git a/src/sage/categories/category_cy_helper.pyx b/src/sage/categories/category_cy_helper.pyx index 6ed38f4d00e..d3859221c13 100644 --- a/src/sage/categories/category_cy_helper.pyx +++ b/src/sage/categories/category_cy_helper.pyx @@ -21,7 +21,7 @@ AUTHOR: ####################################### # Sorting -cpdef inline tuple category_sort_key(object category) noexcept: +cpdef inline tuple category_sort_key(object category): """ Return ``category._cmp_key``. @@ -38,7 +38,7 @@ cpdef inline tuple category_sort_key(object category) noexcept: """ return category._cmp_key -cpdef tuple _sort_uniq(categories) noexcept: +cpdef tuple _sort_uniq(categories): """ Return the categories after sorting them and removing redundant categories. @@ -72,7 +72,7 @@ cpdef tuple _sort_uniq(categories) noexcept: result.append(category) return tuple(result) -cpdef tuple _flatten_categories(categories, ClasscallMetaclass JoinCategory) noexcept: +cpdef tuple _flatten_categories(categories, ClasscallMetaclass JoinCategory): """ Return the tuple of categories in ``categories``, while flattening join categories. @@ -116,7 +116,7 @@ cdef bint is_supercategory_of_done(new_cat, dict done) noexcept: return True return False -cpdef tuple join_as_tuple(tuple categories, tuple axioms, tuple ignore_axioms) noexcept: +cpdef tuple join_as_tuple(tuple categories, tuple axioms, tuple ignore_axioms): """ Helper for :meth:`~sage.categories.category.Category.join`. @@ -267,7 +267,7 @@ cdef class AxiomContainer(dict): return self -cpdef inline get_axiom_index(AxiomContainer all_axioms, str axiom) noexcept: +cpdef inline get_axiom_index(AxiomContainer all_axioms, str axiom): """ Helper function: Return the rank of an axiom. @@ -286,7 +286,7 @@ cpdef inline get_axiom_index(AxiomContainer all_axioms, str axiom) noexcept: return (all_axioms)[axiom] -cpdef tuple canonicalize_axioms(AxiomContainer all_axioms, axioms) noexcept: +cpdef tuple canonicalize_axioms(AxiomContainer all_axioms, axioms): r""" Canonicalize a set of axioms. diff --git a/src/sage/categories/examples/semigroups_cython.pyx b/src/sage/categories/examples/semigroups_cython.pyx index 2b7b76c00e3..b456c2868f8 100644 --- a/src/sage/categories/examples/semigroups_cython.pyx +++ b/src/sage/categories/examples/semigroups_cython.pyx @@ -85,7 +85,7 @@ cdef class LeftZeroSemigroupElement(Element): """ return LeftZeroSemigroupElement, (self._parent, self._value) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ EXAMPLES:: @@ -100,7 +100,7 @@ cdef class LeftZeroSemigroupElement(Element): right = (other)._value return PyObject_RichCompare(left, right, op) - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): """ EXAMPLES:: diff --git a/src/sage/categories/map.pxd b/src/sage/categories/map.pxd index 98c74d862e4..0467b872353 100644 --- a/src/sage/categories/map.pxd +++ b/src/sage/categories/map.pxd @@ -8,12 +8,12 @@ cdef class Map(Element): # a rough measure of the cost of using this morphism in the coercion system. # 10 by default, 100 if a DefaultCoercionMorphism, 10000 if inexact. - cdef _update_slots(self, dict) noexcept - cdef dict _extra_slots(self) noexcept + cdef _update_slots(self, dict) + cdef dict _extra_slots(self) # these methods require x is an element of domain, and returns an element with parent codomain - cpdef Element _call_(self, x) noexcept - cpdef Element _call_with_args(self, x, args=*, kwds=*) noexcept + cpdef Element _call_(self, x) + cpdef Element _call_with_args(self, x, args=*, kwds=*) cdef public domain # will be either a weakref or a constant map cdef public codomain # will be a constant map @@ -23,7 +23,7 @@ cdef class Map(Element): cdef public _repr_type_str cdef public bint _is_coercion - cpdef _pow_int(self, n) noexcept + cpdef _pow_int(self, n) cdef class Section(Map): diff --git a/src/sage/categories/map.pyx b/src/sage/categories/map.pyx index 29613f16285..b41b7538c59 100644 --- a/src/sage/categories/map.pyx +++ b/src/sage/categories/map.pyx @@ -389,7 +389,7 @@ cdef class Map(Element): self.domain = ConstantFunction(D) self._parent = homset.Hom(D, C, self._category_for) - cdef _update_slots(self, dict slots) noexcept: + cdef _update_slots(self, dict slots): """ Set various attributes of this map to implement unpickling. @@ -451,7 +451,7 @@ cdef class Map(Element): """ self._update_slots(_slots) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Return a dict with attributes to pickle and copy this map. """ @@ -816,7 +816,7 @@ cdef class Map(Element): return self._call_(x) return self._call_with_args(x, args, kwds) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Call method with a single argument, not implemented in the base class. @@ -831,7 +831,7 @@ cdef class Map(Element): """ raise NotImplementedError(type(self)) - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ Call method with multiple arguments, not implemented in the base class. @@ -1222,7 +1222,7 @@ cdef class Map(Element): """ raise NotImplementedError(type(self)) - cpdef _pow_int(self, n) noexcept: + cpdef _pow_int(self, n): """ TESTS:: @@ -1368,7 +1368,7 @@ cdef class Section(Map): Map.__init__(self, Hom(map.codomain(), map.domain(), SetsWithPartialMaps())) self._inverse = map # TODO: Use this attribute somewhere! - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for pickling and copying. @@ -1387,7 +1387,7 @@ cdef class Section(Map): slots['_inverse'] = self._inverse return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for pickling and copying. @@ -1576,7 +1576,7 @@ cdef class FormalCompositeMap(Map): """ return FormalCompositeMap(self.parent(), [f.__copy__() for f in self.__list]) - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Used in pickling and copying. @@ -1595,7 +1595,7 @@ cdef class FormalCompositeMap(Map): self.__list = _slots['__list'] Map._update_slots(self, _slots) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Used in pickling and copying. @@ -1708,7 +1708,7 @@ cdef class FormalCompositeMap(Map): """ return self.__list[i] - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Call with a single argument @@ -1726,7 +1726,7 @@ cdef class FormalCompositeMap(Map): x = f._call_(x) return x - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ Additional arguments are only passed to the last applied map. diff --git a/src/sage/categories/morphism.pyx b/src/sage/categories/morphism.pyx index e36c32b34bc..0e4805ef1b4 100644 --- a/src/sage/categories/morphism.pyx +++ b/src/sage/categories/morphism.pyx @@ -345,7 +345,7 @@ cdef class Morphism(Map): definition = repr(self) return hash((domain, codomain, definition)) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Generic comparison function for morphisms. @@ -454,7 +454,7 @@ cdef class FormalCoercionMorphism(Morphism): def _repr_type(self): return "Coercion" - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): return self._codomain.coerce(x) cdef class CallMorphism(Morphism): @@ -462,7 +462,7 @@ cdef class CallMorphism(Morphism): def _repr_type(self): return "Call" - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): return self._codomain(x) cdef class IdentityMorphism(Morphism): @@ -476,10 +476,10 @@ cdef class IdentityMorphism(Morphism): def _repr_type(self): return "Identity" - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): return x - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): if not args and not kwds: return x cdef Parent C = self._codomain @@ -500,7 +500,7 @@ cdef class IdentityMorphism(Morphism): else: return left - cpdef _pow_int(self, n) noexcept: + cpdef _pow_int(self, n): return self def __invert__(self): @@ -587,7 +587,7 @@ cdef class SetMorphism(Morphism): Morphism.__init__(self, parent) self._function = function - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ INPUT: @@ -608,7 +608,7 @@ cdef class SetMorphism(Morphism): """ return self._function(x) - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ Extra arguments are passed to the defining function. @@ -630,7 +630,7 @@ cdef class SetMorphism(Morphism): except Exception: raise TypeError("Underlying map %s does not accept additional arguments" % type(self._function)) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ INPUT: @@ -652,7 +652,7 @@ cdef class SetMorphism(Morphism): slots['_function'] = self._function return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ INPUT: diff --git a/src/sage/coding/codecan/codecan.pxd b/src/sage/coding/codecan/codecan.pxd index b76608d68e3..279688d2333 100644 --- a/src/sage/coding/codecan/codecan.pxd +++ b/src/sage/coding/codecan/codecan.pxd @@ -17,20 +17,20 @@ cdef class InnerGroup: cdef inline int get_rep(self, int pos) noexcept cdef inline int join_rows(self, int rep1, int rep2) noexcept - cdef InnerGroup _new_c(self) noexcept + cdef InnerGroup _new_c(self) cdef void copy_from(self, InnerGroup other) noexcept cdef bint has_semilinear_action(self) noexcept - cdef minimize_by_row_mult(self, FreeModuleElement v) noexcept + cdef minimize_by_row_mult(self, FreeModuleElement v) cdef minimize_matrix_col(self, object m, int pos, list fixed_minimized_cols, - bint *group_changed) noexcept + bint *group_changed) cdef void gaussian_elimination(self, object m, int pos, int pivot, list nz_pos) noexcept cdef void minimize_by_frobenius(self, object v, int *applied_frob, int *stab_pow) noexcept - cdef SemimonomialTransformation get_transporter(self) noexcept + cdef SemimonomialTransformation get_transporter(self) cdef bint has_semilinear_action(self) noexcept cpdef int get_frob_pow(self) noexcept - cpdef column_blocks(self, mat) noexcept + cpdef column_blocks(self, mat) cdef class PartitionRefinementLinearCode(PartitionRefinement_generic): cdef int _k, _q @@ -58,5 +58,5 @@ cdef class PartitionRefinementLinearCode(PartitionRefinement_generic): cdef bint _hyp_refine(self, bint *changed_partition) noexcept # some additional methods - cdef _compute_group_element(self, SemimonomialTransformation trans, str algorithm_type) noexcept - cdef _init_point_hyperplane_incidence(self) noexcept + cdef _compute_group_element(self, SemimonomialTransformation trans, str algorithm_type) + cdef _init_point_hyperplane_incidence(self) diff --git a/src/sage/coding/codecan/codecan.pyx b/src/sage/coding/codecan/codecan.pyx index 25fdfa8e5b1..89a04d61433 100644 --- a/src/sage/coding/codecan/codecan.pyx +++ b/src/sage/coding/codecan/codecan.pyx @@ -221,7 +221,7 @@ cdef class InnerGroup: self.permutational_only = other.permutational_only OP_copy_from_to(other.row_partition, self.row_partition) - cdef minimize_by_row_mult(self, FreeModuleElement w) noexcept: + cdef minimize_by_row_mult(self, FreeModuleElement w): r""" We suppose `v \in \GF{q}^k` and the entries `v_i = 0` for all ``i >= self.rank``. @@ -249,7 +249,7 @@ cdef class InnerGroup: return d, v cdef minimize_matrix_col(self, object m, int pos, list fixed_minimized_cols, - bint *group_changed) noexcept: + bint *group_changed): r""" Minimize the column at position ``pos`` of the matrix ``m`` by the action of ``self``. ``m`` should have no zero column. ``self`` is set to @@ -347,7 +347,7 @@ cdef class InnerGroup: if pivot != self.rank: m.swap_rows(self.rank, pivot) - cdef InnerGroup _new_c(self) noexcept: + cdef InnerGroup _new_c(self): r""" Make a new copy of ``self``. """ @@ -358,7 +358,7 @@ cdef class InnerGroup: res.permutational_only = self.permutational_only return res - cdef SemimonomialTransformation get_transporter(self) noexcept: + cdef SemimonomialTransformation get_transporter(self): r""" Return the group element we have applied. Should only be called if we passed an element in @@ -431,7 +431,7 @@ cdef class InnerGroup: """ return self.frob_pow - cpdef column_blocks(self, mat) noexcept: + cpdef column_blocks(self, mat): r""" Let ``mat`` be a matrix which is stabilized by ``self`` having no zero columns. We know that for each column of ``mat`` there is a uniquely @@ -646,7 +646,7 @@ cdef class PartitionRefinementLinearCode(PartitionRefinement_generic): self._autom_group_generators.append(transp_inv * x * self._transporter) self._inner_group_stabilizer_order *= Integer(F.degree() / remaining_inner_group.get_frob_pow()) - cdef _compute_group_element(self, SemimonomialTransformation trans, str algorithm_type) noexcept: + cdef _compute_group_element(self, SemimonomialTransformation trans, str algorithm_type): """ Apply ``trans`` to ``self._root_matrix`` and minimize this matrix column by column under the inner minimization. The action is @@ -738,7 +738,7 @@ cdef class PartitionRefinementLinearCode(PartitionRefinement_generic): """ return self._inner_group_stabilizer_order - cdef _init_point_hyperplane_incidence(self) noexcept: + cdef _init_point_hyperplane_incidence(self): r""" Compute a set of codewords `W` of `C` (generated by self) which is compatible with the group action, i.e. if we start with some other code `(g,\pi)C` @@ -1045,7 +1045,7 @@ cdef class PartitionRefinementLinearCode(PartitionRefinement_generic): self._hyp_part.depth -= 1 return ret_val[0] - cdef tuple _store_state_(self) noexcept: + cdef tuple _store_state_(self): r""" Store the current state of the node to a tuple, such that it can be restored by :meth:`_restore_state_`. diff --git a/src/sage/combinat/combinat_cython.pxd b/src/sage/combinat/combinat_cython.pxd index dfafe45f589..40cae00a781 100644 --- a/src/sage/combinat/combinat_cython.pxd +++ b/src/sage/combinat/combinat_cython.pxd @@ -1,5 +1,5 @@ from sage.libs.gmp.all cimport mpz_t -cdef mpz_stirling_s2(mpz_t s, unsigned long n, unsigned long k) noexcept +cdef mpz_stirling_s2(mpz_t s, unsigned long n, unsigned long k) -cdef list convert(Py_ssize_t* f, Py_ssize_t n) noexcept +cdef list convert(Py_ssize_t* f, Py_ssize_t n) diff --git a/src/sage/combinat/combinat_cython.pyx b/src/sage/combinat/combinat_cython.pyx index 3b8fb7aefa3..421994394c2 100644 --- a/src/sage/combinat/combinat_cython.pyx +++ b/src/sage/combinat/combinat_cython.pyx @@ -38,7 +38,7 @@ cdef void mpz_addmul_alt(mpz_t s, mpz_t t, mpz_t u, unsigned long parity) noexce mpz_addmul(s, t, u) -cdef mpz_stirling_s2(mpz_t s, unsigned long n, unsigned long k) noexcept: +cdef mpz_stirling_s2(mpz_t s, unsigned long n, unsigned long k): """ Set s = S(n,k) where S(n,k) denotes a Stirling number of the second kind. @@ -280,7 +280,7 @@ def perfect_matchings_iterator(Py_ssize_t n): sig_free(f) -cdef list convert(Py_ssize_t* f, Py_ssize_t n) noexcept: +cdef list convert(Py_ssize_t* f, Py_ssize_t n): """ Convert a list ``f`` representing a fixed-point free involution to a set partition. diff --git a/src/sage/combinat/crystals/letters.pxd b/src/sage/combinat/crystals/letters.pxd index e473a02dc24..4f8e25da411 100644 --- a/src/sage/combinat/crystals/letters.pxd +++ b/src/sage/combinat/crystals/letters.pxd @@ -5,38 +5,38 @@ cdef class Letter(Element): cdef class EmptyLetter(Element): cdef readonly str value - cpdef e(self, int i) noexcept - cpdef f(self, int i) noexcept + cpdef e(self, int i) + cpdef f(self, int i) cpdef int epsilon(self, int i) noexcept cpdef int phi(self, int i) noexcept cdef class Crystal_of_letters_type_A_element(Letter): - cpdef Letter e(self, int i) noexcept - cpdef Letter f(self, int i) noexcept + cpdef Letter e(self, int i) + cpdef Letter f(self, int i) cpdef int epsilon(self, int i) noexcept cpdef int phi(self, int i) noexcept cdef class Crystal_of_letters_type_B_element(Letter): - cpdef Letter e(self, int i) noexcept - cpdef Letter f(self, int i) noexcept + cpdef Letter e(self, int i) + cpdef Letter f(self, int i) cpdef int epsilon(self, int i) noexcept cpdef int phi(self, int i) noexcept cdef class Crystal_of_letters_type_C_element(Letter): - cpdef Letter e(self, int i) noexcept - cpdef Letter f(self, int i) noexcept + cpdef Letter e(self, int i) + cpdef Letter f(self, int i) cpdef int epsilon(self, int i) noexcept cpdef int phi(self, int i) noexcept cdef class Crystal_of_letters_type_D_element(Letter): - cpdef Letter e(self, int i) noexcept - cpdef Letter f(self, int i) noexcept + cpdef Letter e(self, int i) + cpdef Letter f(self, int i) cpdef int epsilon(self, int i) noexcept cpdef int phi(self, int i) noexcept cdef class Crystal_of_letters_type_G_element(Letter): - cpdef Letter e(self, int i) noexcept - cpdef Letter f(self, int i) noexcept + cpdef Letter e(self, int i) + cpdef Letter f(self, int i) cpdef int epsilon(self, int i) noexcept cpdef int phi(self, int i) noexcept @@ -46,33 +46,33 @@ cdef class LetterTuple(Element): cpdef int phi(self, int i) noexcept cdef class Crystal_of_letters_type_E6_element(LetterTuple): - cpdef LetterTuple e(self, int i) noexcept - cpdef LetterTuple f(self, int i) noexcept + cpdef LetterTuple e(self, int i) + cpdef LetterTuple f(self, int i) cdef class Crystal_of_letters_type_E6_element_dual(LetterTuple): - cpdef LetterTuple lift(self) noexcept - cpdef LetterTuple retract(self, LetterTuple p) noexcept - cpdef LetterTuple e(self, int i) noexcept - cpdef LetterTuple f(self, int i) noexcept + cpdef LetterTuple lift(self) + cpdef LetterTuple retract(self, LetterTuple p) + cpdef LetterTuple e(self, int i) + cpdef LetterTuple f(self, int i) cdef class Crystal_of_letters_type_E7_element(LetterTuple): - cpdef LetterTuple e(self, int i) noexcept - cpdef LetterTuple f(self, int i) noexcept + cpdef LetterTuple e(self, int i) + cpdef LetterTuple f(self, int i) cdef class BKKLetter(Letter): - cpdef Letter e(self, int i) noexcept - cpdef Letter f(self, int i) noexcept + cpdef Letter e(self, int i) + cpdef Letter f(self, int i) cdef class QueerLetter_element(Letter): - cpdef Letter e(self, int i) noexcept - cpdef Letter f(self, int i) noexcept + cpdef Letter e(self, int i) + cpdef Letter f(self, int i) cpdef int epsilon(self, int i) noexcept cpdef int phi(self, int i) noexcept cdef class LetterWrapped(Element): cdef readonly Element value - cpdef tuple _to_tuple(self) noexcept - cpdef LetterWrapped e(self, int i) noexcept - cpdef LetterWrapped f(self, int i) noexcept + cpdef tuple _to_tuple(self) + cpdef LetterWrapped e(self, int i) + cpdef LetterWrapped f(self, int i) cpdef int epsilon(self, int i) noexcept cpdef int phi(self, int i) noexcept diff --git a/src/sage/combinat/crystals/letters.pyx b/src/sage/combinat/crystals/letters.pyx index 368dce3a9fd..f54a4705047 100644 --- a/src/sage/combinat/crystals/letters.pyx +++ b/src/sage/combinat/crystals/letters.pyx @@ -464,7 +464,7 @@ cdef class Letter(Element): """ return self.value - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Return ``True`` if ``left`` compares with ``right`` based on ``op``. @@ -585,7 +585,7 @@ cdef class EmptyLetter(Element): """ return hash(self.value) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Return ``True`` if ``left`` compares with ``right`` based on ``op``. @@ -625,7 +625,7 @@ cdef class EmptyLetter(Element): """ return self._parent.weight_lattice_realization().zero() - cpdef e(self, int i) noexcept: + cpdef e(self, int i): """ Return `e_i` of ``self`` which is ``None``. @@ -636,7 +636,7 @@ cdef class EmptyLetter(Element): """ return None - cpdef f(self, int i) noexcept: + cpdef f(self, int i): """ Return `f_i` of ``self`` which is ``None``. @@ -711,7 +711,7 @@ cdef class Crystal_of_letters_type_A_element(Letter): """ return self._parent.weight_lattice_realization().monomial(self.value-1) - cpdef Letter e(self, int i) noexcept: + cpdef Letter e(self, int i): r""" Return the action of `e_i` on ``self``. @@ -726,7 +726,7 @@ cdef class Crystal_of_letters_type_A_element(Letter): else: return None - cpdef Letter f(self, int i) noexcept: + cpdef Letter f(self, int i): r""" Return the action of `f_i` on ``self``. @@ -804,7 +804,7 @@ cdef class Crystal_of_letters_type_B_element(Letter): else: return self._parent.weight_lattice_realization()(0) - cpdef Letter e(self, int i) noexcept: + cpdef Letter e(self, int i): r""" Return the action of `e_i` on ``self``. @@ -833,7 +833,7 @@ cdef class Crystal_of_letters_type_B_element(Letter): else: return None - cpdef Letter f(self, int i) noexcept: + cpdef Letter f(self, int i): r""" Return the actions of `f_i` on ``self``. @@ -942,7 +942,7 @@ cdef class Crystal_of_letters_type_C_element(Letter): else: return self._parent.weight_lattice_realization()(0) - cpdef Letter e(self, int i) noexcept: + cpdef Letter e(self, int i): r""" Return the action of `e_i` on ``self``. @@ -965,7 +965,7 @@ cdef class Crystal_of_letters_type_C_element(Letter): else: return None - cpdef Letter f(self, int i) noexcept: + cpdef Letter f(self, int i): r""" Return the action of `f_i` on ``self``. @@ -1049,7 +1049,7 @@ cdef class Crystal_of_letters_type_D_element(Letter): else: return self._parent.weight_lattice_realization()(0) - cpdef Letter e(self, int i) noexcept: + cpdef Letter e(self, int i): r""" Return the action of `e_i` on ``self``. @@ -1082,7 +1082,7 @@ cdef class Crystal_of_letters_type_D_element(Letter): else: return None - cpdef Letter f(self, int i) noexcept: + cpdef Letter f(self, int i): r""" Return the action of `f_i` on ``self``. @@ -1188,7 +1188,7 @@ cdef class Crystal_of_letters_type_G_element(Letter): else: raise RuntimeError("G2 crystal of letters element %d not valid" % self.value) - cpdef Letter e(self, int i) noexcept: + cpdef Letter e(self, int i): r""" Return the action of `e_i` on ``self``. @@ -1222,7 +1222,7 @@ cdef class Crystal_of_letters_type_G_element(Letter): else: return None - cpdef Letter f(self, int i) noexcept: + cpdef Letter f(self, int i): r""" Return the action of `f_i` on ``self``. @@ -1358,7 +1358,7 @@ cdef class LetterTuple(Element): """ return hash(self.value) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Check comparison between ``left`` and ``right`` based on ``op`` @@ -1555,7 +1555,7 @@ cdef class Crystal_of_letters_type_E6_element(LetterTuple): R = self._parent.weight_lattice_realization().fundamental_weights() return sum(Integer(i).sign() * R[abs(i)] for i in self.value) - cpdef LetterTuple e(self, int i) noexcept: + cpdef LetterTuple e(self, int i): r""" Return the action of `e_i` on ``self``. @@ -1643,7 +1643,7 @@ cdef class Crystal_of_letters_type_E6_element(LetterTuple): else: return None - cpdef LetterTuple f(self, int i) noexcept: + cpdef LetterTuple f(self, int i): r""" Return the action of `f_i` on ``self``. @@ -1774,7 +1774,7 @@ cdef class Crystal_of_letters_type_E6_element_dual(LetterTuple): return l[self._parent.list().index(self)] return repr(self.value) - cpdef LetterTuple lift(self) noexcept: + cpdef LetterTuple lift(self): """ Lift an element of ``self`` to the crystal of letters ``crystals.Letters(['E',6])`` by taking its inverse weight. @@ -1791,7 +1791,7 @@ cdef class Crystal_of_letters_type_E6_element_dual(LetterTuple): # tuple from a list return self._parent._ambient(tuple([-i for i in self.value])) - cpdef LetterTuple retract(self, LetterTuple p) noexcept: + cpdef LetterTuple retract(self, LetterTuple p): """ Retract element ``p``, which is an element in ``crystals.Letters(['E',6])`` to an element in @@ -1814,7 +1814,7 @@ cdef class Crystal_of_letters_type_E6_element_dual(LetterTuple): # tuple from a list return self._parent._element_constructor_(tuple([-i for i in p.value])) - cpdef LetterTuple e(self, int i) noexcept: + cpdef LetterTuple e(self, int i): r""" Return the action of `e_i` on ``self``. @@ -1826,7 +1826,7 @@ cdef class Crystal_of_letters_type_E6_element_dual(LetterTuple): """ return self.retract(self.lift().f(i)) - cpdef LetterTuple f(self, int i) noexcept: + cpdef LetterTuple f(self, int i): r""" Return the action of `f_i` on ``self``. @@ -1956,7 +1956,7 @@ cdef class Crystal_of_letters_type_E7_element(LetterTuple): R = self._parent.weight_lattice_realization().fundamental_weights() return sum(Integer(i).sign() * R[abs(i)] for i in self.value) - cpdef LetterTuple e(self, int i) noexcept: + cpdef LetterTuple e(self, int i): r""" Return the action of `e_i` on ``self``. @@ -2138,7 +2138,7 @@ cdef class Crystal_of_letters_type_E7_element(LetterTuple): else: return None - cpdef LetterTuple f(self, int i) noexcept: + cpdef LetterTuple f(self, int i): r""" Return the action of `f_i` on ``self``. @@ -2395,7 +2395,7 @@ cdef class BKKLetter(Letter): ret = "\\underline{{{}}}".format(ret) return ret - cpdef Letter e(self, int i) noexcept: + cpdef Letter e(self, int i): r""" Return the action of `e_i` on ``self``. @@ -2435,7 +2435,7 @@ cdef class BKKLetter(Letter): return self._parent._element_constructor_(-1) return None - cpdef Letter f(self, int i) noexcept: + cpdef Letter f(self, int i): r""" Return the action of `f_i` on ``self``. @@ -2715,7 +2715,7 @@ cdef class QueerLetter_element(Letter): """ return self._parent.weight_lattice_realization().monomial(self.value-1) - cpdef Letter e(self, int i) noexcept: + cpdef Letter e(self, int i): r""" Return the action of `e_i` on ``self``. @@ -2731,7 +2731,7 @@ cdef class QueerLetter_element(Letter): return self._parent._element_constructor_(self.value-1) return None - cpdef Letter f(self, int i) noexcept: + cpdef Letter f(self, int i): r""" Return the action of `f_i` on ``self``. @@ -2823,7 +2823,7 @@ cdef class LetterWrapped(Element): """ return hash(self.value) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Check comparison between ``left`` and ``right`` based on ``op`` @@ -2854,7 +2854,7 @@ cdef class LetterWrapped(Element): return self.value == x.value or x._parent.lt_elements(x, self) return False - cpdef tuple _to_tuple(self) noexcept: + cpdef tuple _to_tuple(self): r""" Return a tuple encoding the `\varepsilon_i` and `\varphi_i` values of ``elt``. @@ -2923,7 +2923,7 @@ cdef class LetterWrapped(Element): ret+= repr(v) return ret + "\\right)" - cpdef LetterWrapped e(self, int i) noexcept: + cpdef LetterWrapped e(self, int i): r""" Return `e_i` of ``self``. @@ -2939,7 +2939,7 @@ cdef class LetterWrapped(Element): return None return type(self)(self._parent, ret) - cpdef LetterWrapped f(self, int i) noexcept: + cpdef LetterWrapped f(self, int i): r""" Return `f_i` of ``self``. diff --git a/src/sage/combinat/crystals/pbw_datum.pxd b/src/sage/combinat/crystals/pbw_datum.pxd index ecfbf60b842..9c3aab083df 100644 --- a/src/sage/combinat/crystals/pbw_datum.pxd +++ b/src/sage/combinat/crystals/pbw_datum.pxd @@ -1,3 +1,3 @@ -cpdef tuple compute_new_lusztig_datum(list enhanced_braid_chain, initial_lusztig_datum) noexcept -cpdef tuple tropical_plucker_relation(tuple a, lusztig_datum) noexcept -cpdef list enhance_braid_move_chain(braid_move_chain, cartan_type) noexcept +cpdef tuple compute_new_lusztig_datum(list enhanced_braid_chain, initial_lusztig_datum) +cpdef tuple tropical_plucker_relation(tuple a, lusztig_datum) +cpdef list enhance_braid_move_chain(braid_move_chain, cartan_type) diff --git a/src/sage/combinat/crystals/pbw_datum.pyx b/src/sage/combinat/crystals/pbw_datum.pyx index a81732cdc73..2adcb09d902 100644 --- a/src/sage/combinat/crystals/pbw_datum.pyx +++ b/src/sage/combinat/crystals/pbw_datum.pyx @@ -282,7 +282,7 @@ class PBWData(): # UniqueRepresentation? # enhanced_braid_chain is an ugly data structure. @cython.boundscheck(False) @cython.wraparound(False) -cpdef tuple compute_new_lusztig_datum(list enhanced_braid_chain, initial_lusztig_datum) noexcept: +cpdef tuple compute_new_lusztig_datum(list enhanced_braid_chain, initial_lusztig_datum): """ Return the Lusztig datum obtained by applying tropical Plücker relations along ``enhanced_braid_chain`` starting with @@ -330,7 +330,7 @@ cpdef tuple compute_new_lusztig_datum(list enhanced_braid_chain, initial_lusztig # The tropical Plücker relations @cython.boundscheck(False) @cython.wraparound(False) -cpdef tuple tropical_plucker_relation(tuple a, lusztig_datum) noexcept: +cpdef tuple tropical_plucker_relation(tuple a, lusztig_datum): r""" Apply the tropical Plücker relation of type ``a`` to ``lusztig_datum``. @@ -403,7 +403,7 @@ cpdef tuple tropical_plucker_relation(tuple a, lusztig_datum) noexcept: # TODO: Move to PBW_data? @cython.boundscheck(False) @cython.wraparound(False) -cpdef list enhance_braid_move_chain(braid_move_chain, cartan_type) noexcept: +cpdef list enhance_braid_move_chain(braid_move_chain, cartan_type): r""" Return a list of tuples that records the data of the long words in ``braid_move_chain`` plus the data of the intervals where the braid moves diff --git a/src/sage/combinat/crystals/spins.pxd b/src/sage/combinat/crystals/spins.pxd index a98f1702508..3ef5e0b7c5f 100644 --- a/src/sage/combinat/crystals/spins.pxd +++ b/src/sage/combinat/crystals/spins.pxd @@ -5,16 +5,16 @@ cdef class Spin(Element): cdef int _n cdef long _hash - cdef Spin _new_c(self, bint* value) noexcept + cdef Spin _new_c(self, bint* value) cdef class Spin_crystal_type_B_element(Spin): - cpdef Spin e(self, int i) noexcept - cpdef Spin f(self, int i) noexcept + cpdef Spin e(self, int i) + cpdef Spin f(self, int i) cpdef int epsilon(self, int i) noexcept cpdef int phi(self, int i) noexcept cdef class Spin_crystal_type_D_element(Spin): - cpdef Spin e(self, int i) noexcept - cpdef Spin f(self, int i) noexcept + cpdef Spin e(self, int i) + cpdef Spin f(self, int i) cpdef int epsilon(self, int i) noexcept cpdef int phi(self, int i) noexcept diff --git a/src/sage/combinat/crystals/spins.pyx b/src/sage/combinat/crystals/spins.pyx index 97e8157afd5..62299a434f5 100644 --- a/src/sage/combinat/crystals/spins.pyx +++ b/src/sage/combinat/crystals/spins.pyx @@ -297,7 +297,7 @@ cdef class Spin(Element): self._value[i] = (val[i] != 1) Element.__init__(self, parent) - cdef Spin _new_c(self, bint* value) noexcept: + cdef Spin _new_c(self, bint* value): r""" Fast creation of a spin element. """ @@ -349,7 +349,7 @@ cdef class Spin(Element): tup = tuple([-1 if self._value[i] else 1 for i in range(self._n)]) return (self._parent, (tup,)) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Return ``True`` if ``left`` compares with ``right`` based on ``op``. @@ -534,7 +534,7 @@ cdef class Spin_crystal_type_B_element(Spin): r""" Type B spin representation crystal element """ - cpdef Spin e(self, int i) noexcept: + cpdef Spin e(self, int i): r""" Return the action of `e_i` on ``self``. @@ -567,7 +567,7 @@ cdef class Spin_crystal_type_B_element(Spin): return self._new_c(ret) return None - cpdef Spin f(self, int i) noexcept: + cpdef Spin f(self, int i): r""" Return the action of `f_i` on ``self``. @@ -638,7 +638,7 @@ cdef class Spin_crystal_type_D_element(Spin): r""" Type D spin representation crystal element """ - cpdef Spin e(self, int i) noexcept: + cpdef Spin e(self, int i): r""" Return the action of `e_i` on ``self``. @@ -679,7 +679,7 @@ cdef class Spin_crystal_type_D_element(Spin): return self._new_c(ret) return None - cpdef Spin f(self, int i) noexcept: + cpdef Spin f(self, int i): r""" Return the action of `f_i` on ``self``. diff --git a/src/sage/combinat/crystals/tensor_product_element.pxd b/src/sage/combinat/crystals/tensor_product_element.pxd index c1af4e1cb20..792d6d3351e 100644 --- a/src/sage/combinat/crystals/tensor_product_element.pxd +++ b/src/sage/combinat/crystals/tensor_product_element.pxd @@ -1,14 +1,14 @@ from sage.structure.list_clone cimport ClonableArray cdef class ImmutableListWithParent(ClonableArray): - cpdef _set_index(self, k, value) noexcept + cpdef _set_index(self, k, value) cdef class TensorProductOfCrystalsElement(ImmutableListWithParent): pass cdef class TensorProductOfRegularCrystalsElement(TensorProductOfCrystalsElement): - cpdef position_of_last_unmatched_minus(self, i) noexcept - cpdef position_of_first_unmatched_plus(self, i) noexcept + cpdef position_of_last_unmatched_minus(self, i) + cpdef position_of_first_unmatched_plus(self, i) cdef class CrystalOfTableauxElement(TensorProductOfRegularCrystalsElement): pass diff --git a/src/sage/combinat/crystals/tensor_product_element.pyx b/src/sage/combinat/crystals/tensor_product_element.pyx index 29921c95838..42a7f271092 100644 --- a/src/sage/combinat/crystals/tensor_product_element.pyx +++ b/src/sage/combinat/crystals/tensor_product_element.pyx @@ -73,7 +73,7 @@ cdef class ImmutableListWithParent(ClonableArray): self._is_immutable = True self._hash = 0 - cpdef _set_index(self, k, value) noexcept: + cpdef _set_index(self, k, value): r""" Return a sibling of ``self`` obtained by setting the `k^{th}` entry of self to value. @@ -573,7 +573,7 @@ cdef class TensorProductOfRegularCrystalsElement(TensorProductOfCrystalsElement) height = height - minus + plus return height - cpdef position_of_last_unmatched_minus(self, i) noexcept: + cpdef position_of_last_unmatched_minus(self, i): """ Return the position of the last unmatched `-` or ``None`` if there is no unmatched `-`. @@ -599,7 +599,7 @@ cdef class TensorProductOfRegularCrystalsElement(TensorProductOfCrystalsElement) height = height - minus + plus return unmatched_minus - cpdef position_of_first_unmatched_plus(self, i) noexcept: + cpdef position_of_first_unmatched_plus(self, i): """ Return the position of the first unmatched `+` or ``None`` if there is no unmatched `+`. diff --git a/src/sage/combinat/debruijn_sequence.pyx b/src/sage/combinat/debruijn_sequence.pyx index 18fe9212504..02e224283c2 100644 --- a/src/sage/combinat/debruijn_sequence.pyx +++ b/src/sage/combinat/debruijn_sequence.pyx @@ -95,7 +95,7 @@ def debruijn_sequence(int k, int n): return sequence -cdef gen(int t, int p, k, n) noexcept: +cdef gen(int t, int p, k, n): """ The internal generation function. This should not be accessed by the user. diff --git a/src/sage/combinat/degree_sequences.pyx b/src/sage/combinat/degree_sequences.pyx index b25e76d9208..6a0b070a44e 100644 --- a/src/sage/combinat/degree_sequences.pyx +++ b/src/sage/combinat/degree_sequences.pyx @@ -414,7 +414,7 @@ class DegreeSequences: sig_free(seq) -cdef init(int n) noexcept: +cdef init(int n): """ Initializes the memory and starts the enumeration algorithm. """ @@ -438,7 +438,7 @@ cdef init(int n) noexcept: sig_free(seq) return sequences -cdef inline add_seq() noexcept: +cdef inline add_seq(): """ This function is called whenever a sequence is found. diff --git a/src/sage/combinat/designs/designs_pyx.pxd b/src/sage/combinat/designs/designs_pyx.pxd index 8ff6bee5bd4..345a41f2945 100644 --- a/src/sage/combinat/designs/designs_pyx.pxd +++ b/src/sage/combinat/designs/designs_pyx.pxd @@ -17,4 +17,4 @@ cdef struct cache_entry: cdef cache_entry * _OA_cache cdef int _OA_cache_size -cpdef _OA_cache_get(int k, int n) noexcept +cpdef _OA_cache_get(int k, int n) diff --git a/src/sage/combinat/designs/designs_pyx.pyx b/src/sage/combinat/designs/designs_pyx.pyx index d1800d4382e..4a237ec82b3 100644 --- a/src/sage/combinat/designs/designs_pyx.pyx +++ b/src/sage/combinat/designs/designs_pyx.pyx @@ -954,7 +954,7 @@ _OA_cache[0].max_true = -1 _OA_cache[1].max_true = -1 _OA_cache_size = 2 -cpdef _OA_cache_set(int k,int n,truth_value) noexcept: +cpdef _OA_cache_set(int k,int n,truth_value): r""" Sets a value in the OA cache of existence results @@ -989,7 +989,7 @@ cpdef _OA_cache_set(int k,int n,truth_value) noexcept: else: _OA_cache[n].min_false = k if k<_OA_cache[n].min_false else _OA_cache[n].min_false -cpdef _OA_cache_get(int k,int n) noexcept: +cpdef _OA_cache_get(int k,int n): r""" Gets a value from the OA cache of existence results @@ -1008,7 +1008,7 @@ cpdef _OA_cache_get(int k,int n) noexcept: return None -cpdef _OA_cache_construction_available(int k,int n) noexcept: +cpdef _OA_cache_construction_available(int k,int n): r""" Tests if a construction is implemented using the cache's information diff --git a/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx b/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx index db6bb3c294a..7e80ab00034 100644 --- a/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx +++ b/src/sage/combinat/designs/orthogonal_arrays_find_recursive.pyx @@ -116,7 +116,7 @@ def find_recursive_construction(k, n): return False -cpdef find_product_decomposition(int k,int n) noexcept: +cpdef find_product_decomposition(int k,int n): r""" Find `n_1n_2=n` to obtain an `OA(k,n)` by the product construction. @@ -157,7 +157,7 @@ cpdef find_product_decomposition(int k,int n) noexcept: return wilson_construction, (None,k,n1,n2,(),False) return False -cpdef find_wilson_decomposition_with_one_truncated_group(int k,int n) noexcept: +cpdef find_wilson_decomposition_with_one_truncated_group(int k,int n): r""" Find `rm+u=n` to obtain an `OA(k,n)` by Wilson's construction with one truncated column. @@ -208,7 +208,7 @@ cpdef find_wilson_decomposition_with_one_truncated_group(int k,int n) noexcept: return False -cpdef find_wilson_decomposition_with_two_truncated_groups(int k,int n) noexcept: +cpdef find_wilson_decomposition_with_two_truncated_groups(int k,int n): r""" Find `rm+r_1+r_2=n` to obtain an `OA(k,n)` by Wilson's construction with two truncated columns. @@ -270,7 +270,7 @@ cpdef find_wilson_decomposition_with_two_truncated_groups(int k,int n) noexcept: return wilson_construction, (None,k,r,m,(r1,r2),False) return False -cpdef find_construction_3_3(int k,int n) noexcept: +cpdef find_construction_3_3(int k,int n): r""" Find a decomposition for construction 3.3 from [AC07]_ @@ -309,7 +309,7 @@ cpdef find_construction_3_3(int k,int n) noexcept: from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_3 return construction_3_3, (k,nn,mm,i) -cpdef find_construction_3_4(int k,int n) noexcept: +cpdef find_construction_3_4(int k,int n): r""" Find a decomposition for construction 3.4 from [AC07]_ @@ -352,7 +352,7 @@ cpdef find_construction_3_4(int k,int n) noexcept: from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_4 return construction_3_4, (k,nn,mm,r,s) -cpdef find_construction_3_5(int k,int n) noexcept: +cpdef find_construction_3_5(int k,int n): r""" Find a decomposition for construction 3.5 from [AC07]_ @@ -402,7 +402,7 @@ cpdef find_construction_3_5(int k,int n) noexcept: from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_5 return construction_3_5, (k,nn,mm,r,s,t) -cpdef find_construction_3_6(int k,int n) noexcept: +cpdef find_construction_3_6(int k,int n): r""" Find a decomposition for construction 3.6 from [AC07]_ @@ -443,7 +443,7 @@ cpdef find_construction_3_6(int k,int n) noexcept: from sage.combinat.designs.orthogonal_arrays_build_recursive import construction_3_6 return construction_3_6, (k,nn,mm,i) -cpdef find_q_x(int k,int n) noexcept: +cpdef find_q_x(int k,int n): r""" Find integers `q,x` such that the `q-x` construction yields an `OA(k,n)`. @@ -496,7 +496,7 @@ cpdef find_q_x(int k,int n) noexcept: return construction_q_x, (k,q,x) return False -cpdef find_thwart_lemma_3_5(int k,int N) noexcept: +cpdef find_thwart_lemma_3_5(int k,int N): r""" Find the values on which Lemma 3.5 from [Thwarts]_ applies. @@ -617,7 +617,7 @@ cpdef find_thwart_lemma_3_5(int k,int N) noexcept: return False -cpdef find_thwart_lemma_4_1(int k,int n) noexcept: +cpdef find_thwart_lemma_4_1(int k,int n): r""" Find a decomposition for Lemma 4.1 from [Thwarts]_. @@ -666,7 +666,7 @@ cpdef find_thwart_lemma_4_1(int k,int n) noexcept: return False -cpdef find_three_factor_product(int k,int n) noexcept: +cpdef find_three_factor_product(int k,int n): r""" Find `n_1n_2n_3=n` to obtain an `OA(k,n)` by the three-factor product from [DukesLing14]_ @@ -711,7 +711,7 @@ cpdef find_three_factor_product(int k,int n) noexcept: return False -cpdef find_brouwer_separable_design(int k,int n) noexcept: +cpdef find_brouwer_separable_design(int k,int n): r""" Find `t(q^2+q+1)+x=n` to obtain an `OA(k,n)` by Brouwer's separable design construction. @@ -882,7 +882,7 @@ def int_as_sum(int value, list S, int k_max): return None -cpdef find_brouwer_van_rees_with_one_truncated_column(int k,int n) noexcept: +cpdef find_brouwer_van_rees_with_one_truncated_column(int k,int n): r""" Find `rm+x_1+...+x_c=n` such that the Brouwer-van Rees constructions yields a `OA(k,n)`. diff --git a/src/sage/combinat/designs/subhypergraph_search.pyx b/src/sage/combinat/designs/subhypergraph_search.pyx index c31e8dcd229..968159b9012 100644 --- a/src/sage/combinat/designs/subhypergraph_search.pyx +++ b/src/sage/combinat/designs/subhypergraph_search.pyx @@ -229,7 +229,7 @@ cdef inline void permute(hypergraph * h,int n1,int n2) noexcept: bs_set(h.sets[i],n1,b2) bs_set(h.sets[i],n2,b1) -cdef induced_hypergraph(hypergraph * h, int n, hypergraph * tmp) noexcept: +cdef induced_hypergraph(hypergraph * h, int n, hypergraph * tmp): r""" Fills tmp with the hypergraph induced by points {0,...,n-1} in h. diff --git a/src/sage/combinat/enumeration_mod_permgroup.pxd b/src/sage/combinat/enumeration_mod_permgroup.pxd index 6d73f402321..24a0e15217c 100644 --- a/src/sage/combinat/enumeration_mod_permgroup.pxd +++ b/src/sage/combinat/enumeration_mod_permgroup.pxd @@ -1,9 +1,9 @@ from sage.structure.list_clone cimport ClonableIntArray -cpdef list all_children(ClonableIntArray v, int max_part) noexcept +cpdef list all_children(ClonableIntArray v, int max_part) cpdef int lex_cmp_partial(ClonableIntArray t1, ClonableIntArray t2, int step) noexcept cpdef int lex_cmp(ClonableIntArray t1, ClonableIntArray t2) noexcept cpdef bint is_canonical(list sgs, ClonableIntArray v) except -1 -cpdef ClonableIntArray canonical_representative_of_orbit_of(list sgs, ClonableIntArray v) noexcept -cpdef list canonical_children(list sgs, ClonableIntArray v, int max_part) noexcept -cpdef set orbit(list sgs, ClonableIntArray v) noexcept +cpdef ClonableIntArray canonical_representative_of_orbit_of(list sgs, ClonableIntArray v) +cpdef list canonical_children(list sgs, ClonableIntArray v, int max_part) +cpdef set orbit(list sgs, ClonableIntArray v) diff --git a/src/sage/combinat/enumeration_mod_permgroup.pyx b/src/sage/combinat/enumeration_mod_permgroup.pyx index 742202d04ad..70b05c6276b 100644 --- a/src/sage/combinat/enumeration_mod_permgroup.pyx +++ b/src/sage/combinat/enumeration_mod_permgroup.pyx @@ -13,7 +13,7 @@ Tools for enumeration modulo the action of a permutation group from sage.groups.perm_gps.permgroup_element cimport PermutationGroupElement -cpdef list all_children(ClonableIntArray v, int max_part) noexcept: +cpdef list all_children(ClonableIntArray v, int max_part): r""" Returns all the children of an integer vector (:class:`~sage.structure.list_clone.ClonableIntArray`) ``v`` in the tree of enumeration by lexicographic order. The children of @@ -184,7 +184,7 @@ cpdef bint is_canonical(list sgs, ClonableIntArray v) except -1: return True -cpdef ClonableIntArray canonical_representative_of_orbit_of(list sgs, ClonableIntArray v) noexcept: +cpdef ClonableIntArray canonical_representative_of_orbit_of(list sgs, ClonableIntArray v): r""" Returns the maximal vector for the lexicographic order living in the orbit of `v` under the action of the permutation group whose @@ -230,7 +230,7 @@ cpdef ClonableIntArray canonical_representative_of_orbit_of(list sgs, ClonableIn representative = max(to_analyse) return representative -cpdef list canonical_children(list sgs, ClonableIntArray v, int max_part) noexcept: +cpdef list canonical_children(list sgs, ClonableIntArray v, int max_part): r""" Returns the canonical children of the integer vector ``v``. This function computes all children of the integer vector ``v`` via the @@ -251,7 +251,7 @@ cpdef list canonical_children(list sgs, ClonableIntArray v, int max_part) noexce cdef ClonableIntArray child return [child for child in all_children(v, max_part) if is_canonical(sgs, child)] -cpdef set orbit(list sgs, ClonableIntArray v) noexcept: +cpdef set orbit(list sgs, ClonableIntArray v): r""" Returns the orbit of the integer vector ``v`` under the action of the permutation group whose strong generating system is ``sgs``. diff --git a/src/sage/combinat/fast_vector_partitions.pyx b/src/sage/combinat/fast_vector_partitions.pyx index 5142eb79108..fe937b75ee7 100644 --- a/src/sage/combinat/fast_vector_partitions.pyx +++ b/src/sage/combinat/fast_vector_partitions.pyx @@ -30,7 +30,7 @@ AUTHORS: # # To understand the code below, consult the ALGORITHM. -cdef list vector_halve(list v) noexcept: +cdef list vector_halve(list v): r""" Return the vector halfway (lexicographically) between ``v`` and zero. @@ -231,7 +231,7 @@ def within_from_to(list m, list s, list e): yield from recursive_within_from_to(m, ss, e, True, True) -cdef inline list vector_sub(list a, list b) noexcept: +cdef inline list vector_sub(list a, list b): """ Return ``a - b`` considered as vectors. diff --git a/src/sage/combinat/permutation_cython.pxd b/src/sage/combinat/permutation_cython.pxd index 9744b2f549e..094dafc8ddc 100644 --- a/src/sage/combinat/permutation_cython.pxd +++ b/src/sage/combinat/permutation_cython.pxd @@ -3,9 +3,9 @@ from cpython.array cimport array cdef void reset_swap(int n, int *c, int *o) noexcept cdef int next_swap(int n, int *c, int *o) noexcept cpdef bint next_perm(array l) noexcept -cpdef map_to_list(array l, tuple values, int n) noexcept -cpdef list left_action_same_n(list l, list r) noexcept -cpdef list right_action_same_n(list l, list r) noexcept -cpdef list left_action_product(list l, list r) noexcept -cpdef list right_action_product(list l, list r) noexcept +cpdef map_to_list(array l, tuple values, int n) +cpdef list left_action_same_n(list l, list r) +cpdef list right_action_same_n(list l, list r) +cpdef list left_action_product(list l, list r) +cpdef list right_action_product(list l, list r) diff --git a/src/sage/combinat/permutation_cython.pyx b/src/sage/combinat/permutation_cython.pyx index 17010476cd9..d16a0b175a9 100644 --- a/src/sage/combinat/permutation_cython.pyx +++ b/src/sage/combinat/permutation_cython.pyx @@ -255,7 +255,7 @@ cpdef bint next_perm(array l) noexcept: @cython.boundscheck(False) -cpdef map_to_list(array l, tuple values, int n) noexcept: +cpdef map_to_list(array l, tuple values, int n): """ Build a list by mapping the array ``l`` using ``values``. @@ -291,7 +291,7 @@ cpdef map_to_list(array l, tuple values, int n) noexcept: ##################################################################### ## Multiplication functions for permutations -cpdef list left_action_same_n(list S, list lp) noexcept: +cpdef list left_action_same_n(list S, list lp): r""" Return the permutation obtained by composing a permutation ``S`` with a permutation ``lp`` in such an order that ``lp`` @@ -318,7 +318,7 @@ cpdef list left_action_same_n(list S, list lp) noexcept: ret.append(S[i-1]) return ret -cpdef list right_action_same_n(list S, list rp) noexcept: +cpdef list right_action_same_n(list S, list rp): """ Return the permutation obtained by composing a permutation ``S`` with a permutation ``rp`` in such an order that ``S`` is @@ -345,7 +345,7 @@ cpdef list right_action_same_n(list S, list rp) noexcept: ret.append(rp[i-1]) return ret -cpdef list left_action_product(list S, list lp) noexcept: +cpdef list left_action_product(list S, list lp): r""" Return the permutation obtained by composing a permutation ``S`` with a permutation ``lp`` in such an order that ``lp`` is @@ -379,7 +379,7 @@ cpdef list left_action_product(list S, list lp) noexcept: lp.append(i) return left_action_same_n(S, lp) -cpdef list right_action_product(list S, list rp) noexcept: +cpdef list right_action_product(list S, list rp): """ Return the permutation obtained by composing a permutation ``S`` with a permutation ``rp`` in such an order that ``S`` is diff --git a/src/sage/combinat/posets/hasse_cython_flint.pyx b/src/sage/combinat/posets/hasse_cython_flint.pyx index fb01d5967f2..5d2c5b967ae 100644 --- a/src/sage/combinat/posets/hasse_cython_flint.pyx +++ b/src/sage/combinat/posets/hasse_cython_flint.pyx @@ -22,7 +22,7 @@ from sage.matrix.matrix_space import MatrixSpace from sage.rings.integer_ring import ZZ -cpdef Matrix_integer_dense moebius_matrix_fast(list positions) noexcept: +cpdef Matrix_integer_dense moebius_matrix_fast(list positions): """ Compute the Möbius matrix of a poset by a specific triangular inversion. @@ -81,7 +81,7 @@ cpdef Matrix_integer_dense moebius_matrix_fast(list positions) noexcept: return A -cpdef Matrix_integer_dense coxeter_matrix_fast(list positions) noexcept: +cpdef Matrix_integer_dense coxeter_matrix_fast(list positions): """ Compute the Coxeter matrix of a poset by a specific algorithm. diff --git a/src/sage/combinat/rigged_configurations/rigged_partition.pxd b/src/sage/combinat/rigged_configurations/rigged_partition.pxd index 9b333b4fdc6..e99258f33b2 100644 --- a/src/sage/combinat/rigged_configurations/rigged_partition.pxd +++ b/src/sage/combinat/rigged_configurations/rigged_partition.pxd @@ -6,9 +6,9 @@ cdef class RiggedPartition(SageObject): cdef public list rigging cdef long _hash - cpdef get_num_cells_to_column(self, int end_column, t=*) noexcept - cpdef insert_cell(self, int max_width) noexcept - cpdef remove_cell(self, row, int num_cells=*) noexcept + cpdef get_num_cells_to_column(self, int end_column, t=*) + cpdef insert_cell(self, int max_width) + cpdef remove_cell(self, row, int num_cells=*) cdef class RiggedPartitionTypeB(RiggedPartition): pass diff --git a/src/sage/combinat/rigged_configurations/rigged_partition.pyx b/src/sage/combinat/rigged_configurations/rigged_partition.pyx index 98a9047d6c9..97ff48d7918 100644 --- a/src/sage/combinat/rigged_configurations/rigged_partition.pyx +++ b/src/sage/combinat/rigged_configurations/rigged_partition.pyx @@ -354,7 +354,7 @@ cdef class RiggedPartition(SageObject): # Should we move these functions to the CP -> RC bijections? - cpdef get_num_cells_to_column(self, int end_column, t=1) noexcept: + cpdef get_num_cells_to_column(self, int end_column, t=1): r""" Get the number of cells in all columns before the ``end_column``. @@ -394,7 +394,7 @@ cdef class RiggedPartition(SageObject): return sum_cells - cpdef insert_cell(self, int max_width) noexcept: + cpdef insert_cell(self, int max_width): r""" Insert a cell given at a singular value as long as its less than the specified width. @@ -446,7 +446,7 @@ cdef class RiggedPartition(SageObject): self.rigging[max_pos] = None # State that we've changed this row return self._list[max_pos] - 1 - cpdef remove_cell(self, row, int num_cells=1) noexcept: + cpdef remove_cell(self, row, int num_cells=1): r""" Removes a cell at the specified ``row``. diff --git a/src/sage/combinat/root_system/braid_orbit.pyx b/src/sage/combinat/root_system/braid_orbit.pyx index c7983eeb43a..5107038df4c 100644 --- a/src/sage/combinat/root_system/braid_orbit.pyx +++ b/src/sage/combinat/root_system/braid_orbit.pyx @@ -7,7 +7,7 @@ Cython function to compute the orbit of the braid moves on a reduced word. from cysignals.signals cimport sig_check -cpdef set BraidOrbit(list word, list rels) noexcept: +cpdef set BraidOrbit(list word, list rels): r""" Return the orbit of ``word`` by all replacements given by ``rels``. diff --git a/src/sage/combinat/root_system/reflection_group_c.pyx b/src/sage/combinat/root_system/reflection_group_c.pyx index a44a5874b7f..dbfc76282f8 100644 --- a/src/sage/combinat/root_system/reflection_group_c.pyx +++ b/src/sage/combinat/root_system/reflection_group_c.pyx @@ -32,7 +32,7 @@ cdef class Iterator(): cdef list noncom cdef list order - cdef list noncom_letters(self) noexcept: + cdef list noncom_letters(self): """ Return a list ``L`` of lists such that ... @@ -90,7 +90,7 @@ cdef class Iterator(): # self.noncom = self.noncom_letters() - cdef list succ(self, PermutationGroupElement u, int first) noexcept: + cdef list succ(self, PermutationGroupElement u, int first): cdef PermutationGroupElement si cdef int i cdef list successors = [] @@ -110,7 +110,7 @@ cdef class Iterator(): successors.append((_new_mul_(si, u), i)) return successors - cdef list succ_words(self, PermutationGroupElement u, list word, int first) noexcept: + cdef list succ_words(self, PermutationGroupElement u, list word, int first): cdef PermutationGroupElement u1, si cdef int i cdef list successors = [] @@ -460,7 +460,7 @@ cdef int first_descent_in_parabolic(PermutationGroupElement w, list parabolic, cpdef PermutationGroupElement reduce_in_coset(PermutationGroupElement w, tuple S, - list parabolic, int N, bint right) noexcept: + list parabolic, int N, bint right): r""" Return the minimal length coset representative of ``w`` of the parabolic subgroup indexed by ``parabolic`` (with indices `\{0, \ldots, n\}`). @@ -504,7 +504,7 @@ cpdef PermutationGroupElement reduce_in_coset(PermutationGroupElement w, tuple S w = _new_mul_(w, si) cdef list reduced_coset_representatives(W, list parabolic_big, list parabolic_small, - bint right) noexcept: + bint right): cdef tuple S = tuple(W.simple_reflections()) cdef int N = W.number_of_reflections() cdef set totest = set([W.one()]) @@ -521,7 +521,7 @@ cdef list reduced_coset_representatives(W, list parabolic_big, list parabolic_sm totest = new.difference(res) # [w for w in new if w not in res] return list(res) -cdef parabolic_recursive(PermutationGroupElement x, list v, f) noexcept: +cdef parabolic_recursive(PermutationGroupElement x, list v, f): if not v: f(x) else: @@ -562,7 +562,7 @@ def parabolic_iteration_application(W, f): parabolic_recursive(W.one(), coset_reps, f) -cpdef list reduced_word_c(W, PermutationGroupElement w) noexcept: +cpdef list reduced_word_c(W, PermutationGroupElement w): r""" Computes a reduced word for the element ``w`` in the reflection group ``W`` in the positions ``range(n)``. @@ -588,7 +588,7 @@ cpdef list reduced_word_c(W, PermutationGroupElement w) noexcept: word.append(fdes) return word -cdef PermutationGroupElement _new_mul_(PermutationGroupElement left, PermutationGroupElement right) noexcept: +cdef PermutationGroupElement _new_mul_(PermutationGroupElement left, PermutationGroupElement right): """ Multiply two :class:`PermutationGroupElement` directly without the coercion framework. diff --git a/src/sage/combinat/root_system/reflection_group_element.pxd b/src/sage/combinat/root_system/reflection_group_element.pxd index 194688e25b6..218dd6c2575 100644 --- a/src/sage/combinat/root_system/reflection_group_element.pxd +++ b/src/sage/combinat/root_system/reflection_group_element.pxd @@ -1,11 +1,11 @@ from sage.groups.perm_gps.permgroup_element cimport PermutationGroupElement cdef class ComplexReflectionGroupElement(PermutationGroupElement): - cpdef action(self, vec, on_space=*) noexcept - cpdef action_on_root_indices(self, i) noexcept + cpdef action(self, vec, on_space=*) + cpdef action_on_root_indices(self, i) cdef class RealReflectionGroupElement(ComplexReflectionGroupElement): cpdef bint has_left_descent(self, i) noexcept cpdef bint has_descent(self, i, side=*, positive=*) noexcept - cpdef action(self, vec, side=*, on_space=*) noexcept - cpdef action_on_root_indices(self, i, side=*) noexcept + cpdef action(self, vec, side=*, on_space=*) + cpdef action_on_root_indices(self, i, side=*) diff --git a/src/sage/combinat/root_system/reflection_group_element.pyx b/src/sage/combinat/root_system/reflection_group_element.pyx index 680e40f16cd..3d81a84ff4b 100644 --- a/src/sage/combinat/root_system/reflection_group_element.pyx +++ b/src/sage/combinat/root_system/reflection_group_element.pyx @@ -348,7 +348,7 @@ cdef class ComplexReflectionGroupElement(PermutationGroupElement): mat.set_immutable() return mat - cpdef action(self, vec, on_space="primal") noexcept: + cpdef action(self, vec, on_space="primal"): r""" Return the image of ``vec`` under the action of ``self``. @@ -373,7 +373,7 @@ cdef class ComplexReflectionGroupElement(PermutationGroupElement): mat = self.matrix(on_space=on_space) return vec * mat - cpdef _act_on_(self, vec, bint self_on_left) noexcept: + cpdef _act_on_(self, vec, bint self_on_left): r""" Defines the action of ``self`` as a linear transformation on the vector space, in the basis given by the simple @@ -397,7 +397,7 @@ cdef class ComplexReflectionGroupElement(PermutationGroupElement): return (~self).action(vec) return self.action(vec) - cpdef action_on_root_indices(self, i) noexcept: + cpdef action_on_root_indices(self, i): """ Return the right action on the set of roots. @@ -959,7 +959,7 @@ cdef class RealReflectionGroupElement(ComplexReflectionGroupElement): matrix = to_matrix - cpdef action(self, vec, side="right", on_space="primal") noexcept: + cpdef action(self, vec, side="right", on_space="primal"): r""" Return the image of ``vec`` under the action of ``self``. @@ -1022,7 +1022,7 @@ cdef class RealReflectionGroupElement(ComplexReflectionGroupElement): else: raise ValueError('on_space must be "primal" or "dual"') - cpdef _act_on_(self, vec, bint self_on_left) noexcept: + cpdef _act_on_(self, vec, bint self_on_left): r""" Give the action of ``self`` as a linear transformation on the vector space, in the basis given by the simple roots. @@ -1054,7 +1054,7 @@ cdef class RealReflectionGroupElement(ComplexReflectionGroupElement): return self.action(vec, side="left") return self.action(vec, side="right") - cpdef action_on_root_indices(self, i, side="right") noexcept: + cpdef action_on_root_indices(self, i, side="right"): """ Return the action on the set of roots. diff --git a/src/sage/combinat/set_partition_iterator.pyx b/src/sage/combinat/set_partition_iterator.pyx index 7c9bc0eaaf5..ff7d2e7c6c3 100644 --- a/src/sage/combinat/set_partition_iterator.pyx +++ b/src/sage/combinat/set_partition_iterator.pyx @@ -7,7 +7,7 @@ cimport cython @cython.wraparound(False) @cython.boundscheck(False) -cdef list from_word(list w, list base_set) noexcept: +cdef list from_word(list w, list base_set): cdef list sp = [] cdef Py_ssize_t i cdef Py_ssize_t b diff --git a/src/sage/combinat/subword_complex_c.pyx b/src/sage/combinat/subword_complex_c.pyx index 31a985f8675..5b155efda75 100644 --- a/src/sage/combinat/subword_complex_c.pyx +++ b/src/sage/combinat/subword_complex_c.pyx @@ -63,7 +63,7 @@ cpdef int _flip_c(W, set positions, list extended_root_conf_indices, return j -cpdef list _construct_facets_c(tuple Q, w, int n=-1, int pos=0, int l=-1) noexcept: +cpdef list _construct_facets_c(tuple Q, w, int n=-1, int pos=0, int l=-1): r""" Return the list of facets of the subword complex associated to the word `Q` and the element `w` in a Coxeter group `W`. diff --git a/src/sage/combinat/words/word_char.pyx b/src/sage/combinat/words/word_char.pyx index b34bbad7c19..069f17fbcbc 100644 --- a/src/sage/combinat/words/word_char.pyx +++ b/src/sage/combinat/words/word_char.pyx @@ -100,7 +100,7 @@ cdef class WordDatatype_char(WordDatatype): @cython.boundscheck(False) # assume that indexing will not cause any IndexErrors @cython.wraparound(False) # not check not correctly handle negative indices - cdef _set_data(self, data) noexcept: + cdef _set_data(self, data): r""" set the attribute ._data and ._length from the sequence data (usually data is a word, a tuple or a list) @@ -209,7 +209,7 @@ cdef class WordDatatype_char(WordDatatype): bitset_free(seen) return res - cdef _new_c(self, unsigned char * data, size_t length, WordDatatype_char master) noexcept: + cdef _new_c(self, unsigned char * data, size_t length, WordDatatype_char master): r""" TO DISCUSS: in Integer (sage.rings.integer) this method is actually an external function. But we might want to have several possible inheritance. @@ -425,7 +425,7 @@ cdef class WordDatatype_char(WordDatatype): """ return reversed_word_iterator(self) - cdef _concatenate(self, WordDatatype_char other) noexcept: + cdef _concatenate(self, WordDatatype_char other): cdef unsigned char * data data = check_allocarray(self._length + other._length, sizeof(unsigned char)) diff --git a/src/sage/combinat/words/word_datatypes.pyx b/src/sage/combinat/words/word_datatypes.pyx index 9ab88d799ba..62132c64032 100644 --- a/src/sage/combinat/words/word_datatypes.pyx +++ b/src/sage/combinat/words/word_datatypes.pyx @@ -419,7 +419,7 @@ cdef class WordDatatype_str(WordDatatype): else: return a in self._data - cpdef _has_factor_naive(self, w) noexcept: + cpdef _has_factor_naive(self, w): r""" A naive test for testing whether the word contains ``w`` as a factor. @@ -449,7 +449,7 @@ cdef class WordDatatype_str(WordDatatype): return w in self._data raise ValueError - cpdef find(self, sub, start=0, end=None) noexcept: + cpdef find(self, sub, start=0, end=None): r""" Returns the index of the first occurrence of sub in self, such that sub is contained within self[start:end]. diff --git a/src/sage/cpython/getattr.pxd b/src/sage/cpython/getattr.pxd index 299509a00dc..e0987cfa4c5 100644 --- a/src/sage/cpython/getattr.pxd +++ b/src/sage/cpython/getattr.pxd @@ -5,4 +5,4 @@ cdef class AttributeErrorMessage: cdef public cls cdef public name -cpdef getattr_from_other_class(self, cls, name) noexcept +cpdef getattr_from_other_class(self, cls, name) diff --git a/src/sage/cpython/getattr.pyx b/src/sage/cpython/getattr.pyx index 5df2880d835..d8a5795c0c4 100644 --- a/src/sage/cpython/getattr.pyx +++ b/src/sage/cpython/getattr.pyx @@ -111,7 +111,7 @@ cdef class AttributeErrorMessage: cdef AttributeErrorMessage dummy_error_message = AttributeErrorMessage() -cpdef raw_getattr(obj, name) noexcept: +cpdef raw_getattr(obj, name): """ Like ``getattr(obj, name)`` but without invoking the binding behavior of descriptors under normal attribute access. @@ -227,7 +227,7 @@ cpdef raw_getattr(obj, name) noexcept: raise AttributeError(dummy_error_message) -cpdef getattr_from_other_class(self, cls, name) noexcept: +cpdef getattr_from_other_class(self, cls, name): """ Emulate ``getattr(self, name)``, as if ``self`` was an instance of ``cls``. diff --git a/src/sage/cpython/string.pxd b/src/sage/cpython/string.pxd index dbf1c91c08b..1fde0aec0de 100644 --- a/src/sage/cpython/string.pxd +++ b/src/sage/cpython/string.pxd @@ -13,7 +13,7 @@ cdef extern from "string_impl.h": bytes _str_to_bytes(s, encoding, errors) -cdef inline str char_to_str(const char* c, encoding=None, errors=None) noexcept: +cdef inline str char_to_str(const char* c, encoding=None, errors=None): r""" Convert a C string to a Python ``str``. """ @@ -23,7 +23,7 @@ cdef inline str char_to_str(const char* c, encoding=None, errors=None) noexcept: return _cstr_to_str(c, encoding, errors) -cpdef inline str bytes_to_str(b, encoding=None, errors=None) noexcept: +cpdef inline str bytes_to_str(b, encoding=None, errors=None): r""" Convert ``bytes`` to ``str``. @@ -49,7 +49,7 @@ cpdef inline str bytes_to_str(b, encoding=None, errors=None) noexcept: return _cstr_to_str(b, encoding, errors) -cpdef inline bytes str_to_bytes(s, encoding=None, errors=None) noexcept: +cpdef inline bytes str_to_bytes(s, encoding=None, errors=None): r""" Convert ``str`` or ``unicode`` to ``bytes``. diff --git a/src/sage/cpython/wrapperdescr.pxd b/src/sage/cpython/wrapperdescr.pxd index 2260c062f1f..b6775860710 100644 --- a/src/sage/cpython/wrapperdescr.pxd +++ b/src/sage/cpython/wrapperdescr.pxd @@ -24,7 +24,7 @@ cdef extern from *: PyDescr_NewWrapper(PyTypeObject* cls, wrapperbase* wrapper, void* wrapped) -cdef wrapperdescr_fastcall(wrapper_descriptor slotwrapper, self, args, kwds) noexcept +cdef wrapperdescr_fastcall(wrapper_descriptor slotwrapper, self, args, kwds) cdef inline wrapperbase* get_slotdef(wrapper_descriptor slotwrapper) except NULL: diff --git a/src/sage/cpython/wrapperdescr.pyx b/src/sage/cpython/wrapperdescr.pyx index 5738a87af46..776e4fe94a8 100644 --- a/src/sage/cpython/wrapperdescr.pyx +++ b/src/sage/cpython/wrapperdescr.pyx @@ -87,7 +87,7 @@ def wrapperdescr_call(slotwrapper, self, *args, **kwds): return wrapperdescr_fastcall(slotwrapper, self, args, kwds) -cdef wrapperdescr_fastcall(wrapper_descriptor slotwrapper, self, args, kwds) noexcept: +cdef wrapperdescr_fastcall(wrapper_descriptor slotwrapper, self, args, kwds): # Cython implementation of wrapperdescr_call cdef wrapperbase* slotdef = slotwrapper.d_base diff --git a/src/sage/crypto/boolean_function.pxd b/src/sage/crypto/boolean_function.pxd index d9fd1017fcd..5703943123c 100644 --- a/src/sage/crypto/boolean_function.pxd +++ b/src/sage/crypto/boolean_function.pxd @@ -6,4 +6,4 @@ cdef inline unsigned int hamming_weight(unsigned int x) noexcept: x *= 0x01010101UL return x>>24 -cdef walsh_hadamard(long *f, int ldn) noexcept +cdef walsh_hadamard(long *f, int ldn) diff --git a/src/sage/crypto/boolean_function.pyx b/src/sage/crypto/boolean_function.pyx index 6190129278f..70833c63dc3 100644 --- a/src/sage/crypto/boolean_function.pyx +++ b/src/sage/crypto/boolean_function.pyx @@ -51,7 +51,7 @@ except ImportError: # walsh_hadamard transform, reed_muller transform, and a lot # more, see 'Matters computational' available on www.jjj.de. -cdef walsh_hadamard(long *f, int ldn) noexcept: +cdef walsh_hadamard(long *f, int ldn): r""" The Walsh Hadamard transform is an orthogonal transform equivalent to a multidimensional discrete Fourier transform of size 2x2x...x2. @@ -109,7 +109,7 @@ cdef long yellow_code(unsigned long a) noexcept: m ^= (m<= 0 - cpdef list list(self) noexcept: + cpdef list list(self): """ Converts this bounded integer sequence to a list @@ -1236,7 +1236,7 @@ cdef class BoundedIntegerSequence: biseq_init_concat(out.data, myself.data, right.data) return out - cpdef BoundedIntegerSequence maximal_overlap(self, BoundedIntegerSequence other) noexcept: + cpdef BoundedIntegerSequence maximal_overlap(self, BoundedIntegerSequence other): """ Return ``self``'s maximal trailing sub-sequence that ``other`` starts with. @@ -1355,7 +1355,7 @@ cdef class BoundedIntegerSequence: return 0 return h -cpdef BoundedIntegerSequence NewBISEQ(tuple bitset_data, mp_bitcnt_t itembitsize, mp_size_t length) noexcept: +cpdef BoundedIntegerSequence NewBISEQ(tuple bitset_data, mp_bitcnt_t itembitsize, mp_size_t length): """ Helper function for unpickling of :class:`BoundedIntegerSequence`. diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds_helper.pyx b/src/sage/dynamics/arithmetic_dynamics/projective_ds_helper.pyx index 145c0533bb2..f05806f4935 100644 --- a/src/sage/dynamics/arithmetic_dynamics/projective_ds_helper.pyx +++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds_helper.pyx @@ -24,7 +24,7 @@ from sage.rings.finite_rings.finite_field_constructor import GF from sage.combinat.subset import subsets -cpdef _fast_possible_periods(self, return_points=False) noexcept: +cpdef _fast_possible_periods(self, return_points=False): r""" Return the list of possible minimal periods of a periodic point over `\QQ` and (optionally) a point in each cycle. @@ -199,7 +199,7 @@ cpdef int _hash(list Point, int prime) noexcept: return hash_q -cpdef list _get_point_from_hash(int value, int prime, int dimension) noexcept: +cpdef list _get_point_from_hash(int value, int prime, int dimension): """ Hash unique number to point as a list. @@ -241,7 +241,7 @@ cdef inline int _mod_inv(int num, int prime) noexcept: else: return y -cpdef _normalize_coordinates(list point, int prime, int len_points) noexcept: +cpdef _normalize_coordinates(list point, int prime, int len_points): """ Normalize the coordinates of the point for the given prime. @@ -270,7 +270,7 @@ cpdef _normalize_coordinates(list point, int prime, int len_points) noexcept: for coefficient in range(len_points): point[coefficient] = (point[coefficient] * mod_inverse) % prime -cpdef _all_periodic_points(self) noexcept: +cpdef _all_periodic_points(self): """ Find all periodic points over a finite field. diff --git a/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx b/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx index 32ffb1effe5..43ce0effd58 100644 --- a/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx +++ b/src/sage/dynamics/complex_dynamics/mandel_julia_helper.pyx @@ -61,7 +61,7 @@ def _color_to_RGB(color): cpdef fast_mandelbrot_plot(double x_center, double y_center, double image_width, long max_iteration, long pixel_count, - long level_sep, long color_num, base_color) noexcept: + long level_sep, long color_num, base_color): r""" Plots the Mandelbrot set in the complex plane for the map `Q_c(z) = z^2 + c`. @@ -179,7 +179,7 @@ cpdef fast_mandelbrot_plot(double x_center, double y_center, cpdef fast_external_ray(double theta, long D=30, long S=10, long R=100, - long pixel_count=500, double image_width=4, long prec=300) noexcept: + long pixel_count=500, double image_width=4, long prec=300): r""" Return a list of points that approximate the external ray for a given angle. @@ -290,7 +290,7 @@ cpdef fast_external_ray(double theta, long D=30, long S=10, long R=100, return c_list cpdef convert_to_pixels(point_list, double x_0, double y_0, double width, - long number_of_pixels) noexcept: + long number_of_pixels): r""" Converts cartesian coordinates to pixels within a specified window. @@ -334,7 +334,7 @@ cpdef convert_to_pixels(point_list, double x_0, double y_0, double width, pixel_list.append((x_pixel, y_pixel)) return pixel_list -cpdef get_line(start, end) noexcept: +cpdef get_line(start, end): r""" Produces a list of pixel coordinates approximating a line from a starting point to an ending point using the Bresenham's Line Algorithm. @@ -421,7 +421,7 @@ cpdef get_line(start, end) noexcept: cpdef fast_julia_plot(double c_real, double c_imag, double x_center=0, double y_center=0, double image_width=4, long max_iteration=500, long pixel_count=500, long level_sep=2, - long color_num=40, base_color=[50, 50, 50]) noexcept: + long color_num=40, base_color=[50, 50, 50]): r""" Plots the Julia set for a given `c` value in the complex plane for the map `Q_c(z) = z^2 + c`. @@ -540,7 +540,7 @@ cpdef fast_julia_plot(double c_real, double c_imag, cpdef julia_helper(double c_real, double c_imag, double x_center=0, double y_center=0, double image_width=4, long max_iteration=500, long pixel_count=500, long level_sep=2, long color_num=40, - base_color=[50, 50, 50], point_color=[255, 0, 0]) noexcept: + base_color=[50, 50, 50], point_color=[255, 0, 0]): r""" Helper function that returns the image of a Julia set for a given `c` value side by side with the Mandelbrot set with a point denoting @@ -631,7 +631,7 @@ cpdef julia_helper(double c_real, double c_imag, double x_center=0, cpdef polynomial_mandelbrot(f, parameter=None, double x_center=0, double y_center=0, image_width=4, int max_iteration=50, int pixel_count=500, - int level_sep=1, int color_num=30, base_color=Color('red')) noexcept: + int level_sep=1, int color_num=30, base_color=Color('red')): r""" Plots the Mandelbrot set in the complex plane for a family of polynomial maps. @@ -934,7 +934,7 @@ cpdef polynomial_mandelbrot(f, parameter=None, double x_center=0, cpdef general_julia(f, double x_center=0, double y_center=0, image_width=4, int max_iteration=50, int pixel_count=500, int level_sep=1, int color_num=30, - base_color=[50,50,50]) noexcept: + base_color=[50,50,50]): r""" Plots Julia sets for general polynomials. diff --git a/src/sage/ext/fast_callable.pyx b/src/sage/ext/fast_callable.pyx index a93799ab19a..b9072da61c5 100644 --- a/src/sage/ext/fast_callable.pyx +++ b/src/sage/ext/fast_callable.pyx @@ -1578,7 +1578,7 @@ cdef class ExpressionChoice(Expression): repr(self._cond), repr(self._iffalse)) -cpdef _expression_binop_helper(s, o, op) noexcept: +cpdef _expression_binop_helper(s, o, op): r""" Make an Expression for (s op o). Either s or o (or both) must already be an expression. @@ -1714,7 +1714,7 @@ class IntegerPowerFunction(): return x**self.exponent cdef dict builtin_functions = None -cpdef dict get_builtin_functions() noexcept: +cpdef dict get_builtin_functions(): r""" To handle ExpressionCall, we need to map from Sage and Python functions to opcode names. @@ -1768,7 +1768,7 @@ cpdef dict get_builtin_functions() noexcept: cdef class InstructionStream # forward declaration -cpdef generate_code(Expression expr, InstructionStream stream) noexcept: +cpdef generate_code(Expression expr, InstructionStream stream): r""" Generate code from an Expression tree; write the result into an InstructionStream. @@ -2192,7 +2192,7 @@ cdef class InstructionStream: """ self.instr0(opname, args) - cdef instr0(self, opname, tuple args) noexcept: + cdef instr0(self, opname, tuple args): """ Cdef version of instr. (Can't cpdef because of star args.) """ diff --git a/src/sage/ext/stdsage.pxd b/src/sage/ext/stdsage.pxd index 7249fbf84d8..ddd3fd76504 100644 --- a/src/sage/ext/stdsage.pxd +++ b/src/sage/ext/stdsage.pxd @@ -13,7 +13,7 @@ Standard C helper code for Cython modules from cpython.object cimport Py_TYPE, PyTypeObject, PyObject -cdef inline PY_NEW(type t) noexcept: +cdef inline PY_NEW(type t): """ Return ``t.__new__(t)``. This works even for types like :class:`Integer` where we change ``tp_new`` at runtime (Cython diff --git a/src/sage/functions/prime_pi.pyx b/src/sage/functions/prime_pi.pyx index 50be4d24a74..8dede094229 100644 --- a/src/sage/functions/prime_pi.pyx +++ b/src/sage/functions/prime_pi.pyx @@ -210,7 +210,7 @@ cdef class PrimePi(BuiltinFunction): prime_pi = PrimePi() -cpdef Integer legendre_phi(x, a) noexcept: +cpdef Integer legendre_phi(x, a): r""" Legendre's formula, also known as the partial sieve function, is a useful combinatorial function for computing the prime counting function (the diff --git a/src/sage/geometry/integral_points.pxi b/src/sage/geometry/integral_points.pxi index 5a10ebfe548..40f26e39d69 100644 --- a/src/sage/geometry/integral_points.pxi +++ b/src/sage/geometry/integral_points.pxi @@ -70,7 +70,7 @@ from sage.modules.free_module import FreeModule # existing lattice point and then copy it! -cpdef tuple parallelotope_points(spanning_points, lattice) noexcept: +cpdef tuple parallelotope_points(spanning_points, lattice): r""" Return integral points in the parallelotope starting at the origin and spanned by the ``spanning_points``. @@ -143,7 +143,7 @@ cpdef tuple parallelotope_points(spanning_points, lattice) noexcept: return points -cpdef tuple ray_matrix_normal_form(R) noexcept: +cpdef tuple ray_matrix_normal_form(R): r""" Compute the Smith normal form of the ray matrix for :func:`parallelotope_points`. @@ -179,7 +179,7 @@ cpdef tuple ray_matrix_normal_form(R) noexcept: # The optimized version avoids constructing new matrices, vectors, and lattice points cpdef tuple loop_over_parallelotope_points(e, d, MatrixClass VDinv, MatrixClass R, lattice, - A=None, b=None) noexcept: + A=None, b=None): r""" The inner loop of :func:`parallelotope_points`. @@ -244,7 +244,7 @@ cpdef tuple loop_over_parallelotope_points(e, d, MatrixClass VDinv, ############################################################################## -cpdef tuple simplex_points(vertices) noexcept: +cpdef tuple simplex_points(vertices): r""" Return the integral points in a lattice simplex. @@ -329,7 +329,7 @@ cpdef tuple simplex_points(vertices) noexcept: return points -cdef translate_points(v_list, VectorClass delta) noexcept: +cdef translate_points(v_list, VectorClass delta): r""" Add ``delta`` to each vector in ``v_list``. """ @@ -348,7 +348,7 @@ cdef translate_points(v_list, VectorClass delta) noexcept: cpdef rectangular_box_points(list box_min, list box_max, polyhedron=None, count_only=False, - return_saturated=False) noexcept: + return_saturated=False): r""" Return the integral points in the lattice bounding box that are also contained in the given polyhedron. @@ -583,7 +583,7 @@ cpdef rectangular_box_points(list box_min, list box_max, return tuple(points) -cdef list perm_action(list p, list lst) noexcept: +cdef list perm_action(list p, list lst): """ Return the action of a permutation ``p`` of `(0, ..., n-1)` on a list of length `n`. @@ -592,7 +592,7 @@ cdef list perm_action(list p, list lst) noexcept: cdef loop_over_rectangular_box_points(list box_min, list box_max, InequalityCollection inequalities, - int d, bint count_only) noexcept: + int d, bint count_only): """ The inner loop of :func:`rectangular_box_points`. @@ -666,7 +666,7 @@ cdef loop_over_rectangular_box_points(list box_min, list box_max, cdef loop_over_rectangular_box_points_saturated(list box_min, list box_max, InequalityCollection inequalities, - int d) noexcept: + int d): """ The analog of :func:`rectangular_box_points` except that it keeps track of which inequalities are saturated. @@ -790,7 +790,7 @@ cdef class Inequality_generic: s += ') x + ' + str(self.b) + ' >= 0' return s - cdef prepare_next_to_inner_loop(self, p) noexcept: + cdef prepare_next_to_inner_loop(self, p): """ In :class:`Inequality_int` this method is used to peel of the next-to-inner loop. @@ -799,7 +799,7 @@ cdef class Inequality_generic: """ pass - cdef prepare_inner_loop(self, p) noexcept: + cdef prepare_inner_loop(self, p): """ Peel off the inner loop. @@ -956,7 +956,7 @@ cdef class Inequality_int: s += ') x + ' + str(self.b) + ' >= 0' return s - cdef prepare_next_to_inner_loop(Inequality_int self, p) noexcept: + cdef prepare_next_to_inner_loop(Inequality_int self, p): """ Peel off the next-to-inner loop. @@ -967,7 +967,7 @@ cdef class Inequality_int: for j in range(2, self.dim): self.cache_next += self.A[j] * p[j] - cdef prepare_inner_loop(Inequality_int self, p) noexcept: + cdef prepare_inner_loop(Inequality_int self, p): """ Peel off the inner loop. @@ -1054,7 +1054,7 @@ cdef class InequalityCollection: s += str(ineq) + '\n' return s.strip() - cpdef tuple _make_A_b(self, Hrep_obj, list permutation) noexcept: + cpdef tuple _make_A_b(self, Hrep_obj, list permutation): r""" Return the coefficients and constant of the H-representation object. @@ -1124,7 +1124,7 @@ cdef class InequalityCollection: raise TypeError('Cannot extract Hrepresentation data from polyhedron.') cdef _cinit_from_PPL(self, list max_abs_coordinates, list permutation, - polyhedron) noexcept: + polyhedron): """ Initialize the inequalities from a PPL C_Polyhedron @@ -1173,7 +1173,7 @@ cdef class InequalityCollection: self.ineqs_generic.append(H) cdef _cinit_from_Polyhedron(self, list max_abs_coordinates, - list permutation, polyhedron) noexcept: + list permutation, polyhedron): """ Initialize the inequalities from a Sage Polyhedron @@ -1225,7 +1225,7 @@ cdef class InequalityCollection: H = Inequality_generic(A, b, Hrep_obj.index()) self.ineqs_generic.append(H) - cpdef prepare_next_to_inner_loop(self, p) noexcept: + cpdef prepare_next_to_inner_loop(self, p): r""" Peel off the next-to-inner loop. @@ -1263,7 +1263,7 @@ cdef class InequalityCollection: for ineq in self.ineqs_generic: (ineq).prepare_next_to_inner_loop(p) - cpdef prepare_inner_loop(self, p) noexcept: + cpdef prepare_inner_loop(self, p): r""" Peel off the inner loop. @@ -1302,7 +1302,7 @@ cdef class InequalityCollection: for ineq in self.ineqs_generic: (ineq).prepare_inner_loop(p) - cpdef swap_ineq_to_front(self, int i) noexcept: + cpdef swap_ineq_to_front(self, int i): r""" Swap the ``i``-th entry of the list to the front of the list of inequalities. @@ -1377,7 +1377,7 @@ cdef class InequalityCollection: return False return True - cpdef frozenset satisfied_as_equalities(self, inner_loop_variable) noexcept: + cpdef frozenset satisfied_as_equalities(self, inner_loop_variable): """ Return the inequalities (by their index) that are satisfied as equalities. @@ -1423,7 +1423,7 @@ cdef class InequalityCollection: -cpdef print_cache(InequalityCollection inequality_collection) noexcept: +cpdef print_cache(InequalityCollection inequality_collection): r""" Print the cached values in :class:`Inequality_int` (for debugging/doctesting only). diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd index 3506aab65bb..a04a1186876 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pxd @@ -31,34 +31,34 @@ cdef class CombinatorialPolyhedron(SageObject): cdef ListOfPairs _face_lattice_incidences # stores incidences in Hasse diagram labeled indices of the faces cdef PolyhedronFaceLattice _all_faces # class to generate Hasse diagram incidences - cdef tuple Vrep(self) noexcept - cdef tuple facet_names(self) noexcept - cdef tuple equations(self) noexcept - cdef tuple equalities(self) noexcept + cdef tuple Vrep(self) + cdef tuple facet_names(self) + cdef tuple equations(self) + cdef tuple equalities(self) cdef unsigned int n_Vrepresentation(self) noexcept cdef unsigned int n_Hrepresentation(self) noexcept cdef bint is_bounded(self) noexcept - cdef ListOfFaces bitrep_facets(self) noexcept - cdef ListOfFaces bitrep_Vrep(self) noexcept - cdef tuple far_face_tuple(self) noexcept + cdef ListOfFaces bitrep_facets(self) + cdef ListOfFaces bitrep_Vrep(self) + cdef tuple far_face_tuple(self) cdef int _algorithm_to_dual(self, algorithm) except -2 # Methods to initialize the combinatorial polyhedron. - cdef _init_from_polyhedron(self, data) noexcept - cdef _init_from_lattice_polytope(self, data) noexcept - cdef _init_from_cone(self, data) noexcept - cdef _init_facet_names(self, facets) noexcept - cdef _init_from_incidence_matrix(self, data) noexcept - cdef _init_from_list_of_facets(self, data) noexcept - cdef _init_from_ListOfFaces(self, ListOfFaces facets, ListOfFaces Vrep) noexcept - cdef _initialize_far_face(self) noexcept - cdef _init_as_trivial_polyhedron(self, int dimension) noexcept + cdef _init_from_polyhedron(self, data) + cdef _init_from_lattice_polytope(self, data) + cdef _init_from_cone(self, data) + cdef _init_facet_names(self, facets) + cdef _init_from_incidence_matrix(self, data) + cdef _init_from_list_of_facets(self, data) + cdef _init_from_ListOfFaces(self, ListOfFaces facets, ListOfFaces Vrep) + cdef _initialize_far_face(self) + cdef _init_as_trivial_polyhedron(self, int dimension) # Methods to obtain a different combinatorial polyhedron. - cpdef CombinatorialPolyhedron dual(self) noexcept - cpdef CombinatorialPolyhedron pyramid(self, new_vertex=*, new_facet=*) noexcept + cpdef CombinatorialPolyhedron dual(self) + cpdef CombinatorialPolyhedron pyramid(self, new_vertex=*, new_facet=*) - cdef FaceIterator _face_iter(self, bint dual, int dimension) noexcept + cdef FaceIterator _face_iter(self, bint dual, int dimension) cdef int _compute_f_vector(self, size_t num_threads, size_t parallelization_depth, int dual) except -1 cdef int _persist_f_vector(self, size_t* input_f_vector, bint input_is_reversed) except -1 diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx index 8d9d0567100..367049b9fc0 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/base.pyx @@ -397,7 +397,7 @@ cdef class CombinatorialPolyhedron(SageObject): else: self._init_from_list_of_facets(data) - cdef _init_from_polyhedron(self, data) noexcept: + cdef _init_from_polyhedron(self, data): r''' Initialize from :class:`~sage.geometry.polyhedron.parent.Polyhedron_base`. ''' @@ -414,7 +414,7 @@ cdef class CombinatorialPolyhedron(SageObject): return self._init_from_incidence_matrix(data.incidence_matrix()) - cdef _init_from_lattice_polytope(self, data) noexcept: + cdef _init_from_lattice_polytope(self, data): r''' Initialize from :class:`~sage.geometry.lattice_polytope.LatticePolytopeClass`. ''' @@ -424,7 +424,7 @@ cdef class CombinatorialPolyhedron(SageObject): self._dimension = data.dimension() return self._init_from_incidence_matrix(data.incidence_matrix()) - cdef _init_from_cone(self, data) noexcept: + cdef _init_from_cone(self, data): r''' Initialize from :class:`~sage.geometry.cone.ConvexRationalPolyhedralCone`. ''' @@ -439,7 +439,7 @@ cdef class CombinatorialPolyhedron(SageObject): + [[ZZ.one() for _ in range(len(data.facet_normals()))]]) return self._init_from_incidence_matrix(incidence_matrix) - cdef _init_facet_names(self, facets) noexcept: + cdef _init_facet_names(self, facets): ''' Store facet names and compute equations. ''' @@ -460,7 +460,7 @@ cdef class CombinatorialPolyhedron(SageObject): else: self._facet_names = None - cdef _init_from_incidence_matrix(self, data) noexcept: + cdef _init_from_incidence_matrix(self, data): """ Initialize from an incidence matrix. """ @@ -496,7 +496,7 @@ cdef class CombinatorialPolyhedron(SageObject): self._initialize_far_face() - cdef _init_from_list_of_facets(self, data) noexcept: + cdef _init_from_list_of_facets(self, data): """ Initialize from a list of facets. @@ -541,7 +541,7 @@ cdef class CombinatorialPolyhedron(SageObject): self._initialize_far_face() - cdef _init_from_ListOfFaces(self, ListOfFaces facets, ListOfFaces Vrep) noexcept: + cdef _init_from_ListOfFaces(self, ListOfFaces facets, ListOfFaces Vrep): """ Initialize self from two ``ListOfFaces``. """ @@ -554,7 +554,7 @@ cdef class CombinatorialPolyhedron(SageObject): self._initialize_far_face() - cdef _initialize_far_face(self) noexcept: + cdef _initialize_far_face(self): """ Initialize far_face if unbounded. """ @@ -562,7 +562,7 @@ cdef class CombinatorialPolyhedron(SageObject): face_init(self._far_face, self.bitrep_facets().n_atoms(), self._n_facets) Vrep_list_to_bit_rep(tuple(self._far_face_tuple), self._far_face) - cdef _init_as_trivial_polyhedron(self, int dimension) noexcept: + cdef _init_as_trivial_polyhedron(self, int dimension): """ Initialize polyhedron equal to its affine hull. """ @@ -2801,7 +2801,7 @@ cdef class CombinatorialPolyhedron(SageObject): face_iter = face_generator - cdef FaceIterator _face_iter(self, bint dual, int dimension) noexcept: + cdef FaceIterator _face_iter(self, bint dual, int dimension): r""" A method to obtain the FaceIterator as Cython object. @@ -3251,13 +3251,13 @@ cdef class CombinatorialPolyhedron(SageObject): tester.assertTrue(all(j in f.ambient_V_indices() for f in b)) tester.assertTrue(all(i in f.ambient_H_indices() for f in b)) - cdef tuple Vrep(self) noexcept: + cdef tuple Vrep(self): r""" Return the names of the Vrepresentation, if they exist. Else return ``None``. """ return self._Vrep - cdef tuple facet_names(self) noexcept: + cdef tuple facet_names(self): r""" Return the names Hrepresentatives, which are facets. @@ -3265,7 +3265,7 @@ cdef class CombinatorialPolyhedron(SageObject): """ return self._facet_names - cdef tuple equations(self) noexcept: + cdef tuple equations(self): r""" Return the names of the equations. @@ -3273,7 +3273,7 @@ cdef class CombinatorialPolyhedron(SageObject): """ return self._equations - cdef tuple equalities(self) noexcept: + cdef tuple equalities(self): from sage.misc.superseded import deprecation deprecation(31834, "the method equalities of CombinatorialPolyhedron is deprecated; use equations", 3) return self.equations() @@ -3317,19 +3317,19 @@ cdef class CombinatorialPolyhedron(SageObject): """ return self._bounded - cdef ListOfFaces bitrep_facets(self) noexcept: + cdef ListOfFaces bitrep_facets(self): r""" Return the facets in bit representation. """ return self._bitrep_facets - cdef ListOfFaces bitrep_Vrep(self) noexcept: + cdef ListOfFaces bitrep_Vrep(self): r""" Return the Vrepresentations in bit representation. """ return self._bitrep_Vrep - cdef tuple far_face_tuple(self) noexcept: + cdef tuple far_face_tuple(self): r""" Return the far face as it was given on initialization. """ @@ -3352,7 +3352,7 @@ cdef class CombinatorialPolyhedron(SageObject): # Methods to obtain a different combinatorial polyhedron. - cpdef CombinatorialPolyhedron dual(self) noexcept: + cpdef CombinatorialPolyhedron dual(self): r""" Return the dual/polar of self. @@ -3395,7 +3395,7 @@ cdef class CombinatorialPolyhedron(SageObject): polar = dual - cpdef CombinatorialPolyhedron pyramid(self, new_vertex=None, new_facet=None) noexcept: + cpdef CombinatorialPolyhedron pyramid(self, new_vertex=None, new_facet=None): r""" Return the pyramid of ``self``. diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd index afc01904da2..f39284ace68 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pxd @@ -32,7 +32,7 @@ cdef class CombinatorialFace(SageObject): # If ``dual == 0``, then coatoms are facets, atoms vertices and vice versa. cdef ListOfFaces atoms, coatoms - cpdef dimension(self) noexcept + cpdef dimension(self) cdef size_t n_atom_rep(self) except -1 cdef size_t set_coatom_rep(self) except -1 cdef size_t set_atom_rep(self) except -1 diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx index 81dc7c269db..fb780e29353 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/combinatorial_face.pyx @@ -497,7 +497,7 @@ cdef class CombinatorialFace(SageObject): else: raise NotImplementedError("is_subface only implemented for faces of the same polyhedron") - cpdef dimension(self) noexcept: + cpdef dimension(self): r""" Return the dimension of the face. diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd index 87e3e87c1c6..3c015973dd1 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pxd @@ -70,7 +70,7 @@ cdef class FaceIterator_base(SageObject): # If ``dual == 0``, then coatoms are facets, atoms vertices and vice versa. cdef ListOfFaces atoms, coatoms, coatoms_coatom_rep - cdef inline CombinatorialFace next_face(self) noexcept + cdef inline CombinatorialFace next_face(self) cdef inline int next_dimension(self) except -1 cdef inline int next_face_loop(self) except -1 cdef size_t n_atom_rep(self) except -1 diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx index 76227cfe3cf..ca5634d31a7 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/face_iterator.pyx @@ -1199,7 +1199,7 @@ cdef class FaceIterator_base(SageObject): # for the dimension. By this time the current dimension has changed. self.structure.highest_dimension = self.structure.current_dimension - 1 - cdef inline CombinatorialFace next_face(self) noexcept: + cdef inline CombinatorialFace next_face(self): r""" Set attribute ``face`` to the next face and return it as :class:`sage.geometry.polyhedron.combinatorial_polyhedron.combinatorial_face.CombinatorialFace`. diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pxd b/src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pxd index c660240fbc4..62ba5b987cf 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pxd +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pxd @@ -8,7 +8,7 @@ cdef class ListOfFaces: # It will be of "type" ``uint64_t[n_faces][face_length]`` cdef face_list_t data - cpdef ListOfFaces __copy__(self) noexcept + cpdef ListOfFaces __copy__(self) cpdef int compute_dimension(self) except -2 @@ -19,12 +19,12 @@ cdef class ListOfFaces: cdef inline size_t n_coatoms(self) noexcept: return self.data.n_coatoms - cpdef ListOfFaces pyramid(self) noexcept + cpdef ListOfFaces pyramid(self) - cdef ListOfFaces delete_atoms_unsafe(self, bint* delete, face_t face) noexcept # not in place + cdef ListOfFaces delete_atoms_unsafe(self, bint* delete, face_t face) # not in place cdef void delete_faces_unsafe(self, bint* delete, face_t face) noexcept # in place cdef void get_not_inclusion_maximal_unsafe(self, bint *not_inclusion_maximal) noexcept cdef void get_faces_all_set_unsafe(self, bint *all_set) noexcept -cdef tuple face_as_combinatorial_polyhedron(ListOfFaces facets, ListOfFaces Vrep, face_t face, bint dual) noexcept +cdef tuple face_as_combinatorial_polyhedron(ListOfFaces facets, ListOfFaces Vrep, face_t face, bint dual) diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx index cd7b7316a43..468347f5256 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/list_of_faces.pyx @@ -178,7 +178,7 @@ cdef class ListOfFaces: """ assert face_list_check_alignment(self.data) - cpdef ListOfFaces __copy__(self) noexcept: + cpdef ListOfFaces __copy__(self): r""" Return a copy of self. @@ -303,7 +303,7 @@ cdef class ListOfFaces: # by calculating dimension of one of its faces. return new_faces.compute_dimension() + 1 - cpdef ListOfFaces pyramid(self) noexcept: + cpdef ListOfFaces pyramid(self): r""" Return the list of faces of the pyramid. @@ -381,7 +381,7 @@ cdef class ListOfFaces: return copy - cdef ListOfFaces delete_atoms_unsafe(self, bint *delete, face_t face) noexcept: + cdef ListOfFaces delete_atoms_unsafe(self, bint *delete, face_t face): r""" Return a copy of ``self`` where bits in ``delete`` have been removed/contracted. @@ -518,7 +518,7 @@ cdef class ListOfFaces: M.set_immutable() return M -cdef tuple face_as_combinatorial_polyhedron(ListOfFaces facets, ListOfFaces Vrep, face_t face, bint dual) noexcept: +cdef tuple face_as_combinatorial_polyhedron(ListOfFaces facets, ListOfFaces Vrep, face_t face, bint dual): r""" Obtain facets and Vrepresentation of ``face`` as new combinatorial polyhedron. diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd b/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd index afe956672ff..824b832f238 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pxd @@ -41,7 +41,7 @@ cdef class PolyhedronFaceLattice: cdef int _sort(self) except -1 cdef inline size_t find_face(self, int dimension, face_t face) except -2 - cpdef CombinatorialFace get_face(self, int dimension, size_t index) noexcept + cpdef CombinatorialFace get_face(self, int dimension, size_t index) cdef size_t set_coatom_rep(self, int dimension, size_t index) except -1 cdef size_t set_atom_rep(self, int dimension, size_t index) except -1 cdef void incidence_init(self, int dimension_one, int dimension_two) noexcept diff --git a/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx b/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx index 5a2c31f6453..d0064795fa5 100644 --- a/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx +++ b/src/sage/geometry/polyhedron/combinatorial_polyhedron/polyhedron_face_lattice.pyx @@ -313,7 +313,7 @@ cdef class PolyhedronFaceLattice: return find_face(face, self.faces[dimension+1]) - cpdef CombinatorialFace get_face(self, int dimension, size_t index) noexcept: + cpdef CombinatorialFace get_face(self, int dimension, size_t index): r""" Return the face of dimension ``dimension`` and index ``index``. diff --git a/src/sage/geometry/toric_lattice_element.pyx b/src/sage/geometry/toric_lattice_element.pyx index 60782a805f4..8a2f87762eb 100644 --- a/src/sage/geometry/toric_lattice_element.pyx +++ b/src/sage/geometry/toric_lattice_element.pyx @@ -223,7 +223,7 @@ cdef class ToricLatticeElement(Vector_integer_dense): """ return Vector_integer_dense.__hash__(self) - cpdef _act_on_(self, other, bint self_on_left) noexcept: + cpdef _act_on_(self, other, bint self_on_left): """ Act on ``other``. @@ -298,7 +298,7 @@ cdef class ToricLatticeElement(Vector_integer_dense): # We need to override this function to prohibit default behaviour. # It seems to be called when right is in the same lattice as self, which # is wrong from our point of view. - cpdef _dot_product_(self, Vector right) noexcept: + cpdef _dot_product_(self, Vector right): """ Raise a :class:`TypeError` exception. diff --git a/src/sage/geometry/triangulation/base.pyx b/src/sage/geometry/triangulation/base.pyx index 3161d19afba..cb9cb948256 100644 --- a/src/sage/geometry/triangulation/base.pyx +++ b/src/sage/geometry/triangulation/base.pyx @@ -109,7 +109,7 @@ cdef class Point(SageObject): """ return hash(self._point_configuration) ^ (self._index) - cpdef point_configuration(self) noexcept: + cpdef point_configuration(self): r""" Return the point configuration to which the point belongs. @@ -158,7 +158,7 @@ cdef class Point(SageObject): """ return len(self._affine) - cpdef index(self) noexcept: + cpdef index(self): """ Return the index of the point in the point configuration. @@ -172,7 +172,7 @@ cdef class Point(SageObject): """ return self._index - cpdef projective(self) noexcept: + cpdef projective(self): r""" Return the projective coordinates of the point in the ambient space. @@ -198,7 +198,7 @@ cdef class Point(SageObject): """ return self._projective - cpdef affine(self) noexcept: + cpdef affine(self): r""" Return the affine coordinates of the point in the ambient space. @@ -224,7 +224,7 @@ cdef class Point(SageObject): """ return self._affine - cpdef reduced_affine(self) noexcept: + cpdef reduced_affine(self): r""" Return the affine coordinates of the point on the hyperplane spanned by the point configuration. @@ -251,7 +251,7 @@ cdef class Point(SageObject): """ return self._reduced_affine - cpdef reduced_projective(self) noexcept: + cpdef reduced_projective(self): r""" Return the projective coordinates of the point on the hyperplane spanned by the point configuration. @@ -278,7 +278,7 @@ cdef class Point(SageObject): """ return tuple(self._reduced_affine)+(1,) - cpdef reduced_affine_vector(self) noexcept: + cpdef reduced_affine_vector(self): """ Return the affine coordinates of the point on the hyperplane spanned by the point configuration. @@ -305,7 +305,7 @@ cdef class Point(SageObject): """ return self._reduced_affine_vector - cpdef reduced_projective_vector(self) noexcept: + cpdef reduced_projective_vector(self): """ Return the affine coordinates of the point on the hyperplane spanned by the point configuration. @@ -334,7 +334,7 @@ cdef class Point(SageObject): """ return self._reduced_projective_vector - cpdef _repr_(self) noexcept: + cpdef _repr_(self): """ Return a string representation of the point. @@ -396,7 +396,7 @@ cdef class PointConfiguration_base(Parent): cdef bint _is_affine cdef object _reduced_affine_vector_space, _reduced_projective_vector_space - cdef _init_points(self, tuple projective_points) noexcept: + cdef _init_points(self, tuple projective_points): """ Internal method to determine coordinates of points. @@ -466,7 +466,7 @@ cdef class PointConfiguration_base(Parent): """ return hash_by_id( self) - cpdef reduced_affine_vector_space(self) noexcept: + cpdef reduced_affine_vector_space(self): """ Return the vector space that contains the affine points. @@ -486,7 +486,7 @@ cdef class PointConfiguration_base(Parent): """ return self._reduced_affine_vector_space - cpdef reduced_projective_vector_space(self) noexcept: + cpdef reduced_projective_vector_space(self): """ Return the vector space that is spanned by the homogeneous coordinates. @@ -507,7 +507,7 @@ cdef class PointConfiguration_base(Parent): """ return self._reduced_projective_vector_space - cpdef ambient_dim(self) noexcept: + cpdef ambient_dim(self): """ Return the dimension of the ambient space of the point configuration. @@ -524,7 +524,7 @@ cdef class PointConfiguration_base(Parent): """ return self._ambient_dim - cpdef dim(self) noexcept: + cpdef dim(self): """ Return the actual dimension of the point configuration. @@ -540,7 +540,7 @@ cdef class PointConfiguration_base(Parent): """ return self._dim - cpdef base_ring(self) noexcept: + cpdef base_ring(self): r""" Return the base ring, that is, the ring containing the coordinates of the points. @@ -632,7 +632,7 @@ cdef class PointConfiguration_base(Parent): """ return self._pts[i] - cpdef n_points(self) noexcept: + cpdef n_points(self): """ Return the number of points. @@ -653,7 +653,7 @@ cdef class PointConfiguration_base(Parent): """ return len(self._pts) - cpdef points(self) noexcept: + cpdef points(self): """ Return a list of the points. @@ -731,7 +731,7 @@ cdef class PointConfiguration_base(Parent): """ return len(self._pts) - cpdef simplex_to_int(self, simplex) noexcept: + cpdef simplex_to_int(self, simplex): r""" Return an integer that uniquely identifies the given simplex. @@ -776,7 +776,7 @@ cdef class PointConfiguration_base(Parent): k = l+1 return s - cpdef int_to_simplex(self, int s) noexcept: + cpdef int_to_simplex(self, int s): r""" Reverse the enumeration of possible simplices in :meth:`simplex_to_int`. diff --git a/src/sage/graphs/asteroidal_triples.pyx b/src/sage/graphs/asteroidal_triples.pyx index fc5cc3ff09b..d2423c912e3 100644 --- a/src/sage/graphs/asteroidal_triples.pyx +++ b/src/sage/graphs/asteroidal_triples.pyx @@ -184,7 +184,7 @@ cdef list is_asteroidal_triple_free_C(uint32_t n, short_digraph sd, uint32_t** connected_structure, uint32_t* waiting_list, - bitset_t seen) noexcept: + bitset_t seen): """ INPUT: diff --git a/src/sage/graphs/base/boost_graph.pyx b/src/sage/graphs/base/boost_graph.pyx index 8856da5a165..b4474a96bd6 100644 --- a/src/sage/graphs/base/boost_graph.pyx +++ b/src/sage/graphs/base/boost_graph.pyx @@ -55,7 +55,7 @@ from libcpp.set cimport set as cset from libcpp.pair cimport pair -cdef boost_graph_from_sage_graph(BoostGenGraph *g, g_sage, vertex_to_int, reverse=False) noexcept: +cdef boost_graph_from_sage_graph(BoostGenGraph *g, g_sage, vertex_to_int, reverse=False): r""" Initialize the Boost graph ``g`` to be equal to ``g_sage``. @@ -98,7 +98,7 @@ cdef boost_weighted_graph_from_sage_graph(BoostWeightedGraph *g, g_sage, vertex_to_int, weight_function=None, - reverse=False) noexcept: + reverse=False): r""" Initialize the Boost weighted graph ``g`` to be equal to ``g_sage``. @@ -169,7 +169,7 @@ cdef boost_weighted_graph_from_sage_graph(BoostWeightedGraph *g, g.add_edge(vertex_to_int[u], vertex_to_int[v], 1) -cdef boost_edge_connectivity(BoostVecGenGraph *g) noexcept: +cdef boost_edge_connectivity(BoostVecGenGraph *g): r""" Compute the edge connectivity of the input Boost graph. @@ -189,7 +189,7 @@ cdef boost_edge_connectivity(BoostVecGenGraph *g) noexcept: return (result.ec, edges) -cpdef edge_connectivity(g) noexcept: +cpdef edge_connectivity(g): r""" Compute the edge connectivity of the input graph, using Boost. @@ -244,7 +244,7 @@ cpdef edge_connectivity(g) noexcept: return (ec, [(int_to_vertex[u], int_to_vertex[v]) for u, v in edges]) -cdef boost_clustering_coeff(BoostGenGraph *g, vertices) noexcept: +cdef boost_clustering_coeff(BoostGenGraph *g, vertices): r""" Compute the clustering coefficient of all vertices in the list provided. @@ -276,7 +276,7 @@ cdef boost_clustering_coeff(BoostGenGraph *g, vertices) noexcept: return ((sum(clust_of_v.itervalues()) / len(clust_of_v)), clust_of_v) -cpdef clustering_coeff(g, vertices=None) noexcept: +cpdef clustering_coeff(g, vertices=None): r""" Compute the clustering coefficient of the input graph, using Boost. @@ -343,7 +343,7 @@ cpdef clustering_coeff(g, vertices=None) noexcept: @cython.binding(True) -cpdef dominator_tree(g, root, return_dict=False, reverse=False) noexcept: +cpdef dominator_tree(g, root, return_dict=False, reverse=False): r""" Use Boost to compute the dominator tree of ``g``, rooted at ``root``. @@ -500,7 +500,7 @@ cpdef dominator_tree(g, root, return_dict=False, reverse=False) noexcept: return Graph(edges) -cpdef bandwidth_heuristics(g, algorithm='cuthill_mckee') noexcept: +cpdef bandwidth_heuristics(g, algorithm='cuthill_mckee'): r""" Use Boost heuristics to approximate the bandwidth of the input graph. @@ -621,7 +621,7 @@ cpdef bandwidth_heuristics(g, algorithm='cuthill_mckee') noexcept: cpdef min_spanning_tree(g, weight_function=None, - algorithm='Kruskal') noexcept: + algorithm='Kruskal'): r""" Use Boost to compute the minimum spanning tree of the input graph. @@ -746,7 +746,7 @@ cpdef min_spanning_tree(g, return [(u, v, g.edge_label(u, v)) for u, v in edges] -cpdef blocks_and_cut_vertices(g) noexcept: +cpdef blocks_and_cut_vertices(g): r""" Compute the blocks and cut vertices of the graph. @@ -841,7 +841,7 @@ cpdef blocks_and_cut_vertices(g) noexcept: return (result_blocks, list(result_cut)) -cpdef shortest_paths(g, start, weight_function=None, algorithm=None) noexcept: +cpdef shortest_paths(g, start, weight_function=None, algorithm=None): r""" Compute the shortest paths from ``start`` to all other vertices. @@ -1039,7 +1039,7 @@ cpdef shortest_paths(g, start, weight_function=None, algorithm=None) noexcept: return (dist, pred) -cdef get_predecessors(BoostWeightedGraph g, result, int_to_v, directed, weight_type) noexcept: +cdef get_predecessors(BoostWeightedGraph g, result, int_to_v, directed, weight_type): r""" Return the predecessor matrix from the distance matrix of the graph. @@ -1096,7 +1096,7 @@ cdef get_predecessors(BoostWeightedGraph g, result, int_to_v, directed, weight_t return pred -cpdef johnson_shortest_paths(g, weight_function=None, distances=True, predecessors=False) noexcept: +cpdef johnson_shortest_paths(g, weight_function=None, distances=True, predecessors=False): r""" Use Johnson algorithm to solve the all-pairs-shortest-paths. @@ -1251,7 +1251,7 @@ cpdef johnson_shortest_paths(g, weight_function=None, distances=True, predecesso return pred -cpdef floyd_warshall_shortest_paths(g, weight_function=None, distances=True, predecessors=False) noexcept: +cpdef floyd_warshall_shortest_paths(g, weight_function=None, distances=True, predecessors=False): r""" Use Floyd-Warshall algorithm to solve the all-pairs-shortest-paths. @@ -1407,7 +1407,7 @@ cpdef floyd_warshall_shortest_paths(g, weight_function=None, distances=True, pre return pred -cpdef johnson_closeness_centrality(g, weight_function=None) noexcept: +cpdef johnson_closeness_centrality(g, weight_function=None): r""" Use Johnson algorithm to compute the closeness centrality of all vertices. @@ -1512,7 +1512,7 @@ cpdef johnson_closeness_centrality(g, weight_function=None) noexcept: return {v: closeness[i] for i, v in enumerate(int_to_v) if closeness[i] != sys.float_info.max} -cpdef min_cycle_basis(g_sage, weight_function=None, by_weight=False) noexcept: +cpdef min_cycle_basis(g_sage, weight_function=None, by_weight=False): r""" Return a minimum weight cycle basis of the input graph ``g_sage``. @@ -1631,7 +1631,7 @@ cpdef min_cycle_basis(g_sage, weight_function=None, by_weight=False) noexcept: return cycle_basis -cpdef eccentricity_DHV(g, vertex_list=None, weight_function=None, check_weight=True) noexcept: +cpdef eccentricity_DHV(g, vertex_list=None, weight_function=None, check_weight=True): r""" Return the vector of eccentricities using the algorithm of [Dragan2018]_. @@ -1819,7 +1819,7 @@ cpdef eccentricity_DHV(g, vertex_list=None, weight_function=None, check_weight=T return eccentricity -cpdef radius_DHV(g, weight_function=None, check_weight=True) noexcept: +cpdef radius_DHV(g, weight_function=None, check_weight=True): r""" Return the radius of weighted graph `g`. @@ -1956,7 +1956,7 @@ cpdef radius_DHV(g, weight_function=None, check_weight=True) noexcept: return UB -cpdef diameter_DHV(g, weight_function=None, check_weight=True) noexcept: +cpdef diameter_DHV(g, weight_function=None, check_weight=True): r""" Return the diameter of weighted graph `g`. @@ -2129,7 +2129,7 @@ cpdef diameter_DHV(g, weight_function=None, check_weight=True) noexcept: cdef tuple diameter_lower_bound_2Dsweep(BoostVecWeightedDiGraphU g_boost, BoostVecWeightedDiGraphU rev_g_boost, v_index source, - str algorithm) noexcept: + str algorithm): r""" Return a lower bound on the diameter of `G`. @@ -2490,7 +2490,7 @@ cdef double diameter_DiFUB(BoostVecWeightedDiGraphU g_boost, return LB cpdef diameter(G, algorithm=None, source=None, - weight_function=None, check_weight=True) noexcept: + weight_function=None, check_weight=True): r""" Return the diameter of `G`. @@ -2626,7 +2626,7 @@ cpdef diameter(G, algorithm=None, source=None, return LB cpdef shortest_paths_from_vertices(g, vertex_list=None, order=None, - weight_function=None, algorithm=None) noexcept: + weight_function=None, algorithm=None): r""" Compute the shortest paths to all vertices from each vertex in ``vertex_list``. @@ -2869,7 +2869,7 @@ cpdef shortest_paths_from_vertices(g, vertex_list=None, order=None, return distances, predecessors -cpdef wiener_index(g, algorithm=None, weight_function=None, check_weight=True) noexcept: +cpdef wiener_index(g, algorithm=None, weight_function=None, check_weight=True): r""" Return the Wiener index of the graph. diff --git a/src/sage/graphs/base/c_graph.pxd b/src/sage/graphs/base/c_graph.pxd index b29cc3c9527..9cd670ccbc5 100644 --- a/src/sage/graphs/base/c_graph.pxd +++ b/src/sage/graphs/base/c_graph.pxd @@ -21,13 +21,13 @@ cdef class CGraph: ################################### cpdef bint has_vertex(self, int n) except -1 - cpdef check_vertex(self, int n) noexcept - cpdef del_vertex(self, int v) noexcept + cpdef check_vertex(self, int n) + cpdef del_vertex(self, int v) cpdef int current_allocation(self) noexcept - cpdef list verts(self) noexcept - cpdef add_vertices(self, verts) noexcept + cpdef list verts(self) + cpdef add_vertices(self, verts) cdef int del_vertex_unsafe(self, int) except -1 - cpdef realloc(self, int) noexcept + cpdef realloc(self, int) cdef int add_vertex_unsafe(self, int) except -1 ################################### @@ -42,9 +42,9 @@ cdef class CGraph: cdef int del_arc_unsafe(self, int, int) except -1 - cpdef add_arc(self, int u, int v) noexcept + cpdef add_arc(self, int u, int v) cpdef bint has_arc(self, int u, int v) except -1 - cpdef del_all_arcs(self, int u, int v) noexcept + cpdef del_all_arcs(self, int u, int v) ################################### # Labeled Edge Functions @@ -57,8 +57,8 @@ cdef class CGraph: cdef int all_arcs_unsafe(self, int, int, int *, int) except -1 cpdef int arc_label(self, int u, int v) noexcept - cpdef list all_arcs(self, int u, int v) noexcept - cpdef del_arc_label(self, int u, int v, int l) noexcept + cpdef list all_arcs(self, int u, int v) + cpdef del_arc_label(self, int u, int v, int l) cpdef bint has_arc_label(self, int u, int v, int l) noexcept ################################### @@ -76,16 +76,16 @@ cdef class CGraph: cdef int next_out_neighbor_unsafe(self, int, int, int*) except -2 cdef int next_in_neighbor_unsafe(self, int, int, int*) except -2 - cdef adjacency_sequence_out(self, int n, int *vertices, int v, int* sequence) noexcept - cdef adjacency_sequence_in(self, int n, int *vertices, int v, int* sequence) noexcept - cpdef list in_neighbors(self, int v) noexcept - cpdef list out_neighbors(self, int u) noexcept + cdef adjacency_sequence_out(self, int n, int *vertices, int v, int* sequence) + cdef adjacency_sequence_in(self, int n, int *vertices, int v, int* sequence) + cpdef list in_neighbors(self, int v) + cpdef list out_neighbors(self, int u) cdef class CGraphBackend(GenericGraphBackend): cdef int get_vertex(self, u) except ? -2 cdef int get_vertex_checked(self, u) except ? -2 - cdef vertex_label(self, int u_int) noexcept + cdef vertex_label(self, int u_int) cdef int check_labelled_vertex(self, u, bint reverse) except ? -1 #cdef CGraph _cg # a child class should declare this accordingly cdef bint _directed @@ -94,12 +94,12 @@ cdef class CGraphBackend(GenericGraphBackend): cdef dict edge_labels cdef bint _loops cdef bint _multiple_edges - cdef CGraph cg(self) noexcept - cpdef add_edge(self, object u, object v, object l, bint directed) noexcept - cpdef del_edge(self, object u, object v, object l, bint directed) noexcept + cdef CGraph cg(self) + cpdef add_edge(self, object u, object v, object l, bint directed) + cpdef del_edge(self, object u, object v, object l, bint directed) cdef bint _has_labeled_edge_unsafe(self, int, int, object) except -1 cdef bint _delete_edge_before_adding(self) noexcept cdef int new_edge_label(self, object l) except -1 cdef int free_edge_label(self, int l_int) except -1 cdef int _use_edge_iterator_on_subgraph(self, CGraphBackend other, object vertices, const int modus) except -1 - cdef list _all_edge_labels(self, int u, int v, uint32_t* edge=*) noexcept + cdef list _all_edge_labels(self, int u, int v, uint32_t* edge=*) diff --git a/src/sage/graphs/base/c_graph.pyx b/src/sage/graphs/base/c_graph.pyx index 9b9dac6917b..c8d68c4837f 100644 --- a/src/sage/graphs/base/c_graph.pyx +++ b/src/sage/graphs/base/c_graph.pyx @@ -126,7 +126,7 @@ cdef class CGraph: n < self.active_vertices.size and bitset_in(self.active_vertices, n)) - cpdef check_vertex(self, int n) noexcept: + cpdef check_vertex(self, int n): """ Check that ``n`` is a vertex of ``self``. @@ -333,7 +333,7 @@ cdef class CGraph: self.realloc(2 * self.active_vertices.size) return self.add_vertex_unsafe(k) - cpdef add_vertices(self, verts) noexcept: + cpdef add_vertices(self, verts): """ Add vertices from the iterable ``verts``. @@ -433,7 +433,7 @@ cdef class CGraph: self.num_verts -= 1 bitset_remove(self.active_vertices, v) - cpdef del_vertex(self, int v) noexcept: + cpdef del_vertex(self, int v): """ Delete the vertex ``v``, along with all edges incident to it. @@ -581,7 +581,7 @@ cdef class CGraph: """ return self.active_vertices.size - cpdef list verts(self) noexcept: + cpdef list verts(self): """ Return a list of the vertices in ``self``. @@ -614,7 +614,7 @@ cdef class CGraph: """ return bitset_list(self.active_vertices) - cpdef realloc(self, int total) noexcept: + cpdef realloc(self, int total): """ Reallocate the number of vertices to use, without actually adding any. @@ -725,7 +725,7 @@ cdef class CGraph: cdef int del_arc_unsafe(self, int u, int v) except -1: raise NotImplementedError() - cpdef add_arc(self, int u, int v) noexcept: + cpdef add_arc(self, int u, int v): """ Add arc ``(u, v)`` to the graph. @@ -823,7 +823,7 @@ cdef class CGraph: return False return self.has_arc_unsafe(u, v) == 1 - cpdef del_all_arcs(self, int u, int v) noexcept: + cpdef del_all_arcs(self, int u, int v): """ Delete all arcs from ``u`` to ``v``. @@ -933,7 +933,7 @@ cdef class CGraph: self.check_vertex(v) return self.arc_label_unsafe(u, v) - cpdef list all_arcs(self, int u, int v) noexcept: + cpdef list all_arcs(self, int u, int v): """ Gives the labels of all arcs ``(u, v)``. An unlabeled arc is interpreted as having label 0. @@ -973,7 +973,7 @@ cdef class CGraph: sig_free(arc_labels) return output - cpdef del_arc_label(self, int u, int v, int l) noexcept: + cpdef del_arc_label(self, int u, int v, int l): """ Delete an arc ``(u, v)`` with label ``l``. @@ -1124,7 +1124,7 @@ cdef class CGraph: cdef int next_in_neighbor_unsafe(self, int v, int u, int* l) except -2: raise NotImplementedError() - cdef adjacency_sequence_out(self, int n, int *vertices, int v, int* sequence) noexcept: + cdef adjacency_sequence_out(self, int n, int *vertices, int v, int* sequence): r""" Return the adjacency sequence corresponding to a list of vertices and a vertex. @@ -1164,7 +1164,7 @@ cdef class CGraph: for i in range(n): sequence[i] = self.has_arc_unsafe(v, vertices[i]) - cdef adjacency_sequence_in(self, int n, int *vertices, int v, int* sequence) noexcept: + cdef adjacency_sequence_in(self, int n, int *vertices, int v, int* sequence): r""" Compute the adjacency sequence corresponding to a list of vertices and a vertex. @@ -1203,7 +1203,7 @@ cdef class CGraph: for i in range(n): sequence[i] = self.has_arc_unsafe(vertices[i], v) - cpdef list out_neighbors(self, int u) noexcept: + cpdef list out_neighbors(self, int u): """ Return the list of out-neighbors of the vertex ``u``. @@ -1257,7 +1257,7 @@ cdef class CGraph: sig_free(neighbors) return output - cpdef list in_neighbors(self, int v) noexcept: + cpdef list in_neighbors(self, int v): """ Return the list of in-neighbors of the vertex ``v``. @@ -1375,7 +1375,7 @@ cdef class CGraphBackend(GenericGraphBackend): # Basic Access ################################### - cdef CGraph cg(self) noexcept: + cdef CGraph cg(self): r""" Return the attribute ``_cg`` casted into ``CGraph``. """ @@ -1631,7 +1631,7 @@ cdef class CGraphBackend(GenericGraphBackend): else: return -1 - cdef vertex_label(self, int u_int) noexcept: + cdef vertex_label(self, int u_int): """ Return the object represented by ``u_int``, or ``None`` if this does not represent a vertex. @@ -2357,7 +2357,7 @@ cdef class CGraphBackend(GenericGraphBackend): continue self.add_edge(u, v, l, directed) - cpdef add_edge(self, object u, object v, object l, bint directed) noexcept: + cpdef add_edge(self, object u, object v, object l, bint directed): """ Add the edge ``(u,v)`` to self. @@ -2489,7 +2489,7 @@ cdef class CGraphBackend(GenericGraphBackend): l = None self.del_edge(u, v, l, directed) - cpdef del_edge(self, object u, object v, object l, bint directed) noexcept: + cpdef del_edge(self, object u, object v, object l, bint directed): """ Delete edge ``(u, v, l)``. @@ -2607,7 +2607,7 @@ cdef class CGraphBackend(GenericGraphBackend): cdef int free_edge_label(self, int l_int) except -1: raise NotImplementedError() - cdef list _all_edge_labels(self, int u, int v, uint32_t* edge=NULL) noexcept: + cdef list _all_edge_labels(self, int u, int v, uint32_t* edge=NULL): """ Gives the labels of all arcs from ``u`` to ``v``. @@ -4885,7 +4885,7 @@ cdef class Search_iterator: """ return self - cdef inline next_breadth_first_search(self) noexcept: + cdef inline next_breadth_first_search(self): r""" Return the next vertex in a breadth first search traversal of a graph. @@ -4947,7 +4947,7 @@ cdef class Search_iterator: return value_prev, value return value - cdef inline next_depth_first_search(self) noexcept: + cdef inline next_depth_first_search(self): r""" Return the next vertex in a depth first search traversal of a graph. diff --git a/src/sage/graphs/base/dense_graph.pxd b/src/sage/graphs/base/dense_graph.pxd index 6c4145694fe..82659713bd9 100644 --- a/src/sage/graphs/base/dense_graph.pxd +++ b/src/sage/graphs/base/dense_graph.pxd @@ -21,5 +21,5 @@ cdef int copy_dense_graph(DenseGraph dest, DenseGraph src) except -1 cdef class DenseGraphBackend(CGraphBackend): cdef DenseGraph _cg - cdef inline CGraph cg(self) noexcept: + cdef inline CGraph cg(self): return self._cg diff --git a/src/sage/graphs/base/dense_graph.pyx b/src/sage/graphs/base/dense_graph.pyx index db4a02a5a3f..eca8de6afed 100644 --- a/src/sage/graphs/base/dense_graph.pyx +++ b/src/sage/graphs/base/dense_graph.pyx @@ -195,7 +195,7 @@ cdef class DenseGraph(CGraph): sig_free(self.out_degrees) bitset_free(self.active_vertices) - cpdef realloc(self, int total_verts) noexcept: + cpdef realloc(self, int total_verts): """ Reallocate the number of vertices to use, without actually adding any. diff --git a/src/sage/graphs/base/sparse_graph.pxd b/src/sage/graphs/base/sparse_graph.pxd index 3795c8ff0f0..540a8827801 100644 --- a/src/sage/graphs/base/sparse_graph.pxd +++ b/src/sage/graphs/base/sparse_graph.pxd @@ -70,5 +70,5 @@ cdef class SparseGraphBackend(CGraphBackend): cdef int edge_labels_max cdef list edge_labels_available_ids cdef SparseGraph _cg - cdef inline CGraph cg(self) noexcept: + cdef inline CGraph cg(self): return self._cg diff --git a/src/sage/graphs/base/sparse_graph.pyx b/src/sage/graphs/base/sparse_graph.pyx index e512832d958..8672940c404 100644 --- a/src/sage/graphs/base/sparse_graph.pyx +++ b/src/sage/graphs/base/sparse_graph.pyx @@ -370,7 +370,7 @@ cdef class SparseGraph(CGraph): sig_free(self.out_degrees) bitset_free(self.active_vertices) - cpdef realloc(self, int total) noexcept: + cpdef realloc(self, int total): """ Reallocate the number of vertices to use, without actually adding any. diff --git a/src/sage/graphs/base/static_dense_graph.pxd b/src/sage/graphs/base/static_dense_graph.pxd index d1c2a0aa3f9..0e580a02b57 100644 --- a/src/sage/graphs/base/static_dense_graph.pxd +++ b/src/sage/graphs/base/static_dense_graph.pxd @@ -1,4 +1,4 @@ from sage.data_structures.binary_matrix cimport binary_matrix_t from libc.stdint cimport uint32_t, uint64_t -cdef dict dense_graph_init(binary_matrix_t m, g, translation = ?, force_undirected = ?) noexcept +cdef dict dense_graph_init(binary_matrix_t m, g, translation = ?, force_undirected = ?) diff --git a/src/sage/graphs/base/static_dense_graph.pyx b/src/sage/graphs/base/static_dense_graph.pyx index fe356d939d6..b23eab66a3b 100644 --- a/src/sage/graphs/base/static_dense_graph.pyx +++ b/src/sage/graphs/base/static_dense_graph.pyx @@ -54,7 +54,7 @@ from itertools import product from sage.misc.flatten import flatten -cdef dict dense_graph_init(binary_matrix_t m, g, translation=None, force_undirected=False) noexcept: +cdef dict dense_graph_init(binary_matrix_t m, g, translation=None, force_undirected=False): r""" Fill a binary matrix with the information from a Sage (di)graph. diff --git a/src/sage/graphs/base/static_sparse_backend.pxd b/src/sage/graphs/base/static_sparse_backend.pxd index fb72a89180b..31f3b172a94 100644 --- a/src/sage/graphs/base/static_sparse_backend.pxd +++ b/src/sage/graphs/base/static_sparse_backend.pxd @@ -21,6 +21,6 @@ cdef class StaticSparseBackend(CGraphBackend): cdef list _vertex_to_labels cdef dict _vertex_to_int cdef StaticSparseCGraph _cg - cdef inline CGraph cg(self) noexcept: + cdef inline CGraph cg(self): return self._cg cdef int _use_edge_iterator_on_subgraph(self, CGraphBackend other, object vertices, const int modus) except -1 diff --git a/src/sage/graphs/base/static_sparse_backend.pyx b/src/sage/graphs/base/static_sparse_backend.pyx index 678d7e86c8a..1dc517a957a 100644 --- a/src/sage/graphs/base/static_sparse_backend.pyx +++ b/src/sage/graphs/base/static_sparse_backend.pyx @@ -196,7 +196,7 @@ cdef class StaticSparseCGraph(CGraph): """ self.add_vertex_unsafe(k) - cpdef del_vertex(self, int k) noexcept: + cpdef del_vertex(self, int k): r""" Remove a vertex from the graph. No way. @@ -211,7 +211,7 @@ cdef class StaticSparseCGraph(CGraph): """ self.del_vertex_unsafe(k) - cpdef list verts(self) noexcept: + cpdef list verts(self): r""" Returns the list of vertices @@ -318,7 +318,7 @@ cdef class StaticSparseCGraph(CGraph): neighbors[i] = self.g_rev.neighbors[u][i] return -1 if size < degree else degree - cpdef list out_neighbors(self, int u) noexcept: + cpdef list out_neighbors(self, int u): r""" List the out-neighbors of a vertex @@ -343,7 +343,7 @@ cdef class StaticSparseCGraph(CGraph): cdef int i return [ self.g.neighbors[u][i] for i in range(out_degree(self.g, u))] - cpdef list in_neighbors(self, int u) noexcept: + cpdef list in_neighbors(self, int u): r""" Return the in-neighbors of a vertex @@ -556,7 +556,7 @@ cdef class StaticSparseBackend(CGraphBackend): """ return v in self._vertex_to_int - cpdef add_edge(self, object u, object v, object l, bint directed) noexcept: + cpdef add_edge(self, object u, object v, object l, bint directed): r""" Set edge label. No way. @@ -601,7 +601,7 @@ cdef class StaticSparseBackend(CGraphBackend): """ raise ValueError("graph is immutable; please change a copy instead (use function copy())") - cpdef del_edge(self, object u, object v, object l, bint directed) noexcept: + cpdef del_edge(self, object u, object v, object l, bint directed): r""" Set edge label. No way. @@ -698,7 +698,7 @@ cdef class StaticSparseBackend(CGraphBackend): return self._all_edge_labels(u, v, edge) return edge_label(cg.g, edge) - cdef inline list _all_edge_labels(self, int u, int v, uint32_t* edge=NULL) noexcept: + cdef inline list _all_edge_labels(self, int u, int v, uint32_t* edge=NULL): """ Gives the labels of all arcs from ``u`` to ``v``. diff --git a/src/sage/graphs/base/static_sparse_graph.pxd b/src/sage/graphs/base/static_sparse_graph.pxd index 4a427f81237..bece6946be3 100644 --- a/src/sage/graphs/base/static_sparse_graph.pxd +++ b/src/sage/graphs/base/static_sparse_graph.pxd @@ -27,7 +27,7 @@ cdef void free_short_digraph(short_digraph g) noexcept cdef int init_reverse(short_digraph dst, short_digraph src) except -1 cdef int out_degree(short_digraph g, int u) noexcept cdef uint32_t * has_edge(short_digraph g, int u, int v) noexcept -cdef object edge_label(short_digraph g, uint32_t * edge) noexcept +cdef object edge_label(short_digraph g, uint32_t * edge) cdef int tarjan_strongly_connected_components_C(short_digraph g, int *scc) noexcept cdef void strongly_connected_components_digraph_C(short_digraph g, int nscc, int *scc, short_digraph output) noexcept diff --git a/src/sage/graphs/base/static_sparse_graph.pyx b/src/sage/graphs/base/static_sparse_graph.pyx index 35f3de67c98..4c68f4043d3 100644 --- a/src/sage/graphs/base/static_sparse_graph.pyx +++ b/src/sage/graphs/base/static_sparse_graph.pyx @@ -418,7 +418,7 @@ cdef inline uint32_t * has_edge(short_digraph g, int u, int v) noexcept: return bsearch(&v, g.neighbors[u], g.neighbors[u + 1] - g.neighbors[u], sizeof(uint32_t), compare_uint32_p) -cdef inline object edge_label(short_digraph g, uint32_t * edge) noexcept: +cdef inline object edge_label(short_digraph g, uint32_t * edge): r""" Return the label associated with a given edge """ @@ -887,7 +887,7 @@ def strongly_connected_components_digraph(G): return output, {v: scc[i] for i, v in enumerate(int_to_vertex)} -cdef strongly_connected_component_containing_vertex(short_digraph g, short_digraph g_reversed, int v, bitset_t scc) noexcept: +cdef strongly_connected_component_containing_vertex(short_digraph g, short_digraph g_reversed, int v, bitset_t scc): """ Feed ``scc`` with the vertices in the strongly connected component of ``v``. """ diff --git a/src/sage/graphs/centrality.pyx b/src/sage/graphs/centrality.pyx index 118edd5d7b0..d73c7571d18 100755 --- a/src/sage/graphs/centrality.pyx +++ b/src/sage/graphs/centrality.pyx @@ -123,7 +123,7 @@ def centrality_betweenness(G, bint exact=False, bint normalize=True): @cython.cdivision(True) -cdef dict centrality_betweenness_C(G, numerical_type _, bint normalize=True) noexcept: +cdef dict centrality_betweenness_C(G, numerical_type _, bint normalize=True): r""" Return the centrality betweenness of G (C implementation) diff --git a/src/sage/graphs/connectivity.pxd b/src/sage/graphs/connectivity.pxd index 5e49e66cc3a..f529d2ebdea 100644 --- a/src/sage/graphs/connectivity.pxd +++ b/src/sage/graphs/connectivity.pxd @@ -16,9 +16,9 @@ cdef class _Component: cdef _LinkedList * edge_list cdef int component_type - cdef add_edge(self, Py_ssize_t e_index) noexcept - cdef finish_tric_or_poly(self, Py_ssize_t e_index) noexcept - cdef list get_edge_list(self) noexcept + cdef add_edge(self, Py_ssize_t e_index) + cdef finish_tric_or_poly(self, Py_ssize_t e_index) + cdef list get_edge_list(self) cdef class TriconnectivitySPQR: cdef MemoryAllocator mem @@ -88,7 +88,7 @@ cdef class TriconnectivitySPQR: # === Methods === - cdef inline __tstack_push(self, int h, int a, int b) noexcept: + cdef inline __tstack_push(self, int h, int a, int b): """ Push ``(h, a, b)`` triple on ``Tstack``. """ @@ -97,7 +97,7 @@ cdef class TriconnectivitySPQR: self.t_stack_a[self.t_stack_top] = a self.t_stack_b[self.t_stack_top] = b - cdef inline __tstack_push_eos(self) noexcept: + cdef inline __tstack_push_eos(self): """ Push end-of-stack marker on ``Tstack``. """ @@ -116,7 +116,7 @@ cdef class TriconnectivitySPQR: """ return self.e_stack.pop() - cdef inline __new_component(self, list edges, int type_c) noexcept: + cdef inline __new_component(self, list edges, int type_c): """ Create a new component and add ``edges`` to it. @@ -145,12 +145,12 @@ cdef class TriconnectivitySPQR: cdef int __new_virtual_edge(self, int u, int v) noexcept cdef _LinkedListNode * __new_LinkedListNode(self, Py_ssize_t e_index) noexcept cdef Py_ssize_t __high(self, Py_ssize_t v) noexcept - cdef __del_high(self, int e_index) noexcept - cdef __split_multiple_edges(self) noexcept + cdef __del_high(self, int e_index) + cdef __split_multiple_edges(self) cdef int __dfs1(self, int start, bint check=*) noexcept - cdef __build_acceptable_adj_struct(self) noexcept - cdef __path_finder(self, int start) noexcept - cdef __dfs2(self) noexcept + cdef __build_acceptable_adj_struct(self) + cdef __path_finder(self, int start) + cdef __dfs2(self) cdef int __path_search(self, int start) except -1 - cdef __assemble_triconnected_components(self) noexcept - cdef __build_spqr_tree(self) noexcept + cdef __assemble_triconnected_components(self) + cdef __build_spqr_tree(self) diff --git a/src/sage/graphs/connectivity.pyx b/src/sage/graphs/connectivity.pyx index d97f3a2819a..ee387ab352b 100644 --- a/src/sage/graphs/connectivity.pyx +++ b/src/sage/graphs/connectivity.pyx @@ -2676,7 +2676,7 @@ def spqr_tree_to_graph(T): # Helper methods for ``TriconnectivitySPQR``. # Define a doubly linked list -cdef inline _LinkedListNode_initialize(_LinkedListNode * node, Py_ssize_t data) noexcept: +cdef inline _LinkedListNode_initialize(_LinkedListNode * node, Py_ssize_t data): """ Initialize the ``_LinkedListNode`` with value data. """ @@ -2685,7 +2685,7 @@ cdef inline _LinkedListNode_initialize(_LinkedListNode * node, Py_ssize_t data) node.data = data -cdef inline _LinkedList_initialize(_LinkedList * ll) noexcept: +cdef inline _LinkedList_initialize(_LinkedList * ll): """ Initialize the ``_LinkedList``. """ @@ -2693,7 +2693,7 @@ cdef inline _LinkedList_initialize(_LinkedList * ll) noexcept: ll.tail = NULL ll.length = 0 -cdef _LinkedList_set_head(_LinkedList * ll, _LinkedListNode * h) noexcept: +cdef _LinkedList_set_head(_LinkedList * ll, _LinkedListNode * h): """ Set the node ``h`` as the head and tail of the linked list ``ll``. """ @@ -2713,7 +2713,7 @@ cdef inline Py_ssize_t _LinkedList_get_length(_LinkedList * ll) noexcept: """ return ll.length -cdef _LinkedList_append(_LinkedList * ll, _LinkedListNode * node) noexcept: +cdef _LinkedList_append(_LinkedList * ll, _LinkedListNode * node): """ Append the node ``node`` to the linked list ``ll``. """ @@ -2725,7 +2725,7 @@ cdef _LinkedList_append(_LinkedList * ll, _LinkedListNode * node) noexcept: ll.tail = node ll.length += 1 -cdef _LinkedList_remove(_LinkedList * ll, _LinkedListNode * node) noexcept: +cdef _LinkedList_remove(_LinkedList * ll, _LinkedListNode * node): """ Remove the node ``node`` from the linked list ``ll``. """ @@ -2743,7 +2743,7 @@ cdef _LinkedList_remove(_LinkedList * ll, _LinkedListNode * node) noexcept: node.next.prev = node.prev ll.length -= 1 -cdef _LinkedList_push_front(_LinkedList * ll, _LinkedListNode * node) noexcept: +cdef _LinkedList_push_front(_LinkedList * ll, _LinkedListNode * node): """ Add node ``node`` to the beginning of the linked list ``ll``. """ @@ -2755,7 +2755,7 @@ cdef _LinkedList_push_front(_LinkedList * ll, _LinkedListNode * node) noexcept: ll.head = node ll.length += 1 -cdef _LinkedList_concatenate(_LinkedList * lst1, _LinkedList * lst2) noexcept: +cdef _LinkedList_concatenate(_LinkedList * lst1, _LinkedList * lst2): """ Concatenate lst2 to lst1. @@ -2768,7 +2768,7 @@ cdef _LinkedList_concatenate(_LinkedList * lst1, _LinkedList * lst2) noexcept: lst2.head = NULL lst2.length = 0 -cdef str _LinkedList_to_string(_LinkedList * ll) noexcept: +cdef str _LinkedList_to_string(_LinkedList * ll): """ Return a string representation of self. """ @@ -2827,7 +2827,7 @@ cdef class _Component: self.add_edge(e_index) self.component_type = type_c - cdef add_edge(self, Py_ssize_t e_index) noexcept: + cdef add_edge(self, Py_ssize_t e_index): """ Add edge index ``e_index`` to the component. """ @@ -2835,7 +2835,7 @@ cdef class _Component: _LinkedListNode_initialize(node, e_index) _LinkedList_append(self.edge_list, node) - cdef finish_tric_or_poly(self, Py_ssize_t e_index) noexcept: + cdef finish_tric_or_poly(self, Py_ssize_t e_index): r""" Finalize the component by adding edge ``e``. @@ -2873,7 +2873,7 @@ cdef class _Component: type_str = "Triconnected: " return type_str + _LinkedList_to_string(self.edge_list) - cdef list get_edge_list(self) noexcept: + cdef list get_edge_list(self): """ Return the list of edges belonging to the component. """ @@ -3301,7 +3301,7 @@ cdef class TriconnectivitySPQR: return head.data return 0 - cdef __del_high(self, int e_index) noexcept: + cdef __del_high(self, int e_index): """ Delete edge ``e`` from the ``highpt`` list of the endpoint ``v`` it belongs to. @@ -3315,7 +3315,7 @@ cdef class TriconnectivitySPQR: v = self.edge_extremity_second[e_index] _LinkedList_remove(self.highpt[v], it) - cdef __split_multiple_edges(self) noexcept: + cdef __split_multiple_edges(self): """ Make the graph simple and build bonds recording multiple edges. @@ -3487,7 +3487,7 @@ cdef class TriconnectivitySPQR: return cut_vertex # cut_vertex is -1 if graph does not have a cut vertex - cdef __build_acceptable_adj_struct(self) noexcept: + cdef __build_acceptable_adj_struct(self): """ Build the adjacency lists for each vertex with certain properties of the ordering, using the ``lowpt1`` and ``lowpt2`` values. @@ -3542,7 +3542,7 @@ cdef class TriconnectivitySPQR: _LinkedList_append(self.adj[self.edge_extremity_first[e_index]], node) self.in_adj[e_index] = node - cdef __path_finder(self, int start) noexcept: + cdef __path_finder(self, int start): """ This function is a helper function for :meth:`__dfs2` function. @@ -3601,7 +3601,7 @@ cdef class TriconnectivitySPQR: self.dfs_counter -= 1 stack_top -= 1 - cdef __dfs2(self) noexcept: + cdef __dfs2(self): """ Update the values of ``lowpt1`` and ``lowpt2`` lists with the help of new numbering obtained from :meth:`__path_finder`. @@ -3984,7 +3984,7 @@ cdef class TriconnectivitySPQR: # Go to next edge in adjacency list e_node_dict[v] = e_node.next - cdef __assemble_triconnected_components(self) noexcept: + cdef __assemble_triconnected_components(self): """ Iterate through all the split components built by :meth:`__path_finder` and merges two bonds or two polygons that share an edge for constructing @@ -4111,7 +4111,7 @@ cdef class TriconnectivitySPQR: self.comp_type.append((<_Component> comp).component_type) self.comp_final_edge_list.append(e_list_new) - cdef __build_spqr_tree(self) noexcept: + cdef __build_spqr_tree(self): """ Build the SPQR-tree of the graph and store it in variable ``self.spqr_tree``. See diff --git a/src/sage/graphs/convexity_properties.pxd b/src/sage/graphs/convexity_properties.pxd index cc80e214ea5..f6c1b68b6b8 100644 --- a/src/sage/graphs/convexity_properties.pxd +++ b/src/sage/graphs/convexity_properties.pxd @@ -7,9 +7,9 @@ cdef class ConvexityProperties: cdef dict _dict_vertices_to_integers cdef binary_matrix_t _cache_hull_pairs - cdef list _vertices_to_integers(self, vertices) noexcept - cdef list _integers_to_vertices(self, list integers) noexcept - cdef _bitset_convex_hull(self, bitset_t hull) noexcept - cpdef hull(self, list vertices) noexcept - cdef _greedy_increase(self, bitset_t bs) noexcept - cpdef hull_number(self, value_only = *, verbose = *) noexcept + cdef list _vertices_to_integers(self, vertices) + cdef list _integers_to_vertices(self, list integers) + cdef _bitset_convex_hull(self, bitset_t hull) + cpdef hull(self, list vertices) + cdef _greedy_increase(self, bitset_t bs) + cpdef hull_number(self, value_only = *, verbose = *) diff --git a/src/sage/graphs/convexity_properties.pyx b/src/sage/graphs/convexity_properties.pyx index 7024324f362..60c7941147d 100644 --- a/src/sage/graphs/convexity_properties.pyx +++ b/src/sage/graphs/convexity_properties.pyx @@ -227,20 +227,20 @@ cdef class ConvexityProperties: """ binary_matrix_free(self._cache_hull_pairs) - cdef list _vertices_to_integers(self, vertices) noexcept: + cdef list _vertices_to_integers(self, vertices): r""" Converts a list of vertices to a list of integers with the cached data. """ return [self._dict_vertices_to_integers[v] for v in vertices] - cdef list _integers_to_vertices(self, list integers) noexcept: + cdef list _integers_to_vertices(self, list integers): r""" Convert a list of integers to a list of vertices with the cached data. """ cdef int i return [self._list_integers_to_vertices[i] for i in integers] - cdef _bitset_convex_hull(self, bitset_t hull) noexcept: + cdef _bitset_convex_hull(self, bitset_t hull): r""" Compute the convex hull of a list of vertices given as a bitset. @@ -290,7 +290,7 @@ cdef class ConvexityProperties: # Otherwise, update and back to the loop count = tmp_count - cpdef hull(self, list vertices) noexcept: + cpdef hull(self, list vertices): r""" Return the convex hull of a set of vertices. @@ -321,7 +321,7 @@ cdef class ConvexityProperties: return answer - cdef _greedy_increase(self, bitset_t bs) noexcept: + cdef _greedy_increase(self, bitset_t bs): r""" Given a bitset whose hull is not the whole set, greedily add vertices and stop before its hull is the whole set. @@ -343,7 +343,7 @@ cdef class ConvexityProperties: bitset_free(tmp) - cpdef hull_number(self, value_only=True, verbose=False) noexcept: + cpdef hull_number(self, value_only=True, verbose=False): r""" Compute the hull number and a corresponding generating set. diff --git a/src/sage/graphs/distances_all_pairs.pxd b/src/sage/graphs/distances_all_pairs.pxd index 98301b92213..d87a001d143 100644 --- a/src/sage/graphs/distances_all_pairs.pxd +++ b/src/sage/graphs/distances_all_pairs.pxd @@ -6,6 +6,6 @@ cdef all_pairs_shortest_path_BFS(gg, unsigned short * predecessors, unsigned short * distances, uint32_t * eccentricity, - vertex_list=*) noexcept + vertex_list=*) cdef uint32_t * c_eccentricity(G, vertex_list=*) except NULL diff --git a/src/sage/graphs/distances_all_pairs.pyx b/src/sage/graphs/distances_all_pairs.pyx index db6df6b2cb1..3eb15129d19 100644 --- a/src/sage/graphs/distances_all_pairs.pyx +++ b/src/sage/graphs/distances_all_pairs.pyx @@ -145,7 +145,7 @@ from sage.graphs.base.static_sparse_graph cimport (short_digraph, cdef inline c_all_pairs_shortest_path_BFS(short_digraph sd, unsigned short* predecessors, unsigned short* distances, - uint32_t* eccentricity) noexcept: + uint32_t* eccentricity): r""" See the module's documentation. """ @@ -269,7 +269,7 @@ cdef inline all_pairs_shortest_path_BFS(gg, unsigned short* predecessors, unsigned short* distances, uint32_t* eccentricity, - vertex_list=None) noexcept: + vertex_list=None): r""" See the module's documentation. @@ -1141,7 +1141,7 @@ cdef uint32_t diameter_lower_bound_2sweep(short_digraph g, cdef tuple diameter_lower_bound_2Dsweep(short_digraph g, short_digraph rev_g, - uint32_t source) noexcept: + uint32_t source): r""" Lower bound on the diameter of digraph using directed version of 2-sweep. @@ -1255,7 +1255,7 @@ cdef tuple diameter_lower_bound_2Dsweep(short_digraph g, cdef tuple diameter_lower_bound_multi_sweep(short_digraph g, - uint32_t source) noexcept: + uint32_t source): """ Lower bound on the diameter using multi-sweep. diff --git a/src/sage/graphs/edge_connectivity.pyx b/src/sage/graphs/edge_connectivity.pyx index a2e367bb577..aef8e43d98e 100644 --- a/src/sage/graphs/edge_connectivity.pyx +++ b/src/sage/graphs/edge_connectivity.pyx @@ -300,7 +300,7 @@ cdef class GabowEdgeConnectivity: _ = self.compute_edge_connectivity() sig_check() - cdef build_graph_data_structure(self) noexcept: + cdef build_graph_data_structure(self): r""" Build graph data structures. @@ -1024,7 +1024,7 @@ cdef class GabowEdgeConnectivity: e = ep ep = self.labels[e] - cdef re_init(self, int tree) noexcept: + cdef re_init(self, int tree): """ Make f_trees active (except the f_tree of the root), update depths and parent values, and clear the labels. diff --git a/src/sage/graphs/generic_graph_pyx.pxd b/src/sage/graphs/generic_graph_pyx.pxd index 1a472c59a70..a09c1d69333 100644 --- a/src/sage/graphs/generic_graph_pyx.pxd +++ b/src/sage/graphs/generic_graph_pyx.pxd @@ -8,7 +8,7 @@ ctypedef fused dimension_t: D_TWO D_THREE -cdef run_spring(int, dimension_t, double*, int*, int, int, bint) noexcept +cdef run_spring(int, dimension_t, double*, int*, int, int, bint) cdef class GenericGraph_pyx(SageObject): pass diff --git a/src/sage/graphs/generic_graph_pyx.pyx b/src/sage/graphs/generic_graph_pyx.pyx index 9d091cdee58..74a6f13c1c6 100644 --- a/src/sage/graphs/generic_graph_pyx.pyx +++ b/src/sage/graphs/generic_graph_pyx.pyx @@ -258,7 +258,7 @@ def spring_layout_fast(G, iterations=50, int dim=2, vpos=None, bint rescale=True @cython.cdivision(True) -cdef run_spring(int iterations, dimension_t _dim, double* pos, int* edges, int n, int m, bint height) noexcept: +cdef run_spring(int iterations, dimension_t _dim, double* pos, int* edges, int n, int m, bint height): r""" Find a locally optimal layout for this graph, according to the constraints that neighboring nodes want to be a fixed distance @@ -1159,7 +1159,7 @@ def _test_vectors_equal_inferior(): cpdef tuple find_hamiltonian(G, long max_iter=100000, long reset_bound=30000, - long backtrack_bound=1000, find_path=False) noexcept: + long backtrack_bound=1000, find_path=False): r""" Randomized backtracking for finding Hamiltonian cycles and paths. diff --git a/src/sage/graphs/genus.pyx b/src/sage/graphs/genus.pyx index 441fae754d6..dae6f71308f 100644 --- a/src/sage/graphs/genus.pyx +++ b/src/sage/graphs/genus.pyx @@ -477,7 +477,7 @@ cdef class simple_connected_genus_backtracker: cdef int genus_backtrack(self, int cutoff, bint record_embedding, - (int (*)(simple_connected_genus_backtracker, int, bint, int))check_embedding) noexcept: + (int (*)(simple_connected_genus_backtracker, int, bint, int) noexcept) check_embedding) noexcept: """ Here's the main backtracking routine. diff --git a/src/sage/graphs/graph_coloring.pyx b/src/sage/graphs/graph_coloring.pyx index c300d4f39a9..e4b6dd9873e 100644 --- a/src/sage/graphs/graph_coloring.pyx +++ b/src/sage/graphs/graph_coloring.pyx @@ -327,7 +327,7 @@ def all_graph_colorings(G, n, count_only=False, hex_colors=False, raise RuntimeError("too much recursion, Graph coloring failed") -cpdef first_coloring(G, n=0, hex_colors=False) noexcept: +cpdef first_coloring(G, n=0, hex_colors=False): r""" Return the first vertex coloring found. @@ -365,7 +365,7 @@ cpdef first_coloring(G, n=0, hex_colors=False) noexcept: return C -cpdef number_of_n_colorings(G, n) noexcept: +cpdef number_of_n_colorings(G, n): r""" Compute the number of `n`-colorings of a graph @@ -397,7 +397,7 @@ cpdef number_of_n_colorings(G, n) noexcept: return m -cpdef numbers_of_colorings(G) noexcept: +cpdef numbers_of_colorings(G): r""" Compute the number of colorings of a graph. @@ -416,7 +416,7 @@ cpdef numbers_of_colorings(G) noexcept: return answer -cpdef chromatic_number(G) noexcept: +cpdef chromatic_number(G): r""" Return the chromatic number of the graph. diff --git a/src/sage/graphs/graph_decompositions/rankwidth.pyx b/src/sage/graphs/graph_decompositions/rankwidth.pyx index 5be540bafe2..d817cf04a5d 100644 --- a/src/sage/graphs/graph_decompositions/rankwidth.pyx +++ b/src/sage/graphs/graph_decompositions/rankwidth.pyx @@ -321,7 +321,7 @@ def mkgraph(int num_vertices): return g -cdef bitset_to_vertex_set(subset_t s) noexcept: +cdef bitset_to_vertex_set(subset_t s): """ Return as a Set object the set corresponding to the given subset_t variable. diff --git a/src/sage/graphs/graph_decompositions/vertex_separation.pxd b/src/sage/graphs/graph_decompositions/vertex_separation.pxd index fbadc893436..fa757b2c28e 100644 --- a/src/sage/graphs/graph_decompositions/vertex_separation.pxd +++ b/src/sage/graphs/graph_decompositions/vertex_separation.pxd @@ -1,4 +1,4 @@ from libc.stdint cimport uint8_t from sage.graphs.graph_decompositions.fast_digraph cimport FastDigraph -cdef list find_order(FastDigraph, uint8_t *, int) noexcept +cdef list find_order(FastDigraph, uint8_t *, int) diff --git a/src/sage/graphs/graph_decompositions/vertex_separation.pyx b/src/sage/graphs/graph_decompositions/vertex_separation.pyx index eaec31b5c96..2d49f4bdb29 100644 --- a/src/sage/graphs/graph_decompositions/vertex_separation.pyx +++ b/src/sage/graphs/graph_decompositions/vertex_separation.pyx @@ -1052,7 +1052,7 @@ cdef inline int exists(FastDigraph g, uint8_t* neighborhoods, int current, int c return neighborhoods[current] -cdef list find_order(FastDigraph g, uint8_t* neighborhoods, int cost) noexcept: +cdef list find_order(FastDigraph g, uint8_t* neighborhoods, int cost): """ Return the ordering once we are sure it exists """ @@ -1741,7 +1741,7 @@ def vertex_separation_BAB(G, return (width if width < upper_bound else -1), order -cdef inline _my_invert_positions(int *prefix, int *positions, int pos_a, int pos_b) noexcept: +cdef inline _my_invert_positions(int *prefix, int *positions, int pos_a, int pos_b): """ Permute vertices at positions ``pos_a`` and ``pos_b`` in array ``prefix``, and record the new positions in array ``positions``. diff --git a/src/sage/graphs/hyperbolicity.pyx b/src/sage/graphs/hyperbolicity.pyx index 6474e9d6869..78b3205b6fd 100644 --- a/src/sage/graphs/hyperbolicity.pyx +++ b/src/sage/graphs/hyperbolicity.pyx @@ -263,7 +263,7 @@ cdef inline int __hyp__(unsigned short** distances, int a, int b, int c, int d) cdef tuple hyperbolicity_basic_algorithm(int N, unsigned short** distances, - verbose) noexcept: + verbose): """ Return **twice** the hyperbolicity of a graph, and a certificate. @@ -368,7 +368,7 @@ def _greedy_dominating_set(H, verbose=False): cdef inline distances_and_far_apart_pairs(gg, unsigned short* distances, unsigned short* far_apart_pairs, - list int_to_vertex) noexcept: + list int_to_vertex): """ Compute both distances between all pairs and far-apart pairs. @@ -583,7 +583,7 @@ cdef tuple hyperbolicity_BCCM(int N, int h_LB, float approximation_factor, float additive_gap, - verbose=False) noexcept: + verbose=False): """ Return the hyperbolicity of a graph. @@ -841,7 +841,7 @@ cdef tuple hyperbolicity_CCL(int N, int h_LB, float approximation_factor, float additive_gap, - verbose=False) noexcept: + verbose=False): """ Return the hyperbolicity of a graph. @@ -1465,7 +1465,7 @@ def hyperbolicity(G, # Distribution of the hyperbolicity of 4-tuples ###################################################################### -cdef dict __hyperbolicity_distribution__(int N, unsigned short** distances) noexcept: +cdef dict __hyperbolicity_distribution__(int N, unsigned short** distances): """ Return the distribution of the hyperbolicity of the 4-tuples of the graph. @@ -1526,7 +1526,7 @@ cdef extern from "stdlib.h": void c_libc_srandom "srandom"(unsigned int seed) -cdef dict __hyperbolicity_sampling__(int N, unsigned short** distances, uint64_t sampling_size) noexcept: +cdef dict __hyperbolicity_sampling__(int N, unsigned short** distances, uint64_t sampling_size): """ Return a sampling of the hyperbolicity distribution of the graph. diff --git a/src/sage/graphs/strongly_regular_db.pyx b/src/sage/graphs/strongly_regular_db.pyx index 955f87222a1..27cfd3da535 100644 --- a/src/sage/graphs/strongly_regular_db.pyx +++ b/src/sage/graphs/strongly_regular_db.pyx @@ -1736,7 +1736,7 @@ def is_nowhere0_twoweight(int v, int k, int l, int mu): return (Nowhere0WordsTwoWeightCodeGraph, q) -cdef eigenvalues(int v, int k, int l, int mu) noexcept: +cdef eigenvalues(int v, int k, int l, int mu): r""" Return the eigenvalues of a (v,k,l,mu)-strongly regular graph. @@ -1846,7 +1846,7 @@ def eigenmatrix(int v, int k, int l, int mu): return Matrix(ZZ, [[1, k, v-k-1], [1, r, -r-1], [1, s, -s-1]]) -cpdef latin_squares_graph_parameters(int v, int k, int l,int mu) noexcept: +cpdef latin_squares_graph_parameters(int v, int k, int l,int mu): r""" Check whether (v,k,l,mu)-strongly regular graph has parameters of an `L_g(n)` s.r.g. @@ -3256,7 +3256,7 @@ def _build_small_srg_database(): _small_srg_database[N, K, l, m] = [strongly_regular_from_two_weight_code, code['M']] -cdef load_brouwer_database() noexcept: +cdef load_brouwer_database(): r""" Loads Andries Brouwer's database into _brouwer_database. """ diff --git a/src/sage/graphs/traversals.pxd b/src/sage/graphs/traversals.pxd index c9a8444be0c..a81c72dcd9d 100644 --- a/src/sage/graphs/traversals.pxd +++ b/src/sage/graphs/traversals.pxd @@ -5,4 +5,4 @@ cdef maximum_cardinality_search_M_short_digraph(short_digraph sd, int* alpha, int* alpha_inv, list F, - bint* X) noexcept + bint* X) diff --git a/src/sage/graphs/traversals.pyx b/src/sage/graphs/traversals.pyx index ae8518d3b25..d7dfad47a30 100644 --- a/src/sage/graphs/traversals.pyx +++ b/src/sage/graphs/traversals.pyx @@ -107,7 +107,7 @@ def _is_valid_lex_BFS_order(G, L): return True -cdef lex_BFS_fast_short_digraph(short_digraph sd, uint32_t *sigma, uint32_t *pred) noexcept: +cdef lex_BFS_fast_short_digraph(short_digraph sd, uint32_t *sigma, uint32_t *pred): r""" Perform a lexicographic breadth first search (LexBFS) on the graph. @@ -1747,7 +1747,7 @@ cdef inline int swap(int* alpha, int* alpha_inv, int u, int new_pos_u) noexcept: cdef maximum_cardinality_search_M_short_digraph(short_digraph sd, int initial_vertex, - int* alpha, int* alpha_inv, list F, bint* X) noexcept: + int* alpha, int* alpha_inv, list F, bint* X): r""" Compute the ordering and the edges of the triangulation produced by MCS-M. diff --git a/src/sage/graphs/weakly_chordal.pyx b/src/sage/graphs/weakly_chordal.pyx index 9153c8ee93d..ea82042f996 100644 --- a/src/sage/graphs/weakly_chordal.pyx +++ b/src/sage/graphs/weakly_chordal.pyx @@ -51,7 +51,7 @@ cdef inline is_long_hole_free_process(g, short_digraph sd, bitset_t dense_graph, list id_label, int* path, int* InPath, int* neighbor_index, set VisitedP3, bint certificate, - int a, int b, int c, int n) noexcept: + int a, int b, int c, int n): """ This method is part of method ``is_long_hole_free``. @@ -279,7 +279,7 @@ cdef inline is_long_antihole_free_process(g, short_digraph sd, bitset_t dense_gr list id_label, int* path, int* InPath, int* neighbor_index, set VisitedP3, bint certificate, - int a, int b, int c, int n) noexcept: + int a, int b, int c, int n): """ This method is part of method ``is_long_antihole_free``. diff --git a/src/sage/groups/libgap_wrapper.pxd b/src/sage/groups/libgap_wrapper.pxd index 25599eea2a8..0c43b098140 100644 --- a/src/sage/groups/libgap_wrapper.pxd +++ b/src/sage/groups/libgap_wrapper.pxd @@ -4,5 +4,5 @@ from sage.libs.gap.element cimport GapElement cdef class ElementLibGAP(MultiplicativeGroupElement): cdef GapElement _libgap - cpdef GapElement gap(self) noexcept - cpdef _mul_(self, other) noexcept + cpdef GapElement gap(self) + cpdef _mul_(self, other) diff --git a/src/sage/groups/libgap_wrapper.pyx b/src/sage/groups/libgap_wrapper.pyx index 69395ed7e73..3d27ec44ea0 100644 --- a/src/sage/groups/libgap_wrapper.pyx +++ b/src/sage/groups/libgap_wrapper.pyx @@ -518,7 +518,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement): else: raise TypeError('need a libgap group element or "1" in constructor') - cpdef GapElement gap(self) noexcept: + cpdef GapElement gap(self): """ Return a LibGAP representation of the element. @@ -640,7 +640,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement): from sage.misc.latex import latex return latex(self._repr_()) - cpdef _mul_(left, right) noexcept: + cpdef _mul_(left, right): """ Multiplication of group elements @@ -662,7 +662,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement): return P.element_class(P, ( left)._libgap * ( right)._libgap) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ This method implements comparison. @@ -682,7 +682,7 @@ cdef class ElementLibGAP(MultiplicativeGroupElement): return richcmp((left)._libgap, (right)._libgap, op) - cpdef _div_(left, right) noexcept: + cpdef _div_(left, right): """ Division of group elements. diff --git a/src/sage/groups/matrix_gps/group_element.pxd b/src/sage/groups/matrix_gps/group_element.pxd index 1b32eea3602..36a5a9fc4ce 100644 --- a/src/sage/groups/matrix_gps/group_element.pxd +++ b/src/sage/groups/matrix_gps/group_element.pxd @@ -1,10 +1,10 @@ from sage.structure.element cimport MultiplicativeGroupElement, Element, MonoidElement, Matrix -cpdef is_MatrixGroupElement(x) noexcept +cpdef is_MatrixGroupElement(x) cdef class MatrixGroupElement_generic(MultiplicativeGroupElement): cdef public Matrix _matrix - cpdef _act_on_(self, x, bint self_on_left) noexcept - cpdef _mul_(self, other) noexcept - cpdef list list(self) noexcept + cpdef _act_on_(self, x, bint self_on_left) + cpdef _mul_(self, other) + cpdef list list(self) diff --git a/src/sage/groups/matrix_gps/group_element.pyx b/src/sage/groups/matrix_gps/group_element.pyx index fa914a9499d..38bf1f03279 100644 --- a/src/sage/groups/matrix_gps/group_element.pyx +++ b/src/sage/groups/matrix_gps/group_element.pyx @@ -89,7 +89,7 @@ except ImportError: MatrixGroupElement_gap = () -cpdef is_MatrixGroupElement(x) noexcept: +cpdef is_MatrixGroupElement(x): """ Test whether ``x`` is a matrix group element @@ -222,7 +222,7 @@ cdef class MatrixGroupElement_generic(MultiplicativeGroupElement): """ return self._matrix._latex_() - cpdef _act_on_(self, x, bint self_on_left) noexcept: + cpdef _act_on_(self, x, bint self_on_left): """ EXAMPLES:: @@ -245,7 +245,7 @@ cdef class MatrixGroupElement_generic(MultiplicativeGroupElement): except TypeError: return None - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ EXAMPLES:: @@ -266,7 +266,7 @@ cdef class MatrixGroupElement_generic(MultiplicativeGroupElement): cdef MatrixGroupElement_generic y = other return richcmp(x._matrix, y._matrix, op) - cpdef list list(self) noexcept: + cpdef list list(self): """ Return list representation of this matrix. @@ -327,7 +327,7 @@ cdef class MatrixGroupElement_generic(MultiplicativeGroupElement): """ return self.matrix() - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): """ Return the product of ``self`` and`` other``, which must have identical parents. diff --git a/src/sage/groups/matrix_gps/group_element_gap.pxd b/src/sage/groups/matrix_gps/group_element_gap.pxd index 2633f21892c..e0ecbefea5c 100644 --- a/src/sage/groups/matrix_gps/group_element_gap.pxd +++ b/src/sage/groups/matrix_gps/group_element_gap.pxd @@ -1,5 +1,5 @@ from sage.groups.libgap_wrapper cimport ElementLibGAP cdef class MatrixGroupElement_gap(ElementLibGAP): - cpdef _act_on_(self, x, bint self_on_left) noexcept - cpdef list list(self) noexcept + cpdef _act_on_(self, x, bint self_on_left) + cpdef list list(self) diff --git a/src/sage/groups/matrix_gps/group_element_gap.pyx b/src/sage/groups/matrix_gps/group_element_gap.pyx index 7c581377f6f..b07c0f01a44 100644 --- a/src/sage/groups/matrix_gps/group_element_gap.pyx +++ b/src/sage/groups/matrix_gps/group_element_gap.pyx @@ -136,7 +136,7 @@ cdef class MatrixGroupElement_gap(ElementLibGAP): """ return self.matrix()._latex_() - cpdef _act_on_(self, x, bint self_on_left) noexcept: + cpdef _act_on_(self, x, bint self_on_left): """ EXAMPLES:: @@ -157,7 +157,7 @@ cdef class MatrixGroupElement_gap(ElementLibGAP): except TypeError: return None - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ EXAMPLES:: @@ -230,7 +230,7 @@ cdef class MatrixGroupElement_gap(ElementLibGAP): """ return self.matrix() - cpdef list list(self) noexcept: + cpdef list list(self): """ Return list representation of this matrix. diff --git a/src/sage/groups/perm_gps/partn_ref/data_structures.pxd b/src/sage/groups/perm_gps/partn_ref/data_structures.pxd index 4c7152e5d6d..f53184bd082 100644 --- a/src/sage/groups/perm_gps/partn_ref/data_structures.pxd +++ b/src/sage/groups/perm_gps/partn_ref/data_structures.pxd @@ -95,7 +95,7 @@ cdef inline OrbitPartition *OP_copy(OrbitPartition *OP) noexcept: OP_copy_from_to(OP, OP2) return OP2 -cdef OP_string(OrbitPartition *OP) noexcept +cdef OP_string(OrbitPartition *OP) cdef inline void OP_clear(OrbitPartition *OP) noexcept: cdef int i, n = OP.degree @@ -255,7 +255,7 @@ cdef PartitionStack *PS_copy(PartitionStack *PS) noexcept cdef void PS_dealloc(PartitionStack *PS) noexcept -cdef PS_print(PartitionStack *PS) noexcept +cdef PS_print(PartitionStack *PS) cdef void PS_unit_partition(PartitionStack *PS) noexcept @@ -263,7 +263,7 @@ cdef int PS_first_smallest(PartitionStack *PS, bitset_t b, int *second_pos=?) no cdef PartitionStack *PS_from_list(list L) noexcept -cdef list PS_singletons(PartitionStack * part) noexcept +cdef list PS_singletons(PartitionStack * part) cdef int PS_all_new_cells(PartitionStack *PS, bitset_t** nonsingletons_ptr) noexcept diff --git a/src/sage/groups/perm_gps/partn_ref/data_structures.pyx b/src/sage/groups/perm_gps/partn_ref/data_structures.pyx index d2da976bc87..cb25f23a4d3 100644 --- a/src/sage/groups/perm_gps/partn_ref/data_structures.pyx +++ b/src/sage/groups/perm_gps/partn_ref/data_structures.pyx @@ -66,7 +66,7 @@ cdef inline void OP_dealloc(OrbitPartition *OP) noexcept: sig_free(OP.parent) sig_free(OP) -cdef OP_string(OrbitPartition *OP) noexcept: +cdef OP_string(OrbitPartition *OP): """ Return a string representation of the OrbitPartition. """ @@ -260,7 +260,7 @@ cdef PartitionStack *PS_from_list(list L) noexcept: PS.degree = n return PS -cdef PS_print(PartitionStack *PS) noexcept: +cdef PS_print(PartitionStack *PS): """ Print a visual representation of PS. """ @@ -268,7 +268,7 @@ cdef PS_print(PartitionStack *PS) noexcept: for i in range(PS.depth + 1): PS_print_partition(PS, i) -cdef PS_print_partition(PartitionStack *PS, int k) noexcept: +cdef PS_print_partition(PartitionStack *PS, int k): """ Print the partition at depth k. """ @@ -381,7 +381,7 @@ cdef int PS_find_element(PartitionStack *PS, bitset_t b, int x) except -1: i += 1 return location -cdef list PS_singletons(PartitionStack * part) noexcept: +cdef list PS_singletons(PartitionStack * part): """ Return the list of all singletons in the PartitionStack. """ @@ -818,7 +818,7 @@ cdef int SC_copy_nomalloc(StabilizerChain *SC_dest, StabilizerChain *SC, int lev memcpy(SC_dest.gen_inverses[i], SC.gen_inverses[i], SC.num_gens[i]*n * sizeof(int) ) return 0 -cdef SC_print_level(StabilizerChain *SC, int level) noexcept: +cdef SC_print_level(StabilizerChain *SC, int level): cdef int i, j, n = SC.degree if level < SC.base_size: print('/ level {}'.format(level)) diff --git a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pxd b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pxd index cf964bfd17c..9ba66caff70 100644 --- a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pxd +++ b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pxd @@ -23,7 +23,7 @@ cdef extern from *: cdef tuple PS_refinement(PartitionStack * part, long *refine_vals, long *best, int begin, int end, - bint * cand_initialized, bint *changed_partition) noexcept + bint * cand_initialized, bint *changed_partition) cdef class _BestValStore: cdef int default_data_length @@ -39,7 +39,7 @@ cdef class LabelledBranching: cdef GapElement group, ClosureGroup cdef Parent sym_gp cdef bint has_empty_intersection(self, PartitionStack * part) noexcept - cpdef add_gen(self, GapElement_Permutation gen) noexcept + cpdef add_gen(self, GapElement_Permutation gen) cdef class PartitionRefinement_generic: cdef PartitionStack * _part @@ -65,7 +65,7 @@ cdef class PartitionRefinement_generic: # methods which have to be implemented in derived classes cdef bint _inner_min_(self, int pos, bint* inner_group_changed) noexcept cdef bint _refine(self, bint *part_changed, bint inner_group_changed, bint first_step) noexcept - cdef tuple _store_state_(self) noexcept + cdef tuple _store_state_(self) cdef void _restore_state_(self, tuple act_state) noexcept cdef void _store_best_(self) noexcept cdef bint _minimization_allowed_on_col(self, int pos) noexcept diff --git a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx index 4a723873ae7..261d1987897 100644 --- a/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx +++ b/src/sage/groups/perm_gps/partn_ref2/refinement_generic.pyx @@ -191,7 +191,7 @@ from sage.data_structures.bitset_base cimport * cdef tuple PS_refinement(PartitionStack * part, long *refine_vals, long *best, int begin, int end, - bint * cand_initialized, bint *changed_partition) noexcept: + bint * cand_initialized, bint *changed_partition): """ Refine the partition stack by the values given by ``refine_vals``. We also compare our actual refinement result with the vector ``best`` in the @@ -356,7 +356,7 @@ cdef class LabelledBranching: sig_free(self.father) sig_free(self.act_perm) - cpdef add_gen(self, GapElement_Permutation gen) noexcept: + cpdef add_gen(self, GapElement_Permutation gen): r""" Add a further generator to the group and update the complete labeled branching. @@ -524,7 +524,7 @@ cdef class PartitionRefinement_generic: """ raise NotImplementedError - cdef tuple _store_state_(self) noexcept: + cdef tuple _store_state_(self): r""" Store the current state of the node to a tuple, such that it can be restored by :meth:`_restore_state_`. diff --git a/src/sage/groups/perm_gps/permgroup_element.pxd b/src/sage/groups/perm_gps/permgroup_element.pxd index 2e3f22150e7..21b509f06d1 100644 --- a/src/sage/groups/perm_gps/permgroup_element.pxd +++ b/src/sage/groups/perm_gps/permgroup_element.pxd @@ -8,22 +8,22 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): cdef int n cdef int perm_buf[15] # to avoid malloc for small elements cdef GapElement _libgap - cdef PermutationGroupElement _new_c(self) noexcept - cdef _alloc(self, int) noexcept - cpdef _set_identity(self) noexcept - cpdef _set_list_images(self, v, bint convert) noexcept - cpdef _set_libgap(self, GapElement p) noexcept - cpdef _set_list_cycles(self, c, bint convert) noexcept - cpdef _set_string(self, str s) noexcept - cpdef _set_permutation_group_element(self, PermutationGroupElement p, bint convert) noexcept + cdef PermutationGroupElement _new_c(self) + cdef _alloc(self, int) + cpdef _set_identity(self) + cpdef _set_list_images(self, v, bint convert) + cpdef _set_libgap(self, GapElement p) + cpdef _set_list_cycles(self, c, bint convert) + cpdef _set_string(self, str s) + cpdef _set_permutation_group_element(self, PermutationGroupElement p, bint convert) - cpdef _mul_(self, other) noexcept - cpdef PermutationGroupElement _transpose_left(self, j, k) noexcept - cpdef PermutationGroupElement _generate_new(self, list new_list) noexcept - cpdef PermutationGroupElement _generate_new_GAP(self, old) noexcept - cpdef _gap_list(self) noexcept - cpdef domain(self) noexcept + cpdef _mul_(self, other) + cpdef PermutationGroupElement _transpose_left(self, j, k) + cpdef PermutationGroupElement _generate_new(self, list new_list) + cpdef PermutationGroupElement _generate_new_GAP(self, old) + cpdef _gap_list(self) + cpdef domain(self) cdef public _SageObject__custom_name - cpdef list _act_on_list_on_position(self, list x) noexcept - cpdef ClonableIntArray _act_on_array_on_position(self, ClonableIntArray x) noexcept - cpdef ETuple _act_on_etuple_on_position(self, ETuple x) noexcept + cpdef list _act_on_list_on_position(self, list x) + cpdef ClonableIntArray _act_on_array_on_position(self, ClonableIntArray x) + cpdef ETuple _act_on_etuple_on_position(self, ETuple x) diff --git a/src/sage/groups/perm_gps/permgroup_element.pyx b/src/sage/groups/perm_gps/permgroup_element.pyx index 73247ffe9d8..0d80d04a8af 100644 --- a/src/sage/groups/perm_gps/permgroup_element.pyx +++ b/src/sage/groups/perm_gps/permgroup_element.pyx @@ -513,7 +513,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): if p not in P: raise ValueError('permutation %s not in %s' % (g, parent)) - cpdef _set_identity(self) noexcept: + cpdef _set_identity(self): r""" TESTS:: @@ -532,7 +532,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): for i in range(self.n): self.perm[i] = i - cpdef _set_list_images(self, v, bint convert) noexcept: + cpdef _set_list_images(self, v, bint convert): r""" TESTS:: @@ -566,7 +566,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): for i in range(vn, self.n): self.perm[i] = i - cpdef _set_libgap(self, GapElement p) noexcept: + cpdef _set_libgap(self, GapElement p): r""" TESTS:: @@ -615,7 +615,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): self._libgap = p - cpdef _set_permutation_group_element(self, PermutationGroupElement p, bint convert) noexcept: + cpdef _set_permutation_group_element(self, PermutationGroupElement p, bint convert): r""" TESTS:: @@ -669,7 +669,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): for i in range(p.n, self.n): self.perm[i] = i - cpdef _set_list_cycles(self, c, bint convert) noexcept: + cpdef _set_list_cycles(self, c, bint convert): r""" TESTS:: @@ -716,7 +716,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): raise ValueError("invalid list of cycles to initialize a permutation") self.perm[j] = t[0] - 1 - cpdef _set_string(self, str s) noexcept: + cpdef _set_string(self, str s): r""" TESTS:: @@ -807,7 +807,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): """ return make_permgroup_element_v2, (self._parent, self.domain(), self._parent.domain()) - cdef _alloc(self, int n) noexcept: + cdef _alloc(self, int n): if n < 16 and self.perm == NULL: self.perm = self.perm_buf elif self.perm == NULL: @@ -817,7 +817,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): self.n = n - cdef PermutationGroupElement _new_c(self) noexcept: + cdef PermutationGroupElement _new_c(self): cdef type t = type(self) cdef PermutationGroupElement other = t.__new__(t) if HAS_DICTIONARY(self): @@ -980,7 +980,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): """ return self.cycles()[i] - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): r""" Compare group elements ``self`` and ``other``. @@ -1089,7 +1089,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): else: return from_gap[i] - cpdef list _act_on_list_on_position(self, list x) noexcept: + cpdef list _act_on_list_on_position(self, list x): r""" Returns the right action of ``self`` on the list ``x``. This is the action on positions. @@ -1117,7 +1117,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): assert len(x) == self.n, '%s and %s should have the same length'%(self, x) return [ x[self.perm[i]] for i in range(self.n) ] - cpdef ClonableIntArray _act_on_array_on_position(self, ClonableIntArray x) noexcept: + cpdef ClonableIntArray _act_on_array_on_position(self, ClonableIntArray x): r""" Returns the right action of ``self`` on the ClonableIntArray ``x``. This is the action on positions. @@ -1141,7 +1141,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): y.set_immutable() return y - cpdef ETuple _act_on_etuple_on_position(self, ETuple x) noexcept: + cpdef ETuple _act_on_etuple_on_position(self, ETuple x): r""" Return the right action of this permutation on the ETuple ``x``. @@ -1181,7 +1181,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): qsort(result._data, result._nonzero, 2 * sizeof(int), etuple_index_cmp) return result - cpdef _act_on_(self, x, bint self_on_left) noexcept: + cpdef _act_on_(self, x, bint self_on_left): r""" Return the result of the action of ``self`` on ``x``. @@ -1301,7 +1301,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): return coercion_model.bin_op(left, right, operator.mul) - cpdef PermutationGroupElement _transpose_left(self, j, k) noexcept: + cpdef PermutationGroupElement _transpose_left(self, j, k): r""" Return the product of the transposition `(j, k)` with ``self``. @@ -1334,7 +1334,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): prod.perm[j - 1], prod.perm[k - 1] = self.perm[k - 1], self.perm[j - 1] return prod - cpdef _mul_(left, _right) noexcept: + cpdef _mul_(left, _right): r""" EXAMPLES:: @@ -1351,7 +1351,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): prod.perm[i] = right.perm[left.perm[i]] return prod - cpdef PermutationGroupElement _generate_new(self, list v) noexcept: + cpdef PermutationGroupElement _generate_new(self, list v): r""" Generate a new permutation group element with the same parent as ``self`` from ``v``. @@ -1369,7 +1369,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): new._set_list_images(v, False) return new - cpdef PermutationGroupElement _generate_new_GAP(self, lst_in) noexcept: + cpdef PermutationGroupElement _generate_new_GAP(self, lst_in): r""" Generate a new permutation group element with the same parent as ``self`` from the GAP list ``lst_in``. @@ -1420,7 +1420,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): inv.perm[self.perm[i]] = i return inv - cpdef _gap_list(self) noexcept: + cpdef _gap_list(self): r""" Returns this permutation in list notation compatible with the GAP numbering. @@ -1468,7 +1468,7 @@ cdef class PermutationGroupElement(MultiplicativeGroupElement): from sage.combinat.permutation import Permutation return Permutation(self._gap_list()).cycle_string() - cpdef domain(self) noexcept: + cpdef domain(self): r""" Return the domain of ``self``. diff --git a/src/sage/groups/semimonomial_transformations/semimonomial_transformation.pxd b/src/sage/groups/semimonomial_transformations/semimonomial_transformation.pxd index 1808129c4b7..bd4f62d497f 100644 --- a/src/sage/groups/semimonomial_transformations/semimonomial_transformation.pxd +++ b/src/sage/groups/semimonomial_transformations/semimonomial_transformation.pxd @@ -4,5 +4,5 @@ cdef class SemimonomialTransformation(MultiplicativeGroupElement): cdef tuple v cdef object perm, alpha - cdef _new_c(self) noexcept - cpdef _mul_(self, other) noexcept + cdef _new_c(self) + cpdef _mul_(self, other) diff --git a/src/sage/groups/semimonomial_transformations/semimonomial_transformation.pyx b/src/sage/groups/semimonomial_transformations/semimonomial_transformation.pyx index 5368340c98f..baaefa1950e 100644 --- a/src/sage/groups/semimonomial_transformations/semimonomial_transformation.pyx +++ b/src/sage/groups/semimonomial_transformations/semimonomial_transformation.pyx @@ -135,7 +135,7 @@ cdef class SemimonomialTransformation(MultiplicativeGroupElement): self.perm = perm self.alpha = alpha - cdef _new_c(self) noexcept: + cdef _new_c(self): # Create a copy of self. cdef SemimonomialTransformation x x = SemimonomialTransformation.__new__(SemimonomialTransformation) @@ -173,7 +173,7 @@ cdef class SemimonomialTransformation(MultiplicativeGroupElement): """ return hash(self.v) + hash(self.perm) + hash(self.get_autom()) - cpdef _mul_(left, _right) noexcept: + cpdef _mul_(left, _right): r""" Multiplication of elements. @@ -247,7 +247,7 @@ cdef class SemimonomialTransformation(MultiplicativeGroupElement): return "(%s; %s, %s)"%(self.v, self.perm.cycle_string(), self.get_autom()) - cpdef _richcmp_(left, _right, int op) noexcept: + cpdef _richcmp_(left, _right, int op): """ Compare group elements ``self`` and ``right``. diff --git a/src/sage/interacts/library_cython.pyx b/src/sage/interacts/library_cython.pyx index a2b36489165..37e75a16e7d 100644 --- a/src/sage/interacts/library_cython.pyx +++ b/src/sage/interacts/library_cython.pyx @@ -16,7 +16,7 @@ AUTHORS: #***************************************************************************** -cpdef julia(ff_j, z, int iterations) noexcept: +cpdef julia(ff_j, z, int iterations): """ Helper function for the Julia Fractal interact example. @@ -44,7 +44,7 @@ cpdef julia(ff_j, z, int iterations) noexcept: return z -cpdef mandel(ff_m, z, int iterations) noexcept: +cpdef mandel(ff_m, z, int iterations): """ Helper function for the Mandelbrot Fractal interact example. @@ -73,7 +73,7 @@ cpdef mandel(ff_m, z, int iterations) noexcept: return z -cpdef cellular(rule, int N) noexcept: +cpdef cellular(rule, int N): """ Cythonized helper function for the cellular_automata fractal. diff --git a/src/sage/lfunctions/zero_sums.pyx b/src/sage/lfunctions/zero_sums.pyx index 46f84d6f12d..c5a425b4429 100644 --- a/src/sage/lfunctions/zero_sums.pyx +++ b/src/sage/lfunctions/zero_sums.pyx @@ -1109,7 +1109,7 @@ cdef class LFunctionZeroSum_EllipticCurve(LFunctionZeroSum_abstract): logp = c_log(p) return -(t - logp) * (logp / p) * ap - cpdef _zerosum_sincsquared_fast(self, Delta=1, bad_primes=None) noexcept: + cpdef _zerosum_sincsquared_fast(self, Delta=1, bad_primes=None): r""" A faster cythonized implementation of self._zerosum_sincsquared(). diff --git a/src/sage/libs/ecl.pyx b/src/sage/libs/ecl.pyx index f2667d9ceca..1cc38a3ab3a 100644 --- a/src/sage/libs/ecl.pyx +++ b/src/sage/libs/ecl.pyx @@ -289,7 +289,7 @@ def init_ecl(): ecl_has_booted = 1 -cdef ecl_string_to_python(cl_object s) noexcept: +cdef ecl_string_to_python(cl_object s): if bint_base_string_p(s): return char_to_str(ecl_base_string_pointer_safe(s)) else: @@ -492,7 +492,7 @@ cdef cl_object python_to_ecl(pyobj, bint read_strings) except NULL: raise TypeError("Unimplemented type for python_to_ecl") -cdef ecl_to_python(cl_object o) noexcept: +cdef ecl_to_python(cl_object o): cdef cl_object s cdef Integer N # conversions from an ecl object to a python object. @@ -1348,13 +1348,13 @@ cdef class EclListIterator: return r # input: a cl-object. Output: EclObject wrapping that. -cdef EclObject ecl_wrap(cl_object o) noexcept: +cdef EclObject ecl_wrap(cl_object o): cdef EclObject obj = EclObject.__new__(EclObject) obj.set_obj(o) return obj # convenience routine to more easily evaluate strings -cpdef EclObject ecl_eval(str s) noexcept: +cpdef EclObject ecl_eval(str s): r""" Read and evaluate string in Lisp and return the result diff --git a/src/sage/libs/eclib/mat.pxd b/src/sage/libs/eclib/mat.pxd index de8d9e81ad3..509bd4d0ce8 100644 --- a/src/sage/libs/eclib/mat.pxd +++ b/src/sage/libs/eclib/mat.pxd @@ -4,4 +4,4 @@ cdef class Matrix: cdef mat* M cdef class MatrixFactory: - cdef new_matrix(self, mat M) noexcept + cdef new_matrix(self, mat M) diff --git a/src/sage/libs/eclib/mat.pyx b/src/sage/libs/eclib/mat.pyx index b83cd76b5a5..b4b607ef083 100644 --- a/src/sage/libs/eclib/mat.pyx +++ b/src/sage/libs/eclib/mat.pyx @@ -240,11 +240,11 @@ cdef class Matrix: cdef class MatrixFactory: - cdef new_matrix(self, mat M) noexcept: + cdef new_matrix(self, mat M): return new_Matrix(M) -cdef Matrix new_Matrix(mat M) noexcept: +cdef Matrix new_Matrix(mat M): cdef Matrix A = Matrix() A.M = new mat(M) return A diff --git a/src/sage/libs/eclib/mwrank.pyx b/src/sage/libs/eclib/mwrank.pyx index b91dccf74b9..bc475f907b6 100644 --- a/src/sage/libs/eclib/mwrank.pyx +++ b/src/sage/libs/eclib/mwrank.pyx @@ -68,7 +68,7 @@ cdef extern from "wrap.cpp": long two_descent_get_selmer_rank(two_descent* t) void two_descent_saturate(two_descent* t, long sat_bd, long sat_low_bd) -cdef object string_sigoff(char* s) noexcept: +cdef object string_sigoff(char* s): sig_off() # Makes a python string and deletes what is pointed to by s. t = char_to_str(s) @@ -239,7 +239,7 @@ cdef class _bigint: return string_sigoff(bigint_to_str(self.x)) -cdef make_bigint(bigint* x) noexcept: +cdef make_bigint(bigint* x): cdef _bigint y sig_off() y = _bigint.__new__(_bigint) diff --git a/src/sage/libs/flint/fmpq_poly_sage.pxd b/src/sage/libs/flint/fmpq_poly_sage.pxd index 661623745b4..7ee5e58c356 100644 --- a/src/sage/libs/flint/fmpq_poly_sage.pxd +++ b/src/sage/libs/flint/fmpq_poly_sage.pxd @@ -18,7 +18,7 @@ from sage.libs.flint.fmpq_poly cimport fmpq_poly_numref, fmpq_poly_length # since the fmpq_poly header seems to be lacking this inline function -cdef inline sage_fmpq_poly_max_limbs(const fmpq_poly_t poly) noexcept: +cdef inline sage_fmpq_poly_max_limbs(const fmpq_poly_t poly): return _fmpz_vec_max_limbs(fmpq_poly_numref(poly), fmpq_poly_length(poly)) # functions removed from flint but still needed in sage diff --git a/src/sage/libs/flint/fmpz_factor_sage.pxd b/src/sage/libs/flint/fmpz_factor_sage.pxd index e91931005c7..f29155b46e5 100644 --- a/src/sage/libs/flint/fmpz_factor_sage.pxd +++ b/src/sage/libs/flint/fmpz_factor_sage.pxd @@ -1,3 +1,3 @@ from .types cimport * -cdef fmpz_factor_to_pairlist(const fmpz_factor_t factors) noexcept +cdef fmpz_factor_to_pairlist(const fmpz_factor_t factors) diff --git a/src/sage/libs/flint/fmpz_factor_sage.pyx b/src/sage/libs/flint/fmpz_factor_sage.pyx index aeb9c76f9e3..330ba3d4d4e 100644 --- a/src/sage/libs/flint/fmpz_factor_sage.pyx +++ b/src/sage/libs/flint/fmpz_factor_sage.pyx @@ -2,7 +2,7 @@ from cysignals.signals cimport sig_check from sage.libs.flint.fmpz cimport fmpz_get_mpz from sage.rings.integer cimport Integer -cdef fmpz_factor_to_pairlist(const fmpz_factor_t factors) noexcept: +cdef fmpz_factor_to_pairlist(const fmpz_factor_t factors): r""" Helper function that converts a fmpz_factor_t into a list of (factor, exponent) pairs. The factors are Integers, and the diff --git a/src/sage/libs/flint/nmod_poly_linkage.pxi b/src/sage/libs/flint/nmod_poly_linkage.pxi index 239f87a7dd2..461679cba20 100644 --- a/src/sage/libs/flint/nmod_poly_linkage.pxi +++ b/src/sage/libs/flint/nmod_poly_linkage.pxi @@ -68,7 +68,7 @@ cdef inline int celement_gen(nmod_poly_t e, long i, unsigned long n) except -2: nmod_poly_zero(e) nmod_poly_set_coeff_ui(e, 1, 1) -cdef object celement_repr(nmod_poly_t e, unsigned long n) noexcept: +cdef object celement_repr(nmod_poly_t e, unsigned long n): raise NotImplementedError cdef inline int celement_set(nmod_poly_t res, nmod_poly_t a, unsigned long n) except -2: @@ -621,7 +621,7 @@ cdef inline int celement_xgcd(nmod_poly_t res, nmod_poly_t s, nmod_poly_t t, nmo nmod_poly_xgcd(res, s, t, a, b) -cdef factor_helper(Polynomial_zmod_flint poly, bint squarefree=False) noexcept: +cdef factor_helper(Polynomial_zmod_flint poly, bint squarefree=False): """ EXAMPLES:: diff --git a/src/sage/libs/gap/element.pxd b/src/sage/libs/gap/element.pxd index 329001e72f5..ba4028cd91c 100644 --- a/src/sage/libs/gap/element.pxd +++ b/src/sage/libs/gap/element.pxd @@ -18,16 +18,16 @@ cdef Obj make_gap_record(sage_dict) except NULL cdef Obj make_gap_integer(sage_int) except NULL cdef Obj make_gap_string(sage_string) except NULL -cdef GapElement make_any_gap_element(parent, Obj obj) noexcept -cdef GapElement make_GapElement(parent, Obj obj) noexcept -cdef GapElement_List make_GapElement_List(parent, Obj obj) noexcept -cdef GapElement_Record make_GapElement_Record(parent, Obj obj) noexcept -cdef GapElement_Integer make_GapElement_Integer(parent, Obj obj) noexcept -cdef GapElement_Rational make_GapElement_Rational(parent, Obj obj) noexcept -cdef GapElement_String make_GapElement_String(parent, Obj obj) noexcept -cdef GapElement_Boolean make_GapElement_Boolean(parent, Obj obj) noexcept -cdef GapElement_Function make_GapElement_Function(parent, Obj obj) noexcept -cdef GapElement_Permutation make_GapElement_Permutation(parent, Obj obj) noexcept +cdef GapElement make_any_gap_element(parent, Obj obj) +cdef GapElement make_GapElement(parent, Obj obj) +cdef GapElement_List make_GapElement_List(parent, Obj obj) +cdef GapElement_Record make_GapElement_Record(parent, Obj obj) +cdef GapElement_Integer make_GapElement_Integer(parent, Obj obj) +cdef GapElement_Rational make_GapElement_Rational(parent, Obj obj) +cdef GapElement_String make_GapElement_String(parent, Obj obj) +cdef GapElement_Boolean make_GapElement_Boolean(parent, Obj obj) +cdef GapElement_Function make_GapElement_Function(parent, Obj obj) +cdef GapElement_Permutation make_GapElement_Permutation(parent, Obj obj) cdef char *capture_stdout(Obj, Obj) noexcept cdef char *gap_element_str(Obj) noexcept @@ -43,18 +43,18 @@ cdef class GapElement(RingElement): cdef bint _compare_by_id cdef bint _compare_equal(self, Element other) except -2 cdef bint _compare_less(self, Element other) except -2 - cpdef _set_compare_by_id(self) noexcept - cpdef _assert_compare_by_id(self) noexcept + cpdef _set_compare_by_id(self) + cpdef _assert_compare_by_id(self) - cdef _initialize(self, parent, Obj obj) noexcept - cpdef _type_number(self) noexcept - cpdef is_bool(self) noexcept - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cpdef _mod_(self, other) noexcept - cpdef _pow_(self, other) noexcept + cdef _initialize(self, parent, Obj obj) + cpdef _type_number(self) + cpdef is_bool(self) + cpdef _add_(self, other) + cpdef _mul_(self, other) + cpdef _mod_(self, other) + cpdef _pow_(self, other) - cpdef GapElement deepcopy(self, bint mut) noexcept + cpdef GapElement deepcopy(self, bint mut) cdef class GapElement_Integer(GapElement): pass @@ -63,10 +63,10 @@ cdef class GapElement_Rational(GapElement): pass cdef class GapElement_IntegerMod(GapElement): - cpdef GapElement_Integer lift(self) noexcept + cpdef GapElement_Integer lift(self) cdef class GapElement_FiniteField(GapElement): - cpdef GapElement_Integer lift(self) noexcept + cpdef GapElement_Integer lift(self) cdef class GapElement_Cyclotomic(GapElement): pass diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx index b2b0681c052..f1482997b86 100644 --- a/src/sage/libs/gap/element.pyx +++ b/src/sage/libs/gap/element.pyx @@ -266,7 +266,7 @@ cdef Obj make_gap_string(sage_string) except NULL: ### generic construction of GapElements #################################### ############################################################################ -cdef GapElement make_any_gap_element(parent, Obj obj) noexcept: +cdef GapElement make_any_gap_element(parent, Obj obj): """ Return the GAP element wrapper of ``obj`` @@ -354,7 +354,7 @@ cdef GapElement make_any_gap_element(parent, Obj obj) noexcept: ### GapElement ############################################################# ############################################################################ -cdef GapElement make_GapElement(parent, Obj obj) noexcept: +cdef GapElement make_GapElement(parent, Obj obj): r""" Turn a Gap C object (of type ``Obj``) into a Cython ``GapElement``. @@ -387,7 +387,7 @@ cdef GapElement make_GapElement(parent, Obj obj) noexcept: return r -cpdef _from_sage(elem) noexcept: +cpdef _from_sage(elem): """ Currently just used for unpickling; equivalent to calling ``libgap(elem)`` to convert a Sage object to a `GapElement` where possible. @@ -460,7 +460,7 @@ cdef class GapElement(RingElement): """ raise TypeError('this class cannot be instantiated from Python') - cdef _initialize(self, parent, Obj obj) noexcept: + cdef _initialize(self, parent, Obj obj): r""" Initialize the GapElement. @@ -544,7 +544,7 @@ cdef class GapElement(RingElement): else: return self - cpdef GapElement deepcopy(self, bint mut) noexcept: + cpdef GapElement deepcopy(self, bint mut): r""" Return a deepcopy of this Gap object @@ -647,7 +647,7 @@ cdef class GapElement(RingElement): GAP_IN = libgap.eval(r'\in') return GAP_IN(other, self).sage() - cpdef _type_number(self) noexcept: + cpdef _type_number(self): """ Return the GAP internal type number. @@ -776,7 +776,7 @@ cdef class GapElement(RingElement): s = char_to_str(gap_element_repr(self.value)) return s.strip() - cpdef _set_compare_by_id(self) noexcept: + cpdef _set_compare_by_id(self): """ Set comparison to compare by ``id`` @@ -814,7 +814,7 @@ cdef class GapElement(RingElement): """ self._compare_by_id = True - cpdef _assert_compare_by_id(self) noexcept: + cpdef _assert_compare_by_id(self): """ Ensure that comparison is by ``id`` @@ -851,7 +851,7 @@ cdef class GapElement(RingElement): """ return hash(str(self)) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Compare ``self`` with ``other``. @@ -973,7 +973,7 @@ cdef class GapElement(RingElement): GAP_Leave() sig_off() - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): r""" Add two GapElement objects. @@ -1002,7 +1002,7 @@ cdef class GapElement(RingElement): GAP_Leave() return make_any_gap_element(self.parent(), result) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): r""" Subtract two GapElement objects. @@ -1031,7 +1031,7 @@ cdef class GapElement(RingElement): return make_any_gap_element(self.parent(), result) - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): r""" Multiply two GapElement objects. @@ -1060,7 +1060,7 @@ cdef class GapElement(RingElement): GAP_Leave() return make_any_gap_element(self.parent(), result) - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): r""" Divide two GapElement objects. @@ -1094,7 +1094,7 @@ cdef class GapElement(RingElement): GAP_Leave() return make_any_gap_element(self.parent(), result) - cpdef _mod_(self, right) noexcept: + cpdef _mod_(self, right): r""" Modulus of two GapElement objects. @@ -1121,7 +1121,7 @@ cdef class GapElement(RingElement): GAP_Leave() return make_any_gap_element(self.parent(), result) - cpdef _pow_(self, other) noexcept: + cpdef _pow_(self, other): r""" Exponentiation of two GapElement objects. @@ -1170,7 +1170,7 @@ cdef class GapElement(RingElement): GAP_Leave() return make_any_gap_element(self._parent, result) - cpdef _pow_int(self, other) noexcept: + cpdef _pow_int(self, other): """ TESTS:: @@ -1232,7 +1232,7 @@ cdef class GapElement(RingElement): """ return GAP_IsRecord(self.value) - cpdef is_bool(self) noexcept: + cpdef is_bool(self): r""" Return whether the wrapped GAP object is a GAP boolean. @@ -1401,7 +1401,7 @@ cdef class GapElement(RingElement): ### GapElement_Integer ##################################################### ############################################################################ -cdef GapElement_Integer make_GapElement_Integer(parent, Obj obj) noexcept: +cdef GapElement_Integer make_GapElement_Integer(parent, Obj obj): r""" Turn a Gap integer object into a GapElement_Integer Sage object @@ -1555,7 +1555,7 @@ cdef class GapElement_Integer(GapElement): ### GapElement_Float ##################################################### ########################################################################## -cdef GapElement_Float make_GapElement_Float(parent, Obj obj) noexcept: +cdef GapElement_Float make_GapElement_Float(parent, Obj obj): r""" Turn a Gap macfloat object into a GapElement_Float Sage object @@ -1628,7 +1628,7 @@ cdef class GapElement_Float(GapElement): ### GapElement_IntegerMod ##################################################### ############################################################################ -cdef GapElement_IntegerMod make_GapElement_IntegerMod(parent, Obj obj) noexcept: +cdef GapElement_IntegerMod make_GapElement_IntegerMod(parent, Obj obj): r""" Turn a Gap integer object into a :class:`GapElement_IntegerMod` Sage object @@ -1656,7 +1656,7 @@ cdef class GapElement_IntegerMod(GapElement): """ - cpdef GapElement_Integer lift(self) noexcept: + cpdef GapElement_Integer lift(self): """ Return an integer lift. @@ -1709,7 +1709,7 @@ cdef class GapElement_IntegerMod(GapElement): ### GapElement_FiniteField ##################################################### ############################################################################ -cdef GapElement_FiniteField make_GapElement_FiniteField(parent, Obj obj) noexcept: +cdef GapElement_FiniteField make_GapElement_FiniteField(parent, Obj obj): r""" Turn a GAP finite field object into a :class:`GapElement_FiniteField` Sage object @@ -1737,7 +1737,7 @@ cdef class GapElement_FiniteField(GapElement): """ - cpdef GapElement_Integer lift(self) noexcept: + cpdef GapElement_Integer lift(self): """ Return an integer lift. @@ -1876,7 +1876,7 @@ cdef class GapElement_FiniteField(GapElement): ### GapElement_Cyclotomic ##################################################### ############################################################################ -cdef GapElement_Cyclotomic make_GapElement_Cyclotomic(parent, Obj obj) noexcept: +cdef GapElement_Cyclotomic make_GapElement_Cyclotomic(parent, Obj obj): r""" Turn a Gap cyclotomic object into a :class:`GapElement_Cyclotomic` Sage object. @@ -1964,7 +1964,7 @@ cdef class GapElement_Cyclotomic(GapElement): ### GapElement_Rational #################################################### ############################################################################ -cdef GapElement_Rational make_GapElement_Rational(parent, Obj obj) noexcept: +cdef GapElement_Rational make_GapElement_Rational(parent, Obj obj): r""" Turn a Gap Rational number (of type ``Obj``) into a Cython ``GapElement_Rational``. @@ -2036,7 +2036,7 @@ cdef class GapElement_Rational(GapElement): ### GapElement_Ring ##################################################### ############################################################################ -cdef GapElement_Ring make_GapElement_Ring(parent, Obj obj) noexcept: +cdef GapElement_Ring make_GapElement_Ring(parent, Obj obj): r""" Turn a Gap integer object into a :class:`GapElement_Ring` Sage object. @@ -2200,7 +2200,7 @@ cdef class GapElement_Ring(GapElement): ### GapElement_Boolean ##################################################### ############################################################################ -cdef GapElement_Boolean make_GapElement_Boolean(parent, Obj obj) noexcept: +cdef GapElement_Boolean make_GapElement_Boolean(parent, Obj obj): r""" Turn a Gap Boolean number (of type ``Obj``) into a Cython ``GapElement_Boolean``. @@ -2292,7 +2292,7 @@ cdef class GapElement_Boolean(GapElement): ### GapElement_String #################################################### ############################################################################ -cdef GapElement_String make_GapElement_String(parent, Obj obj) noexcept: +cdef GapElement_String make_GapElement_String(parent, Obj obj): r""" Turn a Gap String (of type ``Obj``) into a Cython ``GapElement_String``. @@ -2352,7 +2352,7 @@ cdef class GapElement_String(GapElement): ### GapElement_Function #################################################### ############################################################################ -cdef GapElement_Function make_GapElement_Function(parent, Obj obj) noexcept: +cdef GapElement_Function make_GapElement_Function(parent, Obj obj): r""" Turn a Gap C function object (of type ``Obj``) into a Cython ``GapElement_Function``. @@ -2562,7 +2562,7 @@ cdef class GapElement_Function(GapElement): ### GapElement_MethodProxy ################################################# ############################################################################ -cdef GapElement_MethodProxy make_GapElement_MethodProxy(parent, Obj function, GapElement base_object) noexcept: +cdef GapElement_MethodProxy make_GapElement_MethodProxy(parent, Obj function, GapElement base_object): r""" Turn a Gap C rec object (of type ``Obj``) into a Cython ``GapElement_Record``. @@ -2652,7 +2652,7 @@ cdef class GapElement_MethodProxy(GapElement_Function): ### GapElement_List ######################################################## ############################################################################ -cdef GapElement_List make_GapElement_List(parent, Obj obj) noexcept: +cdef GapElement_List make_GapElement_List(parent, Obj obj): r""" Turn a Gap C List object (of type ``Obj``) into a Cython ``GapElement_List``. @@ -2990,7 +2990,7 @@ cdef class GapElement_List(GapElement): ############################################################################ -cdef GapElement_Permutation make_GapElement_Permutation(parent, Obj obj) noexcept: +cdef GapElement_Permutation make_GapElement_Permutation(parent, Obj obj): r""" Turn a Gap C permutation object (of type ``Obj``) into a Cython ``GapElement_Permutation``. @@ -3055,7 +3055,7 @@ cdef class GapElement_Permutation(GapElement): ### GapElement_Record ###################################################### ############################################################################ -cdef GapElement_Record make_GapElement_Record(parent, Obj obj) noexcept: +cdef GapElement_Record make_GapElement_Record(parent, Obj obj): r""" Turn a Gap C rec object (of type ``Obj``) into a Cython ``GapElement_Record``. diff --git a/src/sage/libs/gap/util.pxd b/src/sage/libs/gap/util.pxd index 8b4a7aadce7..bb559f7c6a3 100644 --- a/src/sage/libs/gap/util.pxd +++ b/src/sage/libs/gap/util.pxd @@ -17,10 +17,10 @@ from sage.libs.gap.gap_includes cimport Obj cdef class ObjWrapper(): cdef Obj value -cdef ObjWrapper wrap_obj(Obj obj) noexcept +cdef ObjWrapper wrap_obj(Obj obj) # returns the refcount dictionary for debugging purposes -cpdef get_owned_objects() noexcept +cpdef get_owned_objects() # Reference count GAP objects that you want to prevent from being # garbage collected @@ -35,7 +35,7 @@ cdef void gasman_callback() noexcept with gil ### Initialization of GAP ################################################## ############################################################################ -cdef initialize() noexcept +cdef initialize() ############################################################################ diff --git a/src/sage/libs/gap/util.pyx b/src/sage/libs/gap/util.pyx index 81df83a6e0d..3e75d71ff06 100644 --- a/src/sage/libs/gap/util.pyx +++ b/src/sage/libs/gap/util.pyx @@ -103,7 +103,7 @@ cdef class ObjWrapper(): return (self.value) -cdef ObjWrapper wrap_obj(Obj obj) noexcept: +cdef ObjWrapper wrap_obj(Obj obj): """ Constructor function for :class:`ObjWrapper` """ @@ -120,7 +120,7 @@ cdef dict owned_objects_refcount = dict() # # used in Sage's libgap.Gap.count_GAP_objects # -cpdef get_owned_objects() noexcept: +cpdef get_owned_objects(): """ Helper to access the refcount dictionary from Python code """ @@ -184,7 +184,7 @@ MakeImmutable(libgap_errout); """ -cdef initialize() noexcept: +cdef initialize(): """ Initialize the GAP library, if it hasn't already been initialized. It is safe to call this multiple times. One can set @@ -405,7 +405,7 @@ class GAPError(ValueError): # ValueError for historical reasons """ -cdef str extract_libgap_errout() noexcept: +cdef str extract_libgap_errout(): """ Reads the global variable libgap_errout and returns a Python string containing the error message (with some boilerplate removed). diff --git a/src/sage/libs/gmp/pylong.pxd b/src/sage/libs/gmp/pylong.pxd index 846444d2082..325d747f57b 100644 --- a/src/sage/libs/gmp/pylong.pxd +++ b/src/sage/libs/gmp/pylong.pxd @@ -5,7 +5,7 @@ Various functions to deal with conversion mpz <-> Python int/long from cpython.longintrepr cimport py_long from sage.libs.gmp.types cimport * -cdef mpz_get_pylong(mpz_srcptr z) noexcept -cdef mpz_get_pyintlong(mpz_srcptr z) noexcept +cdef mpz_get_pylong(mpz_srcptr z) +cdef mpz_get_pyintlong(mpz_srcptr z) cdef int mpz_set_pylong(mpz_ptr z, py_long L) except -1 cdef Py_hash_t mpz_pythonhash(mpz_srcptr z) noexcept diff --git a/src/sage/libs/gmp/pylong.pyx b/src/sage/libs/gmp/pylong.pyx index 202008f4587..80f9843e07c 100644 --- a/src/sage/libs/gmp/pylong.pyx +++ b/src/sage/libs/gmp/pylong.pyx @@ -56,7 +56,7 @@ cdef extern from *: cdef size_t PyLong_nails = 8*sizeof(digit) - PyLong_SHIFT -cdef mpz_get_pylong_large(mpz_srcptr z) noexcept: +cdef mpz_get_pylong_large(mpz_srcptr z): """ Convert a non-zero ``mpz`` to a Python ``long``. """ @@ -68,7 +68,7 @@ cdef mpz_get_pylong_large(mpz_srcptr z) noexcept: return L -cdef mpz_get_pylong(mpz_srcptr z) noexcept: +cdef mpz_get_pylong(mpz_srcptr z): """ Convert an ``mpz`` to a Python ``long``. """ @@ -77,7 +77,7 @@ cdef mpz_get_pylong(mpz_srcptr z) noexcept: return mpz_get_pylong_large(z) -cdef mpz_get_pyintlong(mpz_srcptr z) noexcept: +cdef mpz_get_pyintlong(mpz_srcptr z): """ Convert an ``mpz`` to a Python ``int`` if possible, or a ``long`` if the value is too large. diff --git a/src/sage/libs/linbox/conversion.pxd b/src/sage/libs/linbox/conversion.pxd index a4cdd09711d..a443431adbb 100644 --- a/src/sage/libs/linbox/conversion.pxd +++ b/src/sage/libs/linbox/conversion.pxd @@ -167,7 +167,7 @@ cdef inline DenseVector_integer * new_linbox_vector_integer_dense(ZRing &ZZ, Vec return V -cdef inline Vector_integer_dense new_sage_vector_integer_dense(P, DenseVector_integer &v) noexcept: +cdef inline Vector_integer_dense new_sage_vector_integer_dense(P, DenseVector_integer &v): r""" Return a new Sage vector from a LinBox one. diff --git a/src/sage/libs/linkages/padics/Polynomial_ram.pxi b/src/sage/libs/linkages/padics/Polynomial_ram.pxi index 2048bb0a3c2..e0584ecb8ad 100644 --- a/src/sage/libs/linkages/padics/Polynomial_ram.pxi +++ b/src/sage/libs/linkages/padics/Polynomial_ram.pxi @@ -318,7 +318,7 @@ cdef inline int cpow(celement out, celement a, mpz_t n, long prec, PowComputer_ _expansion_zero = [] # the expansion_mode enum is defined in padic_template_element_header.pxi -cdef inline cexpansion_next(celement value, expansion_mode mode, long curpower, PowComputer_ prime_pow) noexcept: +cdef inline cexpansion_next(celement value, expansion_mode mode, long curpower, PowComputer_ prime_pow): if mode == teichmuller_mode: raise NotImplementedError # This is not very efficient, but there's no clear better way. @@ -339,7 +339,7 @@ cdef inline cexpansion_next(celement value, expansion_mode mode, long curpower, cshift_notrunc(value, value, -1, curpower, prime_pow, False) return term -cdef inline cexpansion_getitem(celement value, long m, PowComputer_ prime_pow) noexcept: +cdef inline cexpansion_getitem(celement value, long m, PowComputer_ prime_pow): """ Return the `m`th `p`-adic digit in the ``simple_mode`` expansion. @@ -383,7 +383,7 @@ cdef int cteichmuller(celement out, celement value, long prec, PowComputer_ prim else: out._coeffs = [value[0].parent().teichmuller(value[0])] -cdef list ccoefficients(celement x, long valshift, long prec, PowComputer_ prime_pow) noexcept: +cdef list ccoefficients(celement x, long valshift, long prec, PowComputer_ prime_pow): """ Return a list of coefficients, as elements that can be converted into the base ring. diff --git a/src/sage/libs/linkages/padics/Polynomial_shared.pxi b/src/sage/libs/linkages/padics/Polynomial_shared.pxi index b210b53ce19..367bbc2f33d 100644 --- a/src/sage/libs/linkages/padics/Polynomial_shared.pxi +++ b/src/sage/libs/linkages/padics/Polynomial_shared.pxi @@ -332,7 +332,7 @@ cdef inline int ccopy(celement out, celement a, PowComputer_ prime_pow) except - """ out._coeffs = a._coeffs[:] -cdef inline cpickle(celement a, PowComputer_ prime_pow) noexcept: +cdef inline cpickle(celement a, PowComputer_ prime_pow): r""" Return a representation of ``a`` for pickling. diff --git a/src/sage/libs/linkages/padics/fmpz_poly_unram.pxi b/src/sage/libs/linkages/padics/fmpz_poly_unram.pxi index 18f710fad36..2171b426911 100644 --- a/src/sage/libs/linkages/padics/fmpz_poly_unram.pxi +++ b/src/sage/libs/linkages/padics/fmpz_poly_unram.pxi @@ -499,7 +499,7 @@ cdef inline int ccopy(celement out, celement a, PowComputer_ prime_pow) except - """ fmpz_poly_set(out, a) -cdef inline cpickle(celement a, PowComputer_ prime_pow) noexcept: +cdef inline cpickle(celement a, PowComputer_ prime_pow): """ Serialization into objects that Sage knows how to pickle. @@ -546,7 +546,7 @@ cdef inline long chash(celement a, long ordp, long prec, PowComputer_ prime_pow) fmpz_poly_get_coeff_mpz(h.value, a, 0) return hash(h) -cdef inline cmodp_rep(fmpz_poly_t rep, fmpz_poly_t value, expansion_mode mode, bint return_list, PowComputer_ prime_pow) noexcept: +cdef inline cmodp_rep(fmpz_poly_t rep, fmpz_poly_t value, expansion_mode mode, bint return_list, PowComputer_ prime_pow): """ Compute a polynomial that is reduced modulo p and equivalent to the given value. @@ -579,7 +579,7 @@ cdef inline cmodp_rep(fmpz_poly_t rep, fmpz_poly_t value, expansion_mode mode, b return L # the expansion_mode enum is defined in padic_template_element_header.pxi -cdef inline cexpansion_next(fmpz_poly_t value, expansion_mode mode, long curpower, PowComputer_ prime_pow) noexcept: +cdef inline cexpansion_next(fmpz_poly_t value, expansion_mode mode, long curpower, PowComputer_ prime_pow): """ Return the next digit in a `p`-adic expansion of ``value``. @@ -609,7 +609,7 @@ cdef inline cexpansion_next(fmpz_poly_t value, expansion_mode mode, long curpowe _fmpz_poly_normalise(value) return trim_zeros(ans) # defined in sage.rings.padics.misc and imported in padic_template_element -cdef inline cexpansion_getitem(fmpz_poly_t value, long m, PowComputer_ prime_pow) noexcept: +cdef inline cexpansion_getitem(fmpz_poly_t value, long m, PowComputer_ prime_pow): """ Return the `m`th `p`-adic digit in the ``simple_mode`` expansion. @@ -639,7 +639,7 @@ cdef inline cexpansion_getitem(fmpz_poly_t value, long m, PowComputer_ prime_pow # The element is filled in for zero in the p-adic expansion if necessary. _expansion_zero = [] -cdef list ccoefficients(celement x, long valshift, long prec, PowComputer_ prime_pow) noexcept: +cdef list ccoefficients(celement x, long valshift, long prec, PowComputer_ prime_pow): """ Return a list of coefficients, as elements that can be converted into the base ring. @@ -849,7 +849,7 @@ cdef inline int cconv_mpz_t_out(mpz_t out, celement x, long valshift, long prec, ## Extra functions ## -cdef cmatrix_mod_pn(celement a, long aprec, long valshift, PowComputer_ prime_pow) noexcept: +cdef cmatrix_mod_pn(celement a, long aprec, long valshift, PowComputer_ prime_pow): r""" Returns the matrix of right multiplication by the element on the power basis `1, x, x^2, \ldots, x^{d-1}` for this diff --git a/src/sage/libs/linkages/padics/mpz.pxi b/src/sage/libs/linkages/padics/mpz.pxi index ba8c143f3b7..3a555e441dc 100644 --- a/src/sage/libs/linkages/padics/mpz.pxi +++ b/src/sage/libs/linkages/padics/mpz.pxi @@ -435,7 +435,7 @@ cdef inline int ccopy(mpz_t out, mpz_t a, PowComputer_ prime_pow) except -1: """ mpz_set(out, a) -cdef inline cpickle(mpz_t a, PowComputer_ prime_pow) noexcept: +cdef inline cpickle(mpz_t a, PowComputer_ prime_pow): """ Serialization into objects that Sage knows how to pickle. @@ -493,7 +493,7 @@ cdef inline long chash(mpz_t a, long ordp, long prec, PowComputer_ prime_pow) ex return n # the expansion_mode enum is defined in padic_template_element_header.pxi -cdef inline cexpansion_next(mpz_t value, expansion_mode mode, long curpower, PowComputer_ prime_pow) noexcept: +cdef inline cexpansion_next(mpz_t value, expansion_mode mode, long curpower, PowComputer_ prime_pow): """ Return the next digit in a `p`-adic expansion of ``value``. @@ -523,7 +523,7 @@ cdef inline cexpansion_next(mpz_t value, expansion_mode mode, long curpower, Pow mpz_sub(value, value, prime_pow.pow_mpz_t_tmp(curpower)) return ans -cdef inline cexpansion_getitem(mpz_t value, long m, PowComputer_ prime_pow) noexcept: +cdef inline cexpansion_getitem(mpz_t value, long m, PowComputer_ prime_pow): """ Return the `m`th `p`-adic digit in the ``simple_mode`` expansion. @@ -545,7 +545,7 @@ cdef inline cexpansion_getitem(mpz_t value, long m, PowComputer_ prime_pow) noex # It could be [] for some other linkages. _expansion_zero = Integer(0) -cdef list ccoefficients(mpz_t x, long valshift, long prec, PowComputer_ prime_pow) noexcept: +cdef list ccoefficients(mpz_t x, long valshift, long prec, PowComputer_ prime_pow): """ Return a list of coefficients, as elements that can be converted into the base ring. diff --git a/src/sage/libs/linkages/padics/relaxed/flint.pxi b/src/sage/libs/linkages/padics/relaxed/flint.pxi index a1cbdeedf81..7085fd76ac8 100644 --- a/src/sage/libs/linkages/padics/relaxed/flint.pxi +++ b/src/sage/libs/linkages/padics/relaxed/flint.pxi @@ -67,7 +67,7 @@ cdef inline void digit_clear(fmpz_t a) noexcept: # get and set -cdef inline Integer digit_get_sage(fmpz_t a) noexcept: +cdef inline Integer digit_get_sage(fmpz_t a): r""" Convert a digit to a Sage element. @@ -329,7 +329,7 @@ cdef inline void element_clear(fmpz_poly_t x) noexcept: # get and set -cdef inline Integer element_get_sage(fmpz_poly_t x, PowComputer_flint prime_pow) noexcept: +cdef inline Integer element_get_sage(fmpz_poly_t x, PowComputer_flint prime_pow): r""" Convert a digit to a Sage element. diff --git a/src/sage/libs/mpmath/ext_impl.pxd b/src/sage/libs/mpmath/ext_impl.pxd index f2540d326dd..586d10d17f2 100644 --- a/src/sage/libs/mpmath/ext_impl.pxd +++ b/src/sage/libs/mpmath/ext_impl.pxd @@ -4,11 +4,11 @@ ctypedef struct MPopts: long prec int rounding -cdef mpz_set_integer(mpz_t v, x) noexcept -cdef mpzi(mpz_t n) noexcept -cdef mpzl(mpz_t n) noexcept -cdef str rndmode_to_python(int rnd) noexcept -cdef rndmode_from_python(str rnd) noexcept +cdef mpz_set_integer(mpz_t v, x) +cdef mpzi(mpz_t n) +cdef mpzl(mpz_t n) +cdef str rndmode_to_python(int rnd) +cdef rndmode_from_python(str rnd) ctypedef struct MPF: mpz_t man @@ -23,21 +23,21 @@ cdef void MPF_set_one(MPF *x) noexcept cdef void MPF_set_nan(MPF *x) noexcept cdef void MPF_set_inf(MPF *x) noexcept cdef void MPF_set_ninf(MPF *x) noexcept -cdef MPF_set_si(MPF *x, long n) noexcept -cdef MPF_set_int(MPF *x, n) noexcept -cdef MPF_set_man_exp(MPF *x, man, exp) noexcept -cdef MPF_set_tuple(MPF *x, tuple value) noexcept -cdef MPF_to_tuple(MPF *x) noexcept -cdef MPF_set_double(MPF *r, double x) noexcept +cdef MPF_set_si(MPF *x, long n) +cdef MPF_set_int(MPF *x, n) +cdef MPF_set_man_exp(MPF *x, man, exp) +cdef MPF_set_tuple(MPF *x, tuple value) +cdef MPF_to_tuple(MPF *x) +cdef MPF_set_double(MPF *r, double x) cdef double MPF_to_double(MPF *x, bint strict) noexcept -cdef MPF_to_fixed(mpz_t r, MPF *x, long prec, bint truncate) noexcept +cdef MPF_to_fixed(mpz_t r, MPF *x, long prec, bint truncate) cdef int MPF_sgn(MPF *x) noexcept cdef void MPF_neg(MPF *r, MPF *s) noexcept cdef void MPF_abs(MPF *r, MPF *s) noexcept -cdef MPF_normalize(MPF *x, MPopts opts) noexcept +cdef MPF_normalize(MPF *x, MPopts opts) cdef void MPF_pos(MPF *x, MPF *y, MPopts opts) noexcept -cdef MPF_add(MPF *r, MPF *s, MPF *t, MPopts opts) noexcept -cdef MPF_sub(MPF *r, MPF *s, MPF *t, MPopts opts) noexcept +cdef MPF_add(MPF *r, MPF *s, MPF *t, MPopts opts) +cdef MPF_sub(MPF *r, MPF *s, MPF *t, MPopts opts) cdef bint MPF_eq(MPF *s, MPF *t) noexcept cdef bint MPF_ne(MPF *s, MPF *t) noexcept cdef int MPF_cmp(MPF *s, MPF *t) noexcept @@ -45,22 +45,22 @@ cdef bint MPF_lt(MPF *s, MPF *t) noexcept cdef bint MPF_le(MPF *s, MPF *t) noexcept cdef bint MPF_gt(MPF *s, MPF *t) noexcept cdef bint MPF_ge(MPF *s, MPF *t) noexcept -cdef MPF_mul(MPF *r, MPF *s, MPF *t, MPopts opts) noexcept -cdef MPF_div(MPF *r, MPF *s, MPF *t, MPopts opts) noexcept +cdef MPF_mul(MPF *r, MPF *s, MPF *t, MPopts opts) +cdef MPF_div(MPF *r, MPF *s, MPF *t, MPopts opts) cdef int MPF_sqrt(MPF *r, MPF *s, MPopts opts) noexcept -cdef MPF_hypot(MPF *r, MPF *a, MPF *b, MPopts opts) noexcept -cdef MPF_pow_int(MPF *r, MPF *x, mpz_t n, MPopts opts) noexcept -cdef MPF_set_double(MPF *r, double x) noexcept -cdef MPF_exp(MPF *y, MPF *x, MPopts opts) noexcept -cdef MPF_complex_sqrt(MPF *c, MPF *d, MPF *a, MPF *b, MPopts opts) noexcept -cdef MPF_complex_exp(MPF *re, MPF *im, MPF *a, MPF *b, MPopts opts) noexcept +cdef MPF_hypot(MPF *r, MPF *a, MPF *b, MPopts opts) +cdef MPF_pow_int(MPF *r, MPF *x, mpz_t n, MPopts opts) +cdef MPF_set_double(MPF *r, double x) +cdef MPF_exp(MPF *y, MPF *x, MPopts opts) +cdef MPF_complex_sqrt(MPF *c, MPF *d, MPF *a, MPF *b, MPopts opts) +cdef MPF_complex_exp(MPF *re, MPF *im, MPF *a, MPF *b, MPopts opts) cdef int MPF_log(MPF *y, MPF *x, MPopts opts) noexcept -cdef MPF_set_pi(MPF *x, MPopts opts) noexcept -cdef MPF_set_ln2(MPF *x, MPopts opts) noexcept -cdef MPF_cos(MPF *c, MPF *x, MPopts opts) noexcept -cdef MPF_sin(MPF *c, MPF *x, MPopts opts) noexcept -cdef MPF_cos_sin(MPF *c, MPF *s, MPF *x, MPopts opts) noexcept +cdef MPF_set_pi(MPF *x, MPopts opts) +cdef MPF_set_ln2(MPF *x, MPopts opts) +cdef MPF_cos(MPF *c, MPF *x, MPopts opts) +cdef MPF_sin(MPF *c, MPF *x, MPopts opts) +cdef MPF_cos_sin(MPF *c, MPF *s, MPF *x, MPopts opts) cdef int MPF_pow(MPF *z, MPF *x, MPF *y, MPopts opts) except -1 -cdef MPF_complex_pow(MPF *zre, MPF *zim, MPF *xre, MPF *xim, MPF *yre, MPF *yim, MPopts opts) noexcept +cdef MPF_complex_pow(MPF *zre, MPF *zim, MPF *xre, MPF *xim, MPF *yre, MPF *yim, MPopts opts) cdef MPF_hypsum(MPF *a, MPF *b, int p, int q, param_types, str ztype, coeffs, \ - z, long prec, long wp, long epsshift, dict magnitude_check, kwargs) noexcept + z, long prec, long wp, long epsshift, dict magnitude_check, kwargs) diff --git a/src/sage/libs/mpmath/ext_impl.pyx b/src/sage/libs/mpmath/ext_impl.pyx index 7860fbd3227..0d57c8f2882 100644 --- a/src/sage/libs/mpmath/ext_impl.pyx +++ b/src/sage/libs/mpmath/ext_impl.pyx @@ -42,7 +42,7 @@ from sage.rings.integer cimport Integer from sage.libs.gmp.pylong cimport * -cdef mpz_set_integer(mpz_t v, x) noexcept: +cdef mpz_set_integer(mpz_t v, x): if isinstance(x, int): mpz_set_pylong(v, x) elif isinstance(x, Integer): @@ -57,10 +57,10 @@ cdef inline void mpz_add_si(mpz_t a, mpz_t b, long x) noexcept: # careful: overflow when negating INT_MIN mpz_sub_ui(a, b, (-x)) -cdef inline mpzi(mpz_t n) noexcept: +cdef inline mpzi(mpz_t n): return mpz_get_pyintlong(n) -cdef inline mpzl(mpz_t n) noexcept: +cdef inline mpzl(mpz_t n): return mpz_get_pylong(n) # This should be done better @@ -120,14 +120,14 @@ DEF S_INF = 3 DEF S_NINF = 4 DEF S_NAN = 5 -cdef inline str rndmode_to_python(int rnd) noexcept: +cdef inline str rndmode_to_python(int rnd): if rnd == ROUND_N: return 'n' if rnd == ROUND_F: return 'f' if rnd == ROUND_C: return 'c' if rnd == ROUND_D: return 'd' if rnd == ROUND_U: return 'u' -cdef inline rndmode_from_python(str rnd) noexcept: +cdef inline rndmode_from_python(str rnd): if rnd == 'n': return ROUND_N if rnd == 'f': return ROUND_F if rnd == 'c': return ROUND_C @@ -205,7 +205,7 @@ cdef inline void MPF_set_ninf(MPF *x) noexcept: """Set value to -infinity.""" x.special = S_NINF -cdef MPF_set_si(MPF *x, long n) noexcept: +cdef MPF_set_si(MPF *x, long n): """Set value to that of a given C (long) integer.""" if n: x.special = S_NORMAL @@ -215,7 +215,7 @@ cdef MPF_set_si(MPF *x, long n) noexcept: else: MPF_set_zero(x) -cdef MPF_set_int(MPF *x, n) noexcept: +cdef MPF_set_int(MPF *x, n): """Set value to that of a given Python integer.""" x.special = S_NORMAL mpz_set_integer(x.man, n) @@ -225,7 +225,7 @@ cdef MPF_set_int(MPF *x, n) noexcept: else: MPF_set_zero(x) -cdef MPF_set_man_exp(MPF *x, man, exp) noexcept: +cdef MPF_set_man_exp(MPF *x, man, exp): """ Set value to man*2^exp where man, exp may be of any appropriate Python integer types. @@ -260,7 +260,7 @@ cdef tuple _mpf_fnan = (0, MPZ_ZERO, -123, -1) cdef tuple _mpf_finf = (0, MPZ_ZERO, -456, -2) cdef tuple _mpf_fninf = (1, MPZ_ZERO, -789, -3) -cdef MPF_set_tuple(MPF *x, tuple value) noexcept: +cdef MPF_set_tuple(MPF *x, tuple value): """ Set value of an MPF to that of a normalized (sign, man, exp, bc) tuple in the format used by mpmath.libmp. @@ -289,7 +289,7 @@ cdef MPF_set_tuple(MPF *x, tuple value) noexcept: else: MPF_set_nan(x) -cdef MPF_to_tuple(MPF *x) noexcept: +cdef MPF_to_tuple(MPF *x): """Convert MPF value to (sign, man, exp, bc) tuple.""" cdef Integer man if x.special: @@ -309,7 +309,7 @@ cdef MPF_to_tuple(MPF *x) noexcept: bc = mpz_sizeinbase(x.man, 2) return (sign, man, exp, bc) -cdef MPF_set_double(MPF *r, double x) noexcept: +cdef MPF_set_double(MPF *r, double x): """ Set r to the value of a C double x. """ @@ -366,7 +366,7 @@ cdef double MPF_to_double(MPF *x, bint strict) noexcept: return _double_ninf return _double_nan -cdef MPF_to_fixed(mpz_t r, MPF *x, long prec, bint truncate) noexcept: +cdef MPF_to_fixed(mpz_t r, MPF *x, long prec, bint truncate): """ Set r = x, r being in the format of a fixed-point number with prec bits. Floor division is used unless truncate=True in which case @@ -443,7 +443,7 @@ cdef void MPF_abs(MPF *r, MPF *s) noexcept: if r is not s: mpz_set(r.exp, s.exp) -cdef MPF_normalize(MPF *x, MPopts opts) noexcept: +cdef MPF_normalize(MPF *x, MPopts opts): """ Normalize. @@ -616,7 +616,7 @@ cdef void _mul_special(MPF *r, MPF *s, MPF *t) noexcept: else: MPF_set_ninf(r) -cdef _div_special(MPF *r, MPF *s, MPF *t) noexcept: +cdef _div_special(MPF *r, MPF *s, MPF *t): # TODO: handle signed zeros correctly if s.special == S_NAN or t.special == S_NAN: MPF_set_nan(r) @@ -637,7 +637,7 @@ cdef _div_special(MPF *r, MPF *s, MPF *t) noexcept: elif t.special == S_INF or t.special == S_NINF: MPF_set_zero(r) -cdef _add_perturbation(MPF *r, MPF *s, int sign, MPopts opts) noexcept: +cdef _add_perturbation(MPF *r, MPF *s, int sign, MPopts opts): cdef long shift if opts.rounding == ROUND_N: MPF_set(r, s) @@ -650,7 +650,7 @@ cdef _add_perturbation(MPF *r, MPF *s, int sign, MPopts opts) noexcept: mpz_sub_ui(r.exp, s.exp, shift) MPF_normalize(r, opts) -cdef MPF_add(MPF *r, MPF *s, MPF *t, MPopts opts) noexcept: +cdef MPF_add(MPF *r, MPF *s, MPF *t, MPopts opts): """ Set r = s + t, with exact rounding. @@ -704,7 +704,7 @@ cdef MPF_add(MPF *r, MPF *s, MPF *t, MPopts opts) noexcept: else: _add_perturbation(r, t, mpz_sgn(s.man), opts) -cdef MPF_sub(MPF *r, MPF *s, MPF *t, MPopts opts) noexcept: +cdef MPF_sub(MPF *r, MPF *s, MPF *t, MPopts opts): """ Set r = s - t, with exact rounding. @@ -850,7 +850,7 @@ cdef bint MPF_ge(MPF *s, MPF *t) noexcept: return False return MPF_cmp(s, t) >= 0 -cdef MPF_mul(MPF *r, MPF *s, MPF *t, MPopts opts) noexcept: +cdef MPF_mul(MPF *r, MPF *s, MPF *t, MPopts opts): """ Set r = s * t, with correct rounding. @@ -866,7 +866,7 @@ cdef MPF_mul(MPF *r, MPF *s, MPF *t, MPopts opts) noexcept: if opts.prec: MPF_normalize(r, opts) -cdef MPF_div(MPF *r, MPF *s, MPF *t, MPopts opts) noexcept: +cdef MPF_div(MPF *r, MPF *s, MPF *t, MPopts opts): """ Set r = s / t, with correct rounding. """ @@ -961,7 +961,7 @@ cdef int MPF_sqrt(MPF *r, MPF *s, MPopts opts) noexcept: MPF_normalize(r, opts) return 0 -cdef MPF_hypot(MPF *r, MPF *a, MPF *b, MPopts opts) noexcept: +cdef MPF_hypot(MPF *r, MPF *a, MPF *b, MPopts opts): """ Set r = sqrt(a^2 + b^2) """ @@ -981,7 +981,7 @@ cdef MPF_hypot(MPF *r, MPF *a, MPF *b, MPopts opts) noexcept: MPF_add(r, &tmp1, &tmp2, tmp_opts) MPF_sqrt(r, r, opts) -cdef MPF_pow_int(MPF *r, MPF *x, mpz_t n, MPopts opts) noexcept: +cdef MPF_pow_int(MPF *r, MPF *x, mpz_t n, MPopts opts): """ Set r = x ** n. Currently falls back to mpmath.libmp unless n is tiny. @@ -1074,7 +1074,7 @@ cdef int _pi_prec = -1 cdef mpz_t _ln2_value cdef int _ln2_prec = -1 -cdef mpz_set_pi(mpz_t x, int prec) noexcept: +cdef mpz_set_pi(mpz_t x, int prec): """ Set x = pi as a fixed-point number. """ @@ -1090,7 +1090,7 @@ cdef mpz_set_pi(mpz_t x, int prec) noexcept: mpz_set(x, _pi_value) _pi_prec = prec -cdef mpz_set_ln2(mpz_t x, int prec) noexcept: +cdef mpz_set_ln2(mpz_t x, int prec): """ Set x = ln(2) as a fixed-point number. """ @@ -1122,7 +1122,7 @@ cdef void _cy_exp_mpfr(mpz_t y, mpz_t x, int prec) noexcept: mpfr_clear(yf) mpfr_clear(xf) -cdef cy_exp_basecase(mpz_t y, mpz_t x, int prec) noexcept: +cdef cy_exp_basecase(mpz_t y, mpz_t x, int prec): """ Computes y = exp(x) for fixed-point numbers y and x, assuming that x is small (|x| ~< 1). At small precisions, this function @@ -1174,7 +1174,7 @@ cdef cy_exp_basecase(mpz_t y, mpz_t x, int prec) noexcept: mpz_clear(a) -cdef MPF_exp(MPF *y, MPF *x, MPopts opts) noexcept: +cdef MPF_exp(MPF *y, MPF *x, MPopts opts): """ Set y = exp(x). """ @@ -1229,7 +1229,7 @@ cdef MPF_exp(MPF *y, MPF *x, MPopts opts) noexcept: MPF_normalize(y, opts) -cdef MPF_complex_sqrt(MPF *c, MPF *d, MPF *a, MPF *b, MPopts opts) noexcept: +cdef MPF_complex_sqrt(MPF *c, MPF *d, MPF *a, MPF *b, MPopts opts): """ Set c+di = sqrt(a+bi). @@ -1321,7 +1321,7 @@ cdef int MPF_get_mpfr_overflow(mpfr_t y, MPF *x) noexcept: else: return 1 -cdef MPF_set_mpfr(MPF *y, mpfr_t x, MPopts opts) noexcept: +cdef MPF_set_mpfr(MPF *y, mpfr_t x, MPopts opts): """ Convert the MPFR number x to a normalized MPF y. inf/nan and zero are handled. @@ -1400,7 +1400,7 @@ cdef int MPF_log(MPF *y, MPF *x, MPopts opts) noexcept: mpfr_clear(yy) return negative -cdef MPF_set_pi(MPF *x, MPopts opts) noexcept: +cdef MPF_set_pi(MPF *x, MPopts opts): """ Set x = pi. """ @@ -1409,7 +1409,7 @@ cdef MPF_set_pi(MPF *x, MPopts opts) noexcept: mpz_set_si(x.exp, -(opts.prec+20)) MPF_normalize(x, opts) -cdef MPF_set_ln2(MPF *x, MPopts opts) noexcept: +cdef MPF_set_ln2(MPF *x, MPopts opts): """ Set x = ln(2). """ @@ -1494,7 +1494,7 @@ cdef mpz_t log_int_cache[MAX_LOG_INT_CACHE+1] cdef long log_int_cache_prec[MAX_LOG_INT_CACHE+1] cdef bint log_int_cache_initialized = 0 -cdef mpz_log_int(mpz_t v, mpz_t n, int prec) noexcept: +cdef mpz_log_int(mpz_t v, mpz_t n, int prec): """ Set v = log(n) where n is an integer and v is a fixed-point number with the specified precision. @@ -1545,7 +1545,7 @@ def log_int_fixed(n, long prec, ln2=None): return t -cdef _MPF_cos_python(MPF *c, MPF *x, MPopts opts) noexcept: +cdef _MPF_cos_python(MPF *c, MPF *x, MPopts opts): """ Computes c = cos(x) by calling the mpmath.libmp Python implementation. """ @@ -1554,7 +1554,7 @@ cdef _MPF_cos_python(MPF *c, MPF *x, MPopts opts) noexcept: rndmode_to_python(opts.rounding), 1, False) MPF_set_tuple(c, ct) -cdef _MPF_sin_python(MPF *s, MPF *x, MPopts opts) noexcept: +cdef _MPF_sin_python(MPF *s, MPF *x, MPopts opts): """ Computes s = sin(x) by calling the mpmath.libmp Python implementation. """ @@ -1564,7 +1564,7 @@ cdef _MPF_sin_python(MPF *s, MPF *x, MPopts opts) noexcept: MPF_set_tuple(s, st) -cdef MPF_cos(MPF *c, MPF *x, MPopts opts) noexcept: +cdef MPF_cos(MPF *c, MPF *x, MPopts opts): """ Set c = cos(x) """ @@ -1587,7 +1587,7 @@ cdef MPF_cos(MPF *c, MPF *x, MPopts opts) noexcept: mpfr_clear(xf) mpfr_clear(cf) -cdef MPF_sin(MPF *s, MPF *x, MPopts opts) noexcept: +cdef MPF_sin(MPF *s, MPF *x, MPopts opts): """ Set s = sin(x) """ @@ -1610,7 +1610,7 @@ cdef MPF_sin(MPF *s, MPF *x, MPopts opts) noexcept: mpfr_clear(xf) mpfr_clear(sf) -cdef MPF_cos_sin(MPF *c, MPF *s, MPF *x, MPopts opts) noexcept: +cdef MPF_cos_sin(MPF *c, MPF *s, MPF *x, MPopts opts): """ Set c = cos(x), s = sin(x) """ @@ -1640,7 +1640,7 @@ cdef MPF_cos_sin(MPF *c, MPF *s, MPF *x, MPopts opts) noexcept: mpfr_clear(sf) -cdef MPF_complex_exp(MPF *re, MPF *im, MPF *a, MPF *b, MPopts opts) noexcept: +cdef MPF_complex_exp(MPF *re, MPF *im, MPF *a, MPF *b, MPopts opts): """ Set re+im*i = exp(a+bi) """ @@ -1754,7 +1754,7 @@ cdef int MPF_pow(MPF *z, MPF *x, MPF *y, MPopts opts) except -1: MPF_clear(&w) return 0 -cdef MPF_complex_square(MPF *re, MPF *im, MPF *a, MPF *b, MPopts opts) noexcept: +cdef MPF_complex_square(MPF *re, MPF *im, MPF *a, MPF *b, MPopts opts): """ Set re+im*i = (a+bi)^2 = a^2-b^2, 2ab*i. """ @@ -1771,7 +1771,7 @@ cdef MPF_complex_square(MPF *re, MPF *im, MPF *a, MPF *b, MPopts opts) noexcept: MPF_clear(&u) -cdef MPF_complex_reciprocal(MPF *re, MPF *im, MPF *a, MPF *b, MPopts opts) noexcept: +cdef MPF_complex_reciprocal(MPF *re, MPF *im, MPF *a, MPF *b, MPopts opts): """ Set re+im*i = 1/(a+bi), i.e. compute the reciprocal of a complex number. @@ -1795,7 +1795,7 @@ cdef MPF_complex_reciprocal(MPF *re, MPF *im, MPF *a, MPF *b, MPopts opts) noexc MPF_clear(&m) -cdef MPF_complex_pow_int(MPF *zre, MPF *zim, MPF *xre, MPF *xim, mpz_t n, MPopts opts) noexcept: +cdef MPF_complex_pow_int(MPF *zre, MPF *zim, MPF *xre, MPF *xim, mpz_t n, MPopts opts): """ Set zre+zim*i = (xre+xim) ^ n, i.e. raise a complex number to an integer power. """ @@ -1861,7 +1861,7 @@ cdef MPF_complex_pow_int(MPF *zre, MPF *zim, MPF *xre, MPF *xim, mpz_t n, MPopts MPF_set_tuple(zim, vi) -cdef MPF_complex_pow_re(MPF *zre, MPF *zim, MPF *xre, MPF *xim, MPF *y, MPopts opts) noexcept: +cdef MPF_complex_pow_re(MPF *zre, MPF *zim, MPF *xre, MPF *xim, MPF *y, MPopts opts): """ Set (zre+zim*i) = (xre+xim*i) ^ y, i.e. raise a complex number to a real power. @@ -1906,7 +1906,7 @@ cdef MPF_complex_pow_re(MPF *zre, MPF *zim, MPF *xre, MPF *xim, MPF *y, MPopts o MPF_set_tuple(zim, vi) -cdef MPF_complex_pow(MPF *zre, MPF *zim, MPF *xre, MPF *xim, MPF *yre, MPF *yim, MPopts opts) noexcept: +cdef MPF_complex_pow(MPF *zre, MPF *zim, MPF *xre, MPF *xim, MPF *yre, MPF *yim, MPopts opts): """ Set (zre + zim*i) = (xre+xim*i) ^ (yre+yim*i). """ @@ -1924,7 +1924,7 @@ cdef MPF_complex_pow(MPF *zre, MPF *zim, MPF *xre, MPF *xim, MPF *yre, MPF *yim, MPF_set_tuple(zim, vi) -cdef mpz_set_tuple_fixed(mpz_t x, tuple t, long prec) noexcept: +cdef mpz_set_tuple_fixed(mpz_t x, tuple t, long prec): """ Set the integer x to a fixed-point number with specified precision and the value of t = (sign,man,exp,bc). Truncating division is used @@ -1941,7 +1941,7 @@ cdef mpz_set_tuple_fixed(mpz_t x, tuple t, long prec) noexcept: else: mpz_tdiv_q_2exp(x, x, -offset) -cdef mpz_set_complex_tuple_fixed(mpz_t x, mpz_t y, tuple t, long prec) noexcept: +cdef mpz_set_complex_tuple_fixed(mpz_t x, mpz_t y, tuple t, long prec): """ Set the integers (x,y) to fixed-point numbers with the values of the mpf pair t = ((xsign,xman,xexp,xbc), (ysign,yman,yexp,ybc)). @@ -1949,7 +1949,7 @@ cdef mpz_set_complex_tuple_fixed(mpz_t x, mpz_t y, tuple t, long prec) noexcept: mpz_set_tuple_fixed(x, t[0], prec) mpz_set_tuple_fixed(y, t[1], prec) -cdef MPF_set_fixed(MPF *x, mpz_t man, long wp, long prec, int rnd) noexcept: +cdef MPF_set_fixed(MPF *x, mpz_t man, long wp, long prec, int rnd): """ Set value of an MPF given a fixed-point mantissa of precision wp, rounding to the given precision and rounding mode. @@ -1980,7 +1980,7 @@ cdef mpz_t BCIM[MAX_PARAMS] cdef MPF_hypsum(MPF *a, MPF *b, int p, int q, param_types, str ztype, coeffs, z, - long prec, long wp, long epsshift, dict magnitude_check, kwargs) noexcept: + long prec, long wp, long epsshift, dict magnitude_check, kwargs): """ Evaluates a+bi = pFq(..., z) by summing the hypergeometric series in fixed-point arithmetic. diff --git a/src/sage/libs/mpmath/ext_main.pyx b/src/sage/libs/mpmath/ext_main.pyx index 347712e6cab..36a035f7570 100644 --- a/src/sage/libs/mpmath/ext_main.pyx +++ b/src/sage/libs/mpmath/ext_main.pyx @@ -109,7 +109,7 @@ cdef class constant cdef class wrapped_libmp_function cdef class wrapped_specfun -cdef __isint(MPF *v) noexcept: +cdef __isint(MPF *v): return v.special == S_ZERO or (v.special == S_NORMAL and mpz_sgn(v.exp) >= 0) cdef int MPF_set_any(MPF *re, MPF *im, x, MPopts opts, bint str_tuple_ok) except -1: @@ -185,7 +185,7 @@ cdef int MPF_set_any(MPF *re, MPF *im, x, MPopts opts, bint str_tuple_ok) except return 1 return 0 -cdef binop(int op, x, y, MPopts opts) noexcept: +cdef binop(int op, x, y, MPopts opts): cdef int typx cdef int typy cdef MPF xre, xim, yre, yim @@ -498,7 +498,7 @@ cdef class Context: _prec_rounding = property(_get_prec_rounding) - cpdef mpf make_mpf(ctx, tuple v) noexcept: + cpdef mpf make_mpf(ctx, tuple v): """ Creates an mpf from tuple data :: @@ -511,7 +511,7 @@ cdef class Context: MPF_set_tuple(&x.value, v) return x - cpdef mpc make_mpc(ctx, tuple v) noexcept: + cpdef mpc make_mpc(ctx, tuple v): """ Creates an mpc from tuple data :: @@ -973,7 +973,7 @@ cdef class Context: # Doing a+b directly doesn't work with mpi, presumably due to # Cython trying to be clever with the operation resolution - cdef _stupid_add(ctx, a, b) noexcept: + cdef _stupid_add(ctx, a, b): return a + b def _convert_param(ctx, x): diff --git a/src/sage/libs/mpmath/utils.pxd b/src/sage/libs/mpmath/utils.pxd index 646afa61899..686b108da9a 100644 --- a/src/sage/libs/mpmath/utils.pxd +++ b/src/sage/libs/mpmath/utils.pxd @@ -1,3 +1,3 @@ from sage.libs.mpfr.types cimport mpfr_t -cdef mpfr_to_mpfval(mpfr_t) noexcept +cdef mpfr_to_mpfval(mpfr_t) diff --git a/src/sage/libs/mpmath/utils.pyx b/src/sage/libs/mpmath/utils.pyx index 4cda927d798..b7a4f532823 100644 --- a/src/sage/libs/mpmath/utils.pyx +++ b/src/sage/libs/mpmath/utils.pyx @@ -46,7 +46,7 @@ cpdef int bitcount(n) noexcept: return 0 return mpz_sizeinbase(m.value, 2) -cpdef isqrt(n) noexcept: +cpdef isqrt(n): """ Square root (rounded to floor) of a Sage Integer or Python int/long. The result is a Sage Integer. @@ -77,7 +77,7 @@ cpdef isqrt(n) noexcept: mpz_sqrt(y.value, m.value) return y -cpdef from_man_exp(man, exp, long prec = 0, str rnd = 'd') noexcept: +cpdef from_man_exp(man, exp, long prec = 0, str rnd = 'd'): """ Create normalized mpf value tuple from mantissa and exponent. @@ -106,7 +106,7 @@ cpdef from_man_exp(man, exp, long prec = 0, str rnd = 'd') noexcept: else: return normalize(0, res, exp, bc, prec, rnd) -cpdef normalize(long sign, Integer man, exp, long bc, long prec, str rnd) noexcept: +cpdef normalize(long sign, Integer man, exp, long bc, long prec, str rnd): """ Create normalized mpf value tuple from full list of components. @@ -154,7 +154,7 @@ cpdef normalize(long sign, Integer man, exp, long bc, long prec, str rnd) noexce bc = mpz_sizeinbase(res.value, 2) return (sign, res, int(exp), bc) -cdef mpfr_from_mpfval(mpfr_t res, tuple x) noexcept: +cdef mpfr_from_mpfval(mpfr_t res, tuple x): """ Set value of an MPFR number (in place) to that of a given mpmath mpf data tuple. @@ -180,7 +180,7 @@ cdef mpfr_from_mpfval(mpfr_t res, tuple x) noexcept: else: mpfr_set_nan(res) -cdef mpfr_to_mpfval(mpfr_t value) noexcept: +cdef mpfr_to_mpfval(mpfr_t value): """ Given an MPFR value, return an mpmath mpf data tuple representing the same number. diff --git a/src/sage/libs/ntl/misc.pxi b/src/sage/libs/ntl/misc.pxi index e0d24b01a60..e9dcd9807b0 100644 --- a/src/sage/libs/ntl/misc.pxi +++ b/src/sage/libs/ntl/misc.pxi @@ -8,7 +8,7 @@ from cysignals.signals cimport sig_off cdef extern from *: void del_charstar "delete[]"(char*) -cdef object string(char* s) noexcept: +cdef object string(char* s): """ Takes a char* allocated using malloc, and converts it to a Python string, then deletes the allocated memory. Also unsets the signal @@ -20,7 +20,7 @@ cdef object string(char* s) noexcept: sig_free(s) return t -cdef object string_delete(char* s) noexcept: +cdef object string_delete(char* s): """ Takes a char* allocated using C++ new, and converts it to a Python string, then deletes the allocated memory. Also unsets the signal diff --git a/src/sage/libs/ntl/ntl_GF2E.pxd b/src/sage/libs/ntl/ntl_GF2E.pxd index 93539cf8abf..c36292c8748 100644 --- a/src/sage/libs/ntl/ntl_GF2E.pxd +++ b/src/sage/libs/ntl/ntl_GF2E.pxd @@ -4,5 +4,5 @@ from sage.libs.ntl.ntl_GF2EContext cimport ntl_GF2EContext_class cdef class ntl_GF2E(): cdef GF2E_c x cdef ntl_GF2EContext_class c - cdef ntl_GF2E _new(self) noexcept + cdef ntl_GF2E _new(self) diff --git a/src/sage/libs/ntl/ntl_GF2E.pyx b/src/sage/libs/ntl/ntl_GF2E.pyx index fa941804293..e162f21ddc9 100644 --- a/src/sage/libs/ntl/ntl_GF2E.pyx +++ b/src/sage/libs/ntl/ntl_GF2E.pyx @@ -155,7 +155,7 @@ cdef class ntl_GF2E(): self.c = ntl_GF2EContext(modulus) self.c.restore_c() - cdef ntl_GF2E _new(self) noexcept: + cdef ntl_GF2E _new(self): cdef ntl_GF2E r self.c.restore_c() r = ntl_GF2E.__new__(ntl_GF2E) diff --git a/src/sage/libs/ntl/ntl_GF2EX.pxd b/src/sage/libs/ntl/ntl_GF2EX.pxd index 38c96a7fe52..becd89a9c57 100644 --- a/src/sage/libs/ntl/ntl_GF2EX.pxd +++ b/src/sage/libs/ntl/ntl_GF2EX.pxd @@ -5,5 +5,5 @@ from sage.libs.ntl.ntl_GF2E cimport ntl_GF2E cdef class ntl_GF2EX(): cdef GF2EX_c x cdef ntl_GF2EContext_class c - cdef ntl_GF2E _new_element(self) noexcept - cdef ntl_GF2EX _new(self) noexcept + cdef ntl_GF2E _new_element(self) + cdef ntl_GF2EX _new(self) diff --git a/src/sage/libs/ntl/ntl_GF2EX.pyx b/src/sage/libs/ntl/ntl_GF2EX.pyx index 8c6850fd62e..0b7beb873df 100644 --- a/src/sage/libs/ntl/ntl_GF2EX.pyx +++ b/src/sage/libs/ntl/ntl_GF2EX.pyx @@ -85,14 +85,14 @@ cdef class ntl_GF2EX(): self.c = ntl_GF2EContext(modulus) self.c.restore_c() - cdef ntl_GF2E _new_element(self) noexcept: + cdef ntl_GF2E _new_element(self): cdef ntl_GF2E r self.c.restore_c() r = ntl_GF2E.__new__(ntl_GF2E) r.c = self.c return r - cdef ntl_GF2EX _new(self) noexcept: + cdef ntl_GF2EX _new(self): cdef ntl_GF2EX r self.c.restore_c() r = ntl_GF2EX.__new__(ntl_GF2EX) diff --git a/src/sage/libs/ntl/ntl_GF2X_linkage.pxi b/src/sage/libs/ntl/ntl_GF2X_linkage.pxi index cf480a34653..8f5edce14c1 100644 --- a/src/sage/libs/ntl/ntl_GF2X_linkage.pxi +++ b/src/sage/libs/ntl/ntl_GF2X_linkage.pxi @@ -67,7 +67,7 @@ cdef int celement_gen(GF2X_c *e, long i, long parent) except -2: cdef unsigned char g = 2 GF2XFromBytes(e[0], (&g), 1) -cdef object celement_repr(GF2X_c *e, long parent) noexcept: +cdef object celement_repr(GF2X_c *e, long parent): """ We ignore NTL's printing. diff --git a/src/sage/libs/ntl/ntl_ZZ.pyx b/src/sage/libs/ntl/ntl_ZZ.pyx index 62dddf369c6..3f4a412a5e1 100644 --- a/src/sage/libs/ntl/ntl_ZZ.pyx +++ b/src/sage/libs/ntl/ntl_ZZ.pyx @@ -32,7 +32,7 @@ from sage.misc.randstate cimport current_randstate from cpython.object cimport Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE -cdef make_ZZ(ZZ_c* x) noexcept: +cdef make_ZZ(ZZ_c* x): cdef ntl_ZZ y y = ntl_ZZ() y.x = x[0] diff --git a/src/sage/libs/ntl/ntl_ZZX.pyx b/src/sage/libs/ntl/ntl_ZZX.pyx index 343e5883191..3e23bcd1250 100644 --- a/src/sage/libs/ntl/ntl_ZZX.pyx +++ b/src/sage/libs/ntl/ntl_ZZX.pyx @@ -37,7 +37,7 @@ from sage.arith.power cimport generic_power_pos ZZ = IntegerRing() -cdef inline ntl_ZZ make_ZZ(ZZ_c* x) noexcept: +cdef inline ntl_ZZ make_ZZ(ZZ_c* x): """ These make_XXXX functions are deprecated and should be phased out.""" cdef ntl_ZZ y y = ntl_ZZ() @@ -46,12 +46,12 @@ cdef inline ntl_ZZ make_ZZ(ZZ_c* x) noexcept: return y # You must do sig_on() before calling this function -cdef inline ntl_ZZ make_ZZ_sig_off(ZZ_c* x) noexcept: +cdef inline ntl_ZZ make_ZZ_sig_off(ZZ_c* x): cdef ntl_ZZ y = make_ZZ(x) sig_off() return y -cdef inline ntl_ZZX make_ZZX(ZZX_c* x) noexcept: +cdef inline ntl_ZZX make_ZZX(ZZX_c* x): """ These make_XXXX functions are deprecated and should be phased out.""" cdef ntl_ZZX y y = ntl_ZZX() @@ -60,13 +60,13 @@ cdef inline ntl_ZZX make_ZZX(ZZX_c* x) noexcept: return y # You must do sig_on() before calling this function -cdef inline ntl_ZZX make_ZZX_sig_off(ZZX_c* x) noexcept: +cdef inline ntl_ZZX make_ZZX_sig_off(ZZX_c* x): cdef ntl_ZZX y = make_ZZX(x) sig_off() return y from sage.structure.proof.proof import get_flag -cdef proof_flag(t) noexcept: +cdef proof_flag(t): return get_flag(t, "polynomial") ############################################################################## diff --git a/src/sage/libs/ntl/ntl_ZZ_p.pxd b/src/sage/libs/ntl/ntl_ZZ_p.pxd index a92c9766112..8bac6e012e4 100644 --- a/src/sage/libs/ntl/ntl_ZZ_p.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_p.pxd @@ -6,4 +6,4 @@ cdef class ntl_ZZ_p(): cdef ntl_ZZ_pContext_class c cdef int get_as_int(ntl_ZZ_p self) noexcept cdef void set_from_int(ntl_ZZ_p self, int value) noexcept - cdef ntl_ZZ_p _new(self) noexcept + cdef ntl_ZZ_p _new(self) diff --git a/src/sage/libs/ntl/ntl_ZZ_p.pyx b/src/sage/libs/ntl/ntl_ZZ_p.pyx index d0bb88717b1..f4e84667d2b 100644 --- a/src/sage/libs/ntl/ntl_ZZ_p.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_p.pyx @@ -155,7 +155,7 @@ cdef class ntl_ZZ_p(): self.c = ntl_ZZ_pContext(modulus) self.c.restore_c() - cdef ntl_ZZ_p _new(self) noexcept: + cdef ntl_ZZ_p _new(self): cdef ntl_ZZ_p r self.c.restore_c() r = ntl_ZZ_p.__new__(ntl_ZZ_p) diff --git a/src/sage/libs/ntl/ntl_ZZ_pContext.pxd b/src/sage/libs/ntl/ntl_ZZ_pContext.pxd index d60cab91d55..1cab7b77e35 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pContext.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pContext.pxd @@ -14,7 +14,7 @@ cdef class ntl_ZZ_pContext_class(): cdef class ntl_ZZ_pContext_factory(): cdef object context_dict - cdef ntl_ZZ_pContext_class make_c(self, ntl_ZZ v) noexcept + cdef ntl_ZZ_pContext_class make_c(self, ntl_ZZ v) cdef extern from "ntlwrap.h": diff --git a/src/sage/libs/ntl/ntl_ZZ_pContext.pyx b/src/sage/libs/ntl/ntl_ZZ_pContext.pyx index 52c04e277cd..38f211a5ea1 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pContext.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pContext.pyx @@ -162,7 +162,7 @@ cdef class ntl_ZZ_pContext_factory(): def __init__(self): self.context_dict = {} - cdef ntl_ZZ_pContext_class make_c(self, ntl_ZZ v) noexcept: + cdef ntl_ZZ_pContext_class make_c(self, ntl_ZZ v): """ Creates a new ZZ_pContext. diff --git a/src/sage/libs/ntl/ntl_ZZ_pE.pxd b/src/sage/libs/ntl/ntl_ZZ_pE.pxd index b2a1aa70293..c60eaba4ad5 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pE.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pE.pxd @@ -5,6 +5,6 @@ from sage.libs.ntl.ntl_ZZ_pX cimport ntl_ZZ_pX cdef class ntl_ZZ_pE(): cdef ZZ_pE_c x cdef ntl_ZZ_pEContext_class c - cdef ntl_ZZ_pX get_as_ZZ_pX(ntl_ZZ_pE self) noexcept + cdef ntl_ZZ_pX get_as_ZZ_pX(ntl_ZZ_pE self) cdef void set_from_ZZ_pX(ntl_ZZ_pE self, ntl_ZZ_pX value) noexcept - cdef ntl_ZZ_pE _new(self) noexcept + cdef ntl_ZZ_pE _new(self) diff --git a/src/sage/libs/ntl/ntl_ZZ_pE.pyx b/src/sage/libs/ntl/ntl_ZZ_pE.pyx index a1eeb1c45a5..00644a8bd84 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pE.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pE.pyx @@ -149,7 +149,7 @@ cdef class ntl_ZZ_pE(): self.c = ntl_ZZ_pEContext(modulus) self.c.restore_c() - cdef ntl_ZZ_pE _new(self) noexcept: + cdef ntl_ZZ_pE _new(self): cdef ntl_ZZ_pE r self.c.restore_c() r = ntl_ZZ_pE.__new__(ntl_ZZ_pE) @@ -268,7 +268,7 @@ cdef class ntl_ZZ_pE(): return r - cdef ntl_ZZ_pX get_as_ZZ_pX(ntl_ZZ_pE self) noexcept: + cdef ntl_ZZ_pX get_as_ZZ_pX(ntl_ZZ_pE self): r""" Returns value as ntl_ZZ_pX. """ diff --git a/src/sage/libs/ntl/ntl_ZZ_pEX.pxd b/src/sage/libs/ntl/ntl_ZZ_pEX.pxd index 26ef2baf302..b56b85519a3 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEX.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pEX.pxd @@ -6,4 +6,4 @@ cdef class ntl_ZZ_pEX(): cdef ntl_ZZ_pEContext_class c #cdef void setitem_from_int(ntl_ZZ_pX self, long i, int value) #cdef int getitem_as_int(ntl_ZZ_pX self, long i) - cdef ntl_ZZ_pEX _new(self) noexcept + cdef ntl_ZZ_pEX _new(self) diff --git a/src/sage/libs/ntl/ntl_ZZ_pEX.pyx b/src/sage/libs/ntl/ntl_ZZ_pEX.pyx index 6ebde955aa3..c12df77c2f0 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEX.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pEX.pyx @@ -133,7 +133,7 @@ cdef class ntl_ZZ_pEX(): raise ValueError("modulus must not be None") self.c.restore_c() - cdef ntl_ZZ_pEX _new(self) noexcept: + cdef ntl_ZZ_pEX _new(self): cdef ntl_ZZ_pEX r self.c.restore_c() r = ntl_ZZ_pEX.__new__(ntl_ZZ_pEX) diff --git a/src/sage/libs/ntl/ntl_ZZ_pEX_linkage.pxi b/src/sage/libs/ntl/ntl_ZZ_pEX_linkage.pxi index 4b65bf650c5..76ec8770f3f 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pEX_linkage.pxi +++ b/src/sage/libs/ntl/ntl_ZZ_pEX_linkage.pxi @@ -80,7 +80,7 @@ cdef int celement_gen(ZZ_pEX_c *e, long i, cparent parent) except -2: parent[0].zzpec[0].restore() ZZ_pEX_SetX(e[0]) -cdef object celement_repr(ZZ_pEX_c *e, cparent parent) noexcept: +cdef object celement_repr(ZZ_pEX_c *e, cparent parent): """ We ignore NTL's printing. diff --git a/src/sage/libs/ntl/ntl_ZZ_pX.pxd b/src/sage/libs/ntl/ntl_ZZ_pX.pxd index 38792bca2d1..d02596b5128 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pX.pxd +++ b/src/sage/libs/ntl/ntl_ZZ_pX.pxd @@ -6,7 +6,7 @@ cdef class ntl_ZZ_pX(): cdef ntl_ZZ_pContext_class c cdef void setitem_from_int(ntl_ZZ_pX self, long i, int value) noexcept cdef int getitem_as_int(ntl_ZZ_pX self, long i) noexcept - cdef ntl_ZZ_pX _new(self) noexcept + cdef ntl_ZZ_pX _new(self) cdef class ntl_ZZ_pX_Modulus(): cdef ZZ_pX_Modulus_c x diff --git a/src/sage/libs/ntl/ntl_ZZ_pX.pyx b/src/sage/libs/ntl/ntl_ZZ_pX.pyx index 4db615bcd6c..c93d263cb10 100644 --- a/src/sage/libs/ntl/ntl_ZZ_pX.pyx +++ b/src/sage/libs/ntl/ntl_ZZ_pX.pyx @@ -38,7 +38,7 @@ from sage.misc.randstate cimport current_randstate from sage.libs.gmp.mpz cimport * -cdef inline make_ZZ_p(ZZ_p_c* x, ntl_ZZ_pContext_class ctx) noexcept: +cdef inline make_ZZ_p(ZZ_p_c* x, ntl_ZZ_pContext_class ctx): cdef ntl_ZZ_p y sig_off() y = ntl_ZZ_p(modulus = ctx) @@ -47,7 +47,7 @@ cdef inline make_ZZ_p(ZZ_p_c* x, ntl_ZZ_pContext_class ctx) noexcept: return y -cdef make_ZZ_pX(ZZ_pX_c* x, ntl_ZZ_pContext_class ctx) noexcept: +cdef make_ZZ_pX(ZZ_pX_c* x, ntl_ZZ_pContext_class ctx): cdef ntl_ZZ_pX y y = ntl_ZZ_pX.__new__(ntl_ZZ_pX) y.c = ctx @@ -138,7 +138,7 @@ cdef class ntl_ZZ_pX(): self.c = ntl_ZZ_pContext(ntl_ZZ(modulus)) self.c.restore_c() - cdef ntl_ZZ_pX _new(self) noexcept: + cdef ntl_ZZ_pX _new(self): cdef ntl_ZZ_pX r self.c.restore_c() r = ntl_ZZ_pX.__new__(ntl_ZZ_pX) diff --git a/src/sage/libs/ntl/ntl_lzz_p.pxd b/src/sage/libs/ntl/ntl_lzz_p.pxd index 6b4a6b8d3f0..6e8c43d8997 100644 --- a/src/sage/libs/ntl/ntl_lzz_p.pxd +++ b/src/sage/libs/ntl/ntl_lzz_p.pxd @@ -4,4 +4,4 @@ from sage.libs.ntl.ntl_lzz_pContext cimport ntl_zz_pContext_class cdef class ntl_zz_p(): cdef zz_p_c x cdef ntl_zz_pContext_class c - cdef ntl_zz_p _new(ntl_zz_p self) noexcept + cdef ntl_zz_p _new(ntl_zz_p self) diff --git a/src/sage/libs/ntl/ntl_lzz_p.pyx b/src/sage/libs/ntl/ntl_lzz_p.pyx index 0f7fd8fd5e3..af86b9bcf69 100644 --- a/src/sage/libs/ntl/ntl_lzz_p.pyx +++ b/src/sage/libs/ntl/ntl_lzz_p.pyx @@ -150,7 +150,7 @@ cdef class ntl_zz_p(): ## now that we've determined the modulus, set that modulus. self.c.restore_c() - cdef ntl_zz_p _new(self) noexcept: + cdef ntl_zz_p _new(self): """ Quick and dirty zz_p object creation. diff --git a/src/sage/libs/ntl/ntl_lzz_pX.pxd b/src/sage/libs/ntl/ntl_lzz_pX.pxd index 2cc09419fe5..3ab79084299 100644 --- a/src/sage/libs/ntl/ntl_lzz_pX.pxd +++ b/src/sage/libs/ntl/ntl_lzz_pX.pxd @@ -6,4 +6,4 @@ from sage.libs.ntl.ntl_lzz_pContext cimport ntl_zz_pContext_class cdef class ntl_zz_pX(): cdef zz_pX_c x cdef ntl_zz_pContext_class c - cdef ntl_zz_pX _new(self) noexcept + cdef ntl_zz_pX _new(self) diff --git a/src/sage/libs/ntl/ntl_lzz_pX.pyx b/src/sage/libs/ntl/ntl_lzz_pX.pyx index bbcd9f14dec..7d19cc55e37 100644 --- a/src/sage/libs/ntl/ntl_lzz_pX.pyx +++ b/src/sage/libs/ntl/ntl_lzz_pX.pyx @@ -232,7 +232,7 @@ cdef class ntl_zz_pX(): zz_pX_SetCoeff_long(self.x, i, val) return - cdef ntl_zz_pX _new(self) noexcept: + cdef ntl_zz_pX _new(self): """ Quick and dirty method for creating a new object with the same zz_pContext as self. diff --git a/src/sage/libs/ntl/ntl_mat_GF2.pxd b/src/sage/libs/ntl/ntl_mat_GF2.pxd index 4041f9f8f14..5617ef98915 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2.pxd +++ b/src/sage/libs/ntl/ntl_mat_GF2.pxd @@ -3,5 +3,5 @@ from sage.libs.ntl.ntl_GF2 cimport ntl_GF2 cdef class ntl_mat_GF2(): cdef mat_GF2_c x - cdef ntl_GF2 _new_element(self) noexcept - cdef ntl_mat_GF2 _new(self) noexcept + cdef ntl_GF2 _new_element(self) + cdef ntl_mat_GF2 _new(self) diff --git a/src/sage/libs/ntl/ntl_mat_GF2.pyx b/src/sage/libs/ntl/ntl_mat_GF2.pyx index 71d4f8b7491..318747e9ade 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2.pyx +++ b/src/sage/libs/ntl/ntl_mat_GF2.pyx @@ -118,12 +118,12 @@ cdef class ntl_mat_GF2(): mat_GF2_setitem(&self.x, i, j, &(elem).x) sig_off() - cdef ntl_GF2 _new_element(self) noexcept: + cdef ntl_GF2 _new_element(self): cdef ntl_GF2 r r = ntl_GF2.__new__(ntl_GF2) return r - cdef ntl_mat_GF2 _new(self) noexcept: + cdef ntl_mat_GF2 _new(self): cdef ntl_mat_GF2 r r = ntl_mat_GF2.__new__(ntl_mat_GF2) r.x.SetDims(self.x.NumRows(),self.x.NumCols()) diff --git a/src/sage/libs/ntl/ntl_mat_GF2E.pxd b/src/sage/libs/ntl/ntl_mat_GF2E.pxd index 15415965c66..fbb58382368 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2E.pxd +++ b/src/sage/libs/ntl/ntl_mat_GF2E.pxd @@ -5,5 +5,5 @@ from sage.libs.ntl.ntl_GF2E cimport ntl_GF2E cdef class ntl_mat_GF2E(): cdef mat_GF2E_c x cdef ntl_GF2EContext_class c - cdef ntl_GF2E _new_element(self) noexcept - cdef ntl_mat_GF2E _new(self) noexcept + cdef ntl_GF2E _new_element(self) + cdef ntl_mat_GF2E _new(self) diff --git a/src/sage/libs/ntl/ntl_mat_GF2E.pyx b/src/sage/libs/ntl/ntl_mat_GF2E.pyx index 0588eaaa7a3..7ab9b92c020 100644 --- a/src/sage/libs/ntl/ntl_mat_GF2E.pyx +++ b/src/sage/libs/ntl/ntl_mat_GF2E.pyx @@ -136,14 +136,14 @@ cdef class ntl_mat_GF2E(): self.c = ntl_GF2EContext(modulus) self.c.restore_c() - cdef ntl_GF2E _new_element(self) noexcept: + cdef ntl_GF2E _new_element(self): cdef ntl_GF2E r self.c.restore_c() r = ntl_GF2E.__new__(ntl_GF2E) r.c = self.c return r - cdef ntl_mat_GF2E _new(self) noexcept: + cdef ntl_mat_GF2E _new(self): cdef ntl_mat_GF2E r self.c.restore_c() r = ntl_mat_GF2E.__new__(ntl_mat_GF2E) diff --git a/src/sage/libs/ntl/ntl_mat_ZZ.pyx b/src/sage/libs/ntl/ntl_mat_ZZ.pyx index 349055dc182..ed4e012bb33 100644 --- a/src/sage/libs/ntl/ntl_mat_ZZ.pyx +++ b/src/sage/libs/ntl/ntl_mat_ZZ.pyx @@ -32,7 +32,7 @@ from cpython.object cimport PyObject_RichCompare from sage.libs.ntl.ntl_ZZ import unpickle_class_args -cdef inline ntl_ZZ make_ZZ(ZZ_c* x) noexcept: +cdef inline ntl_ZZ make_ZZ(ZZ_c* x): cdef ntl_ZZ y y = ntl_ZZ() y.x = x[0] @@ -40,12 +40,12 @@ cdef inline ntl_ZZ make_ZZ(ZZ_c* x) noexcept: return y # You must do sig_on() before calling this function -cdef inline ntl_ZZ make_ZZ_sig_off(ZZ_c* x) noexcept: +cdef inline ntl_ZZ make_ZZ_sig_off(ZZ_c* x): cdef ntl_ZZ y = make_ZZ(x) sig_off() return y -cdef inline ntl_mat_ZZ make_mat_ZZ(mat_ZZ_c* x) noexcept: +cdef inline ntl_mat_ZZ make_mat_ZZ(mat_ZZ_c* x): cdef ntl_mat_ZZ y y = ntl_mat_ZZ.__new__(ntl_mat_ZZ) y.x = x[0] @@ -55,7 +55,7 @@ cdef inline ntl_mat_ZZ make_mat_ZZ(mat_ZZ_c* x) noexcept: return y # You must do sig_on() before calling this function -cdef inline ntl_mat_ZZ make_mat_ZZ_sig_off(mat_ZZ_c* x) noexcept: +cdef inline ntl_mat_ZZ make_mat_ZZ_sig_off(mat_ZZ_c* x): cdef ntl_mat_ZZ y = make_mat_ZZ(x) sig_off() return y diff --git a/src/sage/libs/pari/convert_flint.pxd b/src/sage/libs/pari/convert_flint.pxd index 3d6003f56bd..c139703b9a5 100644 --- a/src/sage/libs/pari/convert_flint.pxd +++ b/src/sage/libs/pari/convert_flint.pxd @@ -5,9 +5,9 @@ from sage.libs.flint.types cimport fmpz_t, fmpz_mat_t, fmpq_t, fmpq_mat_t cdef GEN _new_GEN_from_fmpz_t(fmpz_t value) noexcept cdef GEN _new_GEN_from_fmpz_mat_t(fmpz_mat_t B) noexcept cdef GEN _new_GEN_from_fmpz_mat_t_rotate90(fmpz_mat_t B) noexcept -cdef Gen integer_matrix(fmpz_mat_t B, bint rotate) noexcept +cdef Gen integer_matrix(fmpz_mat_t B, bint rotate) cdef GEN _new_GEN_from_fmpq_t(fmpq_t value) noexcept cdef GEN _new_GEN_from_fmpq_mat_t(fmpq_mat_t B) noexcept cdef GEN _new_GEN_from_fmpq_mat_t_rotate90(fmpq_mat_t B) noexcept -cdef Gen rational_matrix(fmpq_mat_t B, bint rotate) noexcept +cdef Gen rational_matrix(fmpq_mat_t B, bint rotate) diff --git a/src/sage/libs/pari/convert_flint.pyx b/src/sage/libs/pari/convert_flint.pyx index eaf063a0f61..fe0e4f7648d 100644 --- a/src/sage/libs/pari/convert_flint.pyx +++ b/src/sage/libs/pari/convert_flint.pyx @@ -126,7 +126,7 @@ cdef GEN _new_GEN_from_fmpq_mat_t_rotate90(fmpq_mat_t B) noexcept: return A -cdef Gen integer_matrix(fmpz_mat_t B, bint rotate) noexcept: +cdef Gen integer_matrix(fmpz_mat_t B, bint rotate): """ EXAMPLES:: @@ -142,7 +142,7 @@ cdef Gen integer_matrix(fmpz_mat_t B, bint rotate) noexcept: return new_gen(g) -cdef Gen rational_matrix(fmpq_mat_t B, bint rotate) noexcept: +cdef Gen rational_matrix(fmpq_mat_t B, bint rotate): """ EXAMPLES:: diff --git a/src/sage/libs/pari/convert_gmp.pxd b/src/sage/libs/pari/convert_gmp.pxd index b745a823ab5..8e984eedce8 100644 --- a/src/sage/libs/pari/convert_gmp.pxd +++ b/src/sage/libs/pari/convert_gmp.pxd @@ -2,12 +2,12 @@ from cypari2.types cimport GEN from cypari2.gen cimport Gen from sage.libs.gmp.types cimport mpz_t, mpq_t, mpz_ptr, mpq_ptr -cdef Gen new_gen_from_mpz_t(mpz_t value) noexcept +cdef Gen new_gen_from_mpz_t(mpz_t value) cdef GEN _new_GEN_from_mpz_t(mpz_t value) noexcept -cdef Gen new_gen_from_mpq_t(mpq_t value) noexcept +cdef Gen new_gen_from_mpq_t(mpq_t value) cdef GEN _new_GEN_from_mpq_t(mpq_t value) noexcept -cdef Gen new_gen_from_padic(long ordp, long relprec, mpz_t prime, mpz_t p_pow, mpz_t unit) noexcept +cdef Gen new_gen_from_padic(long ordp, long relprec, mpz_t prime, mpz_t p_pow, mpz_t unit) cdef GEN _new_GEN_from_mpq_t_matrix(mpq_t** B, long nr, long nc) noexcept -cdef Gen rational_matrix(mpq_t** B, long nr, long nc) noexcept +cdef Gen rational_matrix(mpq_t** B, long nr, long nc) cdef void INT_to_mpz(mpz_ptr value, GEN g) noexcept cdef void INTFRAC_to_mpq(mpq_ptr value, GEN g) noexcept diff --git a/src/sage/libs/pari/convert_gmp.pyx b/src/sage/libs/pari/convert_gmp.pyx index 728729b89d1..9162f7d9a27 100644 --- a/src/sage/libs/pari/convert_gmp.pyx +++ b/src/sage/libs/pari/convert_gmp.pyx @@ -27,7 +27,7 @@ from sage.libs.gmp.all cimport * from cypari2.paridecl cimport * from cypari2.stack cimport new_gen -cdef Gen new_gen_from_mpz_t(mpz_t value) noexcept: +cdef Gen new_gen_from_mpz_t(mpz_t value): """ Create a new PARI Gen of type ``t_INT`` from a given GMP integer ``value``. @@ -73,7 +73,7 @@ cdef inline GEN _new_GEN_from_mpz_t(mpz_t value) noexcept: return z -cdef Gen new_gen_from_mpq_t(mpq_t value) noexcept: +cdef Gen new_gen_from_mpq_t(mpq_t value): """ Create a new PARI Gen of type ``t_INT`` or ``t_FRAC`` from a given GMP rational ``value``. @@ -121,7 +121,7 @@ cdef inline GEN _new_GEN_from_mpq_t(mpq_t value) noexcept: cdef Gen new_gen_from_padic(long ordp, long relprec, - mpz_t prime, mpz_t p_pow, mpz_t unit) noexcept: + mpz_t prime, mpz_t p_pow, mpz_t unit): """ Create a new PARI Gen of type ``t_PADIC`` from the given input data as GMP integers. @@ -155,7 +155,7 @@ cdef GEN _new_GEN_from_mpq_t_matrix(mpq_t** B, long nr, long nc) noexcept: return A -cdef Gen rational_matrix(mpq_t** B, long nr, long nc) noexcept: +cdef Gen rational_matrix(mpq_t** B, long nr, long nc): """ Create a new PARI matrix of type ``t_MAT`` from a given array of GMP rationals ``mpq_t``. diff --git a/src/sage/libs/pari/convert_sage.pxd b/src/sage/libs/pari/convert_sage.pxd index ffa9c0ef6c0..ef80ff4030f 100644 --- a/src/sage/libs/pari/convert_sage.pxd +++ b/src/sage/libs/pari/convert_sage.pxd @@ -2,14 +2,14 @@ from cypari2.gen cimport Gen from sage.rings.integer cimport Integer from sage.rings.rational cimport Rational -cpdef gen_to_sage(Gen z, locals=*) noexcept +cpdef gen_to_sage(Gen z, locals=*) -cpdef set_integer_from_gen(Integer self, Gen x) noexcept -cpdef Gen new_gen_from_integer(Integer self) noexcept -cpdef set_rational_from_gen(Rational self, Gen x) noexcept -cpdef Gen new_gen_from_rational(Rational self) noexcept +cpdef set_integer_from_gen(Integer self, Gen x) +cpdef Gen new_gen_from_integer(Integer self) +cpdef set_rational_from_gen(Rational self, Gen x) +cpdef Gen new_gen_from_rational(Rational self) -cpdef pari_is_prime(Integer p) noexcept -cpdef pari_is_prime_power(Integer q, bint get_data) noexcept +cpdef pari_is_prime(Integer p) +cpdef pari_is_prime_power(Integer q, bint get_data) cpdef unsigned long pari_maxprime() noexcept -cpdef list pari_prime_range(long c_start, long c_stop, bint py_ints=*) noexcept +cpdef list pari_prime_range(long c_start, long c_stop, bint py_ints=*) diff --git a/src/sage/libs/pari/convert_sage.pyx b/src/sage/libs/pari/convert_sage.pyx index 3f21ae46ab4..a163dbf2b33 100644 --- a/src/sage/libs/pari/convert_sage.pyx +++ b/src/sage/libs/pari/convert_sage.pyx @@ -52,7 +52,7 @@ except ImportError: pari_typ_to_entries_type = LazyImport('sage.libs.pari.convert_sage_matrix', 'pari_typ_to_entries_type') -cpdef gen_to_sage(Gen z, locals=None) noexcept: +cpdef gen_to_sage(Gen z, locals=None): """ Convert a PARI gen to a Sage/Python object. @@ -339,7 +339,7 @@ cpdef gen_to_sage(Gen z, locals=None) noexcept: return sage_eval(str(z), locals=locals) -cpdef set_integer_from_gen(Integer self, Gen x) noexcept: +cpdef set_integer_from_gen(Integer self, Gen x): r""" EXAMPLES:: @@ -387,7 +387,7 @@ cpdef set_integer_from_gen(Integer self, Gen x) noexcept: INT_to_mpz(self.value, (x).g) -cpdef Gen new_gen_from_integer(Integer self) noexcept: +cpdef Gen new_gen_from_integer(Integer self): """ TESTS:: @@ -399,7 +399,7 @@ cpdef Gen new_gen_from_integer(Integer self) noexcept: return new_gen_from_mpz_t(self.value) -cpdef set_rational_from_gen(Rational self, Gen x) noexcept: +cpdef set_rational_from_gen(Rational self, Gen x): r""" EXAMPLES:: @@ -419,7 +419,7 @@ cpdef set_rational_from_gen(Rational self, Gen x) noexcept: mpz_set_si(mpq_denref(self.value), 1) -cpdef Gen new_gen_from_rational(Rational self) noexcept: +cpdef Gen new_gen_from_rational(Rational self): """ TESTS:: @@ -431,7 +431,7 @@ cpdef Gen new_gen_from_rational(Rational self) noexcept: return new_gen_from_mpq_t(self.value) -cpdef list pari_divisors_small(Integer self) noexcept: +cpdef list pari_divisors_small(Integer self): r""" Return the list of divisors of this number using PARI ``divisorsu``. @@ -477,7 +477,7 @@ cpdef list pari_divisors_small(Integer self) noexcept: avma = ltop -cpdef pari_is_prime(Integer p) noexcept: +cpdef pari_is_prime(Integer p): r""" Return whether ``p`` is a prime. @@ -504,7 +504,7 @@ cpdef pari_is_prime(Integer p) noexcept: return bool(uisprime(mpz_get_ui(p.value))) -cpdef pari_is_prime_power(Integer q, bint get_data) noexcept: +cpdef pari_is_prime_power(Integer q, bint get_data): r""" Return whether ``q`` is a prime power. @@ -561,7 +561,7 @@ cpdef unsigned long pari_maxprime() noexcept: return maxprime() -cpdef list pari_prime_range(long c_start, long c_stop, bint py_ints=False) noexcept: +cpdef list pari_prime_range(long c_start, long c_stop, bint py_ints=False): """ Return a list of all primes between ``start`` and ``stop - 1``, inclusive. diff --git a/src/sage/libs/pari/convert_sage_complex_double.pxd b/src/sage/libs/pari/convert_sage_complex_double.pxd index 803892b274a..51299d77759 100644 --- a/src/sage/libs/pari/convert_sage_complex_double.pxd +++ b/src/sage/libs/pari/convert_sage_complex_double.pxd @@ -1,13 +1,13 @@ from cypari2.gen cimport Gen from sage.rings.complex_double cimport ComplexDoubleElement -cpdef ComplexDoubleElement pari_to_cdf(Gen g) noexcept +cpdef ComplexDoubleElement pari_to_cdf(Gen g) -cpdef Gen new_gen_from_complex_double_element(ComplexDoubleElement self) noexcept +cpdef Gen new_gen_from_complex_double_element(ComplexDoubleElement self) -cpdef ComplexDoubleElement complex_double_element_eta(ComplexDoubleElement self, int flag) noexcept -cpdef ComplexDoubleElement complex_double_element_agm(ComplexDoubleElement self, right) noexcept -cpdef ComplexDoubleElement complex_double_element_dilog(ComplexDoubleElement self) noexcept -cpdef ComplexDoubleElement complex_double_element_gamma(ComplexDoubleElement self) noexcept -cpdef ComplexDoubleElement complex_double_element_gamma_inc(ComplexDoubleElement self, t) noexcept -cpdef ComplexDoubleElement complex_double_element_zeta(ComplexDoubleElement self) noexcept +cpdef ComplexDoubleElement complex_double_element_eta(ComplexDoubleElement self, int flag) +cpdef ComplexDoubleElement complex_double_element_agm(ComplexDoubleElement self, right) +cpdef ComplexDoubleElement complex_double_element_dilog(ComplexDoubleElement self) +cpdef ComplexDoubleElement complex_double_element_gamma(ComplexDoubleElement self) +cpdef ComplexDoubleElement complex_double_element_gamma_inc(ComplexDoubleElement self, t) +cpdef ComplexDoubleElement complex_double_element_zeta(ComplexDoubleElement self) diff --git a/src/sage/libs/pari/convert_sage_complex_double.pyx b/src/sage/libs/pari/convert_sage_complex_double.pyx index 1c162c12e55..d7d7c5333a1 100644 --- a/src/sage/libs/pari/convert_sage_complex_double.pyx +++ b/src/sage/libs/pari/convert_sage_complex_double.pyx @@ -8,7 +8,7 @@ from cypari2.paridecl cimport * from cypari2.convert cimport new_gen_from_double, new_t_COMPLEX_from_double -cpdef ComplexDoubleElement pari_to_cdf(Gen g) noexcept: +cpdef ComplexDoubleElement pari_to_cdf(Gen g): """ Create a CDF element from a PARI ``gen``. @@ -42,7 +42,7 @@ cpdef ComplexDoubleElement pari_to_cdf(Gen g) noexcept: return z -cpdef Gen new_gen_from_complex_double_element(ComplexDoubleElement self) noexcept: +cpdef Gen new_gen_from_complex_double_element(ComplexDoubleElement self): """ Return PARI version of ``self``, as ``t_COMPLEX`` or ``t_REAL``. @@ -62,7 +62,7 @@ cpdef Gen new_gen_from_complex_double_element(ComplexDoubleElement self) noexcep return new_t_COMPLEX_from_double(GSL_REAL(self._complex), GSL_IMAG(self._complex)) -cpdef ComplexDoubleElement complex_double_element_eta(ComplexDoubleElement self, int flag) noexcept: +cpdef ComplexDoubleElement complex_double_element_eta(ComplexDoubleElement self, int flag): """ TESTS:: @@ -76,7 +76,7 @@ cpdef ComplexDoubleElement complex_double_element_eta(ComplexDoubleElement self, return pari_to_cdf(new_gen_from_complex_double_element(self).eta(flag)) -cpdef ComplexDoubleElement complex_double_element_agm(ComplexDoubleElement self, right) noexcept: +cpdef ComplexDoubleElement complex_double_element_agm(ComplexDoubleElement self, right): """ TESTS:: @@ -87,7 +87,7 @@ cpdef ComplexDoubleElement complex_double_element_agm(ComplexDoubleElement self, return pari_to_cdf(new_gen_from_complex_double_element(self).agm(right)) -cpdef ComplexDoubleElement complex_double_element_dilog(ComplexDoubleElement self) noexcept: +cpdef ComplexDoubleElement complex_double_element_dilog(ComplexDoubleElement self): """ TESTS:: @@ -98,7 +98,7 @@ cpdef ComplexDoubleElement complex_double_element_dilog(ComplexDoubleElement sel return pari_to_cdf(new_gen_from_complex_double_element(self).dilog()) -cpdef ComplexDoubleElement complex_double_element_gamma(ComplexDoubleElement self) noexcept: +cpdef ComplexDoubleElement complex_double_element_gamma(ComplexDoubleElement self): """ TESTS:: @@ -109,7 +109,7 @@ cpdef ComplexDoubleElement complex_double_element_gamma(ComplexDoubleElement sel return pari_to_cdf(new_gen_from_complex_double_element(self).gamma()) -cpdef ComplexDoubleElement complex_double_element_gamma_inc(ComplexDoubleElement self, t) noexcept: +cpdef ComplexDoubleElement complex_double_element_gamma_inc(ComplexDoubleElement self, t): """ TESTS:: @@ -120,7 +120,7 @@ cpdef ComplexDoubleElement complex_double_element_gamma_inc(ComplexDoubleElement return pari_to_cdf(new_gen_from_complex_double_element(self).incgam(t)) -cpdef ComplexDoubleElement complex_double_element_zeta(ComplexDoubleElement self) noexcept: +cpdef ComplexDoubleElement complex_double_element_zeta(ComplexDoubleElement self): """ TESTS:: diff --git a/src/sage/libs/pari/convert_sage_real_double.pxd b/src/sage/libs/pari/convert_sage_real_double.pxd index df2119d0370..12fa7418e69 100644 --- a/src/sage/libs/pari/convert_sage_real_double.pxd +++ b/src/sage/libs/pari/convert_sage_real_double.pxd @@ -1,4 +1,4 @@ from cypari2.gen cimport Gen from sage.rings.real_double cimport RealDoubleElement -cpdef Gen new_gen_from_real_double_element(RealDoubleElement self) noexcept +cpdef Gen new_gen_from_real_double_element(RealDoubleElement self) diff --git a/src/sage/libs/pari/convert_sage_real_double.pyx b/src/sage/libs/pari/convert_sage_real_double.pyx index ee7eba3f4a8..6d7ffe7038e 100644 --- a/src/sage/libs/pari/convert_sage_real_double.pyx +++ b/src/sage/libs/pari/convert_sage_real_double.pyx @@ -1,6 +1,6 @@ from cypari2.convert cimport new_gen_from_double -cpdef Gen new_gen_from_real_double_element(RealDoubleElement self) noexcept: +cpdef Gen new_gen_from_real_double_element(RealDoubleElement self): """ Return a PARI representation of ``self``. diff --git a/src/sage/libs/pari/convert_sage_real_mpfr.pxd b/src/sage/libs/pari/convert_sage_real_mpfr.pxd index a7674309255..34fbd2bbe45 100644 --- a/src/sage/libs/pari/convert_sage_real_mpfr.pxd +++ b/src/sage/libs/pari/convert_sage_real_mpfr.pxd @@ -3,4 +3,4 @@ from cypari2.gen cimport Gen from sage.rings.real_mpfr cimport RealNumber cpdef Gen new_gen_from_real_mpfr_element(RealNumber self) -cpdef bint set_real_mpfr_element_from_gen(RealNumber self, Gen x) +cpdef bint set_real_mpfr_element_from_gen(RealNumber self, Gen x) noexcept diff --git a/src/sage/libs/pari/convert_sage_real_mpfr.pyx b/src/sage/libs/pari/convert_sage_real_mpfr.pyx index 119944a5209..4546c3def24 100644 --- a/src/sage/libs/pari/convert_sage_real_mpfr.pyx +++ b/src/sage/libs/pari/convert_sage_real_mpfr.pyx @@ -56,7 +56,7 @@ cpdef Gen new_gen_from_real_mpfr_element(RealNumber self): return new_gen(pari_float) -cpdef bint set_real_mpfr_element_from_gen(RealNumber self, Gen x): +cpdef bint set_real_mpfr_element_from_gen(RealNumber self, Gen x) noexcept: r""" EXAMPLES:: diff --git a/src/sage/libs/pari/misc.pxd b/src/sage/libs/pari/misc.pxd index da162742f1d..ae89aff0b84 100644 --- a/src/sage/libs/pari/misc.pxd +++ b/src/sage/libs/pari/misc.pxd @@ -1,3 +1,3 @@ from cypari2.gen cimport Gen -cdef Gen new_t_POL_from_int_star(int* vals, unsigned long length, long varnum) noexcept +cdef Gen new_t_POL_from_int_star(int* vals, unsigned long length, long varnum) diff --git a/src/sage/libs/pari/misc.pyx b/src/sage/libs/pari/misc.pyx index 02fd8403b8e..1ed774d417c 100644 --- a/src/sage/libs/pari/misc.pyx +++ b/src/sage/libs/pari/misc.pyx @@ -3,7 +3,7 @@ from cypari2.paridecl cimport * from cypari2.stack cimport new_gen -cdef Gen new_t_POL_from_int_star(int* vals, unsigned long length, long varnum) noexcept: +cdef Gen new_t_POL_from_int_star(int* vals, unsigned long length, long varnum): """ Convert an array of ints to a PARI polynomial. diff --git a/src/sage/libs/singular/function.pxd b/src/sage/libs/singular/function.pxd index 29748c039c6..facdcae674a 100644 --- a/src/sage/libs/singular/function.pxd +++ b/src/sage/libs/singular/function.pxd @@ -19,7 +19,7 @@ from sage.libs.singular.decl cimport leftv, idhdl, syStrategy, matrix, poly, ide from sage.libs.singular.decl cimport ring as singular_ring from sage.rings.polynomial.multi_polynomial_libsingular cimport MPolynomialRing_libsingular, MPolynomial_libsingular -cdef new_sage_polynomial(ring, poly *p) noexcept +cdef new_sage_polynomial(ring, poly *p) cdef poly* access_singular_poly(p) except -1 cdef singular_ring* access_singular_ring(r) except -1 @@ -50,11 +50,11 @@ cdef class Converter(SageObject): cdef leftv * append_matrix(self, a) except NULL cdef leftv * append_ring(self, r) except NULL cdef leftv * append_module(self, m) except NULL - cdef to_sage_integer_matrix(self, intvec *mat) noexcept - cdef object to_sage_module_element_sequence_destructive(self, ideal *i) noexcept - cdef to_sage_vector_destructive(self, poly *p, free_module = ?) noexcept - cdef to_sage_matrix(self, matrix* mat) noexcept - cdef to_python(self, leftv* to_convert) noexcept + cdef to_sage_integer_matrix(self, intvec *mat) + cdef object to_sage_module_element_sequence_destructive(self, ideal *i) + cdef to_sage_vector_destructive(self, poly *p, free_module = ?) + cdef to_sage_matrix(self, matrix* mat) + cdef to_python(self, leftv* to_convert) cdef class BaseCallHandler: cdef leftv* handle_call(self, Converter argument_list, singular_ring *_ring=?) noexcept @@ -72,9 +72,9 @@ cdef class SingularFunction(SageObject): cdef MPolynomialRing_libsingular _ring cdef BaseCallHandler call_handler - cdef BaseCallHandler get_call_handler(self) noexcept + cdef BaseCallHandler get_call_handler(self) cdef bint function_exists(self) noexcept - cdef common_ring(self, tuple args, ring=?) noexcept + cdef common_ring(self, tuple args, ring=?) cdef class SingularLibraryFunction(SingularFunction): pass @@ -83,4 +83,4 @@ cdef class SingularKernelFunction(SingularFunction): pass # the most direct function call interface -cdef call_function(SingularFunction self, tuple args, object R, bint signal_handler=?, object attributes=?) noexcept +cdef call_function(SingularFunction self, tuple args, object R, bint signal_handler=?, object attributes=?) diff --git a/src/sage/libs/singular/function.pyx b/src/sage/libs/singular/function.pyx index e01d8486b0c..4a5ab6d78f6 100644 --- a/src/sage/libs/singular/function.pyx +++ b/src/sage/libs/singular/function.pyx @@ -353,7 +353,7 @@ cdef leftv* new_leftv(void *data, res_type) noexcept: res.rtyp = res_type return res -cdef free_leftv(leftv *args, ring *r = NULL) noexcept: +cdef free_leftv(leftv *args, ring *r = NULL): """ Kills this ``leftv`` and all ``leftv``s in the tail. @@ -394,7 +394,7 @@ def is_sage_wrapper_for_singular_ring(ring): return True return False -cdef new_sage_polynomial(ring, poly *p) noexcept: +cdef new_sage_polynomial(ring, poly *p): if isinstance(ring, MPolynomialRing_libsingular): return new_MP(ring, p) else: @@ -678,7 +678,7 @@ cdef class Converter(SageObject): """ return self._append_leftv( new_leftv(data, res_type) ) - cdef to_sage_matrix(self, matrix* mat) noexcept: + cdef to_sage_matrix(self, matrix* mat): """ Convert singular matrix to matrix over the polynomial ring. """ @@ -693,7 +693,7 @@ cdef class Converter(SageObject): result[i,j] = p return result - cdef to_sage_vector_destructive(self, poly *p, free_module = None) noexcept: + cdef to_sage_vector_destructive(self, poly *p, free_module = None): cdef int rank if free_module: rank = free_module.rank() @@ -733,7 +733,7 @@ cdef class Converter(SageObject): result.append(new_sage_polynomial(self._sage_ring, first)) return free_module(result) - cdef object to_sage_module_element_sequence_destructive( self, ideal *i) noexcept: + cdef object to_sage_module_element_sequence_destructive( self, ideal *i): """ Convert a SINGULAR module to a Sage Sequence (the format Sage stores a Groebner basis in). @@ -756,7 +756,7 @@ cdef class Converter(SageObject): return Sequence(l, check=False, immutable=True) - cdef to_sage_integer_matrix(self, intvec* mat) noexcept: + cdef to_sage_integer_matrix(self, intvec* mat): """ Convert Singular matrix to matrix over the polynomial ring. """ @@ -908,7 +908,7 @@ cdef class Converter(SageObject): b = str_to_bytes(n) return self._append(omStrDup(b), STRING_CMD) - cdef to_python(self, leftv* to_convert) noexcept: + cdef to_python(self, leftv* to_convert): """ Convert the ``leftv`` to a Python object. @@ -1168,7 +1168,7 @@ cdef class SingularFunction(SageObject): currRingHdl.data.uring = omAlloc0Bin(sip_sring_bin) currRingHdl.data.uring.ref += 1 - cdef BaseCallHandler get_call_handler(self) noexcept: + cdef BaseCallHandler get_call_handler(self): """ Return a call handler which does the actual work. """ @@ -1358,7 +1358,7 @@ The Singular documentation for '%s' is given below. else: return prefix + "\n::\n\n"+" Singular documentation not found" - cdef common_ring(self, tuple args, ring=None) noexcept: + cdef common_ring(self, tuple args, ring=None): """ Return the common ring for the argument list ``args``. @@ -1442,7 +1442,7 @@ The Singular documentation for '%s' is given below. return richcmp(lx._name, rx._name, op) -cdef inline call_function(SingularFunction self, tuple args, object R, bint signal_handler=True, attributes=None) noexcept: +cdef inline call_function(SingularFunction self, tuple args, object R, bint signal_handler=True, attributes=None): global currRingHdl global errorreported global currentVoice @@ -1530,7 +1530,7 @@ cdef class SingularLibraryFunction(SingularFunction): super().__init__(name) self.call_handler = self.get_call_handler() - cdef BaseCallHandler get_call_handler(self) noexcept: + cdef BaseCallHandler get_call_handler(self): cdef idhdl* singular_idhdl = ggetid(str_to_bytes(self._name)) if singular_idhdl==NULL: raise NameError("Singular library function {!r} is not defined".format(self._name)) @@ -1577,7 +1577,7 @@ cdef class SingularKernelFunction(SingularFunction): super().__init__(name) self.call_handler = self.get_call_handler() - cdef BaseCallHandler get_call_handler(self) noexcept: + cdef BaseCallHandler get_call_handler(self): cdef int cmd_n = 0 arity = IsCmd(str_to_bytes(self._name), cmd_n) # call by reverence for CMD_n if not cmd_n: @@ -1843,7 +1843,7 @@ def list_of_functions(packages=False): h = IDNEXT(h) return l -cdef inline RingWrap new_RingWrap(ring* r) noexcept: +cdef inline RingWrap new_RingWrap(ring* r): cdef RingWrap ring_wrap_result = RingWrap.__new__(RingWrap) ring_wrap_result._ring = r ring_wrap_result._ring.ref += 1 diff --git a/src/sage/libs/singular/groebner_strategy.pxd b/src/sage/libs/singular/groebner_strategy.pxd index 391f11aee97..605e2679228 100644 --- a/src/sage/libs/singular/groebner_strategy.pxd +++ b/src/sage/libs/singular/groebner_strategy.pxd @@ -11,11 +11,11 @@ cdef class GroebnerStrategy(SageObject): cdef MPolynomialRing_libsingular _parent cdef object _ideal - cpdef MPolynomial_libsingular normal_form(self, MPolynomial_libsingular p) noexcept + cpdef MPolynomial_libsingular normal_form(self, MPolynomial_libsingular p) cdef class NCGroebnerStrategy(SageObject): cdef skStrategy *_strat cdef NCPolynomialRing_plural _parent cdef object _ideal - cpdef NCPolynomial_plural normal_form(self, NCPolynomial_plural p) noexcept + cpdef NCPolynomial_plural normal_form(self, NCPolynomial_plural p) diff --git a/src/sage/libs/singular/groebner_strategy.pyx b/src/sage/libs/singular/groebner_strategy.pyx index 9ad31df1bdb..e9c00e7d1fd 100644 --- a/src/sage/libs/singular/groebner_strategy.pyx +++ b/src/sage/libs/singular/groebner_strategy.pyx @@ -260,7 +260,7 @@ cdef class GroebnerStrategy(SageObject): """ return unpickle_GroebnerStrategy0, (self._ideal,) - cpdef MPolynomial_libsingular normal_form(self, MPolynomial_libsingular p) noexcept: + cpdef MPolynomial_libsingular normal_form(self, MPolynomial_libsingular p): """ Compute the normal form of ``p`` with respect to the generators of this object. @@ -511,7 +511,7 @@ cdef class NCGroebnerStrategy(SageObject): """ return unpickle_NCGroebnerStrategy0, (self._ideal,) - cpdef NCPolynomial_plural normal_form(self, NCPolynomial_plural p) noexcept: + cpdef NCPolynomial_plural normal_form(self, NCPolynomial_plural p): """ Compute the normal form of ``p`` with respect to the generators of this object. diff --git a/src/sage/libs/singular/polynomial.pxd b/src/sage/libs/singular/polynomial.pxd index df27179da54..52b19fbba75 100644 --- a/src/sage/libs/singular/polynomial.pxd +++ b/src/sage/libs/singular/polynomial.pxd @@ -18,7 +18,8 @@ from sage.libs.singular.decl cimport poly, ring cdef int singular_polynomial_check(poly *p, ring *r) except -1 cdef int singular_polynomial_add (poly **ret, poly *p, poly *q, ring *r) noexcept -cdef int singular_polynomial_call (poly **ret, poly *p, ring *r, list args, poly *(*get_element)(object)) noexcept +cdef int singular_polynomial_call (poly **ret, poly *p, ring *r, list args, + poly *(*get_element)(object) noexcept) noexcept cdef int singular_polynomial_cmp (poly *p, poly *q, ring *r) noexcept cdef int singular_polynomial_rmul (poly **ret, poly *p, RingElement q, ring *r) noexcept cdef int singular_polynomial_mul (poly **ret, poly *p, poly *q, ring *r) except -1 @@ -27,9 +28,9 @@ cdef int singular_polynomial_div_coeff (poly **ret, poly *p, poly *q, ring *r) e cdef int singular_polynomial_pow (poly **ret, poly *p, unsigned long exp, ring *r) except -1 cdef int singular_polynomial_neg(poly **ret, poly *p, ring *r) noexcept -cdef object singular_polynomial_latex(poly *p, ring *r, object base, object latex_gens) noexcept -cdef object singular_polynomial_str(poly *p, ring *r) noexcept -cdef object singular_polynomial_str_with_changed_varnames(poly *p, ring *r, object varnames) noexcept +cdef object singular_polynomial_latex(poly *p, ring *r, object base, object latex_gens) +cdef object singular_polynomial_str(poly *p, ring *r) +cdef object singular_polynomial_str_with_changed_varnames(poly *p, ring *r, object varnames) cdef long singular_polynomial_deg(poly *p, poly *x, ring *r) noexcept cdef int singular_polynomial_length_bounded(poly *p, int bound) noexcept diff --git a/src/sage/libs/singular/polynomial.pyx b/src/sage/libs/singular/polynomial.pyx index 43a5b7b1be0..e3a5881383d 100644 --- a/src/sage/libs/singular/polynomial.pyx +++ b/src/sage/libs/singular/polynomial.pyx @@ -132,7 +132,8 @@ cdef int singular_polynomial_rmul(poly **ret, poly *p, RingElement n, ring *r) n n_Delete(&_n, r.cf) return 0 -cdef int singular_polynomial_call(poly **ret, poly *p, ring *r, list args, poly *(*get_element)(object)) noexcept: +cdef int singular_polynomial_call(poly **ret, poly *p, ring *r, list args, + poly *(*get_element)(object) noexcept) noexcept: """ ``ret[0] = p(*args)`` where each entry in arg is a polynomial and ``p`` in ``r``. @@ -425,7 +426,7 @@ cdef int singular_polynomial_neg(poly **ret, poly *p, ring *r) noexcept: ret[0] = p_Neg(p_Copy(p,r),r) return 0 -cdef object singular_polynomial_str(poly *p, ring *r) noexcept: +cdef object singular_polynomial_str(poly *p, ring *r): """ Return the string representation of ``p``. @@ -450,7 +451,7 @@ cdef object singular_polynomial_str(poly *p, ring *r) noexcept: s = parenthvar_pattern.sub("\\1", s) return s -cdef object singular_polynomial_latex(poly *p, ring *r, object base, object latex_gens) noexcept: +cdef object singular_polynomial_latex(poly *p, ring *r, object base, object latex_gens): r""" Return the LaTeX string representation of ``p``. @@ -532,7 +533,7 @@ cdef object singular_polynomial_latex(poly *p, ring *r, object base, object late return "0" return poly -cdef object singular_polynomial_str_with_changed_varnames(poly *p, ring *r, object varnames) noexcept: +cdef object singular_polynomial_str_with_changed_varnames(poly *p, ring *r, object varnames): cdef char **_names cdef char **_orig_names cdef int i diff --git a/src/sage/libs/singular/ring.pxd b/src/sage/libs/singular/ring.pxd index 70ff788f21c..55403521886 100644 --- a/src/sage/libs/singular/ring.pxd +++ b/src/sage/libs/singular/ring.pxd @@ -55,4 +55,4 @@ cdef ring *singular_ring_reference(ring *existing_ring) except NULL cdef void singular_ring_delete(ring *doomed) noexcept # Used internally for reference counting -cdef wrap_ring(ring* R) noexcept +cdef wrap_ring(ring* R) diff --git a/src/sage/libs/singular/ring.pyx b/src/sage/libs/singular/ring.pyx index cad4d27c49f..0efff45904d 100644 --- a/src/sage/libs/singular/ring.pyx +++ b/src/sage/libs/singular/ring.pyx @@ -618,7 +618,7 @@ cdef class ring_wrapper_Py(): return (self._ring == r._ring) == (op == Py_EQ) -cdef wrap_ring(ring* R) noexcept: +cdef wrap_ring(ring* R): """ Wrap a C ring pointer into a Python object. @@ -745,7 +745,7 @@ cdef void singular_ring_delete(ring *doomed) noexcept: ############################################################################# # helpers for debugging -cpdef poison_currRing(frame, event, arg) noexcept: +cpdef poison_currRing(frame, event, arg): """ Poison the ``currRing`` pointer. @@ -778,7 +778,7 @@ cpdef poison_currRing(frame, event, arg) noexcept: return poison_currRing -cpdef print_currRing() noexcept: +cpdef print_currRing(): """ Print the ``currRing`` pointer. diff --git a/src/sage/libs/singular/singular.pxd b/src/sage/libs/singular/singular.pxd index d943a1018a2..05f32b68079 100644 --- a/src/sage/libs/singular/singular.pxd +++ b/src/sage/libs/singular/singular.pxd @@ -18,24 +18,24 @@ from sage.rings.number_field.number_field_base cimport NumberField # Conversion from Singular to Sage types # ====================================== -cdef Rational si2sa_QQ(number (*), number **, ring (*)) noexcept -cdef Integer si2sa_ZZ(number (*),ring (*)) noexcept +cdef Rational si2sa_QQ(number (*), number **, ring (*)) +cdef Integer si2sa_ZZ(number (*),ring (*)) -cdef FFgivE si2sa_GFqGivaro(number *n, ring *_ring, Cache_givaro cache) noexcept -cdef FFgf2eE si2sa_GFqNTLGF2E(number *n, ring *_ring, Cache_ntl_gf2e cache) noexcept -cdef object si2sa_GFq_generic(number *n, ring *_ring, object base) noexcept -cdef object si2sa_ZZmod(number *n, ring *_ring, object base) noexcept +cdef FFgivE si2sa_GFqGivaro(number *n, ring *_ring, Cache_givaro cache) +cdef FFgf2eE si2sa_GFqNTLGF2E(number *n, ring *_ring, Cache_ntl_gf2e cache) +cdef object si2sa_GFq_generic(number *n, ring *_ring, object base) +cdef object si2sa_ZZmod(number *n, ring *_ring, object base) -cdef object si2sa_NF(number *n, ring *_ring, object base) noexcept +cdef object si2sa_NF(number *n, ring *_ring, object base) -cdef object si2sa_intvec(intvec *v) noexcept +cdef object si2sa_intvec(intvec *v) # dispatches to all the above. -cdef object si2sa(number *n, ring *_ring, object base) noexcept +cdef object si2sa(number *n, ring *_ring, object base) -cdef list singular_monomial_exponents(poly *p, ring *r) noexcept -cpdef list si2sa_resolution(Resolution res) noexcept -cpdef tuple si2sa_resolution_graded(Resolution res, tuple degrees) noexcept +cdef list singular_monomial_exponents(poly *p, ring *r) +cpdef list si2sa_resolution(Resolution res) +cpdef tuple si2sa_resolution_graded(Resolution res, tuple degrees) # ====================================== # Conversion from Sage to Singular types @@ -60,4 +60,4 @@ cdef number *sa2si(Element elem, ring * _ring) noexcept cdef int overflow_check(unsigned long e, ring *_ring) except -1 -cdef init_libsingular() noexcept +cdef init_libsingular() diff --git a/src/sage/libs/singular/singular.pyx b/src/sage/libs/singular/singular.pyx index a331b43c876..e256949298e 100644 --- a/src/sage/libs/singular/singular.pyx +++ b/src/sage/libs/singular/singular.pyx @@ -56,7 +56,7 @@ ctypedef struct fraction "fractionObject": _saved_options = (int(0),0,0) -cdef Rational si2sa_QQ(number *n, number **nn, ring *_ring) noexcept: +cdef Rational si2sa_QQ(number *n, number **nn, ring *_ring): """ Create a sage rational number from a singular one. @@ -128,7 +128,7 @@ cdef Rational si2sa_QQ(number *n, number **nn, ring *_ring) noexcept: mpq_clear(_z) return z -cdef Integer si2sa_ZZ(number *n, ring *_ring) noexcept: +cdef Integer si2sa_ZZ(number *n, ring *_ring): """ Create a sage integer number from a singular one. @@ -163,7 +163,7 @@ cdef Integer si2sa_ZZ(number *n, ring *_ring) noexcept: z.set_from_mpz(n) return z -cdef FFgivE si2sa_GFqGivaro(number *n, ring *_ring, Cache_givaro cache) noexcept: +cdef FFgivE si2sa_GFqGivaro(number *n, ring *_ring, Cache_givaro cache): """ Create a sage element of a small finite field from a singular one. @@ -218,7 +218,7 @@ cdef FFgivE si2sa_GFqGivaro(number *n, ring *_ring, Cache_givaro cache) noexcept z = pNext(z) return (cache._zero_element)._new_c(ret) -cdef FFgf2eE si2sa_GFqNTLGF2E(number *n, ring *_ring, Cache_ntl_gf2e cache) noexcept: +cdef FFgf2eE si2sa_GFqNTLGF2E(number *n, ring *_ring, Cache_ntl_gf2e cache): """ Create a sage element of a finite field of characteristic 2 from a singular one. @@ -270,7 +270,7 @@ cdef FFgf2eE si2sa_GFqNTLGF2E(number *n, ring *_ring, Cache_ntl_gf2e cache) noex z = pNext(z) return ret -cdef object si2sa_GFq_generic(number *n, ring *_ring, object base) noexcept: +cdef object si2sa_GFq_generic(number *n, ring *_ring, object base): """ Create a sage element of a generic finite field from a singular one. @@ -332,7 +332,7 @@ cdef object si2sa_GFq_generic(number *n, ring *_ring, object base) noexcept: z = pNext(z) return ret -cdef object si2sa_transext_QQ(number *n, ring *_ring, object base) noexcept: +cdef object si2sa_transext_QQ(number *n, ring *_ring, object base): """ Create a sage element of a transcendental extension of ``QQ`` from a singular one. @@ -421,7 +421,7 @@ cdef object si2sa_transext_QQ(number *n, ring *_ring, object base) noexcept: return snumer/sdenom -cdef object si2sa_transext_FF(number *n, ring *_ring, object base) noexcept: +cdef object si2sa_transext_FF(number *n, ring *_ring, object base): """ Create a sage element of a transcendental extension of a prime field from a singular one. @@ -504,7 +504,7 @@ cdef object si2sa_transext_FF(number *n, ring *_ring, object base) noexcept: return snumer/sdenom -cdef object si2sa_NF(number *n, ring *_ring, object base) noexcept: +cdef object si2sa_NF(number *n, ring *_ring, object base): """ Create a sage element of a number field from a singular one. @@ -570,7 +570,7 @@ cdef object si2sa_NF(number *n, ring *_ring, object base) noexcept: z = pNext(z) return base(ret) -cdef inline object si2sa_ZZmod(number *n, ring *_ring, object base) noexcept: +cdef inline object si2sa_ZZmod(number *n, ring *_ring, object base): """ Create a sage element of a ring of integers modulo n from a singular one. @@ -632,7 +632,7 @@ cdef inline object si2sa_ZZmod(number *n, ring *_ring, object base) noexcept: return base(_ring.cf.cfInt(n,_ring.cf)) -cdef list singular_monomial_exponents(poly *p, ring *r) noexcept: +cdef list singular_monomial_exponents(poly *p, ring *r): r""" Return the list of exponents of monomial ``p``. """ @@ -643,7 +643,7 @@ cdef list singular_monomial_exponents(poly *p, ring *r) noexcept: ml[v-1] = p_GetExp(p, v, r) return ml -cpdef list si2sa_resolution(Resolution res) noexcept: +cpdef list si2sa_resolution(Resolution res): r""" Pull the data from Singular resolution ``res`` to construct a Sage resolution. @@ -760,7 +760,7 @@ cpdef list si2sa_resolution(Resolution res) noexcept: return res_mats -cpdef tuple si2sa_resolution_graded(Resolution res, tuple degrees) noexcept: +cpdef tuple si2sa_resolution_graded(Resolution res, tuple degrees): """ Pull the data from Singular resolution ``res`` to construct a Sage resolution. @@ -1582,7 +1582,7 @@ cdef inline number *sa2si_ZZmod(IntegerMod_abstract d, ring *_ring) noexcept: else: raise ValueError -cdef object si2sa(number *n, ring *_ring, object base) noexcept: +cdef object si2sa(number *n, ring *_ring, object base): r""" Create a sage number from a singular one @@ -1681,7 +1681,7 @@ cdef number *sa2si(Element elem, ring * _ring) noexcept: raise ValueError("cannot convert to SINGULAR number") -cdef object si2sa_intvec(intvec *v) noexcept: +cdef object si2sa_intvec(intvec *v): r""" create a sage tuple from a singular vector of integers @@ -1744,7 +1744,7 @@ cdef int overflow_check(unsigned long e, ring *_ring) except -1: if unlikely(e > _ring.bitmask): raise OverflowError("exponent overflow (%d)"%(e)) -cdef init_libsingular() noexcept: +cdef init_libsingular(): """ This initializes the SINGULAR library. This is a hack to some extent. diff --git a/src/sage/libs/symmetrica/sb.pxi b/src/sage/libs/symmetrica/sb.pxi index 31faf7e3d96..b884d33dafd 100644 --- a/src/sage/libs/symmetrica/sb.pxi +++ b/src/sage/libs/symmetrica/sb.pxi @@ -12,7 +12,7 @@ cdef extern from 'symmetrica/def.h': INT mult_schubert_polynom(OP a,OP b,OP c) -cdef object _check_schubert(object a, OP ca) noexcept: +cdef object _check_schubert(object a, OP ca): if a in Permutations(): if isinstance(a, builtinlist): a = Permutation(a) diff --git a/src/sage/libs/symmetrica/symmetrica.pxi b/src/sage/libs/symmetrica/symmetrica.pxi index 60c3ec23070..2bdb51f1a8e 100644 --- a/src/sage/libs/symmetrica/symmetrica.pxi +++ b/src/sage/libs/symmetrica/symmetrica.pxi @@ -467,7 +467,7 @@ cdef void late_import() noexcept: sage_maxint = Integer(maxint) ########################################## -cdef object _py(OP a) noexcept: +cdef object _py(OP a): cdef OBJECTKIND objk objk = s_o_k(a) if objk == INTEGER: @@ -569,7 +569,7 @@ cdef int _op_int(object x, OP a) except -1: M_I_I(x, a) return 0 -cdef object _py_int(OP a) noexcept: +cdef object _py_int(OP a): late_import() return Integer(S_I_I(a)) @@ -597,7 +597,7 @@ cdef int _op_longint(object x, OP a) except -1: freeall(op_maxint_long) return 0 -cdef object _py_longint(OP a) noexcept: +cdef object _py_longint(OP a): late_import() cdef longint *x = S_O_S(a).ob_longint cdef loc *l = x.floc @@ -620,7 +620,7 @@ cdef object _py_longint(OP a) noexcept: ########### #Fractions# ########### -cdef object _py_fraction(OP a) noexcept: +cdef object _py_fraction(OP a): return _py(S_B_O(a))/_py(S_B_U(a)) cdef int _op_fraction(object f, OP a) except -1: @@ -632,7 +632,7 @@ cdef int _op_fraction(object f, OP a) except -1: ######### #Vectors# ######### -cdef object _py_vector(OP a) noexcept: +cdef object _py_vector(OP a): cdef INT i res = [] for i from 0 <= i < s_v_li(a): @@ -650,7 +650,7 @@ cdef void* _op_il_vector(object l, OP a) noexcept: ######### #Numbers# ######### -cdef object _py_sq_radical(OP a) noexcept: +cdef object _py_sq_radical(OP a): late_import() cdef OP ptr @@ -689,7 +689,7 @@ cdef void* _op_partition(object p, OP a) noexcept: _op_integer(p[i], S_PA_I(a,j)) j = j + 1 -cdef object _py_partition(OP a) noexcept: +cdef object _py_partition(OP a): cdef INT n, i late_import() res = [] @@ -709,7 +709,7 @@ cdef void* _op_skew_partition(object p, OP a) noexcept: _op_partition(p[1], klein) b_gk_spa(gross, klein, a) -cdef object _py_skew_partition(OP a) noexcept: +cdef object _py_skew_partition(OP a): late_import() return SkewPartition( [ _py_partition(s_spa_g(a)), _py_partition(s_spa_k(a)) ] ) @@ -727,7 +727,7 @@ cdef void* _op_permutation(object p, OP a) noexcept: for i from 0 <= i < n: _op_integer(p[i], s_p_i(a,i)) -cdef object _py_permutation(OP a) noexcept: +cdef object _py_permutation(OP a): late_import() cdef INT n, i res = [] @@ -743,7 +743,7 @@ cdef object _py_permutation(OP a) noexcept: ####### #Lists# ####### -cdef object _py_list(OP a) noexcept: +cdef object _py_list(OP a): cdef OP x x = a res = [] @@ -761,7 +761,7 @@ cdef object _py_list(OP a) noexcept: ############# #Polynomials# ############# -cdef object _py_polynom(OP a) noexcept: +cdef object _py_polynom(OP a): late_import() cdef int maxneeded = 0, i = 0 cdef OP pointer = a @@ -792,7 +792,7 @@ cdef object _py_polynom(OP a) noexcept: return P(d) -cdef object _py_polynom_alphabet(OP a, object alphabet, object length) noexcept: +cdef object _py_polynom_alphabet(OP a, object alphabet, object length): """ Converts a symmetrica multivariate polynomial a to a Sage multivariate polynomials. Alphabet specifies the names of the variables which are @@ -828,7 +828,7 @@ cdef object _py_polynom_alphabet(OP a, object alphabet, object length) noexcept: pointer = s_po_n(pointer) return res -cdef object _op_polynom(object d, OP res) noexcept: +cdef object _op_polynom(object d, OP res): late_import() poly_ring = d.parent() @@ -865,7 +865,7 @@ cdef object _op_polynom(object d, OP res) noexcept: ####################################### #Schur symmetric functions and friends# ####################################### -cdef object _py_schur(OP a) noexcept: +cdef object _py_schur(OP a): late_import() z_elt = _py_schur_general(a) if len(z_elt) == 0: @@ -882,7 +882,7 @@ cdef object _py_schur(OP a) noexcept: cdef void* _op_schur(object d, OP res) noexcept: _op_schur_general(d, res) -cdef object _py_monomial(OP a) noexcept: #Monomial symmetric functions +cdef object _py_monomial(OP a): #Monomial symmetric functions late_import() z_elt = _py_schur_general(a) if len(z_elt) == 0: @@ -902,7 +902,7 @@ cdef void* _op_monomial(object d, OP res) noexcept: #Monomial symmetric function c_o_k(pointer, MONOMIAL) pointer = s_s_n(pointer) -cdef object _py_powsym(OP a) noexcept: #Power-sum symmetric functions +cdef object _py_powsym(OP a): #Power-sum symmetric functions late_import() z_elt = _py_schur_general(a) if len(z_elt) == 0: @@ -923,7 +923,7 @@ cdef void* _op_powsym(object d, OP res) noexcept: #Power-sum symmetric functions pointer = s_s_n(pointer) -cdef object _py_elmsym(OP a) noexcept: #Elementary symmetric functions +cdef object _py_elmsym(OP a): #Elementary symmetric functions late_import() z_elt = _py_schur_general(a) if len(z_elt) == 0: @@ -944,7 +944,7 @@ cdef void* _op_elmsym(object d, OP res) noexcept: #Elementary symmetric function pointer = s_s_n(pointer) -cdef object _py_homsym(OP a) noexcept: #Homogenous symmetric functions +cdef object _py_homsym(OP a): #Homogenous symmetric functions late_import() z_elt = _py_schur_general(a) if len(z_elt) == 0: @@ -965,7 +965,7 @@ cdef void* _op_homsym(object d, OP res) noexcept: #Homogenous symmetric function pointer = s_s_n(pointer) -cdef object _py_schur_general(OP a) noexcept: +cdef object _py_schur_general(OP a): cdef OP pointer = a d = {} if a == NULL: @@ -1069,7 +1069,7 @@ cdef void* _op_schubert_dict(object d, OP res) noexcept: insert(next, res, NULL, NULL) -cdef object _py_schubert(OP a) noexcept: +cdef object _py_schubert(OP a): late_import() cdef OP pointer = a cdef dict z_elt = {} @@ -1096,7 +1096,7 @@ cdef object _py_schubert(OP a) noexcept: ########## #Matrices# ########## -cdef object _py_matrix(OP a) noexcept: +cdef object _py_matrix(OP a): late_import() @@ -1136,7 +1136,7 @@ cdef void* _op_matrix(object a, OP res) noexcept: ########## #Tableaux# ########## -cdef object _py_tableau(OP t) noexcept: +cdef object _py_tableau(OP t): late_import() diff --git a/src/sage/matrix/action.pyx b/src/sage/matrix/action.pyx index 18c71299317..0db343c9eed 100644 --- a/src/sage/matrix/action.pyx +++ b/src/sage/matrix/action.pyx @@ -215,7 +215,7 @@ cdef class MatrixMatrixAction(MatrixMulAction): return MatrixSpace(base, self.G.nrows(), self.underlying_set().ncols(), sparse = self.G.is_sparse() and self.underlying_set().is_sparse()) - cpdef _act_(self, g, s) noexcept: + cpdef _act_(self, g, s): """ EXAMPLES: @@ -326,7 +326,7 @@ cdef class MatrixVectorAction(MatrixMulAction): self.underlying_set().degree())) return FreeModule(base, self.G.nrows(), sparse = self.G.is_sparse()) - cpdef _act_(self, g, s) noexcept: + cpdef _act_(self, g, s): cdef Matrix A = g cdef Vector v = s if A._parent._base is not self._codomain._base: @@ -378,7 +378,7 @@ cdef class VectorMatrixAction(MatrixMulAction): self.underlying_set().degree())) return FreeModule(base, self.G.ncols(), sparse = self.G.is_sparse()) - cpdef _act_(self, g, s) noexcept: + cpdef _act_(self, g, s): cdef Matrix A = g cdef Vector v = s if A._parent._base is not self._codomain._base: @@ -437,7 +437,7 @@ cdef class MatrixPolymapAction(MatrixMulAction): return End(self.underlying_set().domain().change_ring(base)) return Hom(self.underlying_set().domain().change_ring(base), self.underlying_set().codomain().change_ring(base)) - cpdef _act_(self, mat, f) noexcept: + cpdef _act_(self, mat, f): """ Call the action @@ -510,7 +510,7 @@ cdef class PolymapMatrixAction(MatrixMulAction): return End(self.underlying_set().domain().change_ring(base)) return Hom(self.underlying_set().domain().change_ring(base), self.underlying_set().codomain().change_ring(base)) - cpdef _act_(self, mat, f) noexcept: + cpdef _act_(self, mat, f): """ Call the action. @@ -578,7 +578,7 @@ cdef class MatrixSchemePointAction(MatrixMulAction): amb = self.underlying_set().codomain() return amb.change_ring(base)(base) - cpdef _act_(self, mat, P) noexcept: + cpdef _act_(self, mat, P): """ Action of matrices on scheme points. diff --git a/src/sage/matrix/args.pxd b/src/sage/matrix/args.pxd index fc26bc35914..9ab004e1887 100644 --- a/src/sage/matrix/args.pxd +++ b/src/sage/matrix/args.pxd @@ -33,7 +33,7 @@ cdef class SparseEntry: cdef public object entry -cdef inline SparseEntry make_SparseEntry(long i, long j, entry) noexcept: +cdef inline SparseEntry make_SparseEntry(long i, long j, entry): e = SparseEntry.__new__(SparseEntry) e.i = i e.j = j @@ -53,9 +53,9 @@ cdef class MatrixArgs: cdef public dict kwds # **kwds for MatrixSpace() cdef bint is_finalized - cpdef Matrix matrix(self, bint convert=?) noexcept - cpdef list list(self, bint convert=?) noexcept - cpdef dict dict(self, bint convert=?) noexcept + cpdef Matrix matrix(self, bint convert=?) + cpdef list list(self, bint convert=?) + cpdef dict dict(self, bint convert=?) cdef inline bint ref_safe(self) noexcept: """ @@ -119,4 +119,4 @@ cdef class MatrixArgs: cdef int set_seq_flat(self, entries) except -1 -cpdef MatrixArgs MatrixArgs_init(space, entries) noexcept +cpdef MatrixArgs MatrixArgs_init(space, entries) diff --git a/src/sage/matrix/args.pyx b/src/sage/matrix/args.pyx index 9a613fcdf62..16cca85dabc 100644 --- a/src/sage/matrix/args.pyx +++ b/src/sage/matrix/args.pyx @@ -630,7 +630,7 @@ cdef class MatrixArgs: self.finalize() return self.nrows * self.ncols - cpdef Matrix matrix(self, bint convert=True) noexcept: + cpdef Matrix matrix(self, bint convert=True): """ Return the entries of the matrix as a Sage Matrix. @@ -721,7 +721,7 @@ cdef class MatrixArgs: self.typ = MA_ENTRIES_MATRIX return M - cpdef list list(self, bint convert=True) noexcept: + cpdef list list(self, bint convert=True): """ Return the entries of the matrix as a flat list of scalars. @@ -788,7 +788,7 @@ cdef class MatrixArgs: self.typ = MA_ENTRIES_SEQ_FLAT return L - cpdef dict dict(self, bint convert=True) noexcept: + cpdef dict dict(self, bint convert=True): """ Return the entries of the matrix as a dict. The keys of this dict are the non-zero positions ``(i,j)``. The corresponding @@ -1392,7 +1392,7 @@ cdef class MatrixArgs: return MA_ENTRIES_SEQ_SEQ -cpdef MatrixArgs MatrixArgs_init(space, entries) noexcept: +cpdef MatrixArgs MatrixArgs_init(space, entries): """ Construct a :class:`MatrixArgs` object from a matrix space and entries. This is the typical use in a matrix constructor. diff --git a/src/sage/matrix/matrix0.pxd b/src/sage/matrix/matrix0.pxd index d2276ef486d..c18c7cdc4a3 100644 --- a/src/sage/matrix/matrix0.pxd +++ b/src/sage/matrix/matrix0.pxd @@ -21,8 +21,8 @@ cdef class Matrix(sage.structure.element.Matrix): cdef public object _base_ring cdef bint _is_immutable - cpdef _add_(self, other) noexcept - cpdef _sub_(self, other) noexcept + cpdef _add_(self, other) + cpdef _sub_(self, other) cdef bint _will_use_strassen(self, Matrix right) except -2 cdef bint _will_use_strassen_echelon(self) except -2 @@ -37,31 +37,31 @@ cdef class Matrix(sage.structure.element.Matrix): cdef public object _cache cdef long hash # cached hash value cdef void clear_cache(self) noexcept - cdef fetch(self, key) noexcept - cdef cache(self, key, x) noexcept + cdef fetch(self, key) + cdef cache(self, key, x) # Mutability and bounds checking - cdef check_bounds(self, Py_ssize_t i, Py_ssize_t j) noexcept - cdef check_mutability(self) noexcept - cdef check_bounds_and_mutability(self, Py_ssize_t i, Py_ssize_t j) noexcept + cdef check_bounds(self, Py_ssize_t i, Py_ssize_t j) + cdef check_mutability(self) + cdef check_bounds_and_mutability(self, Py_ssize_t i, Py_ssize_t j) # Unsafe entry access - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, object x) noexcept - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept - cdef _coerce_element(self, x) noexcept + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, object x) + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) + cdef _coerce_element(self, x) cdef bint get_is_zero_unsafe(self, Py_ssize_t i, Py_ssize_t j) except -1 # Row and column operations - cdef check_row_bounds(self, Py_ssize_t r1, Py_ssize_t r2) noexcept - cdef check_column_bounds(self, Py_ssize_t c1, Py_ssize_t c2) noexcept - cdef check_row_bounds_and_mutability(self, Py_ssize_t r1, Py_ssize_t r2) noexcept - cdef check_column_bounds_and_mutability(self, Py_ssize_t c1, Py_ssize_t c2) noexcept - cdef swap_rows_c(self, Py_ssize_t r1, Py_ssize_t r2) noexcept - cdef swap_columns_c(self, Py_ssize_t c1, Py_ssize_t c2) noexcept - cdef add_multiple_of_row_c(self, Py_ssize_t i, Py_ssize_t j, s, Py_ssize_t col_start) noexcept - cdef add_multiple_of_column_c(self, Py_ssize_t i, Py_ssize_t j, s, Py_ssize_t row_start) noexcept - cdef rescale_row_c(self, Py_ssize_t i, s, Py_ssize_t start_col) noexcept - cdef rescale_col_c(self, Py_ssize_t i, s, Py_ssize_t start_row) noexcept + cdef check_row_bounds(self, Py_ssize_t r1, Py_ssize_t r2) + cdef check_column_bounds(self, Py_ssize_t c1, Py_ssize_t c2) + cdef check_row_bounds_and_mutability(self, Py_ssize_t r1, Py_ssize_t r2) + cdef check_column_bounds_and_mutability(self, Py_ssize_t c1, Py_ssize_t c2) + cdef swap_rows_c(self, Py_ssize_t r1, Py_ssize_t r2) + cdef swap_columns_c(self, Py_ssize_t c1, Py_ssize_t c2) + cdef add_multiple_of_row_c(self, Py_ssize_t i, Py_ssize_t j, s, Py_ssize_t col_start) + cdef add_multiple_of_column_c(self, Py_ssize_t i, Py_ssize_t j, s, Py_ssize_t row_start) + cdef rescale_row_c(self, Py_ssize_t i, s, Py_ssize_t start_col) + cdef rescale_col_c(self, Py_ssize_t i, s, Py_ssize_t start_row) # Helper function for inverse of sparse matrices - cdef build_inverse_from_augmented_sparse(self, A) noexcept + cdef build_inverse_from_augmented_sparse(self, A) diff --git a/src/sage/matrix/matrix0.pyx b/src/sage/matrix/matrix0.pyx index f295f5fc866..3dc47b9df07 100644 --- a/src/sage/matrix/matrix0.pyx +++ b/src/sage/matrix/matrix0.pyx @@ -341,7 +341,7 @@ cdef class Matrix(sage.structure.element.Matrix): self._cache = None self.hash = -1 - cdef fetch(self, key) noexcept: + cdef fetch(self, key): """ Try to get an element from the cache; if there isn't anything there, return None. @@ -353,7 +353,7 @@ cdef class Matrix(sage.structure.element.Matrix): except KeyError: return None - cdef cache(self, key, x) noexcept: + cdef cache(self, key, x): """ Record x in the cache with given key. """ @@ -380,7 +380,7 @@ cdef class Matrix(sage.structure.element.Matrix): # Mutability and bounds checking ########################################################### - cdef check_bounds(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef check_bounds(self, Py_ssize_t i, Py_ssize_t j): """ This function gets called when you're about to access the i,j entry of this matrix. If i, j are out of range, an :class:`IndexError` is @@ -389,7 +389,7 @@ cdef class Matrix(sage.structure.element.Matrix): if i < 0 or i >= self._nrows or j < 0 or j >= self._ncols: raise IndexError("matrix index out of range") - cdef check_mutability(self) noexcept: + cdef check_mutability(self): """ This function gets called when you're about to change this matrix. @@ -403,7 +403,7 @@ cdef class Matrix(sage.structure.element.Matrix): else: self._cache = None - cdef check_bounds_and_mutability(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef check_bounds_and_mutability(self, Py_ssize_t i, Py_ssize_t j): """ This function gets called when you're about to set the i,j entry of this matrix. If i or j is out of range, an :class:`IndexError` @@ -517,7 +517,7 @@ cdef class Matrix(sage.structure.element.Matrix): # Entry access # The first two must be overloaded in the derived class ########################################################### - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, object x) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, object x): """ Set entry quickly without doing any bounds checking. Calling this with invalid arguments is allowed to produce a segmentation fault. @@ -527,7 +527,7 @@ cdef class Matrix(sage.structure.element.Matrix): """ raise NotImplementedError("this must be defined in the derived class (type=%s)" % type(self)) - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): """ Entry access, but fast since it might be without bounds checking. @@ -1563,7 +1563,7 @@ cdef class Matrix(sage.structure.element.Matrix): - cdef _coerce_element(self, x) noexcept: + cdef _coerce_element(self, x): """ Return coercion of x into the base ring of self. """ @@ -2535,11 +2535,11 @@ cdef class Matrix(sage.structure.element.Matrix): # involve multiplication outside base ring, including # with_ versions of these methods for this situation ################################################### - cdef check_row_bounds(self, Py_ssize_t r1, Py_ssize_t r2) noexcept: + cdef check_row_bounds(self, Py_ssize_t r1, Py_ssize_t r2): if r1 < 0 or r1 >= self._nrows or r2 < 0 or r2 >= self._nrows: raise IndexError("matrix row index out of range") - cdef check_row_bounds_and_mutability(self, Py_ssize_t r1, Py_ssize_t r2) noexcept: + cdef check_row_bounds_and_mutability(self, Py_ssize_t r1, Py_ssize_t r2): if self._is_immutable: raise ValueError("Matrix is immutable; please change a copy instead (i.e., use copy(M) to change a copy of M).") else: @@ -2547,11 +2547,11 @@ cdef class Matrix(sage.structure.element.Matrix): if r1 < 0 or r1 >= self._nrows or r2 < 0 or r2 >= self._nrows: raise IndexError("matrix row index out of range") - cdef check_column_bounds(self, Py_ssize_t c1, Py_ssize_t c2) noexcept: + cdef check_column_bounds(self, Py_ssize_t c1, Py_ssize_t c2): if c1 < 0 or c1 >= self._ncols or c2 < 0 or c2 >= self._ncols: raise IndexError("matrix column index out of range") - cdef check_column_bounds_and_mutability(self, Py_ssize_t c1, Py_ssize_t c2) noexcept: + cdef check_column_bounds_and_mutability(self, Py_ssize_t c1, Py_ssize_t c2): if self._is_immutable: raise ValueError("Matrix is immutable; please change a copy instead (i.e., use copy(M) to change a copy of M).") else: @@ -2737,7 +2737,7 @@ cdef class Matrix(sage.structure.element.Matrix): temp.swap_columns_c(cycle[0], elt) return temp - cdef swap_columns_c(self, Py_ssize_t c1, Py_ssize_t c2) noexcept: + cdef swap_columns_c(self, Py_ssize_t c1, Py_ssize_t c2): cdef Py_ssize_t r for r from 0 <= r < self._nrows: a = self.get_unsafe(r, c2) @@ -2919,7 +2919,7 @@ cdef class Matrix(sage.structure.element.Matrix): temp.swap_rows_c(cycle[0], elt) return temp - cdef swap_rows_c(self, Py_ssize_t r1, Py_ssize_t r2) noexcept: + cdef swap_rows_c(self, Py_ssize_t r1, Py_ssize_t r2): cdef Py_ssize_t c for c from 0 <= c < self._ncols: a = self.get_unsafe(r2, c) @@ -3054,7 +3054,7 @@ cdef class Matrix(sage.structure.element.Matrix): except TypeError: raise TypeError('Multiplying row by %s element cannot be done over %s, use change_ring or with_added_multiple_of_row instead.' % (s.parent(), self.base_ring())) - cdef add_multiple_of_row_c(self, Py_ssize_t i, Py_ssize_t j, s, Py_ssize_t start_col) noexcept: + cdef add_multiple_of_row_c(self, Py_ssize_t i, Py_ssize_t j, s, Py_ssize_t start_col): cdef Py_ssize_t c for c from start_col <= c < self._ncols: self.set_unsafe(i, c, self.get_unsafe(i, c) + s*self.get_unsafe(j, c)) @@ -3139,7 +3139,7 @@ cdef class Matrix(sage.structure.element.Matrix): except TypeError: raise TypeError('Multiplying column by %s element cannot be done over %s, use change_ring or with_added_multiple_of_column instead.' % (s.parent(), self.base_ring())) - cdef add_multiple_of_column_c(self, Py_ssize_t i, Py_ssize_t j, s, Py_ssize_t start_row) noexcept: + cdef add_multiple_of_column_c(self, Py_ssize_t i, Py_ssize_t j, s, Py_ssize_t start_row): cdef Py_ssize_t r for r from start_row <= r < self._nrows: self.set_unsafe(r, i, self.get_unsafe(r, i) + s*self.get_unsafe(r, j)) @@ -3254,7 +3254,7 @@ cdef class Matrix(sage.structure.element.Matrix): except TypeError: raise TypeError('Rescaling row by %s element cannot be done over %s, use change_ring or with_rescaled_row instead.' % (s.parent(), self.base_ring())) - cdef rescale_row_c(self, Py_ssize_t i, s, Py_ssize_t start_col) noexcept: + cdef rescale_row_c(self, Py_ssize_t i, s, Py_ssize_t start_col): cdef Py_ssize_t j for j from start_col <= j < self._ncols: self.set_unsafe(i, j, self.get_unsafe(i, j)*s) @@ -3369,7 +3369,7 @@ cdef class Matrix(sage.structure.element.Matrix): except TypeError: raise TypeError('Rescaling column by %s element cannot be done over %s, use change_ring or with_rescaled_col instead.' % (s.parent(), self.base_ring())) - cdef rescale_col_c(self, Py_ssize_t i, s, Py_ssize_t start_row) noexcept: + cdef rescale_col_c(self, Py_ssize_t i, s, Py_ssize_t start_row): cdef Py_ssize_t j for j from start_row <= j < self._nrows: self.set_unsafe(j, i, self.get_unsafe(j, i)*s) @@ -5143,7 +5143,7 @@ cdef class Matrix(sage.structure.element.Matrix): ################################################### # Arithmetic ################################################### - cdef _vector_times_matrix_(self, Vector v) noexcept: + cdef _vector_times_matrix_(self, Vector v): r""" Return the vector times matrix product. @@ -5200,7 +5200,7 @@ cdef class Matrix(sage.structure.element.Matrix): return sum([v[i] * self.row(i, from_list=True) for i in range(self._nrows)], M(0)) - cdef _matrix_times_vector_(self, Vector v) noexcept: + cdef _matrix_times_vector_(self, Vector v): """ EXAMPLES:: @@ -5311,7 +5311,7 @@ cdef class Matrix(sage.structure.element.Matrix): MS = self.matrix_space(n, m) return MS(X).transpose() - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): """ Add two matrices with the same parent. @@ -5335,7 +5335,7 @@ cdef class Matrix(sage.structure.element.Matrix): A.set_unsafe(i, j, self.get_unsafe(i,j)._add_(right.get_unsafe(i,j))) return A - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): """ Subtract two matrices with the same parent. @@ -5401,7 +5401,7 @@ cdef class Matrix(sage.structure.element.Matrix): """ return self.change_ring(self._base_ring.quotient_ring(p)) - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): """ EXAMPLES:: @@ -5439,7 +5439,7 @@ cdef class Matrix(sage.structure.element.Matrix): ans.set_unsafe(r, c, x * self.get_unsafe(r, c)) return ans - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ EXAMPLES: @@ -5483,7 +5483,7 @@ cdef class Matrix(sage.structure.element.Matrix): ans.set_unsafe(r, c, self.get_unsafe(r, c) * x) return ans - cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix right) noexcept: + cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix right): r""" Return the product of two matrices. @@ -5876,7 +5876,7 @@ cdef class Matrix(sage.structure.element.Matrix): raise ZeroDivisionError("input matrix must be nonsingular") return A.matrix_from_columns(list(range(self._ncols, 2 * self._ncols))) - cdef build_inverse_from_augmented_sparse(self, A) noexcept: + cdef build_inverse_from_augmented_sparse(self, A): # We can directly use the dict entries of A cdef Py_ssize_t i, nrows cdef dict data = A._dict() @@ -6179,7 +6179,7 @@ cdef class Matrix(sage.structure.element.Matrix): # C[0] = (1 - m * (m - 1)/2) * C[2] - (m - 1) * C[1] C[0] = (1 - mm) * C[2] - (m - 1) * C[1] - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Compare two matrices. diff --git a/src/sage/matrix/matrix1.pxd b/src/sage/matrix/matrix1.pxd index e3585f9caab..d24468b80e1 100644 --- a/src/sage/matrix/matrix1.pxd +++ b/src/sage/matrix/matrix1.pxd @@ -1,7 +1,7 @@ from sage.matrix.matrix0 cimport Matrix as Matrix0 cdef class Matrix(Matrix0): - cdef _stack_impl(self, bottom) noexcept + cdef _stack_impl(self, bottom) - cpdef row_ambient_module(self, base_ring=*, sparse=*) noexcept - cpdef column_ambient_module(self, base_ring=*, sparse=*) noexcept + cpdef row_ambient_module(self, base_ring=*, sparse=*) + cpdef column_ambient_module(self, base_ring=*, sparse=*) diff --git a/src/sage/matrix/matrix1.pyx b/src/sage/matrix/matrix1.pyx index b15eb21da77..d446030473f 100644 --- a/src/sage/matrix/matrix1.pyx +++ b/src/sage/matrix/matrix1.pyx @@ -854,7 +854,7 @@ cdef class Matrix(Matrix0): ############################################################################################# # rows, columns, sparse_rows, sparse_columns, dense_rows, dense_columns, row, column ############################################################################################# - cpdef row_ambient_module(self, base_ring=None, sparse=None) noexcept: + cpdef row_ambient_module(self, base_ring=None, sparse=None): r""" Return the free module that contains the rows of the matrix. @@ -911,7 +911,7 @@ cdef class Matrix(Matrix0): deprecation(32984, 'the method _row_ambient_module is deprecated use row_ambient_module (without underscore) instead') return self.row_ambient_module(base_ring) - cpdef column_ambient_module(self, base_ring=None, sparse=None) noexcept: + cpdef column_ambient_module(self, base_ring=None, sparse=None): r""" Return the free module that contains the columns of the matrix. @@ -1747,7 +1747,7 @@ cdef class Matrix(Matrix0): Z._subdivide_on_stack(self, other) return Z - cdef _stack_impl(self, bottom) noexcept: + cdef _stack_impl(self, bottom): """ Implementation of :meth:`stack`. diff --git a/src/sage/matrix/matrix2.pxd b/src/sage/matrix/matrix2.pxd index 1fd85c5f082..a2e0297228c 100644 --- a/src/sage/matrix/matrix2.pxd +++ b/src/sage/matrix/matrix2.pxd @@ -15,10 +15,10 @@ Generic matrices from sage.matrix.matrix1 cimport Matrix as Matrix1 cdef class Matrix(Matrix1): - cdef _det_by_minors(self, Py_ssize_t level) noexcept - cdef _pf_bfl(self) noexcept + cdef _det_by_minors(self, Py_ssize_t level) + cdef _pf_bfl(self) cdef bint _is_positive_definite_or_semidefinite(self, bint semi) except -1 - cdef tuple _block_ldlt(self, bint classical) noexcept - cpdef _echelon(self, str algorithm) noexcept - cpdef _echelon_in_place(self, str algorithm) noexcept - cpdef matrix_window(self, Py_ssize_t row=*, Py_ssize_t col=*, Py_ssize_t nrows=*, Py_ssize_t ncols=*, bint check=*) noexcept + cdef tuple _block_ldlt(self, bint classical) + cpdef _echelon(self, str algorithm) + cpdef _echelon_in_place(self, str algorithm) + cpdef matrix_window(self, Py_ssize_t row=*, Py_ssize_t col=*, Py_ssize_t nrows=*, Py_ssize_t ncols=*, bint check=*) diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx index 46a5277673a..fc060f5f210 100644 --- a/src/sage/matrix/matrix2.pyx +++ b/src/sage/matrix/matrix2.pyx @@ -2208,7 +2208,7 @@ cdef class Matrix(Matrix1): self.cache('det', d) return d - cdef _det_by_minors(self, Py_ssize_t level) noexcept: + cdef _det_by_minors(self, Py_ssize_t level): """ Compute the determinant of the upper-left level x level submatrix of self. Does not handle degenerate cases, level MUST be >= 2 @@ -2578,7 +2578,7 @@ cdef class Matrix(Matrix1): return res - cdef _pf_bfl(self) noexcept: + cdef _pf_bfl(self): r""" Computes the Pfaffian of ``self`` using the Baer-Faddeev-LeVerrier algorithm. @@ -7983,7 +7983,7 @@ cdef class Matrix(Matrix1): else: return E - cpdef _echelon(self, str algorithm) noexcept: + cpdef _echelon(self, str algorithm): """ Return the echelon form of ``self`` using ``algorithm``. @@ -8063,7 +8063,7 @@ cdef class Matrix(Matrix1): """ return self._echelon('classical') - cpdef _echelon_in_place(self, str algorithm) noexcept: + cpdef _echelon_in_place(self, str algorithm): """ Transform ``self`` into echelon form and return the pivots of ``self``. @@ -8894,7 +8894,7 @@ cdef class Matrix(Matrix1): cpdef matrix_window(self, Py_ssize_t row=0, Py_ssize_t col=0, Py_ssize_t nrows=-1, Py_ssize_t ncols=-1, - bint check=1) noexcept: + bint check=1): """ Return the requested matrix window. @@ -14089,7 +14089,7 @@ cdef class Matrix(Matrix1): raise ValueError(msg.format(d)) return L, vector(L.base_ring(), d) - cdef tuple _block_ldlt(self, bint classical) noexcept: + cdef tuple _block_ldlt(self, bint classical): r""" Perform a user-unfriendly block-`LDL^{T}` factorization of the Hermitian matrix `A` diff --git a/src/sage/matrix/matrix_cdv.pxd b/src/sage/matrix/matrix_cdv.pxd index 2deb72f25a2..f7684da49f2 100644 --- a/src/sage/matrix/matrix_cdv.pxd +++ b/src/sage/matrix/matrix_cdv.pxd @@ -1,3 +1,3 @@ from sage.matrix.matrix_generic_dense cimport Matrix_generic_dense -cpdef hessenbergize_cdvf(Matrix_generic_dense) noexcept +cpdef hessenbergize_cdvf(Matrix_generic_dense) diff --git a/src/sage/matrix/matrix_cdv.pyx b/src/sage/matrix/matrix_cdv.pyx index a53ae777f20..7a6b1887518 100644 --- a/src/sage/matrix/matrix_cdv.pyx +++ b/src/sage/matrix/matrix_cdv.pyx @@ -20,7 +20,7 @@ from sage.rings.infinity import Infinity # We assume that H is square -cpdef hessenbergize_cdvf(Matrix_generic_dense H) noexcept: +cpdef hessenbergize_cdvf(Matrix_generic_dense H): r""" Replace `H` with a Hessenberg form of it. diff --git a/src/sage/matrix/matrix_complex_ball_dense.pxd b/src/sage/matrix/matrix_complex_ball_dense.pxd index 6b34affb338..effa0413026 100644 --- a/src/sage/matrix/matrix_complex_ball_dense.pxd +++ b/src/sage/matrix/matrix_complex_ball_dense.pxd @@ -5,9 +5,9 @@ from sage.structure.parent cimport Parent cdef void matrix_to_acb_mat(acb_mat_t target, source) noexcept cdef Matrix_generic_dense acb_mat_to_matrix( - acb_mat_t source, Parent CIF) noexcept + acb_mat_t source, Parent CIF) cdef class Matrix_complex_ball_dense(Matrix_dense): cdef acb_mat_t value - cdef Matrix_complex_ball_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept - cpdef _pow_int(self, n) noexcept + cdef Matrix_complex_ball_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols) + cpdef _pow_int(self, n) diff --git a/src/sage/matrix/matrix_complex_ball_dense.pyx b/src/sage/matrix/matrix_complex_ball_dense.pyx index 4d4c3b2d6bd..07857217309 100644 --- a/src/sage/matrix/matrix_complex_ball_dense.pyx +++ b/src/sage/matrix/matrix_complex_ball_dense.pyx @@ -80,14 +80,14 @@ cdef void matrix_to_acb_mat(acb_mat_t target, source) noexcept: ComplexIntervalFieldElement_to_acb(acb_mat_entry(target, r, c), source[r][c]) -cdef ComplexIntervalFieldElement _to_CIF(acb_t source, ComplexIntervalFieldElement template) noexcept: +cdef ComplexIntervalFieldElement _to_CIF(acb_t source, ComplexIntervalFieldElement template): cdef ComplexIntervalFieldElement result result = template._new() acb_to_ComplexIntervalFieldElement( result, source) return result -cdef Matrix_generic_dense acb_mat_to_matrix(acb_mat_t source, Parent CIF) noexcept: +cdef Matrix_generic_dense acb_mat_to_matrix(acb_mat_t source, Parent CIF): """ Convert an ``acb_mat_t`` to a matrix containing :class:`ComplexIntervalFieldElement`. @@ -158,7 +158,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): """ acb_mat_clear(self.value) - cdef Matrix_complex_ball_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept: + cdef Matrix_complex_ball_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols): r""" Return a new matrix over the same base ring. """ @@ -252,7 +252,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): z = se.entry acb_set(acb_mat_entry(self.value, se.i, se.j), z.value) - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, object x) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, object x): """ Set position ``i``, ``j`` of this matrix to ``x``. @@ -278,7 +278,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): """ acb_set(acb_mat_entry(self.value, i, j), ( x).value) - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): """ Return ``(i, j)`` entry of this matrix as a new ComplexBall. @@ -307,7 +307,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): acb_set(z.value, acb_mat_entry(self.value, i, j)) return z - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): r""" EXAMPLES:: @@ -401,7 +401,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): sig_off() return res - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): r""" TESTS:: @@ -414,7 +414,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): sig_off() return res - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): r""" TESTS:: @@ -427,7 +427,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): sig_off() return res - cpdef _lmul_(self, Element a) noexcept: + cpdef _lmul_(self, Element a): r""" TESTS:: @@ -440,7 +440,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): sig_off() return res - cpdef _rmul_(self, Element a) noexcept: + cpdef _rmul_(self, Element a): r""" TESTS:: @@ -449,7 +449,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): """ return self._lmul_(a) - cdef _matrix_times_matrix_(self, Matrix other) noexcept: + cdef _matrix_times_matrix_(self, Matrix other): r""" TESTS:: @@ -462,7 +462,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): sig_off() return res - cpdef _pow_int(self, n) noexcept: + cpdef _pow_int(self, n): r""" Return the ``n``-th power of this matrix. @@ -961,7 +961,7 @@ cdef class Matrix_complex_ball_dense(Matrix_dense): sig_off() return res -cdef _acb_vec_to_list(acb_ptr vec, long n, Parent parent) noexcept: +cdef _acb_vec_to_list(acb_ptr vec, long n, Parent parent): cdef ComplexBall b res = [] for i in range(n): diff --git a/src/sage/matrix/matrix_cyclo_dense.pxd b/src/sage/matrix/matrix_cyclo_dense.pxd index d6c8711f862..13f72389cf5 100644 --- a/src/sage/matrix/matrix_cyclo_dense.pxd +++ b/src/sage/matrix/matrix_cyclo_dense.pxd @@ -12,5 +12,5 @@ cdef class Matrix_cyclo_dense(Matrix_dense): cdef int _n cdef _randomize_rational_column_unsafe(Matrix_cyclo_dense self, - Py_ssize_t col, mpz_t nump1, mpz_t denp1, distribution=?) noexcept + Py_ssize_t col, mpz_t nump1, mpz_t denp1, distribution=?) diff --git a/src/sage/matrix/matrix_cyclo_dense.pyx b/src/sage/matrix/matrix_cyclo_dense.pyx index abca6a4524d..8bffbb905d8 100644 --- a/src/sage/matrix/matrix_cyclo_dense.pyx +++ b/src/sage/matrix/matrix_cyclo_dense.pyx @@ -159,7 +159,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): QQmat = Matrix_rational_dense(QQspace, L, False, False) self._matrix = QQmat.transpose() - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value): """ Set the ij-th entry of self. @@ -286,7 +286,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): mpz_clear(numer) mpz_clear(denom) - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): """ Get the ij-th of self. @@ -488,7 +488,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): # * _dict -- sparse dictionary of underlying elements (need not be a copy) ######################################################################## - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Return the sum of two dense cyclotomic matrices. @@ -516,7 +516,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): A._matrix = self._matrix + (right)._matrix return A - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Return the difference of two dense cyclotomic matrices. @@ -543,7 +543,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): A._matrix = self._matrix - (right)._matrix return A - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ Multiply a dense cyclotomic matrix by a scalar. @@ -584,7 +584,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): A._matrix = T * self._matrix return A - cdef _matrix_times_matrix_(self, baseMatrix right) noexcept: + cdef _matrix_times_matrix_(self, baseMatrix right): """ Return the product of two cyclotomic dense matrices. @@ -719,7 +719,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): """ return hash(self._matrix) - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): """ Implement comparison of two cyclotomic matrices with identical parents. @@ -977,7 +977,7 @@ cdef class Matrix_cyclo_dense(Matrix_dense): return ht cdef _randomize_rational_column_unsafe(Matrix_cyclo_dense self, - Py_ssize_t col, mpz_t nump1, mpz_t denp1, distribution=None) noexcept: + Py_ssize_t col, mpz_t nump1, mpz_t denp1, distribution=None): """ Randomizes all entries in column ``col``. This is a helper method used in the implementation of dense matrices over cyclotomic fields. diff --git a/src/sage/matrix/matrix_dense.pyx b/src/sage/matrix/matrix_dense.pyx index b04fc7248af..a954dde39d2 100644 --- a/src/sage/matrix/matrix_dense.pyx +++ b/src/sage/matrix/matrix_dense.pyx @@ -53,7 +53,7 @@ cdef class Matrix_dense(matrix.Matrix): else: raise RuntimeError("unknown matrix version (=%s)" % version) - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): """ EXAMPLES:: diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx index 6877a924de2..c0245fc93a4 100644 --- a/src/sage/matrix/matrix_double_dense.pyx +++ b/src/sage/matrix/matrix_double_dense.pyx @@ -146,7 +146,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): # LEVEL 2 functionality # * def _pickle # * def _unpickle - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add two matrices together. @@ -169,7 +169,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): M._matrix_numpy = _left._matrix_numpy + _right._matrix_numpy return M - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Return self - right @@ -220,7 +220,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): # def _pickle(self): #unsure how to implement # def _unpickle(self, data, int version): # use version >= 0 #unsure how to implement ###################################################################### - cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix right) noexcept: + cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix right): r""" Multiply ``self * right`` as matrices. @@ -3596,7 +3596,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): posdef = self.fetch(cache_str) return posdef - cdef _vector_times_matrix_(self,Vector v) noexcept: + cdef _vector_times_matrix_(self,Vector v): if self._nrows == 0 or self._ncols == 0: return self.row_ambient_module().zero_vector() global numpy @@ -3609,7 +3609,7 @@ cdef class Matrix_double_dense(Matrix_numpy_dense): ans = numpy.dot(v_numpy,self._matrix_numpy) return M(ans) - cdef _matrix_times_vector_(self,Vector v) noexcept: + cdef _matrix_times_vector_(self,Vector v): if self._nrows == 0 or self._ncols == 0: return self.column_ambient_module().zero_vector() diff --git a/src/sage/matrix/matrix_gap.pxd b/src/sage/matrix/matrix_gap.pxd index da8fe7e1277..f378adbfc2a 100644 --- a/src/sage/matrix/matrix_gap.pxd +++ b/src/sage/matrix/matrix_gap.pxd @@ -5,5 +5,5 @@ from sage.libs.gap.element cimport GapElement cdef class Matrix_gap(Matrix_dense): cdef GapElement _libgap - cpdef GapElement gap(self) noexcept - cdef Matrix_gap _new(self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept + cpdef GapElement gap(self) + cdef Matrix_gap _new(self, Py_ssize_t nrows, Py_ssize_t ncols) diff --git a/src/sage/matrix/matrix_gap.pyx b/src/sage/matrix/matrix_gap.pyx index 9e1d1066a48..bb423ee03d5 100644 --- a/src/sage/matrix/matrix_gap.pyx +++ b/src/sage/matrix/matrix_gap.pyx @@ -125,7 +125,7 @@ cdef class Matrix_gap(Matrix_dense): mat.append(row) self._libgap = libgap(mat) - cdef Matrix_gap _new(self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept: + cdef Matrix_gap _new(self, Py_ssize_t nrows, Py_ssize_t ncols): if nrows == self._nrows and ncols == self._ncols: P = self._parent else: @@ -166,7 +166,7 @@ cdef class Matrix_gap(Matrix_dense): """ return self._parent, (self.list(),) - cpdef GapElement gap(self) noexcept: + cpdef GapElement gap(self): r""" Return the underlying gap object. @@ -184,10 +184,10 @@ cdef class Matrix_gap(Matrix_dense): """ return self._libgap - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): return self._base_ring(self._libgap[i,j]) - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, object x) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, object x): r""" TESTS:: @@ -204,7 +204,7 @@ cdef class Matrix_gap(Matrix_dense): """ self._libgap[i,j] = x - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): r""" Compare ``self`` and ``right``. @@ -284,7 +284,7 @@ cdef class Matrix_gap(Matrix_dense): else: return Matrix_dense.__invert__(self) - cpdef _add_(left, right) noexcept: + cpdef _add_(left, right): r""" TESTS:: @@ -297,7 +297,7 @@ cdef class Matrix_gap(Matrix_dense): ans._libgap = left._libgap + ( right)._libgap return ans - cpdef _sub_(left, right) noexcept: + cpdef _sub_(left, right): r""" TESTS:: @@ -310,7 +310,7 @@ cdef class Matrix_gap(Matrix_dense): ans._libgap = left._libgap - ( right)._libgap return ans - cdef Matrix _matrix_times_matrix_(left, Matrix right) noexcept: + cdef Matrix _matrix_times_matrix_(left, Matrix right): r""" TESTS:: diff --git a/src/sage/matrix/matrix_generic_dense.pxd b/src/sage/matrix/matrix_generic_dense.pxd index 839efd22159..ba37428cb1f 100644 --- a/src/sage/matrix/matrix_generic_dense.pxd +++ b/src/sage/matrix/matrix_generic_dense.pxd @@ -3,4 +3,4 @@ from sage.matrix.matrix_dense cimport Matrix_dense cdef class Matrix_generic_dense(Matrix_dense): cdef list _entries - cdef Matrix_generic_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept + cdef Matrix_generic_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols) diff --git a/src/sage/matrix/matrix_generic_dense.pyx b/src/sage/matrix/matrix_generic_dense.pyx index 96094f5646b..441138560b0 100644 --- a/src/sage/matrix/matrix_generic_dense.pyx +++ b/src/sage/matrix/matrix_generic_dense.pyx @@ -81,7 +81,7 @@ cdef class Matrix_generic_dense(matrix_dense.Matrix_dense): ma = MatrixArgs_init(parent, entries) self._entries = ma.list(coerce) - cdef Matrix_generic_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept: + cdef Matrix_generic_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols): r""" Return a new dense matrix with no entries set. """ @@ -93,10 +93,10 @@ cdef class Matrix_generic_dense(matrix_dense.Matrix_dense): cdef type t = type(self) return t.__new__(t, MS) - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value): self._entries[i*self._ncols + j] = value - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): return self._entries[i*self._ncols + j] @@ -209,7 +209,7 @@ cdef class Matrix_generic_dense(matrix_dense.Matrix_dense): @cython.boundscheck(False) @cython.wraparound(False) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add two generic dense matrices with the same parent. @@ -233,7 +233,7 @@ cdef class Matrix_generic_dense(matrix_dense.Matrix_dense): @cython.boundscheck(False) @cython.wraparound(False) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract two generic dense matrices with the same parent. diff --git a/src/sage/matrix/matrix_generic_sparse.pyx b/src/sage/matrix/matrix_generic_sparse.pyx index bc251f3e5c0..055746a8664 100644 --- a/src/sage/matrix/matrix_generic_sparse.pyx +++ b/src/sage/matrix/matrix_generic_sparse.pyx @@ -188,7 +188,7 @@ cdef class Matrix_generic_sparse(matrix_sparse.Matrix_sparse): """ return bool(self._entries) - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value): if not value: try: del self._entries[(i,j)] @@ -197,7 +197,7 @@ cdef class Matrix_generic_sparse(matrix_sparse.Matrix_sparse): else: self._entries[(i,j)] = value - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): return self._entries.get((i,j), self._zero) cdef bint get_is_zero_unsafe(self, Py_ssize_t i, Py_ssize_t j) except -1: @@ -248,7 +248,7 @@ cdef class Matrix_generic_sparse(matrix_sparse.Matrix_sparse): # x * _dict -- copy of the sparse dictionary of underlying elements ######################################################################## - cpdef _add_(self, _other) noexcept: + cpdef _add_(self, _other): """ EXAMPLES:: diff --git a/src/sage/matrix/matrix_gf2e_dense.pxd b/src/sage/matrix/matrix_gf2e_dense.pxd index 485266e517b..dcd1019f230 100644 --- a/src/sage/matrix/matrix_gf2e_dense.pxd +++ b/src/sage/matrix/matrix_gf2e_dense.pxd @@ -9,6 +9,6 @@ cdef class Matrix_gf2e_dense(Matrix_dense): cdef object _zero cdef m4ri_word _zero_word # m4ri_word representation of _zero - cpdef Matrix_gf2e_dense _multiply_newton_john(Matrix_gf2e_dense self, Matrix_gf2e_dense right) noexcept - cpdef Matrix_gf2e_dense _multiply_karatsuba(Matrix_gf2e_dense self, Matrix_gf2e_dense right) noexcept - cpdef Matrix_gf2e_dense _multiply_strassen(Matrix_gf2e_dense self, Matrix_gf2e_dense right, cutoff=*) noexcept + cpdef Matrix_gf2e_dense _multiply_newton_john(Matrix_gf2e_dense self, Matrix_gf2e_dense right) + cpdef Matrix_gf2e_dense _multiply_karatsuba(Matrix_gf2e_dense self, Matrix_gf2e_dense right) + cpdef Matrix_gf2e_dense _multiply_strassen(Matrix_gf2e_dense self, Matrix_gf2e_dense right, cutoff=*) diff --git a/src/sage/matrix/matrix_gf2e_dense.pyx b/src/sage/matrix/matrix_gf2e_dense.pyx index e77965612fc..a089770ef4c 100644 --- a/src/sage/matrix/matrix_gf2e_dense.pyx +++ b/src/sage/matrix/matrix_gf2e_dense.pyx @@ -232,7 +232,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): se = t mzed_write_elem(self._entries, se.i, se.j, poly_to_word(se.entry)) - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value): """ A[i,j] = value without bound checks @@ -259,7 +259,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): """ mzed_write_elem(self._entries, i, j, poly_to_word(value)) - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): """ Get A[i,j] without bound checks. @@ -298,7 +298,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): """ return mzed_read_elem(self._entries, i, j) == self._zero_word - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Return A+B @@ -324,7 +324,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): return A - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ EXAMPLES:: @@ -385,7 +385,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): sig_off() return ans - cdef _matrix_times_matrix_(self, Matrix right) noexcept: + cdef _matrix_times_matrix_(self, Matrix right): """ Return A*B @@ -428,7 +428,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): sig_off() return ans - cpdef Matrix_gf2e_dense _multiply_newton_john(Matrix_gf2e_dense self, Matrix_gf2e_dense right) noexcept: + cpdef Matrix_gf2e_dense _multiply_newton_john(Matrix_gf2e_dense self, Matrix_gf2e_dense right): """ Return A*B using Newton-John tables. @@ -490,7 +490,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): sig_off() return ans - cpdef Matrix_gf2e_dense _multiply_karatsuba(Matrix_gf2e_dense self, Matrix_gf2e_dense right) noexcept: + cpdef Matrix_gf2e_dense _multiply_karatsuba(Matrix_gf2e_dense self, Matrix_gf2e_dense right): r""" Matrix multiplication using Karatsuba over polynomials with matrix coefficients over GF(2). @@ -538,7 +538,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): sig_off() return ans - cpdef Matrix_gf2e_dense _multiply_strassen(Matrix_gf2e_dense self, Matrix_gf2e_dense right, cutoff=0) noexcept: + cpdef Matrix_gf2e_dense _multiply_strassen(Matrix_gf2e_dense self, Matrix_gf2e_dense right, cutoff=0): """ Winograd-Strassen matrix multiplication with Newton-John multiplication as base case. @@ -592,7 +592,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): sig_off() return ans - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ Return ``a*B`` for ``a`` an element of the base field. @@ -625,7 +625,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): """ return self.__copy__() - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): """ EXAMPLES:: @@ -993,7 +993,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): return A - cdef rescale_row_c(self, Py_ssize_t row, multiple, Py_ssize_t start_col) noexcept: + cdef rescale_row_c(self, Py_ssize_t row, multiple, Py_ssize_t start_col): """ Return ``multiple * self[row][start_col:]`` @@ -1033,7 +1033,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): cdef m4ri_word x = poly_to_word(multiple) mzed_rescale_row(self._entries, row, start_col, x) - cdef add_multiple_of_row_c(self, Py_ssize_t row_to, Py_ssize_t row_from, multiple, Py_ssize_t start_col) noexcept: + cdef add_multiple_of_row_c(self, Py_ssize_t row_to, Py_ssize_t row_from, multiple, Py_ssize_t start_col): """ Compute ``self[row_to][start_col:] += multiple * self[row_from][start_col:]``. @@ -1067,7 +1067,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): mzed_add_multiple_of_row(self._entries, row_to, self._entries, row_from, x, start_col) - cdef swap_rows_c(self, Py_ssize_t row1, Py_ssize_t row2) noexcept: + cdef swap_rows_c(self, Py_ssize_t row1, Py_ssize_t row2): """ Swap rows ``row1`` and ``row2``. @@ -1091,7 +1091,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): """ mzed_row_swap(self._entries, row1, row2) - cdef swap_columns_c(self, Py_ssize_t col1, Py_ssize_t col2) noexcept: + cdef swap_columns_c(self, Py_ssize_t col1, Py_ssize_t col2): """ Swap columns ``col1`` and ``col2``. @@ -1188,7 +1188,7 @@ cdef class Matrix_gf2e_dense(matrix_dense.Matrix_dense): A._entries = mzed_concat(A._entries, self._entries, right._entries) return A - cdef _stack_impl(self, bottom) noexcept: + cdef _stack_impl(self, bottom): r""" Stack ``self`` on top of ``bottom``. diff --git a/src/sage/matrix/matrix_integer_dense.pxd b/src/sage/matrix/matrix_integer_dense.pxd index dcc69db5d72..c60b4422e97 100644 --- a/src/sage/matrix/matrix_integer_dense.pxd +++ b/src/sage/matrix/matrix_integer_dense.pxd @@ -11,11 +11,11 @@ cdef class Matrix_integer_dense(Matrix_dense): cdef fmpz_mat_t _matrix cdef object _pivots cdef int mpz_height(self, mpz_t height) except -1 - cdef _mod_int_c(self, mod_int modulus) noexcept - cdef _mod_two(self) noexcept - cdef _pickle_version0(self) noexcept - cdef _unpickle_version0(self, data) noexcept - cpdef _export_as_string(self, int base=?) noexcept + cdef _mod_int_c(self, mod_int modulus) + cdef _mod_two(self) + cdef _pickle_version0(self) + cdef _unpickle_version0(self, data) + cpdef _export_as_string(self, int base=?) cdef void set_unsafe_mpz(self, Py_ssize_t i, Py_ssize_t j, const mpz_t value) noexcept cdef void set_unsafe_double(self, Py_ssize_t i, Py_ssize_t j, double value) noexcept cdef inline void get_unsafe_mpz(self, Py_ssize_t i, Py_ssize_t j, mpz_t value) noexcept @@ -28,7 +28,7 @@ cdef class Matrix_integer_dense(Matrix_dense): cdef int* _hnf_modn_impl(Matrix_integer_dense self, unsigned int det, Py_ssize_t nrows, Py_ssize_t ncols) except NULL - cdef Matrix_integer_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept + cdef Matrix_integer_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols) -cpdef _lift_crt(Matrix_integer_dense M, residues, moduli=*) noexcept +cpdef _lift_crt(Matrix_integer_dense M, residues, moduli=*) diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx index 6a695689080..e06e5af4c35 100644 --- a/src/sage/matrix/matrix_integer_dense.pyx +++ b/src/sage/matrix/matrix_integer_dense.pyx @@ -313,7 +313,7 @@ cdef class Matrix_integer_dense(Matrix_dense): z = se.entry fmpz_set_mpz(fmpz_mat_entry(self._matrix, se.i, se.j), z.value) - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, object x) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, object x): """ Set position i,j of this matrix to ``x``. @@ -376,7 +376,7 @@ cdef class Matrix_integer_dense(Matrix_dense): """ fmpz_set_d(fmpz_mat_entry(self._matrix,i,j), value) - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): """ Return the (i, j) entry of self as a new Integer. @@ -492,7 +492,7 @@ cdef class Matrix_integer_dense(Matrix_dense): """ return self._pickle_version0(), 0 - cdef _pickle_version0(self) noexcept: + cdef _pickle_version0(self): """ EXAMPLES:: @@ -502,7 +502,7 @@ cdef class Matrix_integer_dense(Matrix_dense): """ return str_to_bytes(self._export_as_string(32), 'ascii') - cpdef _export_as_string(self, int base=10) noexcept: + cpdef _export_as_string(self, int base=10): """ Return space separated string of the entries in this matrix, in the given base. This is optimized for speed. @@ -587,7 +587,7 @@ cdef class Matrix_integer_dense(Matrix_dense): else: raise RuntimeError("unknown matrix version (=%s)"%version) - cdef _unpickle_version0(self, data) noexcept: + cdef _unpickle_version0(self, data): cdef Py_ssize_t i, j, n, k data = data.split() n = self._nrows * self._ncols @@ -613,7 +613,7 @@ cdef class Matrix_integer_dense(Matrix_dense): # LEVEL 1 helpers: # These function support the implementation of the level 1 functionality. ######################################################################## - cdef Matrix_integer_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept: + cdef Matrix_integer_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols): """ Return a new matrix over the integers from given parent All memory is allocated for this matrix, but its @@ -822,7 +822,7 @@ cdef class Matrix_integer_dense(Matrix_dense): fmpz_clear(s) return M - cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix right) noexcept: + cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix right): cdef Matrix_integer_dense M if self._ncols != right._nrows: @@ -835,7 +835,7 @@ cdef class Matrix_integer_dense(Matrix_dense): sig_off() return M - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ EXAMPLES:: @@ -855,7 +855,7 @@ cdef class Matrix_integer_dense(Matrix_dense): sig_off() return M - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add two dense matrices over ZZ. @@ -880,7 +880,7 @@ cdef class Matrix_integer_dense(Matrix_dense): sig_off() return M - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract two dense matrices over ZZ. @@ -1020,7 +1020,7 @@ cdef class Matrix_integer_dense(Matrix_dense): sig_off() return M - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): r""" Compare ``self`` with ``right``, examining entries in lexicographic (row major) ordering. @@ -1054,7 +1054,7 @@ cdef class Matrix_integer_dense(Matrix_dense): return rich_to_bool(op, 0) # TODO: Implement better - cdef _vector_times_matrix_(self, Vector v) noexcept: + cdef _vector_times_matrix_(self, Vector v): """ Return the vector times matrix product. @@ -1579,7 +1579,7 @@ cdef class Matrix_integer_dense(Matrix_dense): else: return self._mod_int_c(modulus) - cdef _mod_two(self) noexcept: + cdef _mod_two(self): """ TESTS: @@ -1593,7 +1593,7 @@ cdef class Matrix_integer_dense(Matrix_dense): MS = matrix_space.MatrixSpace(GF(2), self._nrows, self._ncols) return Matrix_mod2_dense(MS, self, True, True) - cdef _mod_int_c(self, mod_int p) noexcept: + cdef _mod_int_c(self, mod_int p): from sage.matrix.matrix_modn_dense_float import MAX_MODULUS as MAX_MODULUS_FLOAT from sage.matrix.matrix_modn_dense_double import MAX_MODULUS as MAX_MODULUS_DOUBLE @@ -1680,7 +1680,7 @@ cdef class Matrix_integer_dense(Matrix_dense): sig_free(entry_list) return res - cpdef _echelon_in_place(self, str algorithm) noexcept: + cpdef _echelon_in_place(self, str algorithm): cdef Matrix_integer_dense E E = self.echelon_form() sig_on() @@ -5302,7 +5302,7 @@ cdef class Matrix_integer_dense(Matrix_dense): fmpz_get_mpz(v._entries[j], fmpz_mat_entry(self._matrix, j, i)) return v - cdef _stack_impl(self, bottom) noexcept: + cdef _stack_impl(self, bottom): r""" Return the matrix ``self`` on top of ``bottom``:: @@ -6016,7 +6016,7 @@ cdef inline GEN pari_GEN(Matrix_integer_dense B) noexcept: return A -cdef extract_hnf_from_pari_matrix(Matrix_integer_dense self, Gen H, bint include_zero_rows) noexcept: +cdef extract_hnf_from_pari_matrix(Matrix_integer_dense self, Gen H, bint include_zero_rows): cdef mpz_t tmp mpz_init(tmp) @@ -6038,7 +6038,7 @@ cdef extract_hnf_from_pari_matrix(Matrix_integer_dense self, Gen H, bint include return B -cdef _clear_columns(Matrix_integer_dense A, pivots, Py_ssize_t n) noexcept: +cdef _clear_columns(Matrix_integer_dense A, pivots, Py_ssize_t n): # Clear all columns cdef Py_ssize_t i, k, p, l, m = A._ncols cdef fmpz_t c,t @@ -6061,7 +6061,7 @@ cdef _clear_columns(Matrix_integer_dense A, pivots, Py_ssize_t n) noexcept: sig_off() -cpdef _lift_crt(Matrix_integer_dense M, residues, moduli=None) noexcept: +cpdef _lift_crt(Matrix_integer_dense M, residues, moduli=None): """ INPUT: diff --git a/src/sage/matrix/matrix_integer_sparse.pxd b/src/sage/matrix/matrix_integer_sparse.pxd index fa130f9e680..fbfa9c9a793 100644 --- a/src/sage/matrix/matrix_integer_sparse.pxd +++ b/src/sage/matrix/matrix_integer_sparse.pxd @@ -5,4 +5,4 @@ from sage.matrix.matrix_sparse cimport Matrix_sparse cdef class Matrix_integer_sparse(Matrix_sparse): cdef mpz_vector* _matrix - cdef _mod_int_c(self, mod_int p) noexcept + cdef _mod_int_c(self, mod_int p) diff --git a/src/sage/matrix/matrix_integer_sparse.pyx b/src/sage/matrix/matrix_integer_sparse.pyx index 15afd03c179..31c6c1e9d1a 100644 --- a/src/sage/matrix/matrix_integer_sparse.pyx +++ b/src/sage/matrix/matrix_integer_sparse.pyx @@ -110,10 +110,10 @@ cdef class Matrix_integer_sparse(Matrix_sparse): if z: mpz_vector_set_entry(&self._matrix[se.i], se.j, z.value) - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x): mpz_vector_set_entry(&self._matrix[i], j, ( x).value) - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): cdef Integer x x = Integer() mpz_vector_get_entry(x.value, &self._matrix[i], j) @@ -160,7 +160,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse): # def _multiply_classical(left, matrix.Matrix _right): # def _list(self): - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ EXAMPLES:: @@ -182,7 +182,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse): mpz_vector_scalar_multiply(M_row, self_row, _x.value) return M - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): cdef Py_ssize_t i cdef Matrix_integer_sparse M @@ -196,7 +196,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse): mpz_clear(mul) return M - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): cdef Py_ssize_t i cdef Matrix_integer_sparse M @@ -231,7 +231,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse): self.cache('dict', d) return d - cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix _right) noexcept: + cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix _right): """ Return the product of the sparse integer matrices ``self`` and ``_right``. @@ -381,7 +381,7 @@ cdef class Matrix_integer_sparse(Matrix_sparse): """ return self._mod_int_c(modulus) - cdef _mod_int_c(self, mod_int p) noexcept: + cdef _mod_int_c(self, mod_int p): cdef Py_ssize_t i, j cdef Matrix_modn_sparse res cdef mpz_vector* self_row diff --git a/src/sage/matrix/matrix_mod2_dense.pxd b/src/sage/matrix/matrix_mod2_dense.pxd index 82df8116a5c..ea3575ef3be 100644 --- a/src/sage/matrix/matrix_mod2_dense.pxd +++ b/src/sage/matrix/matrix_mod2_dense.pxd @@ -6,8 +6,8 @@ cdef class Matrix_mod2_dense(Matrix_dense): cdef object _one cdef object _zero - cpdef Matrix_mod2_dense _multiply_m4rm(Matrix_mod2_dense self, Matrix_mod2_dense right, int k) noexcept - cpdef Matrix_mod2_dense _multiply_strassen(Matrix_mod2_dense self, Matrix_mod2_dense right, int cutoff) noexcept + cpdef Matrix_mod2_dense _multiply_m4rm(Matrix_mod2_dense self, Matrix_mod2_dense right, int k) + cpdef Matrix_mod2_dense _multiply_strassen(Matrix_mod2_dense self, Matrix_mod2_dense right, int cutoff) # For conversion to other systems - cpdef _export_as_string(self) noexcept + cpdef _export_as_string(self) diff --git a/src/sage/matrix/matrix_mod2_dense.pyx b/src/sage/matrix/matrix_mod2_dense.pyx index 1f079ebc001..f7689c60b07 100644 --- a/src/sage/matrix/matrix_mod2_dense.pyx +++ b/src/sage/matrix/matrix_mod2_dense.pyx @@ -335,10 +335,10 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse """ mzd_write_bit(self._entries, i, j, int(value)) - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value): mzd_write_bit(self._entries, i, j, int(value)) - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): if mzd_read_bit(self._entries, i, j): return self._one else: @@ -539,7 +539,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse # def _pickle(self): # def _unpickle(self, data, int version): # use version >= 0 - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Matrix addition. @@ -577,7 +577,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse return A - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Matrix addition. @@ -593,7 +593,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse """ return self._add_(right) - cdef _matrix_times_vector_(self, Vector v) noexcept: + cdef _matrix_times_vector_(self, Vector v): """ EXAMPLES:: @@ -651,7 +651,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse sig_off() return c - cdef _matrix_times_matrix_(self, Matrix right) noexcept: + cdef _matrix_times_matrix_(self, Matrix right): """ Matrix multiplication. @@ -664,7 +664,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse return self._multiply_strassen(right, 0) - cpdef Matrix_mod2_dense _multiply_m4rm(Matrix_mod2_dense self, Matrix_mod2_dense right, int k) noexcept: + cpdef Matrix_mod2_dense _multiply_m4rm(Matrix_mod2_dense self, Matrix_mod2_dense right, int k): """ Multiply matrices using the 'Method of the Four Russians Multiplication' (M4RM) or Konrod's method. @@ -793,7 +793,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse A._entries = mzd_mul_naive(A._entries, self._entries,(right)._entries) return A - cpdef Matrix_mod2_dense _multiply_strassen(Matrix_mod2_dense self, Matrix_mod2_dense right, int cutoff) noexcept: + cpdef Matrix_mod2_dense _multiply_strassen(Matrix_mod2_dense self, Matrix_mod2_dense right, int cutoff): r""" Strassen-Winograd `O(n^{2.807})` multiplication [Str1969]_. @@ -1268,7 +1268,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse mzd_write_bit(self._entries, i, j, 1) sig_off() - cdef rescale_row_c(self, Py_ssize_t row, multiple, Py_ssize_t start_col) noexcept: + cdef rescale_row_c(self, Py_ssize_t row, multiple, Py_ssize_t start_col): """ EXAMPLES:: @@ -1281,7 +1281,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse mzd_row_clear_offset(self._entries, row, start_col) cdef add_multiple_of_row_c(self, Py_ssize_t row_to, Py_ssize_t row_from, multiple, - Py_ssize_t start_col) noexcept: + Py_ssize_t start_col): """ EXAMPLES:: @@ -1294,7 +1294,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse if int(multiple) % 2: mzd_row_add_offset(self._entries, row_to, row_from, start_col) - cdef swap_rows_c(self, Py_ssize_t row1, Py_ssize_t row2) noexcept: + cdef swap_rows_c(self, Py_ssize_t row1, Py_ssize_t row2): """ EXAMPLES:: @@ -1310,7 +1310,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse """ mzd_row_swap(self._entries, row1, row2) - cdef swap_columns_c(self, Py_ssize_t col1, Py_ssize_t col2) noexcept: + cdef swap_columns_c(self, Py_ssize_t col1, Py_ssize_t col2): """ EXAMPLES:: @@ -1440,7 +1440,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse A.subdivide(*self.subdivisions()) return A - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): """ Compare ``self`` with ``right``. @@ -1589,7 +1589,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse Z._subdivide_on_augment(self, other) return Z - cdef _stack_impl(self, bottom) noexcept: + cdef _stack_impl(self, bottom): r""" Stack ``self`` on top of ``bottom``. @@ -1776,7 +1776,7 @@ cdef class Matrix_mod2_dense(matrix_dense.Matrix_dense): # dense or sparse gdImageDestroy(im) return unpickle_matrix_mod2_dense_v2, (r,c, data, size, self._is_immutable) - cpdef _export_as_string(self) noexcept: + cpdef _export_as_string(self): """ Return space separated string of the entries in this matrix. diff --git a/src/sage/matrix/matrix_modn_dense_double.pyx b/src/sage/matrix/matrix_modn_dense_double.pyx index 858c3fcb887..b112ffba912 100644 --- a/src/sage/matrix/matrix_modn_dense_double.pyx +++ b/src/sage/matrix/matrix_modn_dense_double.pyx @@ -101,7 +101,7 @@ cdef class Matrix_modn_dense_double(Matrix_modn_dense_template): """ self._matrix[i][j] = value - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x): r""" Set the (i,j) entry with no bounds-checking, or any other checks. @@ -136,7 +136,7 @@ cdef class Matrix_modn_dense_double(Matrix_modn_dense_template): else: self._matrix[i][j] = (x).ivalue - cdef IntegerMod_abstract get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef IntegerMod_abstract get_unsafe(self, Py_ssize_t i, Py_ssize_t j): r""" Return the (i,j) entry with no bounds-checking. diff --git a/src/sage/matrix/matrix_modn_dense_float.pyx b/src/sage/matrix/matrix_modn_dense_float.pyx index 325e492f5fb..73fbe175d95 100644 --- a/src/sage/matrix/matrix_modn_dense_float.pyx +++ b/src/sage/matrix/matrix_modn_dense_float.pyx @@ -91,7 +91,7 @@ cdef class Matrix_modn_dense_float(Matrix_modn_dense_template): """ self._matrix[i][j] = value - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x): r""" Set the (i,j) entry with no bounds-checking, or any other checks. @@ -121,7 +121,7 @@ cdef class Matrix_modn_dense_float(Matrix_modn_dense_template): """ self._matrix[i][j] = (x).ivalue - cdef IntegerMod_int get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef IntegerMod_int get_unsafe(self, Py_ssize_t i, Py_ssize_t j): r""" Return the (i,j) entry with no bounds-checking. diff --git a/src/sage/matrix/matrix_modn_dense_template.pxi b/src/sage/matrix/matrix_modn_dense_template.pxi index c85176d583b..08f01205da1 100644 --- a/src/sage/matrix/matrix_modn_dense_template.pxi +++ b/src/sage/matrix/matrix_modn_dense_template.pxi @@ -131,7 +131,7 @@ from sage.cpython.string cimport char_to_str cdef long num = 1 cdef bint little_endian = ((&num))[0] -cdef inline celement_invert(celement a, celement n) noexcept: +cdef inline celement_invert(celement a, celement n): """ Invert the finite field element `a` modulo `n`. """ @@ -172,7 +172,7 @@ cdef inline bint linbox_is_zero(celement modulus, celement* entries, Py_ssize_t return 0 return 1 -cdef inline linbox_echelonize(celement modulus, celement* entries, Py_ssize_t nrows, Py_ssize_t ncols) noexcept: +cdef inline linbox_echelonize(celement modulus, celement* entries, Py_ssize_t nrows, Py_ssize_t ncols): """ Return the reduced row echelon form of this matrix. """ @@ -213,7 +213,7 @@ cdef inline linbox_echelonize(celement modulus, celement* entries, Py_ssize_t nr del F return r, pivots -cdef inline linbox_echelonize_efd(celement modulus, celement* entries, Py_ssize_t nrows, Py_ssize_t ncols) noexcept: +cdef inline linbox_echelonize_efd(celement modulus, celement* entries, Py_ssize_t nrows, Py_ssize_t ncols): # See trac #13878: This is to avoid sending invalid data to linbox, # which would yield a segfault in Sage's debug version. TODO: Fix # that bug upstream. @@ -347,7 +347,7 @@ cdef inline int linbox_matrix_vector_multiply(celement modulus, celement* C, cel del F -cdef inline linbox_minpoly(celement modulus, Py_ssize_t nrows, celement* entries) noexcept: +cdef inline linbox_minpoly(celement modulus, Py_ssize_t nrows, celement* entries): """ Compute the minimal polynomial. """ @@ -368,7 +368,7 @@ cdef inline linbox_minpoly(celement modulus, Py_ssize_t nrows, celement* entries del F return l -cdef inline linbox_charpoly(celement modulus, Py_ssize_t nrows, celement* entries) noexcept: +cdef inline linbox_charpoly(celement modulus, Py_ssize_t nrows, celement* entries): """ Compute the characteristic polynomial. """ @@ -396,7 +396,7 @@ cdef inline linbox_charpoly(celement modulus, Py_ssize_t nrows, celement* entrie return l -cpdef __matrix_from_rows_of_matrices(X) noexcept: +cpdef __matrix_from_rows_of_matrices(X): """ Return a matrix whose row ``i`` is constructed from the entries of matrix ``X[i]``. @@ -802,7 +802,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): sig_off() return M - cpdef _lmul_(self, Element left) noexcept: + cpdef _lmul_(self, Element left): """ EXAMPLES:: @@ -856,7 +856,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): return A - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): r""" Add two dense matrices over `\Z/n\Z` @@ -900,7 +900,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): return M - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): r""" Subtract two dense matrices over `\Z/n\Z` @@ -936,7 +936,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): sig_off() return M - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): r""" Compare two dense matrices over `\Z/n\Z`. @@ -988,7 +988,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): sig_off() return rich_to_bool(op, 0) - cdef _matrix_times_matrix_(self, Matrix right) noexcept: + cdef _matrix_times_matrix_(self, Matrix right): """ return ``self*right`` @@ -1146,7 +1146,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): return ans - cdef _vector_times_matrix_(self, Vector v) noexcept: + cdef _vector_times_matrix_(self, Vector v): """ ``v*self`` @@ -1203,7 +1203,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): sig_free(_c) return c - cdef _matrix_times_vector_(self, Vector v) noexcept: + cdef _matrix_times_vector_(self, Vector v): """ ``self*v`` @@ -2283,7 +2283,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): else: return Matrix_dense.determinant(self) - cdef xgcd_eliminate(self, celement * row1, celement* row2, Py_ssize_t start_col) noexcept: + cdef xgcd_eliminate(self, celement * row1, celement* row2, Py_ssize_t start_col): r""" Reduces ``row1`` and ``row2`` by a unimodular transformation using the xgcd relation between their first coefficients ``a`` and @@ -2325,7 +2325,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): row1[i] = tmp return g - cdef rescale_row_c(self, Py_ssize_t row, multiple, Py_ssize_t start_col) noexcept: + cdef rescale_row_c(self, Py_ssize_t row, multiple, Py_ssize_t start_col): """ Rescale ``self[row]`` by ``multiple`` but only start at column index ``start_col``. @@ -2376,7 +2376,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): for i from start_col <= i < self._ncols: v[i] = (v[i]*multiple) % p - cdef rescale_col_c(self, Py_ssize_t col, multiple, Py_ssize_t start_row) noexcept: + cdef rescale_col_c(self, Py_ssize_t col, multiple, Py_ssize_t start_row): """ EXAMPLES:: @@ -2419,7 +2419,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): for i from start_row <= i < self._nrows: self._matrix[i][col] = (self._matrix[i][col]*multiple) % p - cdef add_multiple_of_row_c(self, Py_ssize_t row_to, Py_ssize_t row_from, multiple, Py_ssize_t start_col) noexcept: + cdef add_multiple_of_row_c(self, Py_ssize_t row_to, Py_ssize_t row_from, multiple, Py_ssize_t start_col): """ Add ``multiple`` times ``self[row_from]`` to ``self[row_to]`` statting in column ``start_col``. @@ -2456,7 +2456,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): for i from start_col <= i < nc: v_to[i] = ((multiple) * v_from[i] + v_to[i]) % p - cdef add_multiple_of_column_c(self, Py_ssize_t col_to, Py_ssize_t col_from, multiple, Py_ssize_t start_row) noexcept: + cdef add_multiple_of_column_c(self, Py_ssize_t col_to, Py_ssize_t col_from, multiple, Py_ssize_t start_row): """ Add ``multiple`` times ``self[row_from]`` to ``self[row_to]`` statting in column ``start_col``. @@ -2491,7 +2491,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): for i from start_row <= i < self._nrows: m[i][col_to] = (m[i][col_to] + (multiple) * m[i][col_from]) %p - cdef swap_rows_c(self, Py_ssize_t row1, Py_ssize_t row2) noexcept: + cdef swap_rows_c(self, Py_ssize_t row1, Py_ssize_t row2): """ EXAMPLES:: @@ -2509,7 +2509,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): r1[i] = r2[i] r2[i] = temp - cdef swap_columns_c(self, Py_ssize_t col1, Py_ssize_t col2) noexcept: + cdef swap_columns_c(self, Py_ssize_t col1, Py_ssize_t col2): """ EXAMPLES:: @@ -2678,7 +2678,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): return 'Matrix(%s,%s,%s,StringToIntegerSequence("%s"))'%( s, self._nrows, self._ncols, self._export_as_string()) - cpdef _export_as_string(self) noexcept: + cpdef _export_as_string(self): """ Return space separated string of the entries in this matrix. @@ -2830,7 +2830,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense): return M - cdef _stack_impl(self, bottom) noexcept: + cdef _stack_impl(self, bottom): r""" Implementation of :meth:`stack` by returning a new matrix formed by appending the matrix ``bottom`` beneath ``self``. diff --git a/src/sage/matrix/matrix_modn_dense_template_header.pxi b/src/sage/matrix/matrix_modn_dense_template_header.pxi index 18e149fb5de..b5f12c69397 100644 --- a/src/sage/matrix/matrix_modn_dense_template_header.pxi +++ b/src/sage/matrix/matrix_modn_dense_template_header.pxi @@ -9,6 +9,6 @@ cdef class Matrix_modn_dense_template(Matrix_dense): cdef celement **_matrix cdef celement *_entries cdef mod_int p - cdef xgcd_eliminate (self, celement * row1, celement* row2, Py_ssize_t start_col) noexcept - cpdef _export_as_string(self) noexcept + cdef xgcd_eliminate (self, celement * row1, celement* row2, Py_ssize_t start_col) + cpdef _export_as_string(self) cdef int _copy_row_to_mod_int_array(self, mod_int *to, Py_ssize_t i) noexcept diff --git a/src/sage/matrix/matrix_modn_sparse.pxd b/src/sage/matrix/matrix_modn_sparse.pxd index 37dd99bf5f3..dded069b3d8 100644 --- a/src/sage/matrix/matrix_modn_sparse.pxd +++ b/src/sage/matrix/matrix_modn_sparse.pxd @@ -4,4 +4,4 @@ from sage.modules.vector_modn_sparse cimport * cdef class Matrix_modn_sparse(Matrix_sparse): cdef c_vector_modint* rows cdef public int p - cdef swap_rows_c(self, Py_ssize_t n1, Py_ssize_t n2) noexcept + cdef swap_rows_c(self, Py_ssize_t n1, Py_ssize_t n2) diff --git a/src/sage/matrix/matrix_modn_sparse.pyx b/src/sage/matrix/matrix_modn_sparse.pyx index 3be3c6b0fc5..55fd65c6061 100644 --- a/src/sage/matrix/matrix_modn_sparse.pyx +++ b/src/sage/matrix/matrix_modn_sparse.pyx @@ -173,10 +173,10 @@ cdef class Matrix_modn_sparse(Matrix_sparse): if z: set_entry(&self.rows[se.i], se.j, z) - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value): set_entry(&self.rows[i], j, ( value).ivalue) - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): cdef IntegerMod_int n n = IntegerMod_int.__new__(IntegerMod_int) IntegerMod_abstract.__init__(n, self._base_ring) @@ -255,7 +255,7 @@ cdef class Matrix_modn_sparse(Matrix_sparse): else: raise ValueError("unknown matrix format") - cdef Matrix _matrix_times_matrix_(self, Matrix _right) noexcept: + cdef Matrix _matrix_times_matrix_(self, Matrix _right): """ This code is implicitly called for multiplying self by another sparse matrix. @@ -392,7 +392,7 @@ cdef class Matrix_modn_sparse(Matrix_sparse): self.check_bounds_and_mutability(r2,0) self.swap_rows_c(r1, r2) - cdef swap_rows_c(self, Py_ssize_t n1, Py_ssize_t n2) noexcept: + cdef swap_rows_c(self, Py_ssize_t n1, Py_ssize_t n2): """ Swap the rows in positions n1 and n2. No bounds checking. """ @@ -401,7 +401,7 @@ cdef class Matrix_modn_sparse(Matrix_sparse): self.rows[n1] = self.rows[n2] self.rows[n2] = tmp - cpdef _echelon_in_place(self, str algorithm) noexcept: + cpdef _echelon_in_place(self, str algorithm): """ Replace self by its reduction to reduced row echelon form. diff --git a/src/sage/matrix/matrix_numpy_dense.pxd b/src/sage/matrix/matrix_numpy_dense.pxd index 150f9d59551..4fe2c65e0fc 100644 --- a/src/sage/matrix/matrix_numpy_dense.pxd +++ b/src/sage/matrix/matrix_numpy_dense.pxd @@ -9,5 +9,5 @@ cdef class Matrix_numpy_dense(Matrix_dense): cdef object _python_dtype cdef object _sage_dtype cdef object _sage_vector_dtype - cdef Matrix_numpy_dense _new(self, int nrows=*, int ncols=*) noexcept + cdef Matrix_numpy_dense _new(self, int nrows=*, int ncols=*) cdef cnumpy.ndarray _matrix_numpy diff --git a/src/sage/matrix/matrix_numpy_dense.pyx b/src/sage/matrix/matrix_numpy_dense.pyx index 3e33599bf70..401f115ed78 100644 --- a/src/sage/matrix/matrix_numpy_dense.pyx +++ b/src/sage/matrix/matrix_numpy_dense.pyx @@ -145,7 +145,7 @@ cdef class Matrix_numpy_dense(Matrix_dense): for j in range(ma.ncols): self.set_unsafe(i, j, next(it)) - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, object value) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, object value): """ Set the (i,j) entry to value without any bounds checking, mutability checking, etc. @@ -169,7 +169,7 @@ cdef class Matrix_numpy_dense(Matrix_dense): self._python_dtype(value)) #TODO: Throw an error if status == -1 - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): """ Get the (i,j) entry without any bounds checking, etc. """ @@ -177,7 +177,7 @@ cdef class Matrix_numpy_dense(Matrix_dense): return self._sage_dtype(cnumpy.PyArray_GETITEM(self._matrix_numpy, cnumpy.PyArray_GETPTR2(self._matrix_numpy, i, j))) - cdef Matrix_numpy_dense _new(self, int nrows=-1, int ncols=-1) noexcept: + cdef Matrix_numpy_dense _new(self, int nrows=-1, int ncols=-1): """ Return a new uninitialized matrix with same parent as ``self``. diff --git a/src/sage/matrix/matrix_rational_dense.pxd b/src/sage/matrix/matrix_rational_dense.pxd index 6a6347f4926..d2d9955fefc 100644 --- a/src/sage/matrix/matrix_rational_dense.pxd +++ b/src/sage/matrix/matrix_rational_dense.pxd @@ -8,14 +8,14 @@ cdef class Matrix_rational_dense(Matrix_dense): cdef int fmpz_height(self, fmpz_t height) except -1 # cdef int _rescale(self, mpq_t a) except -1 - cdef _pickle_version0(self) noexcept - cdef _unpickle_version0(self, data) noexcept - cpdef _export_as_string(self, int base=?) noexcept + cdef _pickle_version0(self) + cdef _unpickle_version0(self, data) + cpdef _export_as_string(self, int base=?) - cdef _add_ui_unsafe_assuming_int(self, Py_ssize_t i, Py_ssize_t j, unsigned long int n) noexcept - cdef _sub_ui_unsafe_assuming_int(self, Py_ssize_t i, Py_ssize_t j, unsigned long int n) noexcept + cdef _add_ui_unsafe_assuming_int(self, Py_ssize_t i, Py_ssize_t j, unsigned long int n) + cdef _sub_ui_unsafe_assuming_int(self, Py_ssize_t i, Py_ssize_t j, unsigned long int n) - cdef inline Matrix_rational_dense _new_matrix(self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept + cdef inline Matrix_rational_dense _new_matrix(self, Py_ssize_t nrows, Py_ssize_t ncols) cdef class MatrixWindow: cdef Matrix_rational_dense _matrix diff --git a/src/sage/matrix/matrix_rational_dense.pyx b/src/sage/matrix/matrix_rational_dense.pyx index ef8a3b484e7..7b6067892de 100644 --- a/src/sage/matrix/matrix_rational_dense.pyx +++ b/src/sage/matrix/matrix_rational_dense.pyx @@ -147,7 +147,7 @@ cdef class Matrix_rational_dense(Matrix_dense): fmpq_mat_init(self._matrix, self._nrows, self._ncols) sig_off() - cdef inline Matrix_rational_dense _new_matrix(self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept: + cdef inline Matrix_rational_dense _new_matrix(self, Py_ssize_t nrows, Py_ssize_t ncols): if nrows == self._nrows and ncols == self._ncols: parent = self._parent else: @@ -255,10 +255,10 @@ cdef class Matrix_rational_dense(Matrix_dense): tmp) fmpq_clear(tmp) - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, value): fmpq_set_mpq(fmpq_mat_entry(self._matrix, i, j), ( value).value) - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): cdef Rational x x = Rational.__new__(Rational) fmpq_get_mpq(x.value, fmpq_mat_entry(self._matrix, i, j)) @@ -275,14 +275,14 @@ cdef class Matrix_rational_dense(Matrix_dense): """ return fmpq_is_zero(fmpq_mat_entry(self._matrix, i,j)) - cdef _add_ui_unsafe_assuming_int(self, Py_ssize_t i, Py_ssize_t j, unsigned long int n) noexcept: + cdef _add_ui_unsafe_assuming_int(self, Py_ssize_t i, Py_ssize_t j, unsigned long int n): # doesn't check immutability # doesn't do bounds checks. # assumes that self[i,j] is an integer. cdef fmpz * entry = fmpq_numref(fmpq_mat_entry(self._matrix, i, j)) fmpz_add_ui(entry, entry, n) - cdef _sub_ui_unsafe_assuming_int(self, Py_ssize_t i, Py_ssize_t j, unsigned long int n) noexcept: + cdef _sub_ui_unsafe_assuming_int(self, Py_ssize_t i, Py_ssize_t j, unsigned long int n): # doesn't check immutability # doesn't do bounds checks. # assumes that self[i,j] is an integer. @@ -298,10 +298,10 @@ cdef class Matrix_rational_dense(Matrix_dense): else: raise RuntimeError("unknown matrix version (=%s)" % version) - cdef _pickle_version0(self) noexcept: + cdef _pickle_version0(self): return self._export_as_string(32) - cpdef _export_as_string(self, int base=10) noexcept: + cpdef _export_as_string(self, int base=10): """ Return space separated string of the entries in this matrix, in the given base. This is optimized for speed. @@ -356,7 +356,7 @@ cdef class Matrix_rational_dense(Matrix_dense): sig_free(s) return data - cdef _unpickle_version0(self, data) noexcept: + cdef _unpickle_version0(self, data): r""" TESTS:: @@ -398,7 +398,7 @@ cdef class Matrix_rational_dense(Matrix_dense): # * _dict -- sparse dictionary of underlying elements (need not be a copy) # ####################################################################### - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ EXAMPLES:: @@ -417,7 +417,7 @@ cdef class Matrix_rational_dense(Matrix_dense): fmpq_clear(x) return M - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add two dense matrices over QQ. @@ -440,7 +440,7 @@ cdef class Matrix_rational_dense(Matrix_dense): sig_off() return ans - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract two dense matrices over QQ. @@ -461,7 +461,7 @@ cdef class Matrix_rational_dense(Matrix_dense): sig_off() return ans - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): r""" TESTS:: @@ -502,7 +502,7 @@ cdef class Matrix_rational_dense(Matrix_dense): return rich_to_bool(op, -1) return rich_to_bool(op, 0) - cdef _vector_times_matrix_(self, Vector v) noexcept: + cdef _vector_times_matrix_(self, Vector v): r""" Return the vector times matrix product. @@ -1127,7 +1127,7 @@ cdef class Matrix_rational_dense(Matrix_dense): self.cache('minpoly', g) return g - cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix right) noexcept: + cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix right): """ EXAMPLES:: @@ -1809,7 +1809,7 @@ cdef class Matrix_rational_dense(Matrix_dense): fmpq_mat_swap(self._matrix, (E)._matrix) return pivots - cdef swap_rows_c(self, Py_ssize_t r1, Py_ssize_t r2) noexcept: + cdef swap_rows_c(self, Py_ssize_t r1, Py_ssize_t r2): """ EXAMPLES:: @@ -1825,7 +1825,7 @@ cdef class Matrix_rational_dense(Matrix_dense): fmpq_swap(fmpq_mat_entry(self._matrix, r1, c), fmpq_mat_entry(self._matrix, r2, c)) - cdef swap_columns_c(self, Py_ssize_t c1, Py_ssize_t c2) noexcept: + cdef swap_columns_c(self, Py_ssize_t c1, Py_ssize_t c2): """ EXAMPLES:: @@ -2996,7 +2996,7 @@ cdef class Matrix_rational_dense(Matrix_dense): return A.is_LLL_reduced(delta, eta) -cdef new_matrix_from_pari_GEN(parent, GEN d) noexcept: +cdef new_matrix_from_pari_GEN(parent, GEN d): """ Given a PARI GEN with ``t_INT`` or ``t_FRAC entries, create a :class:`Matrix_rational_dense` from it. diff --git a/src/sage/matrix/matrix_rational_sparse.pyx b/src/sage/matrix/matrix_rational_sparse.pyx index 96d2402dd83..dac06a3cfd3 100644 --- a/src/sage/matrix/matrix_rational_sparse.pyx +++ b/src/sage/matrix/matrix_rational_sparse.pyx @@ -93,10 +93,10 @@ cdef class Matrix_rational_sparse(Matrix_sparse): if z: mpq_vector_set_entry(&self._matrix[se.i], se.j, z.value) - cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x) noexcept: + cdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x): mpq_vector_set_entry(&self._matrix[i], j, ( x).value) - cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): cdef Rational x x = Rational() mpq_vector_get_entry(x.value, &self._matrix[i], j) @@ -168,7 +168,7 @@ cdef class Matrix_rational_sparse(Matrix_sparse): # * _list -- list of underlying elements (need not be a copy) # * x _dict -- sparse dictionary of underlying elements (need not be a copy) - cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix _right) noexcept: + cdef sage.structure.element.Matrix _matrix_times_matrix_(self, sage.structure.element.Matrix _right): cdef Matrix_rational_sparse right, ans right = _right diff --git a/src/sage/matrix/matrix_real_double_dense.pxd b/src/sage/matrix/matrix_real_double_dense.pxd index d0badf48240..d781a84ce40 100644 --- a/src/sage/matrix/matrix_real_double_dense.pxd +++ b/src/sage/matrix/matrix_real_double_dense.pxd @@ -2,5 +2,5 @@ from sage.matrix.matrix_double_dense cimport Matrix_double_dense cdef class Matrix_real_double_dense(Matrix_double_dense): - cdef set_unsafe_double(self, Py_ssize_t i, Py_ssize_t j, double value) noexcept + cdef set_unsafe_double(self, Py_ssize_t i, Py_ssize_t j, double value) cdef double get_unsafe_double(self, Py_ssize_t i, Py_ssize_t j) noexcept diff --git a/src/sage/matrix/matrix_real_double_dense.pyx b/src/sage/matrix/matrix_real_double_dense.pyx index 1337641bb24..10eaeac4e56 100644 --- a/src/sage/matrix/matrix_real_double_dense.pyx +++ b/src/sage/matrix/matrix_real_double_dense.pyx @@ -99,7 +99,7 @@ cdef class Matrix_real_double_dense(Matrix_double_dense): self.__create_matrix__() return - cdef set_unsafe_double(self, Py_ssize_t i, Py_ssize_t j, double value) noexcept: + cdef set_unsafe_double(self, Py_ssize_t i, Py_ssize_t j, double value): """ Set the (i,j) entry to value without any type checking or bound checking. diff --git a/src/sage/matrix/matrix_sparse.pyx b/src/sage/matrix/matrix_sparse.pyx index c41d6b18f9f..d8b2e65127a 100644 --- a/src/sage/matrix/matrix_sparse.pyx +++ b/src/sage/matrix/matrix_sparse.pyx @@ -301,7 +301,7 @@ cdef class Matrix_sparse(matrix.Matrix): return left.new_matrix(left._nrows, right._ncols, entries=e, coerce=False, copy=False) - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ Left scalar multiplication. Internal usage only. @@ -370,7 +370,7 @@ cdef class Matrix_sparse(matrix.Matrix): else: raise RuntimeError("unknown matrix version (=%s)" % version) - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): """ Rich comparison. @@ -968,7 +968,7 @@ cdef class Matrix_sparse(matrix.Matrix): A.set_unsafe(new_row, new_col, entry) return A - cdef _stack_impl(self, bottom) noexcept: + cdef _stack_impl(self, bottom): r""" Stack ``self`` on top of ``bottom``:: @@ -1119,7 +1119,7 @@ cdef class Matrix_sparse(matrix.Matrix): Z._subdivide_on_augment(self, other) return Z - cdef _vector_times_matrix_(self, Vector v) noexcept: + cdef _vector_times_matrix_(self, Vector v): """ Return the vector times matrix product. @@ -1152,7 +1152,7 @@ cdef class Matrix_sparse(matrix.Matrix): s[j] += v[i] * a return s - cdef _matrix_times_vector_(self, Vector v) noexcept: + cdef _matrix_times_vector_(self, Vector v): """ Return the matrix times vector product. diff --git a/src/sage/matrix/matrix_window.pxd b/src/sage/matrix/matrix_window.pxd index c33d5d16806..070f1deaf25 100644 --- a/src/sage/matrix/matrix_window.pxd +++ b/src/sage/matrix/matrix_window.pxd @@ -7,30 +7,30 @@ cdef class MatrixWindow: cdef object _cached_zero # YOU *REALLY SHOULD* OVERRIDE THESE: - cpdef add(MatrixWindow self, MatrixWindow A) noexcept - cpdef subtract(MatrixWindow self, MatrixWindow A) noexcept - cpdef set_to_sum(MatrixWindow self, MatrixWindow A, MatrixWindow B) noexcept - cpdef set_to_diff(MatrixWindow self, MatrixWindow A, MatrixWindow B) noexcept - cpdef set_to_prod(MatrixWindow self, MatrixWindow A, MatrixWindow B) noexcept - cpdef add_prod(MatrixWindow self, MatrixWindow A, MatrixWindow B) noexcept - cpdef subtract_prod(MatrixWindow self, MatrixWindow A, MatrixWindow B) noexcept + cpdef add(MatrixWindow self, MatrixWindow A) + cpdef subtract(MatrixWindow self, MatrixWindow A) + cpdef set_to_sum(MatrixWindow self, MatrixWindow A, MatrixWindow B) + cpdef set_to_diff(MatrixWindow self, MatrixWindow A, MatrixWindow B) + cpdef set_to_prod(MatrixWindow self, MatrixWindow A, MatrixWindow B) + cpdef add_prod(MatrixWindow self, MatrixWindow A, MatrixWindow B) + cpdef subtract_prod(MatrixWindow self, MatrixWindow A, MatrixWindow B) cpdef bint element_is_zero(MatrixWindow self, Py_ssize_t i, Py_ssize_t j) noexcept - cpdef set_to(MatrixWindow self, MatrixWindow A) noexcept - cpdef set_to_zero(MatrixWindow self) noexcept + cpdef set_to(MatrixWindow self, MatrixWindow A) + cpdef set_to_zero(MatrixWindow self) # FOR BETTER SPEED, OVERRIDE ANY SUBSET OF THESE (OPTIONAL): - cpdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x) noexcept - cpdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept - cpdef to_matrix(MatrixWindow self) noexcept - cpdef new_empty_window(MatrixWindow self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept + cpdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x) + cpdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) + cpdef to_matrix(MatrixWindow self) + cpdef new_empty_window(MatrixWindow self, Py_ssize_t nrows, Py_ssize_t ncols) # NO BENEFIT TO OVERRIDING THESE: cpdef MatrixWindow matrix_window(MatrixWindow self, Py_ssize_t row, Py_ssize_t col, - Py_ssize_t n_rows, Py_ssize_t n_cols) noexcept + Py_ssize_t n_rows, Py_ssize_t n_cols) cpdef MatrixWindow new_matrix_window(MatrixWindow self, Matrix matrix, Py_ssize_t row, Py_ssize_t col, - Py_ssize_t n_rows, Py_ssize_t n_cols) noexcept - cpdef matrix(MatrixWindow self) noexcept - cpdef swap_rows(MatrixWindow self, Py_ssize_t a, Py_ssize_t b) noexcept - cdef object _zero(self) noexcept + Py_ssize_t n_rows, Py_ssize_t n_cols) + cpdef matrix(MatrixWindow self) + cpdef swap_rows(MatrixWindow self, Py_ssize_t a, Py_ssize_t b) + cdef object _zero(self) diff --git a/src/sage/matrix/matrix_window.pyx b/src/sage/matrix/matrix_window.pyx index 671eee0a845..11a8c0ed1b2 100644 --- a/src/sage/matrix/matrix_window.pyx +++ b/src/sage/matrix/matrix_window.pyx @@ -22,7 +22,7 @@ cdef class MatrixWindow: cpdef MatrixWindow new_matrix_window(MatrixWindow self, Matrix matrix, Py_ssize_t row, Py_ssize_t col, - Py_ssize_t n_rows, Py_ssize_t n_cols) noexcept: + Py_ssize_t n_rows, Py_ssize_t n_cols): """ This method is here only to provide a fast cdef way of constructing new matrix windows. The only implicit assumption @@ -47,13 +47,13 @@ cdef class MatrixWindow: self._nrows = nrows self._ncols = ncols - cdef object _zero(self) noexcept: + cdef object _zero(self): if self._cached_zero is None: self._cached_zero = self._matrix.base_ring()(0) # expensive return self._cached_zero cpdef MatrixWindow matrix_window(MatrixWindow self, Py_ssize_t row, Py_ssize_t col, - Py_ssize_t n_rows, Py_ssize_t n_cols) noexcept: + Py_ssize_t n_rows, Py_ssize_t n_cols): """ Returns a matrix window relative to this window of the underlying matrix. @@ -62,7 +62,7 @@ cdef class MatrixWindow: return self return self.new_matrix_window(self._matrix, self._row + row, self._col + col, n_rows, n_cols) - cpdef new_empty_window(MatrixWindow self, Py_ssize_t nrows, Py_ssize_t ncols) noexcept: + cpdef new_empty_window(MatrixWindow self, Py_ssize_t nrows, Py_ssize_t ncols): a = self._matrix.new_matrix(nrows, ncols) return self.new_matrix_window(a, 0, 0, nrows, ncols) @@ -79,10 +79,10 @@ cdef class MatrixWindow: raise TypeError("Parents must be equal.") self.set_to(src) - cpdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x) noexcept: + cpdef set_unsafe(self, Py_ssize_t i, Py_ssize_t j, x): self._matrix.set_unsafe(i + self._row, j + self._col, x) - cpdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j) noexcept: + cpdef get_unsafe(self, Py_ssize_t i, Py_ssize_t j): return self._matrix.get_unsafe(i + self._row, j + self._col) def __setitem__(self, ij, x): @@ -119,14 +119,14 @@ cdef class MatrixWindow: i = ij return self.row(i) - cpdef matrix(MatrixWindow self) noexcept: + cpdef matrix(MatrixWindow self): """ Returns the underlying matrix that this window is a view of. """ return self._matrix - cpdef to_matrix(MatrixWindow self) noexcept: + cpdef to_matrix(MatrixWindow self): """ Returns an actual matrix object representing this view. """ @@ -142,7 +142,7 @@ cdef class MatrixWindow: def ncols(MatrixWindow self): return self._ncols - cpdef set_to(MatrixWindow self, MatrixWindow A) noexcept: + cpdef set_to(MatrixWindow self, MatrixWindow A): """ Change self, making it equal A. """ @@ -154,14 +154,14 @@ cdef class MatrixWindow: self.set_unsafe(i, j, A.get_unsafe(i, j)) return 0 - cpdef set_to_zero(MatrixWindow self) noexcept: + cpdef set_to_zero(MatrixWindow self): cdef Py_ssize_t i, j z = self._zero() for i from 0 <= i < self._nrows: for j from 0 <= j < self._ncols: self.set_unsafe(i, j, z) - cpdef add(MatrixWindow self, MatrixWindow A) noexcept: + cpdef add(MatrixWindow self, MatrixWindow A): cdef Py_ssize_t i, j if self._nrows != A._nrows or self._ncols != A._ncols: raise ArithmeticError("incompatible dimensions") @@ -169,7 +169,7 @@ cdef class MatrixWindow: for j from 0 <= j < self._ncols: self.set_unsafe(i, j, self.get_unsafe(i, j) + A.get_unsafe(i, j)) - cpdef subtract(MatrixWindow self, MatrixWindow A) noexcept: + cpdef subtract(MatrixWindow self, MatrixWindow A): cdef Py_ssize_t i, j if self._nrows != A._nrows or self._ncols != A._ncols: raise ArithmeticError("incompatible dimensions") @@ -177,7 +177,7 @@ cdef class MatrixWindow: for j from 0 <= j < self._ncols: self.set_unsafe(i, j, self.get_unsafe(i, j) - A.get_unsafe(i, j)) - cpdef set_to_sum(MatrixWindow self, MatrixWindow A, MatrixWindow B) noexcept: + cpdef set_to_sum(MatrixWindow self, MatrixWindow A, MatrixWindow B): cdef Py_ssize_t i, j if self._nrows != A._nrows or self._ncols != A._ncols: raise ArithmeticError("incompatible dimensions") @@ -187,13 +187,13 @@ cdef class MatrixWindow: for j from 0 <= j < self._ncols: self.set_unsafe(i, j, A.get_unsafe(i, j) + B.get_unsafe(i, j)) - cpdef set_to_diff(MatrixWindow self, MatrixWindow A, MatrixWindow B) noexcept: + cpdef set_to_diff(MatrixWindow self, MatrixWindow A, MatrixWindow B): cdef Py_ssize_t i, j for i from 0 <= i < self._nrows: for j from 0 <= j < self._ncols: self.set_unsafe(i, j, A.get_unsafe(i, j) - B.get_unsafe(i, j)) - cpdef set_to_prod(MatrixWindow self, MatrixWindow A, MatrixWindow B) noexcept: + cpdef set_to_prod(MatrixWindow self, MatrixWindow A, MatrixWindow B): cdef Py_ssize_t i, j, k if A._ncols != B._nrows or self._nrows != A._nrows or self._ncols != B._ncols: raise ArithmeticError("incompatible dimensions") @@ -204,7 +204,7 @@ cdef class MatrixWindow: s = s + A.get_unsafe(i, k) * B.get_unsafe(k, j) self.set_unsafe(i, j, s) - cpdef add_prod(MatrixWindow self, MatrixWindow A, MatrixWindow B) noexcept: + cpdef add_prod(MatrixWindow self, MatrixWindow A, MatrixWindow B): cdef Py_ssize_t i, j, k if A._ncols != B._nrows or self._nrows != A._nrows or self._ncols != B._ncols: raise ArithmeticError("incompatible dimensions") @@ -215,7 +215,7 @@ cdef class MatrixWindow: s = s + A.get_unsafe(i, k) * B.get_unsafe(k, j) self.set_unsafe(i, j, s) - cpdef subtract_prod(MatrixWindow self, MatrixWindow A, MatrixWindow B) noexcept: + cpdef subtract_prod(MatrixWindow self, MatrixWindow A, MatrixWindow B): cdef Py_ssize_t i, j, k if A._ncols != B._nrows or self._nrows != A._nrows or self._ncols != B._ncols: raise ArithmeticError("incompatible dimensions") @@ -226,7 +226,7 @@ cdef class MatrixWindow: s = s - A.get_unsafe(i, k) * B.get_unsafe(k, j) self.set_unsafe(i, j, s) - cpdef swap_rows(MatrixWindow self, Py_ssize_t a, Py_ssize_t b) noexcept: + cpdef swap_rows(MatrixWindow self, Py_ssize_t a, Py_ssize_t b): self._matrix.swap_rows_c(self._row + a, self._row + b) def echelon_in_place(MatrixWindow self): diff --git a/src/sage/matrix/strassen.pyx b/src/sage/matrix/strassen.pyx index d45e5216747..e568011adb7 100644 --- a/src/sage/matrix/strassen.pyx +++ b/src/sage/matrix/strassen.pyx @@ -50,7 +50,7 @@ def strassen_window_multiply(C, A,B, cutoff): cdef strassen_window_multiply_c(MatrixWindow C, MatrixWindow A, - MatrixWindow B, Py_ssize_t cutoff) noexcept: + MatrixWindow B, Py_ssize_t cutoff): # todo -- I'm not sure how to interpret "cutoff". Should it be... # (a) the minimum side length of the matrices (currently implemented below) # (b) the maximum side length of the matrices @@ -235,7 +235,7 @@ cdef strassen_window_multiply_c(MatrixWindow C, MatrixWindow A, C_bulk = C.matrix_window(0, 0, A_sub_nrows << 1, B_sub_ncols << 1) C_bulk.add_prod(A_last_col, B_last_row) -cdef subtract_strassen_product(MatrixWindow result, MatrixWindow A, MatrixWindow B, Py_ssize_t cutoff) noexcept: +cdef subtract_strassen_product(MatrixWindow result, MatrixWindow A, MatrixWindow B, Py_ssize_t cutoff): cdef MatrixWindow to_sub if (cutoff == -1 or result.ncols() <= cutoff or result.nrows() <= cutoff): result.subtract_prod(A, B) @@ -311,7 +311,7 @@ def strassen_echelon(MatrixWindow A, cutoff): sig_off() -cdef strassen_echelon_c(MatrixWindow A, Py_ssize_t cutoff, Py_ssize_t mul_cutoff) noexcept: +cdef strassen_echelon_c(MatrixWindow A, Py_ssize_t cutoff, Py_ssize_t mul_cutoff): # The following notation will be used in the comments below, which should be understood to give # the general idea of what's going on, as if there were no inconvenient non-pivot columns. # The original matrix is given by [ A B ] diff --git a/src/sage/matroids/basis_exchange_matroid.pxd b/src/sage/matroids/basis_exchange_matroid.pxd index 5877f62fc09..2a36ed6a95b 100644 --- a/src/sage/matroids/basis_exchange_matroid.pxd +++ b/src/sage/matroids/basis_exchange_matroid.pxd @@ -15,86 +15,86 @@ cdef class BasisExchangeMatroid(Matroid): cdef _weak_invariant_var, _strong_invariant_var, _heuristic_invariant_var cdef SetSystem _weak_partition_var, _strong_partition_var, _heuristic_partition_var - cdef _relabel(self, l) noexcept + cdef _relabel(self, l) - cdef _pack(self, bitset_t, X) noexcept - cdef __unpack(self, bitset_t) noexcept + cdef _pack(self, bitset_t, X) + cdef __unpack(self, bitset_t) cdef bint _is_exchange_pair(self, long x, long y) except -1 cdef int _exchange(self, long x, long y) except -1 cdef int _move(self, bitset_t X, bitset_t Y) except -1 - cdef __fundamental_cocircuit(self, bitset_t, long x) noexcept - cdef __fundamental_circuit(self, bitset_t, long y) noexcept + cdef __fundamental_cocircuit(self, bitset_t, long x) + cdef __fundamental_circuit(self, bitset_t, long y) - cdef __max_independent(self, bitset_t, bitset_t) noexcept - cdef __circuit(self, bitset_t, bitset_t) noexcept - cdef __closure(self, bitset_t, bitset_t) noexcept - cdef __max_coindependent(self, bitset_t, bitset_t) noexcept - cdef __cocircuit(self, bitset_t, bitset_t) noexcept - cdef _coclosure_internal(self, bitset_t, bitset_t) noexcept + cdef __max_independent(self, bitset_t, bitset_t) + cdef __circuit(self, bitset_t, bitset_t) + cdef __closure(self, bitset_t, bitset_t) + cdef __max_coindependent(self, bitset_t, bitset_t) + cdef __cocircuit(self, bitset_t, bitset_t) + cdef _coclosure_internal(self, bitset_t, bitset_t) - cdef __augment(self, bitset_t, bitset_t, bitset_t) noexcept + cdef __augment(self, bitset_t, bitset_t, bitset_t) cdef bint __is_independent(self, bitset_t F) except -1 - cdef __move_current_basis(self, bitset_t, bitset_t) noexcept + cdef __move_current_basis(self, bitset_t, bitset_t) cdef bint _set_current_basis(self, F) noexcept - cpdef groundset(self) noexcept - cpdef groundset_list(self) noexcept - cpdef full_rank(self) noexcept - cpdef full_corank(self) noexcept - - cpdef basis(self) noexcept - cpdef _move_current_basis(self, X, Y) noexcept - - cpdef _max_independent(self, F) noexcept - cpdef _rank(self, F) noexcept - cpdef _circuit(self, F) noexcept - cpdef _fundamental_circuit(self, B, e) noexcept - cpdef _closure(self, F) noexcept - - cpdef _max_coindependent(self, F) noexcept - cpdef _corank(self, F) noexcept - cpdef _cocircuit(self, F) noexcept - cpdef _fundamental_cocircuit(self, B, e) noexcept - cpdef _coclosure(self, F) noexcept - - cpdef _augment(self, X, Y) noexcept - cpdef _is_independent(self, F) noexcept - - cpdef f_vector(self) noexcept - cdef _f_vector_rec(self, object f_vec, bitset_t* flats, bitset_t* todo, long elt, long rnk) noexcept - cpdef flats(self, R) noexcept - cdef _flats_rec(self, SetSystem Rflats, long R, bitset_t* flats, bitset_t* todo, long elt, long rnk) noexcept - cpdef coflats(self, R) noexcept - cdef _coflats_rec(self, SetSystem Rcoflats, long R, bitset_t* coflats, bitset_t* todo, long elt, long cornk) noexcept - cdef _flat_element_inv(self, long k) noexcept - cdef _flat_element_inv_rec(self, object f_inc, long R, bitset_t* flats, bitset_t* todo, long elt, long i) noexcept - - cpdef bases_count(self) noexcept - cpdef independent_r_sets(self, long r) noexcept - cpdef bases(self) noexcept - cpdef dependent_r_sets(self, long r) noexcept - cpdef nonbases(self) noexcept - - cpdef nonspanning_circuits(self) noexcept - cpdef cocircuits(self) noexcept - cpdef circuits(self) noexcept - - cpdef _characteristic_setsystem(self) noexcept - cpdef _weak_invariant(self) noexcept - cpdef _weak_partition(self) noexcept - cpdef _strong_invariant(self) noexcept - cpdef _strong_partition(self) noexcept - cpdef _heuristic_invariant(self) noexcept - cpdef _heuristic_partition(self) noexcept - cdef _flush(self) noexcept - - cpdef _equitable_partition(self, P=*) noexcept - cpdef _is_isomorphic(self, other, certificate=*) noexcept - cpdef _isomorphism(self, other) noexcept - cpdef _is_isomorphism(self, other, morphism) noexcept + cpdef groundset(self) + cpdef groundset_list(self) + cpdef full_rank(self) + cpdef full_corank(self) + + cpdef basis(self) + cpdef _move_current_basis(self, X, Y) + + cpdef _max_independent(self, F) + cpdef _rank(self, F) + cpdef _circuit(self, F) + cpdef _fundamental_circuit(self, B, e) + cpdef _closure(self, F) + + cpdef _max_coindependent(self, F) + cpdef _corank(self, F) + cpdef _cocircuit(self, F) + cpdef _fundamental_cocircuit(self, B, e) + cpdef _coclosure(self, F) + + cpdef _augment(self, X, Y) + cpdef _is_independent(self, F) + + cpdef f_vector(self) + cdef _f_vector_rec(self, object f_vec, bitset_t* flats, bitset_t* todo, long elt, long rnk) + cpdef flats(self, R) + cdef _flats_rec(self, SetSystem Rflats, long R, bitset_t* flats, bitset_t* todo, long elt, long rnk) + cpdef coflats(self, R) + cdef _coflats_rec(self, SetSystem Rcoflats, long R, bitset_t* coflats, bitset_t* todo, long elt, long cornk) + cdef _flat_element_inv(self, long k) + cdef _flat_element_inv_rec(self, object f_inc, long R, bitset_t* flats, bitset_t* todo, long elt, long i) + + cpdef bases_count(self) + cpdef independent_r_sets(self, long r) + cpdef bases(self) + cpdef dependent_r_sets(self, long r) + cpdef nonbases(self) + + cpdef nonspanning_circuits(self) + cpdef cocircuits(self) + cpdef circuits(self) + + cpdef _characteristic_setsystem(self) + cpdef _weak_invariant(self) + cpdef _weak_partition(self) + cpdef _strong_invariant(self) + cpdef _strong_partition(self) + cpdef _heuristic_invariant(self) + cpdef _heuristic_partition(self) + cdef _flush(self) + + cpdef _equitable_partition(self, P=*) + cpdef _is_isomorphic(self, other, certificate=*) + cpdef _isomorphism(self, other) + cpdef _is_isomorphism(self, other, morphism) cdef bint __is_isomorphism(self, BasisExchangeMatroid other, morphism) noexcept - cpdef is_valid(self) noexcept + cpdef is_valid(self) cdef bint nxksrd(bitset_s *b, long n, long k, bint succ) noexcept diff --git a/src/sage/matroids/basis_exchange_matroid.pyx b/src/sage/matroids/basis_exchange_matroid.pyx index bfa13b44c02..a6a38c58082 100644 --- a/src/sage/matroids/basis_exchange_matroid.pyx +++ b/src/sage/matroids/basis_exchange_matroid.pyx @@ -191,7 +191,7 @@ cdef class BasisExchangeMatroid(Matroid): bitset_free(self._output) bitset_free(self._temp) - cdef _relabel(self, l) noexcept: + cdef _relabel(self, l): """ Relabel each element `e` as `l[e]`, where `l` is a given injective map. @@ -230,7 +230,7 @@ cdef class BasisExchangeMatroid(Matroid): self._heuristic_partition_var._relabel(l) # the engine - cdef _pack(self, bitset_t I, F) noexcept: + cdef _pack(self, bitset_t I, F): """ Encode a subset F of the groundset into a bitpacked set of integers """ @@ -238,7 +238,7 @@ cdef class BasisExchangeMatroid(Matroid): for f in F: bitset_add(I, self._idx[f]) - cdef __unpack(self, bitset_t I) noexcept: + cdef __unpack(self, bitset_t I): """ Unencode a bitpacked set of integers to a subset of the groundset. """ @@ -285,7 +285,7 @@ cdef class BasisExchangeMatroid(Matroid): y = bitset_next(Y, y + 1) x = bitset_next(X, x + 1) - cdef __fundamental_cocircuit(self, bitset_t C, long x) noexcept: + cdef __fundamental_cocircuit(self, bitset_t C, long x): """ Return the unique cocircuit that meets ``self._current_basis`` in exactly element ``x``. """ @@ -299,7 +299,7 @@ cdef class BasisExchangeMatroid(Matroid): y = bitset_next(self._temp, y + 1) bitset_add(C, x) - cdef __fundamental_circuit(self, bitset_t C, long y) noexcept: + cdef __fundamental_circuit(self, bitset_t C, long y): """ Return the unique circuit contained in ``self._current_basis`` union ``y``. """ @@ -312,7 +312,7 @@ cdef class BasisExchangeMatroid(Matroid): x = bitset_next(self._current_basis, x + 1) bitset_add(C, y) - cdef __max_independent(self, bitset_t R, bitset_t F) noexcept: + cdef __max_independent(self, bitset_t R, bitset_t F): """ Bitpacked version of ``max_independent``. """ @@ -321,7 +321,7 @@ cdef class BasisExchangeMatroid(Matroid): self._move(self._inside, self._outside) bitset_intersection(R, self._current_basis, F) - cdef __circuit(self, bitset_t R, bitset_t F) noexcept: + cdef __circuit(self, bitset_t R, bitset_t F): """ Bitpacked version of ``circuit``. """ @@ -348,7 +348,7 @@ cdef class BasisExchangeMatroid(Matroid): return y = bitset_next(self._outside, y + 1) - cdef __closure(self, bitset_t R, bitset_t F) noexcept: + cdef __closure(self, bitset_t R, bitset_t F): """ Bitpacked version of ``closure``. """ @@ -362,7 +362,7 @@ cdef class BasisExchangeMatroid(Matroid): bitset_difference(R, R, F) x = bitset_next(self._inside, x + 1) - cdef __max_coindependent(self, bitset_t R, bitset_t F) noexcept: + cdef __max_coindependent(self, bitset_t R, bitset_t F): """ Bitpacked version of ``max_coindependent``. """ @@ -372,7 +372,7 @@ cdef class BasisExchangeMatroid(Matroid): self._move(self._inside, self._outside) bitset_difference(R, F, self._current_basis) - cdef __cocircuit(self, bitset_t R, bitset_t F) noexcept: + cdef __cocircuit(self, bitset_t R, bitset_t F): """ Bitpacked version of ``cocircuit``. """ @@ -400,7 +400,7 @@ cdef class BasisExchangeMatroid(Matroid): return x = bitset_next(self._inside, x + 1) - cdef _coclosure_internal(self, bitset_t R, bitset_t F) noexcept: + cdef _coclosure_internal(self, bitset_t R, bitset_t F): """ Bitpacked version of ``closure``. """ @@ -415,7 +415,7 @@ cdef class BasisExchangeMatroid(Matroid): bitset_difference(R, R, F) y = bitset_next(self._outside, y + 1) - cdef __augment(self, bitset_t R, bitset_t X, bitset_t Y) noexcept: + cdef __augment(self, bitset_t R, bitset_t X, bitset_t Y): """ Bitpacked version of ``augment``. """ @@ -436,7 +436,7 @@ cdef class BasisExchangeMatroid(Matroid): self._move(self._inside, self._outside) return bitset_isempty(self._outside) - cdef __move_current_basis(self, bitset_t X, bitset_t Y) noexcept: + cdef __move_current_basis(self, bitset_t X, bitset_t Y): """ Bitpacked version of ``_move_current_basis``. """ @@ -460,7 +460,7 @@ cdef class BasisExchangeMatroid(Matroid): return bitset_isempty(self._outside) and bitset_isempty(self._inside) # groundset and full_rank - cpdef groundset(self) noexcept: + cpdef groundset(self): """ Return the groundset of the matroid. @@ -478,7 +478,7 @@ cdef class BasisExchangeMatroid(Matroid): """ return self._groundset - cpdef groundset_list(self) noexcept: + cpdef groundset_list(self): """ Return a list of elements of the groundset of the matroid. @@ -523,7 +523,7 @@ cdef class BasisExchangeMatroid(Matroid): """ return self._groundset_size - cpdef full_rank(self) noexcept: + cpdef full_rank(self): r""" Return the rank of the matroid. @@ -544,7 +544,7 @@ cdef class BasisExchangeMatroid(Matroid): """ return self._matroid_rank - cpdef full_corank(self) noexcept: + cpdef full_corank(self): r""" Return the corank of the matroid. @@ -572,7 +572,7 @@ cdef class BasisExchangeMatroid(Matroid): # matroid oracles - cpdef basis(self) noexcept: + cpdef basis(self): r""" Return an arbitrary basis of the matroid. @@ -600,7 +600,7 @@ cdef class BasisExchangeMatroid(Matroid): """ return self.__unpack(self._current_basis) - cpdef _move_current_basis(self, X, Y) noexcept: + cpdef _move_current_basis(self, X, Y): """ Change current basis so that intersection with X is maximized, intersection with Y is minimized. @@ -630,7 +630,7 @@ cdef class BasisExchangeMatroid(Matroid): self._pack(self._input2, Y) self.__move_current_basis(self._input, self._input2) - cpdef _max_independent(self, F) noexcept: + cpdef _max_independent(self, F): """ Compute a maximal independent subset. @@ -660,7 +660,7 @@ cdef class BasisExchangeMatroid(Matroid): self.__max_independent(self._output, self._input) return self.__unpack(self._output) - cpdef _rank(self, F) noexcept: + cpdef _rank(self, F): """ Compute the rank of a subset of the ground set. @@ -690,7 +690,7 @@ cdef class BasisExchangeMatroid(Matroid): self.__max_independent(self._output, self._input) return bitset_len(self._output) - cpdef _circuit(self, F) noexcept: + cpdef _circuit(self, F): """ Return a minimal dependent subset. @@ -727,7 +727,7 @@ cdef class BasisExchangeMatroid(Matroid): self.__circuit(self._output, self._input) return self.__unpack(self._output) - cpdef _fundamental_circuit(self, B, e) noexcept: + cpdef _fundamental_circuit(self, B, e): r""" Return the `B`-fundamental circuit using `e`. @@ -754,7 +754,7 @@ cdef class BasisExchangeMatroid(Matroid): self.__fundamental_circuit(self._output, self._idx[e]) return self.__unpack(self._output) - cpdef _closure(self, F) noexcept: + cpdef _closure(self, F): """ Return the closure of a set. @@ -784,7 +784,7 @@ cdef class BasisExchangeMatroid(Matroid): self.__closure(self._output, self._input) return self.__unpack(self._output) - cpdef _max_coindependent(self, F) noexcept: + cpdef _max_coindependent(self, F): """ Compute a maximal coindependent subset. @@ -814,7 +814,7 @@ cdef class BasisExchangeMatroid(Matroid): self.__max_coindependent(self._output, self._input) return self.__unpack(self._output) - cpdef _corank(self, F) noexcept: + cpdef _corank(self, F): """ Return the corank of a set. @@ -844,7 +844,7 @@ cdef class BasisExchangeMatroid(Matroid): self.__max_coindependent(self._output, self._input) return bitset_len(self._output) - cpdef _cocircuit(self, F) noexcept: + cpdef _cocircuit(self, F): """ Return a minimal codependent subset. @@ -881,7 +881,7 @@ cdef class BasisExchangeMatroid(Matroid): self.__cocircuit(self._output, self._input) return self.__unpack(self._output) - cpdef _fundamental_cocircuit(self, B, e) noexcept: + cpdef _fundamental_cocircuit(self, B, e): r""" Return the `B`-fundamental circuit using `e`. @@ -908,7 +908,7 @@ cdef class BasisExchangeMatroid(Matroid): self.__fundamental_cocircuit(self._output, self._idx[e]) return self.__unpack(self._output) - cpdef _coclosure(self, F) noexcept: + cpdef _coclosure(self, F): """ Return the coclosure of a set. @@ -938,7 +938,7 @@ cdef class BasisExchangeMatroid(Matroid): self._coclosure_internal(self._output, self._input) return self.__unpack(self._output) - cpdef _augment(self, X, Y) noexcept: + cpdef _augment(self, X, Y): r""" Return a maximal subset `I` of `Y` such that `r(X + I)=r(X) + r(I)`. @@ -968,7 +968,7 @@ cdef class BasisExchangeMatroid(Matroid): self.__augment(self._output, self._input, self._input2) return self.__unpack(self._output) - cpdef _is_independent(self, F) noexcept: + cpdef _is_independent(self, F): """ Test if input is independent. @@ -1001,7 +1001,7 @@ cdef class BasisExchangeMatroid(Matroid): # connectivity - cpdef components(self) noexcept: + cpdef components(self): """ Return an iterable containing the components of the matroid. @@ -1085,7 +1085,7 @@ cdef class BasisExchangeMatroid(Matroid): sig_free(comp) return res - cpdef _link(self, S, T) noexcept: + cpdef _link(self, S, T): r""" Given disjoint subsets `S` and `T`, return a connector `I` and a separation `X`, which are optimal dual solutions in Tutte's Linking Theorem: @@ -1232,7 +1232,7 @@ cdef class BasisExchangeMatroid(Matroid): # enumeration - cpdef f_vector(self) noexcept: + cpdef f_vector(self): r""" Return the `f`-vector of the matroid. @@ -1272,7 +1272,7 @@ cdef class BasisExchangeMatroid(Matroid): sig_free(todo) return f_vec - cdef _f_vector_rec(self, object f_vec, bitset_t* flats, bitset_t* todo, long elt, long i) noexcept: + cdef _f_vector_rec(self, object f_vec, bitset_t* flats, bitset_t* todo, long elt, long i): """ Recursion for the f_vector method. """ @@ -1290,7 +1290,7 @@ cdef class BasisExchangeMatroid(Matroid): self._f_vector_rec(f_vec, flats, todo, e + 1, i + 1) e = bitset_next(todo[i], e) - cpdef flats(self, r) noexcept: + cpdef flats(self, r): """ Return the collection of flats of the matroid of specified rank. @@ -1345,7 +1345,7 @@ cdef class BasisExchangeMatroid(Matroid): sig_free(todo) return Rflats - cdef _flats_rec(self, SetSystem Rflats, long R, bitset_t* flats, bitset_t* todo, long elt, long i) noexcept: + cdef _flats_rec(self, SetSystem Rflats, long R, bitset_t* flats, bitset_t* todo, long elt, long i): """ Recursion for the ``flats`` method. """ @@ -1365,7 +1365,7 @@ cdef class BasisExchangeMatroid(Matroid): self._flats_rec(Rflats, R, flats, todo, e + 1, i + 1) e = bitset_next(todo[i], e) - cpdef coflats(self, r) noexcept: + cpdef coflats(self, r): """ Return the collection of coflats of the matroid of specified corank. @@ -1420,7 +1420,7 @@ cdef class BasisExchangeMatroid(Matroid): sig_free(todo) return Rcoflats - cdef _coflats_rec(self, SetSystem Rcoflats, long R, bitset_t* coflats, bitset_t* todo, long elt, long i) noexcept: + cdef _coflats_rec(self, SetSystem Rcoflats, long R, bitset_t* coflats, bitset_t* todo, long elt, long i): """ Recursion for the ``coflats`` method. """ @@ -1440,7 +1440,7 @@ cdef class BasisExchangeMatroid(Matroid): self._coflats_rec(Rcoflats, R, coflats, todo, e + 1, i + 1) e = bitset_next(todo[i], e) - cdef _flat_element_inv(self, long k) noexcept: + cdef _flat_element_inv(self, long k): """ Compute a flat-element invariant of the matroid. """ @@ -1475,7 +1475,7 @@ cdef class BasisExchangeMatroid(Matroid): f_vec = tuple([f_inc[i][self._groundset_size] for i in range(k + 1)]) return fie, f_vec - cdef _flat_element_inv_rec(self, object f_inc, long R, bitset_t* flats, bitset_t* todo, long elt, long i) noexcept: + cdef _flat_element_inv_rec(self, object f_inc, long R, bitset_t* flats, bitset_t* todo, long elt, long i): """ Recursion for ``_flat_element_inv``. """ @@ -1502,7 +1502,7 @@ cdef class BasisExchangeMatroid(Matroid): self._flat_element_inv_rec(f_inc, R, flats, todo, e + 1, i + 1) e = bitset_next(todo[i], e) - cpdef bases_count(self) noexcept: + cpdef bases_count(self): """ Return the number of bases of the matroid. @@ -1535,7 +1535,7 @@ cdef class BasisExchangeMatroid(Matroid): self._bcount = res return self._bcount - cpdef independent_sets(self) noexcept: + cpdef independent_sets(self): r""" Return the list of independent subsets of the matroid. @@ -1591,7 +1591,7 @@ cdef class BasisExchangeMatroid(Matroid): sig_free(T) return res - cpdef independent_r_sets(self, long r) noexcept: + cpdef independent_r_sets(self, long r): """ Return the list of size-``r`` independent subsets of the matroid. @@ -1625,7 +1625,7 @@ cdef class BasisExchangeMatroid(Matroid): repeat = nxksrd(self._input, self._groundset_size, r, True) return BB - cpdef bases(self) noexcept: + cpdef bases(self): """ Return the list of bases of the matroid. @@ -1645,7 +1645,7 @@ cdef class BasisExchangeMatroid(Matroid): """ return self.independent_r_sets(self.full_rank()) - cpdef dependent_r_sets(self, long r) noexcept: + cpdef dependent_r_sets(self, long r): """ Return the list of dependent subsets of fixed size. @@ -1684,7 +1684,7 @@ cdef class BasisExchangeMatroid(Matroid): NB.resize() return NB - cpdef nonbases(self) noexcept: + cpdef nonbases(self): """ Return the list of nonbases of the matroid. @@ -1709,7 +1709,7 @@ cdef class BasisExchangeMatroid(Matroid): """ return self.dependent_r_sets(self.full_rank()) - cpdef nonspanning_circuits(self) noexcept: + cpdef nonspanning_circuits(self): """ Return the list of nonspanning circuits of the matroid. @@ -1758,7 +1758,7 @@ cdef class BasisExchangeMatroid(Matroid): NSC.resize() return NSC - cpdef noncospanning_cocircuits(self) noexcept: + cpdef noncospanning_cocircuits(self): """ Return the list of noncospanning cocircuits of the matroid. @@ -1808,7 +1808,7 @@ cdef class BasisExchangeMatroid(Matroid): NSC.resize() return NSC - cpdef cocircuits(self) noexcept: + cpdef cocircuits(self): """ Return the list of cocircuits of the matroid. @@ -1856,7 +1856,7 @@ cdef class BasisExchangeMatroid(Matroid): NSC.resize() return NSC - cpdef circuits(self) noexcept: + cpdef circuits(self): """ Return the list of circuits of the matroid. @@ -1908,7 +1908,7 @@ cdef class BasisExchangeMatroid(Matroid): # isomorphism - cpdef _characteristic_setsystem(self) noexcept: + cpdef _characteristic_setsystem(self): r""" Return a characteristic set-system for this matroid, on the same ground set. @@ -1930,7 +1930,7 @@ cdef class BasisExchangeMatroid(Matroid): else: return self.noncospanning_cocircuits() - cpdef _weak_invariant(self) noexcept: + cpdef _weak_invariant(self): """ Return an isomorphism invariant of the matroid. @@ -1961,7 +1961,7 @@ cdef class BasisExchangeMatroid(Matroid): self._weak_partition_var = SetSystem(self._E, [fie[f] for f in sorted(fie)]) return self._weak_invariant_var - cpdef _weak_partition(self) noexcept: + cpdef _weak_partition(self): """ Return an ordered partition based on the incidences of elements with low-dimensional flats. @@ -1975,7 +1975,7 @@ cdef class BasisExchangeMatroid(Matroid): self._weak_invariant() return self._weak_partition_var - cpdef _strong_invariant(self) noexcept: + cpdef _strong_invariant(self): """ Return an isomorphism invariant of the matroid. @@ -2001,7 +2001,7 @@ cdef class BasisExchangeMatroid(Matroid): self._strong_invariant_var = CP[2] return self._strong_invariant_var - cpdef _strong_partition(self) noexcept: + cpdef _strong_partition(self): """ Return an equitable partition which refines _weak_partition(). @@ -2015,7 +2015,7 @@ cdef class BasisExchangeMatroid(Matroid): self._strong_invariant() return self._strong_partition_var - cpdef _heuristic_invariant(self) noexcept: + cpdef _heuristic_invariant(self): """ Return a number characteristic for the construction of _heuristic_partition(). @@ -2034,7 +2034,7 @@ cdef class BasisExchangeMatroid(Matroid): self._heuristic_invariant_var = CP[2] return self._heuristic_invariant_var - cpdef _heuristic_partition(self) noexcept: + cpdef _heuristic_partition(self): """ Return an ordered partition into singletons which refines an equitable partition of the matroid. @@ -2058,7 +2058,7 @@ cdef class BasisExchangeMatroid(Matroid): self._heuristic_invariant() return self._heuristic_partition_var - cdef _flush(self) noexcept: + cdef _flush(self): """ Delete all invariants. """ @@ -2066,7 +2066,7 @@ cdef class BasisExchangeMatroid(Matroid): self._strong_invariant_var = None self._heuristic_invariant_var = None - cpdef _equitable_partition(self, P=None) noexcept: + cpdef _equitable_partition(self, P=None): """ Return the equitable refinement of a given ordered partition. @@ -2097,7 +2097,7 @@ cdef class BasisExchangeMatroid(Matroid): EQ = self._characteristic_setsystem()._equitable_partition() return EQ[0] - cpdef _is_isomorphism(self, other, morphism) noexcept: + cpdef _is_isomorphism(self, other, morphism): r""" Version of is_isomorphism() that does no type checking. @@ -2164,7 +2164,7 @@ cdef class BasisExchangeMatroid(Matroid): repeat = nxksrd(self._input, self._groundset_size, self._matroid_rank, True) return True - cpdef _isomorphism(self, other) noexcept: + cpdef _isomorphism(self, other): """ Return an isomorphism form ``self`` to ``other``, if one exists. @@ -2252,7 +2252,7 @@ cdef class BasisExchangeMatroid(Matroid): return self._characteristic_setsystem()._isomorphism(other._characteristic_setsystem(), PS, PO) - cpdef _is_isomorphic(self, other, certificate=False) noexcept: + cpdef _is_isomorphic(self, other, certificate=False): """ Test if ``self`` is isomorphic to ``other``. @@ -2338,7 +2338,7 @@ cdef class BasisExchangeMatroid(Matroid): return self._characteristic_setsystem()._isomorphism(other._characteristic_setsystem(), PS, PO) is not None - cpdef is_valid(self) noexcept: + cpdef is_valid(self): r""" Test if the data obey the matroid axioms. diff --git a/src/sage/matroids/basis_matroid.pxd b/src/sage/matroids/basis_matroid.pxd index aeb59fdb66f..3782b51c5fa 100644 --- a/src/sage/matroids/basis_matroid.pxd +++ b/src/sage/matroids/basis_matroid.pxd @@ -14,33 +14,33 @@ cdef class BasisMatroid(BasisExchangeMatroid): cdef _bases_invariant3_var cdef SetSystem _bases_partition3_var - cdef reset_current_basis(self) noexcept - - cpdef _is_basis(self, X) noexcept - - cpdef bases_count(self) noexcept - cpdef bases(self) noexcept - cpdef nonbases(self) noexcept - - cpdef truncation(self) noexcept - cpdef _extension(self, e, H) noexcept - cpdef _with_coloop(self, e) noexcept - cpdef relabel(self, l) noexcept - - cpdef _bases_invariant(self) noexcept - cpdef _bases_partition(self) noexcept - cpdef _bases_invariant2(self) noexcept - cpdef _bases_partition2(self) noexcept - cpdef _bases_invariant3(self) noexcept - cpdef _bases_partition3(self) noexcept - cdef _reset_invariants(self) noexcept + cdef reset_current_basis(self) + + cpdef _is_basis(self, X) + + cpdef bases_count(self) + cpdef bases(self) + cpdef nonbases(self) + + cpdef truncation(self) + cpdef _extension(self, e, H) + cpdef _with_coloop(self, e) + cpdef relabel(self, l) + + cpdef _bases_invariant(self) + cpdef _bases_partition(self) + cpdef _bases_invariant2(self) + cpdef _bases_partition2(self) + cpdef _bases_invariant3(self) + cpdef _bases_partition3(self) + cdef _reset_invariants(self) cpdef bint is_distinguished(self, e) noexcept - cpdef _is_relaxation(self, M, morphism) noexcept - cpdef _is_isomorphism(self, M, morphism) noexcept - cpdef _isomorphism(self, other) noexcept - cpdef _is_isomorphic(self, other, certificate=*) noexcept + cpdef _is_relaxation(self, M, morphism) + cpdef _is_isomorphism(self, M, morphism) + cpdef _isomorphism(self, other) + cpdef _is_isomorphic(self, other, certificate=*) -cdef binom_init(long n, long k) noexcept +cdef binom_init(long n, long k) cdef long set_to_index(bitset_t S) noexcept -cdef index_to_set(bitset_t, long, long, long) noexcept +cdef index_to_set(bitset_t, long, long, long) diff --git a/src/sage/matroids/basis_matroid.pyx b/src/sage/matroids/basis_matroid.pyx index 137edc21d94..11458cf488d 100644 --- a/src/sage/matroids/basis_matroid.pyx +++ b/src/sage/matroids/basis_matroid.pyx @@ -288,7 +288,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): bitset_add(self._b, y) return bitset_in(self._bb, set_to_index(self._b)) - cdef reset_current_basis(self) noexcept: + cdef reset_current_basis(self): """ Set the current basis to the (lexicographically) first basis of the matroid. @@ -297,7 +297,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): # a function that is very efficient for this class - cpdef _is_basis(self, X) noexcept: + cpdef _is_basis(self, X): """ Test if input is a basis. @@ -329,7 +329,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): # dual and minors - cpdef dual(self) noexcept: + cpdef dual(self): r""" Return the dual of the matroid. @@ -369,7 +369,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): D._bcount = self._bcount return D - cpdef _minor(self, contractions, deletions) noexcept: + cpdef _minor(self, contractions, deletions): """ Return a minor. @@ -405,7 +405,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): NB = [frozenset(B) for B in combinations(E, mr) if not self._is_basis(contractions | frozenset(B))] return BasisMatroid(groundset=E, nonbases=NB, rank=mr) - cpdef truncation(self) noexcept: + cpdef truncation(self): r""" Return a rank-1 truncation of the matroid. @@ -437,7 +437,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): return None return BasisMatroid(groundset=self._E, nonbases=self.dependent_r_sets(self.full_rank() - 1), rank=self.full_rank() - 1) - cpdef _extension(self, e, H) noexcept: + cpdef _extension(self, e, H): r""" Extend the matroid by a new element. @@ -489,7 +489,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): BE += BB return BasisMatroid(groundset=self._E + (e,), bases=BE) - cpdef _with_coloop(self, e) noexcept: + cpdef _with_coloop(self, e): r""" Return the matroid that arises by adding an element `e` to the groundset, that is a coloop of the resulting matroid. @@ -515,7 +515,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): cdef frozenset se = frozenset([e]) return BasisMatroid(groundset=self._E + (e,), bases=[B | se for B in self.bases()]) - cpdef relabel(self, l) noexcept: + cpdef relabel(self, l): """ Return an isomorphic matroid with relabeled groundset. @@ -555,7 +555,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): # enumeration - cpdef bases_count(self) noexcept: + cpdef bases_count(self): r""" Return the number of bases of the matroid. @@ -575,7 +575,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): self._bcount = bitset_len(self._bb) return self._bcount - cpdef bases(self) noexcept: + cpdef bases(self): r""" Return the list of bases of the matroid. @@ -606,7 +606,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): b = bitset_next(self._bb, b + 1) return BB - cpdef nonbases(self) noexcept: + cpdef nonbases(self): r""" Return the list of nonbases of the matroid. @@ -651,7 +651,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): # isomorphism test - cpdef _bases_invariant(self) noexcept: + cpdef _bases_invariant(self): """ Return an isomorphism invariant based on the incidences of groundset elements with bases. @@ -695,7 +695,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): self._bases_partition_var = SetSystem(self._E, [[self._E[e] for e in bi[c]] for c in sorted(bi)]) return self._bases_invariant_var - cpdef _bases_partition(self) noexcept: + cpdef _bases_partition(self): """ Return an ordered partition based on the incidences of groundset elements with bases. @@ -710,7 +710,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): self._bases_invariant() return self._bases_partition_var - cpdef _bases_invariant2(self) noexcept: + cpdef _bases_invariant2(self): """ Return an isomorphism invariant of the matroid. @@ -737,7 +737,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): self._bases_invariant2_var = CP[2] return self._bases_invariant2_var - cpdef _bases_partition2(self) noexcept: + cpdef _bases_partition2(self): """ Return an equitable partition which refines :meth:``. @@ -752,7 +752,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): self._bases_invariant2() return self._bases_partition2_var - cpdef _bases_invariant3(self) noexcept: + cpdef _bases_invariant3(self): """ Return a number characteristic for the construction of :meth:``. @@ -771,7 +771,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): self._bases_invariant3_var = CP[2] return self._bases_invariant3_var - cpdef _bases_partition3(self) noexcept: + cpdef _bases_partition3(self): """ Return an ordered partition into singletons which refines an equitable partition of the matroid. @@ -795,7 +795,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): self._bases_invariant3() return self._bases_partition3_var - cdef _reset_invariants(self) noexcept: + cdef _reset_invariants(self): """ Remove all precomputed invariants. """ @@ -855,7 +855,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): q = q2 return e in q - cpdef _is_relaxation(self, other, morphism) noexcept: + cpdef _is_relaxation(self, other, morphism): """ Return if the application of a groundset morphism to this matroid yields a relaxation of the given matroid. @@ -915,7 +915,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): bitset_free(bb_comp) return True - cpdef _is_isomorphism(self, other, morphism) noexcept: + cpdef _is_isomorphism(self, other, morphism): """ Version of :meth:`is_isomorphism` that does no type checking. @@ -953,7 +953,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): ot = other return self.bases_count() == (ot).bases_count() and self._is_relaxation(ot, morphism) - cpdef _isomorphism(self, other) noexcept: + cpdef _isomorphism(self, other): """ Return isomorphism from ``self`` to ``other``, if one exists. @@ -1032,7 +1032,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): return self.nonbases()._isomorphism(other.nonbases(), PS, PO) - cpdef _is_isomorphic(self, other, certificate=False) noexcept: + cpdef _is_isomorphic(self, other, certificate=False): """ Return if this matroid is isomorphic to the given matroid. @@ -1235,7 +1235,7 @@ cdef class BasisMatroid(BasisExchangeMatroid): cdef long binom[2956][33] # Cached binomial table -cdef binom_init(long N, long K) noexcept: +cdef binom_init(long N, long K): """ Fill up the cached binomial table. """ @@ -1277,7 +1277,7 @@ cdef long set_to_index(bitset_t S) noexcept: return index -cdef index_to_set(bitset_t S, long index, long k, long n) noexcept: +cdef index_to_set(bitset_t S, long index, long k, long n): r""" Compute the k-subset of `\{0, ..., n-1\}` of rank index """ diff --git a/src/sage/matroids/circuit_closures_matroid.pxd b/src/sage/matroids/circuit_closures_matroid.pxd index 5f4edf109b7..7c7b61ec35f 100644 --- a/src/sage/matroids/circuit_closures_matroid.pxd +++ b/src/sage/matroids/circuit_closures_matroid.pxd @@ -5,11 +5,11 @@ cdef class CircuitClosuresMatroid(Matroid): cdef frozenset _groundset # _E cdef dict _circuit_closures # _CC cdef int _matroid_rank # _R - cpdef groundset(self) noexcept - cpdef _rank(self, X) noexcept - cpdef full_rank(self) noexcept - cpdef _is_independent(self, F) noexcept - cpdef _max_independent(self, F) noexcept - cpdef _circuit(self, F) noexcept - cpdef circuit_closures(self) noexcept - cpdef _is_isomorphic(self, other, certificate=*) noexcept + cpdef groundset(self) + cpdef _rank(self, X) + cpdef full_rank(self) + cpdef _is_independent(self, F) + cpdef _max_independent(self, F) + cpdef _circuit(self, F) + cpdef circuit_closures(self) + cpdef _is_isomorphic(self, other, certificate=*) diff --git a/src/sage/matroids/circuit_closures_matroid.pyx b/src/sage/matroids/circuit_closures_matroid.pyx index 3570d59c421..42293cc2fc3 100644 --- a/src/sage/matroids/circuit_closures_matroid.pyx +++ b/src/sage/matroids/circuit_closures_matroid.pyx @@ -165,7 +165,7 @@ cdef class CircuitClosuresMatroid(Matroid): self._circuit_closures[k] = frozenset([frozenset(X) for X in circuit_closures[k]]) self._matroid_rank = self.rank(self._groundset) - cpdef groundset(self) noexcept: + cpdef groundset(self): """ Return the groundset of the matroid. @@ -183,7 +183,7 @@ cdef class CircuitClosuresMatroid(Matroid): """ return frozenset(self._groundset) - cpdef _rank(self, X) noexcept: + cpdef _rank(self, X): """ Return the rank of a set ``X``. @@ -207,7 +207,7 @@ cdef class CircuitClosuresMatroid(Matroid): return len(self._max_independent(X)) # OPTIONAL, OPTIMIZED FOR THIS CLASS - cpdef full_rank(self) noexcept: + cpdef full_rank(self): r""" Return the rank of the matroid. @@ -228,7 +228,7 @@ cdef class CircuitClosuresMatroid(Matroid): """ return self._matroid_rank - cpdef _is_independent(self, F) noexcept: + cpdef _is_independent(self, F): """ Test if input is independent. @@ -258,7 +258,7 @@ cdef class CircuitClosuresMatroid(Matroid): return False return True - cpdef _max_independent(self, F) noexcept: + cpdef _max_independent(self, F): """ Compute a maximal independent subset. @@ -295,7 +295,7 @@ cdef class CircuitClosuresMatroid(Matroid): return frozenset(I) - cpdef _circuit(self, F) noexcept: + cpdef _circuit(self, F): """ Return a minimal dependent subset. @@ -328,7 +328,7 @@ cdef class CircuitClosuresMatroid(Matroid): return frozenset(S) raise ValueError("no circuit in independent set") - cpdef circuit_closures(self) noexcept: + cpdef circuit_closures(self): """ Return the list of closures of circuits of the matroid. @@ -362,7 +362,7 @@ cdef class CircuitClosuresMatroid(Matroid): """ return self._circuit_closures - cpdef _is_isomorphic(self, other, certificate=False) noexcept: + cpdef _is_isomorphic(self, other, certificate=False): """ Test if ``self`` is isomorphic to ``other``. diff --git a/src/sage/matroids/circuits_matroid.pxd b/src/sage/matroids/circuits_matroid.pxd index 2de06bd16ab..26f86b2dac0 100644 --- a/src/sage/matroids/circuits_matroid.pxd +++ b/src/sage/matroids/circuits_matroid.pxd @@ -7,25 +7,25 @@ cdef class CircuitsMatroid(Matroid): cdef SetSystem _C # circuits cdef dict _k_C # k-circuits (k=len) cdef bint _nsc_defined - cpdef groundset(self) noexcept - cpdef _rank(self, X) noexcept - cpdef full_rank(self) noexcept - cpdef _is_independent(self, F) noexcept - cpdef _max_independent(self, F) noexcept - cpdef _circuit(self, F) noexcept + cpdef groundset(self) + cpdef _rank(self, X) + cpdef full_rank(self) + cpdef _is_independent(self, F) + cpdef _max_independent(self, F) + cpdef _circuit(self, F) # enumeration - cpdef bases(self) noexcept - cpdef circuits(self, k=*) noexcept - cpdef nonspanning_circuits(self) noexcept - cpdef no_broken_circuits_sets(self, ordering=*) noexcept + cpdef bases(self) + cpdef circuits(self, k=*) + cpdef nonspanning_circuits(self) + cpdef no_broken_circuits_sets(self, ordering=*) # properties - cpdef girth(self) noexcept - cpdef is_paving(self) noexcept + cpdef girth(self) + cpdef is_paving(self) # isomorphism - cpdef _is_isomorphic(self, other, certificate=*) noexcept + cpdef _is_isomorphic(self, other, certificate=*) # verification - cpdef is_valid(self) noexcept + cpdef is_valid(self) diff --git a/src/sage/matroids/circuits_matroid.pyx b/src/sage/matroids/circuits_matroid.pyx index bbcf6ce8319..433581801cc 100644 --- a/src/sage/matroids/circuits_matroid.pyx +++ b/src/sage/matroids/circuits_matroid.pyx @@ -84,7 +84,7 @@ cdef class CircuitsMatroid(Matroid): self._matroid_rank = self.rank(self._groundset) self._nsc_defined = nsc_defined - cpdef groundset(self) noexcept: + cpdef groundset(self): """ Return the groundset of the matroid. @@ -100,7 +100,7 @@ cdef class CircuitsMatroid(Matroid): """ return self._groundset - cpdef _rank(self, X) noexcept: + cpdef _rank(self, X): """ Return the rank of a set ``X``. @@ -123,7 +123,7 @@ cdef class CircuitsMatroid(Matroid): # optional - cpdef full_rank(self) noexcept: + cpdef full_rank(self): r""" Return the rank of the matroid. @@ -140,7 +140,7 @@ cdef class CircuitsMatroid(Matroid): """ return self._matroid_rank - cpdef _is_independent(self, F) noexcept: + cpdef _is_independent(self, F): """ Test if input is independent. @@ -168,7 +168,7 @@ cdef class CircuitsMatroid(Matroid): return False return True - cpdef _max_independent(self, F) noexcept: + cpdef _max_independent(self, F): """ Compute a maximal independent subset. @@ -195,7 +195,7 @@ cdef class CircuitsMatroid(Matroid): return frozenset(I) - cpdef _circuit(self, F) noexcept: + cpdef _circuit(self, F): """ Return a minimal dependent subset. @@ -223,7 +223,7 @@ cdef class CircuitsMatroid(Matroid): return C raise ValueError("no circuit in independent set") - cpdef _is_isomorphic(self, other, certificate=False) noexcept: + cpdef _is_isomorphic(self, other, certificate=False): """ Test if ``self`` is isomorphic to ``other``. @@ -415,7 +415,7 @@ cdef class CircuitsMatroid(Matroid): # enumeration - cpdef bases(self) noexcept: + cpdef bases(self): r""" Return the bases of the matroid. @@ -470,7 +470,7 @@ cdef class CircuitsMatroid(Matroid): if not any(C <= B for C in NSC): yield B - cpdef circuits(self, k=None) noexcept: + cpdef circuits(self, k=None): """ Return the circuits of the matroid. @@ -537,7 +537,7 @@ cdef class CircuitsMatroid(Matroid): for C in self._k_C[i]: yield C - cpdef nonspanning_circuits(self) noexcept: + cpdef nonspanning_circuits(self): """ Return the nonspanning circuits of the matroid. @@ -572,7 +572,7 @@ cdef class CircuitsMatroid(Matroid): for C in self._k_C[i]: yield C - cpdef no_broken_circuits_sets(self, ordering=None) noexcept: + cpdef no_broken_circuits_sets(self, ordering=None): r""" Return the no broken circuits (NBC) sets of ``self``. @@ -641,7 +641,7 @@ cdef class CircuitsMatroid(Matroid): # properties - cpdef girth(self) noexcept: + cpdef girth(self): r""" Return the girth of the matroid. @@ -659,7 +659,7 @@ cdef class CircuitsMatroid(Matroid): """ return min(self._k_C, default=float('inf')) - cpdef is_paving(self) noexcept: + cpdef is_paving(self): """ Return if ``self`` is paving. @@ -678,7 +678,7 @@ cdef class CircuitsMatroid(Matroid): # verification - cpdef is_valid(self) noexcept: + cpdef is_valid(self): r""" Test if ``self`` obeys the matroid axioms. diff --git a/src/sage/matroids/extension.pxd b/src/sage/matroids/extension.pxd index 6b6d7949794..b48a9a7e02d 100644 --- a/src/sage/matroids/extension.pxd +++ b/src/sage/matroids/extension.pxd @@ -6,12 +6,12 @@ cdef class CutNode: cdef bitset_t _p_free, _p_in, _l0, _l1 cdef long _ml - cdef CutNode copy(self) noexcept + cdef CutNode copy(self) cdef bint insert_plane(self, long p0) noexcept cdef bint remove_plane(self, long p0) noexcept - cdef select_plane(self) noexcept + cdef select_plane(self) - cdef list planes(self) noexcept + cdef list planes(self) cdef class LinearSubclassesIter: cdef LinearSubclasses _MC diff --git a/src/sage/matroids/extension.pyx b/src/sage/matroids/extension.pyx index ab2662af7fd..d73b4581674 100644 --- a/src/sage/matroids/extension.pyx +++ b/src/sage/matroids/extension.pyx @@ -87,7 +87,7 @@ cdef class CutNode: bitset_free(self._l0) bitset_free(self._l1) - cdef CutNode copy(self) noexcept: + cdef CutNode copy(self): return CutNode(self._MC, self) cdef bint insert_plane(self, long p0) noexcept: @@ -153,7 +153,7 @@ cdef class CutNode: return False return True - cdef select_plane(self) noexcept: + cdef select_plane(self): """ Choose a hyperplane from the linear subclass. """ @@ -169,7 +169,7 @@ cdef class CutNode: return bitset_first(self._p_free) - cdef list planes(self) noexcept: + cdef list planes(self): """ Return all hyperplanes from the linear subclass. """ diff --git a/src/sage/matroids/lean_matrix.pxd b/src/sage/matroids/lean_matrix.pxd index f71e22f63ee..3091af107d0 100644 --- a/src/sage/matroids/lean_matrix.pxd +++ b/src/sage/matroids/lean_matrix.pxd @@ -5,18 +5,18 @@ cdef class LeanMatrix: cdef long _nrows cdef long _ncols - cdef LeanMatrix copy(self) noexcept # Deprecated Sage matrix operation + cdef LeanMatrix copy(self) # Deprecated Sage matrix operation cdef int resize(self, long k) except -1 # Not a Sage matrix operation - cdef LeanMatrix stack(self, LeanMatrix M) noexcept - cdef LeanMatrix augment(self, LeanMatrix M) noexcept - cdef LeanMatrix prepend_identity(self) noexcept # Not a Sage matrix operation + cdef LeanMatrix stack(self, LeanMatrix M) + cdef LeanMatrix augment(self, LeanMatrix M) + cdef LeanMatrix prepend_identity(self) # Not a Sage matrix operation cpdef long ncols(self) except -1 cpdef long nrows(self) except -1 - cpdef base_ring(self) noexcept - cpdef characteristic(self) noexcept # Not a Sage matrix operation + cpdef base_ring(self) + cpdef characteristic(self) # Not a Sage matrix operation - cdef get_unsafe(self, long r, long c) noexcept + cdef get_unsafe(self, long r, long c) cdef int set_unsafe(self, long r, long c, x) except -1 cdef bint is_nonzero(self, long r, long c) except -2 # Not a Sage matrix operation @@ -25,16 +25,16 @@ cdef class LeanMatrix: cdef int rescale_row_c(self, long x, s, bint col_start) except -1 cdef int rescale_column_c(self, long y, s, bint start_row) except -1 cdef int pivot(self, long x, long y) except -1 # Not a Sage matrix operation - cdef list gauss_jordan_reduce(self, columns) noexcept # Not a Sage matrix operation + cdef list gauss_jordan_reduce(self, columns) # Not a Sage matrix operation - cdef list nonzero_positions_in_row(self, long r) noexcept + cdef list nonzero_positions_in_row(self, long r) - cdef LeanMatrix transpose(self) noexcept - cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other) noexcept - cdef LeanMatrix matrix_from_rows_and_columns(self, rows, columns) noexcept + cdef LeanMatrix transpose(self) + cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other) + cdef LeanMatrix matrix_from_rows_and_columns(self, rows, columns) - cdef shifting_all(self, P_rows, P_cols, Q_rows, Q_cols, int m) noexcept - cdef shifting(self, U_1, V_2, U_2, V_1, z2, z1, int m) noexcept + cdef shifting_all(self, P_rows, P_cols, Q_rows, Q_cols, int m) + cdef shifting(self, U_1, V_2, U_2, V_1, z2, z1, int m) cdef class GenericMatrix(LeanMatrix): cdef _base_ring, _characteristic @@ -42,7 +42,7 @@ cdef class GenericMatrix(LeanMatrix): cdef _zero cdef _one - cdef inline row_inner_product(self, long i, long j) noexcept # Not a Sage matrix operation + cdef inline row_inner_product(self, long i, long j) # Not a Sage matrix operation cdef class BinaryMatrix(LeanMatrix): cdef bitset_t* _M @@ -54,17 +54,17 @@ cdef class BinaryMatrix(LeanMatrix): cdef inline bint get(self, long x, long y) noexcept # Not a Sage matrix operation cdef inline void set(self, long x, long y) noexcept # Not a Sage matrix operation - cdef inline list row_sum(self, object L) noexcept # Not a Sage matrix operation - cdef inline list row_union(self, object L) noexcept # Not a Sage matrix operation + cdef inline list row_sum(self, object L) # Not a Sage matrix operation + cdef inline list row_union(self, object L) # Not a Sage matrix operation - cdef LeanMatrix matrix_from_rows_and_columns(self, rows, columns) noexcept - cdef matrix_from_rows_and_columns_reordered(self, rows, columns) noexcept + cdef LeanMatrix matrix_from_rows_and_columns(self, rows, columns) + cdef matrix_from_rows_and_columns_reordered(self, rows, columns) - cdef list _character(self, bitset_t x) noexcept - cdef BinaryMatrix _distinguish_by(self, BinaryMatrix P) noexcept - cdef BinaryMatrix _splice_by(self, BinaryMatrix P) noexcept - cdef BinaryMatrix _isolate(self, long r) noexcept - cdef BinaryMatrix equitable_partition(self, BinaryMatrix P=*) noexcept # Not a Sage matrix operation + cdef list _character(self, bitset_t x) + cdef BinaryMatrix _distinguish_by(self, BinaryMatrix P) + cdef BinaryMatrix _splice_by(self, BinaryMatrix P) + cdef BinaryMatrix _isolate(self, long r) + cdef BinaryMatrix equitable_partition(self, BinaryMatrix P=*) # Not a Sage matrix operation cdef bint is_isomorphic(self, BinaryMatrix other, BinaryMatrix s_eq=*, BinaryMatrix o_eq=*) except -2 # Not a Sage matrix operation @@ -82,7 +82,7 @@ cdef class TernaryMatrix(LeanMatrix): cdef inline long row_inner_product(self, long i, long j) noexcept # Not a Sage matrix operation cdef void row_subs(self, long x, long y) noexcept # Not a Sage matrix operation cdef void _row_negate(self, long x) noexcept - cdef matrix_from_rows_and_columns_reordered(self, rows, columns) noexcept + cdef matrix_from_rows_and_columns_reordered(self, rows, columns) cdef class QuaternaryMatrix(LeanMatrix): cdef bitset_t *_M0 # _M0[i] = 1-support of row i @@ -90,13 +90,13 @@ cdef class QuaternaryMatrix(LeanMatrix): cdef bitset_t _s, _t, _u # registers cdef object _gf4, _zero, _one, _x_zero, _x_one - cdef inline get(self, long r, long c) noexcept # Not a Sage matrix operation + cdef inline get(self, long r, long c) # Not a Sage matrix operation cdef inline int set(self, long r, long c, x) except -1 # Not a Sage matrix operation cdef inline long row_len(self, long i) except -1 # Not a Sage matrix operation - cdef inline row_inner_product(self, long i, long j) noexcept # Not a Sage matrix operation + cdef inline row_inner_product(self, long i, long j) # Not a Sage matrix operation cdef inline int _row_div(self, long x, object s) except -1 - cdef matrix_from_rows_and_columns_reordered(self, rows, columns) noexcept + cdef matrix_from_rows_and_columns_reordered(self, rows, columns) cdef void conjugate(self) noexcept # Not a Sage matrix operation @@ -107,7 +107,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): cdef inline void set(self, long r, long c, int x) noexcept # Not a Sage matrix operation cdef inline long row_len(self, long i) except -1 # Not a Sage matrix operation - cdef inline row_inner_product(self, long i, long j) noexcept # Not a Sage matrix operation + cdef inline row_inner_product(self, long i, long j) # Not a Sage matrix operation cdef class RationalMatrix(LeanMatrix): cdef mpq_t* _entries @@ -116,10 +116,10 @@ cdef class RationalMatrix(LeanMatrix): cdef inline void set(self, long r, long c, mpq_t x) noexcept # Not a Sage matrix operation cdef inline long row_len(self, long i) except -1 # Not a Sage matrix operation - cdef inline row_inner_product(self, long i, long j) noexcept # Not a Sage matrix operation + cdef inline row_inner_product(self, long i, long j) # Not a Sage matrix operation cdef int add_multiple_of_row_mpq(self, long x, long y, mpq_t s, bint col_start) except -1 cdef int rescale_row_mpq(self, long x, mpq_t s, bint col_start) except -1 cdef int rescale_column_mpq(self, long y, mpq_t s, bint start_row) except -1 -cpdef GenericMatrix generic_identity(n, ring) noexcept +cpdef GenericMatrix generic_identity(n, ring) diff --git a/src/sage/matroids/lean_matrix.pyx b/src/sage/matroids/lean_matrix.pyx index 1e768775fdf..34c498b016a 100644 --- a/src/sage/matroids/lean_matrix.pyx +++ b/src/sage/matroids/lean_matrix.pyx @@ -111,7 +111,7 @@ cdef class LeanMatrix: M[r, c] = self.get_unsafe(r, c) return M - cdef LeanMatrix copy(self) noexcept: # Deprecated Sage matrix operation + cdef LeanMatrix copy(self): # Deprecated Sage matrix operation """ Make a copy of ``self``. """ @@ -124,7 +124,7 @@ cdef class LeanMatrix: """ raise NotImplementedError - cdef LeanMatrix stack(self, LeanMatrix M) noexcept: + cdef LeanMatrix stack(self, LeanMatrix M): """ Stack ``self`` on top of ``M``. Assumes ``self`` and ``M`` are of same type, and compatible dimensions. @@ -141,7 +141,7 @@ cdef class LeanMatrix: A.set_unsafe(i + sr, j, M.get_unsafe(i, j)) return A - cdef LeanMatrix augment(self, LeanMatrix M) noexcept: + cdef LeanMatrix augment(self, LeanMatrix M): """ Concatenates ``self`` with ``M``, placing ``M`` to the right of ``self``. Assumes ``self`` and ``M`` are of same type, and compatible @@ -158,7 +158,7 @@ cdef class LeanMatrix: A.set_unsafe(i, j + sc, M.get_unsafe(i, j)) return A - cdef LeanMatrix prepend_identity(self) noexcept: # Not a Sage matrix operation + cdef LeanMatrix prepend_identity(self): # Not a Sage matrix operation """ Return the matrix obtained by prepending an identity matrix. Special case of ``augment``. @@ -197,7 +197,7 @@ cdef class LeanMatrix: """ return self._nrows - cpdef base_ring(self) noexcept: + cpdef base_ring(self): """ Return the base ring. @@ -212,7 +212,7 @@ cdef class LeanMatrix: """ raise NotImplementedError("subclasses need to implement this.") - cpdef characteristic(self) noexcept: + cpdef characteristic(self): """ Return the characteristic of ``self.base_ring()``. @@ -225,7 +225,7 @@ cdef class LeanMatrix: """ return self.base_ring().characteristic() - cdef get_unsafe(self, long r, long c) noexcept: + cdef get_unsafe(self, long r, long c): """ Return the value in row ``r``, column ``c``. """ @@ -309,7 +309,7 @@ cdef class LeanMatrix: self.add_multiple_of_row_c(i, x, -s, 0) return 0 - cdef list gauss_jordan_reduce(self, columns) noexcept: # Not a Sage matrix operation + cdef list gauss_jordan_reduce(self, columns): # Not a Sage matrix operation """ Row-reduce so the lexicographically first basis indexes an identity submatrix. @@ -334,13 +334,13 @@ cdef class LeanMatrix: break return P - cdef list nonzero_positions_in_row(self, long r) noexcept: + cdef list nonzero_positions_in_row(self, long r): """ Get coordinates of nonzero entries of row ``r``. """ return [i for i in range(self._ncols) if self.is_nonzero(r, i)] - cdef LeanMatrix transpose(self) noexcept: + cdef LeanMatrix transpose(self): """ Return the transpose of the matrix. """ @@ -351,7 +351,7 @@ cdef class LeanMatrix: A.set_unsafe(j, i, self.get_unsafe(i, j)) return A - cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other) noexcept: + cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other): """ Multiply two matrices. Assumes ``self`` and ``M`` are of same type, and compatible dimensions. @@ -364,7 +364,7 @@ cdef class LeanMatrix: A.set_unsafe(i, j, self.get_unsafe(i, k) * other.get_unsafe(k, j)) return A - cdef LeanMatrix matrix_from_rows_and_columns(self, rows, columns) noexcept: + cdef LeanMatrix matrix_from_rows_and_columns(self, rows, columns): """ Return submatrix indexed by indicated rows and columns. """ @@ -517,7 +517,7 @@ cdef class LeanMatrix: """ raise NotImplementedError("subclasses need to implement this.") - cdef shifting_all(self, P_rows, P_cols, Q_rows, Q_cols, int m) noexcept: + cdef shifting_all(self, P_rows, P_cols, Q_rows, Q_cols, int m): r""" Given a partial matrix `M`. If the submatrix `M` using rows `P_rows` columns `P_cols` and submatrix using rows `Q_rows` columns @@ -560,7 +560,7 @@ cdef class LeanMatrix: return True, cert return False, None - cdef shifting(self, U_1, V_2, U_2, V_1, z2, z1, int m) noexcept: + cdef shifting(self, U_1, V_2, U_2, V_1, z2, z1, int m): r""" Let `E_1` be the submatrix using rows `U_1` and columns `V_2` with optional column `z2` attached. @@ -758,7 +758,7 @@ cdef class GenericMatrix(LeanMatrix): """ return "LeanMatrix instance with " + str(self._nrows) + " rows and " + str(self._ncols) + " columns over " + repr(self._base_ring) - cdef LeanMatrix copy(self) noexcept: # Deprecated Sage matrix operation + cdef LeanMatrix copy(self): # Deprecated Sage matrix operation cdef GenericMatrix M = GenericMatrix(self._nrows, self._ncols, M=self) return M @@ -774,7 +774,7 @@ cdef class GenericMatrix(LeanMatrix): self._nrows = k return 0 - cdef LeanMatrix stack(self, LeanMatrix M) noexcept: + cdef LeanMatrix stack(self, LeanMatrix M): """ Warning: assumes ``M`` is a GenericMatrix instance! """ @@ -785,7 +785,7 @@ cdef class GenericMatrix(LeanMatrix): A._ncols = self._ncols return A - cdef LeanMatrix augment(self, LeanMatrix M) noexcept: + cdef LeanMatrix augment(self, LeanMatrix M): """ Warning: assumes ``M`` is a GenericMatrix instance! """ @@ -798,14 +798,14 @@ cdef class GenericMatrix(LeanMatrix): A._entries[i * A._ncols + self._ncols:(i + 1) * A._ncols]=(M)._entries[i * Mn:(i + 1) * Mn] return A - cdef LeanMatrix prepend_identity(self) noexcept: # Not a Sage matrix operation + cdef LeanMatrix prepend_identity(self): # Not a Sage matrix operation cdef GenericMatrix A = GenericMatrix(self._nrows, self._ncols + self._nrows, ring=self._base_ring) for i in range(self._nrows): A._entries[i * A._ncols + i] = self._one A._entries[i * A._ncols + self._nrows:(i + 1) * A._ncols]=self._entries[i * self._ncols:(i + 1) * self._ncols] return A - cpdef base_ring(self) noexcept: + cpdef base_ring(self): """ Return the base ring of ``self``. @@ -818,7 +818,7 @@ cdef class GenericMatrix(LeanMatrix): """ return self._base_ring - cpdef characteristic(self) noexcept: + cpdef characteristic(self): """ Return the characteristic of ``self.base_ring()``. @@ -833,7 +833,7 @@ cdef class GenericMatrix(LeanMatrix): self._characteristic = self._base_ring.characteristic() return self._characteristic - cdef get_unsafe(self, long r, long c) noexcept: + cdef get_unsafe(self, long r, long c): return self._entries[r * self._ncols + c] cdef int set_unsafe(self, long r, long c, x) except -1: @@ -849,7 +849,7 @@ cdef class GenericMatrix(LeanMatrix): self._entries[y * self._ncols:(y + 1) * self._ncols] = tmp return 0 - cdef LeanMatrix transpose(self) noexcept: + cdef LeanMatrix transpose(self): """ Return the transpose of the matrix. """ @@ -861,7 +861,7 @@ cdef class GenericMatrix(LeanMatrix): A.set_unsafe(j, i, self.get_unsafe(i, j)) return A - cdef inline row_inner_product(self, long i, long j) noexcept: # Not a Sage matrix operation + cdef inline row_inner_product(self, long i, long j): # Not a Sage matrix operation """ Return the inner product between rows ``i`` and ``j``. """ @@ -875,7 +875,7 @@ cdef class GenericMatrix(LeanMatrix): res += x * y return res - cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other) noexcept: + cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other): """ Return the product ``self * other``. """ @@ -1082,7 +1082,7 @@ cdef class BinaryMatrix(LeanMatrix): M[i, j] = 1 return M - cdef LeanMatrix copy(self) noexcept: # Deprecated Sage matrix operation + cdef LeanMatrix copy(self): # Deprecated Sage matrix operation cdef BinaryMatrix B cdef long i B = BinaryMatrix(self.nrows(), self.ncols()) @@ -1109,7 +1109,7 @@ cdef class BinaryMatrix(LeanMatrix): self._nrows = k return 0 - cdef LeanMatrix stack(self, LeanMatrix MM) noexcept: + cdef LeanMatrix stack(self, LeanMatrix MM): """ Given ``A`` and ``B``, return [A] @@ -1123,7 +1123,7 @@ cdef class BinaryMatrix(LeanMatrix): bitset_copy(R._M[i + self.nrows()], M._M[i]) return R - cdef LeanMatrix augment(self, LeanMatrix MM) noexcept: + cdef LeanMatrix augment(self, LeanMatrix MM): """ Given ``A`` and ``B``, return [A B] @@ -1137,7 +1137,7 @@ cdef class BinaryMatrix(LeanMatrix): bitset_set_to(R._M[i], self.ncols() + j, bitset_in(M._M[i], j)) return R - cdef LeanMatrix prepend_identity(self) noexcept: # Not a Sage matrix operation + cdef LeanMatrix prepend_identity(self): # Not a Sage matrix operation """ Return the matrix obtained by prepending an identity matrix. Special case of ``augment``. """ @@ -1148,7 +1148,7 @@ cdef class BinaryMatrix(LeanMatrix): A.set(i, i) return A - cpdef base_ring(self) noexcept: + cpdef base_ring(self): """ Return `GF(2)`. @@ -1162,7 +1162,7 @@ cdef class BinaryMatrix(LeanMatrix): global GF2 return GF2 - cpdef characteristic(self) noexcept: + cpdef characteristic(self): """ Return the characteristic of ``self.base_ring()``. @@ -1175,7 +1175,7 @@ cdef class BinaryMatrix(LeanMatrix): """ return 2 - cdef get_unsafe(self, long r, long c) noexcept: + cdef get_unsafe(self, long r, long c): global GF2_one, GF2_zero if bitset_in(self._M[r], c): return GF2_one @@ -1243,13 +1243,13 @@ cdef class BinaryMatrix(LeanMatrix): bitset_copy(self._M[j], self._temp) return 0 - cdef inline list nonzero_positions_in_row(self, long i) noexcept: + cdef inline list nonzero_positions_in_row(self, long i): """ Get coordinates of nonzero entries of row ``r``. """ return bitset_list(self._M[i]) - cdef inline list row_sum(self, object L) noexcept: # Not a Sage matrix operation + cdef inline list row_sum(self, object L): # Not a Sage matrix operation """ Return the mod-2 sum of the rows indexed by ``L``. """ @@ -1258,7 +1258,7 @@ cdef class BinaryMatrix(LeanMatrix): bitset_symmetric_difference(self._temp, self._temp, self._M[l]) return bitset_list(self._temp) - cdef inline list row_union(self, object L) noexcept: # Not a Sage matrix operation + cdef inline list row_union(self, object L): # Not a Sage matrix operation """ Return the ``or`` of the rows indexed by ``L``. """ @@ -1267,7 +1267,7 @@ cdef class BinaryMatrix(LeanMatrix): bitset_union(self._temp, self._temp, self._M[l]) return bitset_list(self._temp) - cdef LeanMatrix transpose(self) noexcept: + cdef LeanMatrix transpose(self): """ Return the transpose of the matrix. """ @@ -1281,7 +1281,7 @@ cdef class BinaryMatrix(LeanMatrix): j = bitset_next(self._M[i], j + 1) return T - cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other) noexcept: + cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other): """ Return the product ``self * other``. """ @@ -1296,7 +1296,7 @@ cdef class BinaryMatrix(LeanMatrix): j = bitset_next(self._M[i], j + 1) return M - cdef LeanMatrix matrix_from_rows_and_columns(self, rows, columns) noexcept: + cdef LeanMatrix matrix_from_rows_and_columns(self, rows, columns): """ Return submatrix indexed by indicated rows and columns. """ @@ -1308,7 +1308,7 @@ cdef class BinaryMatrix(LeanMatrix): bitset_add(A._M[r], c) return A - cdef matrix_from_rows_and_columns_reordered(self, rows, columns) noexcept: + cdef matrix_from_rows_and_columns_reordered(self, rows, columns): """ Return a submatrix indexed by indicated rows and columns, as well as the column order of the resulting submatrix. @@ -1365,7 +1365,7 @@ cdef class BinaryMatrix(LeanMatrix): bitset_free(mask) return A, order - cdef list _character(self, bitset_t x) noexcept: # Not a Sage matrix operation + cdef list _character(self, bitset_t x): # Not a Sage matrix operation """ Return the vector of intersection lengths of the rows with ``x``. """ @@ -1376,7 +1376,7 @@ cdef class BinaryMatrix(LeanMatrix): I.append(bitset_len(self._temp)) return I - cdef BinaryMatrix _distinguish_by(self, BinaryMatrix P) noexcept: + cdef BinaryMatrix _distinguish_by(self, BinaryMatrix P): """ Helper method for equitable partition. """ @@ -1397,7 +1397,7 @@ cdef class BinaryMatrix(LeanMatrix): i += 1 return Q - cdef BinaryMatrix _splice_by(self, BinaryMatrix P) noexcept: + cdef BinaryMatrix _splice_by(self, BinaryMatrix P): """ Helper method for equitable partition. """ @@ -1414,7 +1414,7 @@ cdef class BinaryMatrix(LeanMatrix): Q.resize(r) return Q - cdef BinaryMatrix _isolate(self, long j) noexcept: + cdef BinaryMatrix _isolate(self, long j): """ Helper method for isomorphism test. """ @@ -1427,7 +1427,7 @@ cdef class BinaryMatrix(LeanMatrix): bitset_add(Q._M[self._nrows], j) return Q - cdef BinaryMatrix equitable_partition(self, BinaryMatrix P=None) noexcept: + cdef BinaryMatrix equitable_partition(self, BinaryMatrix P=None): """ Compute an equitable partition of the columns. """ @@ -1718,7 +1718,7 @@ cdef class TernaryMatrix(LeanMatrix): M[i, j] = self.get(i, j) return M - cdef get_unsafe(self, long r, long c) noexcept: + cdef get_unsafe(self, long r, long c): global GF3_zero, GF3_one, GF3_minus_one if not bitset_in(self._M0[r], c): return GF3_zero @@ -1730,7 +1730,7 @@ cdef class TernaryMatrix(LeanMatrix): self.set(r, c, x) return 0 - cdef LeanMatrix copy(self) noexcept: # Deprecated Sage matrix operation + cdef LeanMatrix copy(self): # Deprecated Sage matrix operation cdef TernaryMatrix T cdef long i T = TernaryMatrix(self._nrows, self._ncols) @@ -1764,7 +1764,7 @@ cdef class TernaryMatrix(LeanMatrix): self._nrows = k return 0 - cdef LeanMatrix stack(self, LeanMatrix MM) noexcept: + cdef LeanMatrix stack(self, LeanMatrix MM): cdef TernaryMatrix R cdef TernaryMatrix M = MM cdef long i @@ -1774,7 +1774,7 @@ cdef class TernaryMatrix(LeanMatrix): bitset_copy(R._M1[i + self.nrows()], M._M1[i]) return R - cdef LeanMatrix augment(self, LeanMatrix MM) noexcept: + cdef LeanMatrix augment(self, LeanMatrix MM): cdef TernaryMatrix R cdef TernaryMatrix M = MM cdef long i, j @@ -1785,7 +1785,7 @@ cdef class TernaryMatrix(LeanMatrix): bitset_set_to(R._M1[i], self.ncols() + j, bitset_in(M._M1[i], j)) return R - cdef LeanMatrix prepend_identity(self) noexcept: # Not a Sage matrix operation + cdef LeanMatrix prepend_identity(self): # Not a Sage matrix operation """ Return the matrix obtained by prepending an identity matrix. @@ -1799,7 +1799,7 @@ cdef class TernaryMatrix(LeanMatrix): A.set(i, i, 1) return A - cpdef base_ring(self) noexcept: + cpdef base_ring(self): """ Return GF(3). @@ -1813,7 +1813,7 @@ cdef class TernaryMatrix(LeanMatrix): global GF3 return GF3 - cpdef characteristic(self) noexcept: + cpdef characteristic(self): """ Return the characteristic of ``self.base_ring()``. @@ -1942,13 +1942,13 @@ cdef class TernaryMatrix(LeanMatrix): self.row_subs(i, x) return 0 - cdef list nonzero_positions_in_row(self, long r) noexcept: + cdef list nonzero_positions_in_row(self, long r): """ Get coordinates of nonzero entries of row ``r``. """ return bitset_list(self._M0[r]) - cdef LeanMatrix transpose(self) noexcept: + cdef LeanMatrix transpose(self): """ Return the transpose of the matrix. """ @@ -1964,7 +1964,7 @@ cdef class TernaryMatrix(LeanMatrix): j = bitset_next(self._M0[i], j + 1) return T - cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other) noexcept: + cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other): """ Return the product ``self * other``. """ @@ -1984,7 +1984,7 @@ cdef class TernaryMatrix(LeanMatrix): M.resize(self._nrows) return M - cdef matrix_from_rows_and_columns_reordered(self, rows, columns) noexcept: + cdef matrix_from_rows_and_columns_reordered(self, rows, columns): """ Return a submatrix indexed by indicated rows and columns, as well as the column order of the resulting submatrix. @@ -2296,7 +2296,7 @@ cdef class QuaternaryMatrix(LeanMatrix): M[i, j] = self.get(i, j) return M - cdef inline get(self, long r, long c) noexcept: # Not a Sage matrix operation + cdef inline get(self, long r, long c): # Not a Sage matrix operation if bitset_in(self._M0[r], c): if bitset_in(self._M1[r], c): return self._x_one @@ -2323,7 +2323,7 @@ cdef class QuaternaryMatrix(LeanMatrix): bitset_add(self._M1[r], c) return 0 - cdef get_unsafe(self, long r, long c) noexcept: + cdef get_unsafe(self, long r, long c): return self.get(r, c) cdef int set_unsafe(self, long r, long c, x) except -1: @@ -2333,7 +2333,7 @@ cdef class QuaternaryMatrix(LeanMatrix): cdef inline bint is_nonzero(self, long r, long c) except -2: # Not a Sage matrix operation return bitset_in(self._M0[r], c) or bitset_in(self._M1[r], c) - cdef LeanMatrix copy(self) noexcept: # Deprecated Sage matrix operation + cdef LeanMatrix copy(self): # Deprecated Sage matrix operation cdef QuaternaryMatrix T cdef long i T = QuaternaryMatrix(self._nrows, self._ncols, ring=self._gf4) @@ -2366,7 +2366,7 @@ cdef class QuaternaryMatrix(LeanMatrix): self._nrows = k return 0 - cdef LeanMatrix stack(self, LeanMatrix MM) noexcept: + cdef LeanMatrix stack(self, LeanMatrix MM): cdef QuaternaryMatrix R cdef QuaternaryMatrix M = MM cdef long i @@ -2376,7 +2376,7 @@ cdef class QuaternaryMatrix(LeanMatrix): bitset_copy(R._M1[i + self.nrows()], M._M1[i]) return R - cdef LeanMatrix augment(self, LeanMatrix MM) noexcept: + cdef LeanMatrix augment(self, LeanMatrix MM): cdef QuaternaryMatrix R cdef QuaternaryMatrix M = MM cdef long i, j @@ -2387,7 +2387,7 @@ cdef class QuaternaryMatrix(LeanMatrix): bitset_set_to(R._M1[i], self.ncols() + j, bitset_in(M._M1[i], j)) return R - cdef LeanMatrix prepend_identity(self) noexcept: # Not a Sage matrix operation + cdef LeanMatrix prepend_identity(self): # Not a Sage matrix operation """ Return the matrix obtained by prepending an identity matrix. Special case of ``augment``. @@ -2400,7 +2400,7 @@ cdef class QuaternaryMatrix(LeanMatrix): A.set(i, i, 1) return A - cpdef base_ring(self) noexcept: + cpdef base_ring(self): """ Return copy of `GF(4)` with appropriate generator. @@ -2413,7 +2413,7 @@ cdef class QuaternaryMatrix(LeanMatrix): """ return self._gf4 - cpdef characteristic(self) noexcept: + cpdef characteristic(self): """ Return the characteristic of ``self.base_ring()``. @@ -2433,7 +2433,7 @@ cdef class QuaternaryMatrix(LeanMatrix): bitset_union(self._t, self._M0[i], self._M1[i]) return bitset_len(self._t) - cdef inline row_inner_product(self, long i, long j) noexcept: # Not a Sage matrix operation + cdef inline row_inner_product(self, long i, long j): # Not a Sage matrix operation """ Return the inner product between rows ``i`` and ``j``. """ @@ -2525,14 +2525,14 @@ cdef class QuaternaryMatrix(LeanMatrix): self.add_multiple_of_row_c(i, x, self.get(i, y), 0) return 0 - cdef list nonzero_positions_in_row(self, long r) noexcept: + cdef list nonzero_positions_in_row(self, long r): """ Get coordinates of nonzero entries of row ``r``. """ bitset_union(self._t, self._M0[r], self._M1[r]) return bitset_list(self._t) - cdef LeanMatrix transpose(self) noexcept: + cdef LeanMatrix transpose(self): """ Return the transpose of the matrix. """ @@ -2552,7 +2552,7 @@ cdef class QuaternaryMatrix(LeanMatrix): for i in range(self._nrows): bitset_symmetric_difference(self._M0[i], self._M0[i], self._M1[i]) - cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other) noexcept: + cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other): """ Return the product ``self * other``. """ @@ -2568,7 +2568,7 @@ cdef class QuaternaryMatrix(LeanMatrix): M.resize(self._nrows) return M - cdef matrix_from_rows_and_columns_reordered(self, rows, columns) noexcept: + cdef matrix_from_rows_and_columns_reordered(self, rows, columns): """ Return a submatrix indexed by indicated rows and columns, as well as the column order of the resulting submatrix. @@ -2724,7 +2724,7 @@ cdef class QuaternaryMatrix(LeanMatrix): data = (self.nrows(), self.ncols(), ring, versionB, size, limbs, longsize, M0, M1) return sage.matroids.unpickling.unpickle_quaternary_matrix, (version, data) -cpdef GenericMatrix generic_identity(n, ring) noexcept: +cpdef GenericMatrix generic_identity(n, ring): """ Return a GenericMatrix instance containing the `n \times n` identity matrix over ``ring``. @@ -2852,7 +2852,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): cdef inline void set(self, long r, long c, int x) noexcept: # Not a Sage matrix operation self._entries[r * self._ncols + c] = x - cdef get_unsafe(self, long r, long c) noexcept: + cdef get_unsafe(self, long r, long c): """ Return a Sage Integer, for safety down the line when dividing. @@ -2881,7 +2881,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): cdef bint is_nonzero(self, long r, long c) except -2: # Not a Sage matrix operation return self.get(r, c) != 0 - cdef LeanMatrix copy(self) noexcept: # Deprecated Sage matrix operation + cdef LeanMatrix copy(self): # Deprecated Sage matrix operation cdef PlusMinusOneMatrix M = PlusMinusOneMatrix(self._nrows, self._ncols) memcpy(M._entries, self._entries, self._nrows * self._ncols * sizeof(int)) return M @@ -2899,7 +2899,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): self._nrows = k return 0 - cdef LeanMatrix stack(self, LeanMatrix M) noexcept: + cdef LeanMatrix stack(self, LeanMatrix M): """ Warning: assumes ``M`` is a PlusMinusOneMatrix instance of right dimensions! @@ -2910,7 +2910,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): memcpy(A._entries + self._nrows * self._ncols, (M)._entries, M.nrows() * M.ncols() * sizeof(int)) return A - cdef LeanMatrix augment(self, LeanMatrix M) noexcept: + cdef LeanMatrix augment(self, LeanMatrix M): """ Warning: assumes ``M`` is a PlusMinusOneMatrix instance! """ @@ -2923,7 +2923,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): memcpy(A._entries + (i * A._ncols + self._ncols), (M)._entries + i * Mn, Mn * sizeof(int)) return A - cdef LeanMatrix prepend_identity(self) noexcept: # Not a Sage matrix operation + cdef LeanMatrix prepend_identity(self): # Not a Sage matrix operation cdef PlusMinusOneMatrix A = PlusMinusOneMatrix(self._nrows, self._ncols + self._nrows, ring=self._base_ring) cdef long i for i in range(self._nrows): @@ -2931,7 +2931,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): memcpy(A._entries + (i * A._ncols + self._nrows), self._entries + i * self._ncols, self._ncols * sizeof(int)) return A - cpdef base_ring(self) noexcept: + cpdef base_ring(self): """ Return the base ring of ``self``. @@ -2944,7 +2944,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): """ return ZZ - cpdef characteristic(self) noexcept: + cpdef characteristic(self): """ Return the characteristic of ``self.base_ring()``. @@ -2968,7 +2968,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): res += 1 return res - cdef inline row_inner_product(self, long i, long j) noexcept: # Not a Sage matrix operation + cdef inline row_inner_product(self, long i, long j): # Not a Sage matrix operation """ Return the inner product between rows ``i`` and ``j``. """ @@ -3053,7 +3053,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): self.add_multiple_of_row_c(i, x, -s, 0) return 0 - cdef list nonzero_positions_in_row(self, long r) noexcept: + cdef list nonzero_positions_in_row(self, long r): """ Get coordinates of nonzero entries of row ``r``. """ @@ -3064,7 +3064,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): res.append(j - r * self._ncols) return res - cdef LeanMatrix transpose(self) noexcept: + cdef LeanMatrix transpose(self): """ Return the transpose of the matrix. """ @@ -3076,7 +3076,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): A.set(j, i, self.get(i, j)) return A - cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other) noexcept: + cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other): """ Return the product ``self * other``. """ @@ -3093,7 +3093,7 @@ cdef class PlusMinusOneMatrix(LeanMatrix): A.set(i, j, s) return A - cdef list gauss_jordan_reduce(self, columns) noexcept: # Not a Sage matrix operation + cdef list gauss_jordan_reduce(self, columns): # Not a Sage matrix operation """ Row-reduce so the lexicographically first basis indexes an identity submatrix. @@ -3299,7 +3299,7 @@ cdef class RationalMatrix(LeanMatrix): cdef inline void set(self, long r, long c, mpq_t x) noexcept: # Not a Sage matrix operation mpq_set(self._entries[r * self._ncols + c], x) - cdef get_unsafe(self, long r, long c) noexcept: + cdef get_unsafe(self, long r, long c): """ Return a Sage Integer, for safety down the line when dividing. @@ -3330,7 +3330,7 @@ cdef class RationalMatrix(LeanMatrix): cdef bint is_nonzero(self, long r, long c) except -2: # Not a Sage matrix operation return mpq_sgn(self._entries[self.index(r, c)]) != 0 - cdef LeanMatrix copy(self) noexcept: # Deprecated Sage matrix operation + cdef LeanMatrix copy(self): # Deprecated Sage matrix operation cdef RationalMatrix M = RationalMatrix(self._nrows, self._ncols) cdef long i for i in range(self._nrows * self._ncols): @@ -3356,7 +3356,7 @@ cdef class RationalMatrix(LeanMatrix): self._nrows = k return 0 - cdef LeanMatrix stack(self, LeanMatrix M) noexcept: + cdef LeanMatrix stack(self, LeanMatrix M): """ Warning: assumes ``M`` is a RationalMatrix instance of right dimensions! @@ -3371,7 +3371,7 @@ cdef class RationalMatrix(LeanMatrix): mpq_set(A._entries[l+i], (M)._entries[i]) return A - cdef LeanMatrix augment(self, LeanMatrix M) noexcept: + cdef LeanMatrix augment(self, LeanMatrix M): """ Warning: assumes ``M`` is a RationalMatrix instance! """ @@ -3385,7 +3385,7 @@ cdef class RationalMatrix(LeanMatrix): mpq_set(A._entries[i*A._ncols + self._ncols + j], (M)._entries[i*Mn + j]) return A - cdef LeanMatrix prepend_identity(self) noexcept: # Not a Sage matrix operation + cdef LeanMatrix prepend_identity(self): # Not a Sage matrix operation cdef RationalMatrix A = RationalMatrix(self._nrows, self._ncols + self._nrows) cdef long i, j for i in range(self._nrows): @@ -3394,7 +3394,7 @@ cdef class RationalMatrix(LeanMatrix): mpq_set(A._entries[A.index(i,self._nrows+j)], self._entries[self.index(i,j)]) return A - cpdef base_ring(self) noexcept: + cpdef base_ring(self): """ Return the base ring of ``self``. @@ -3407,7 +3407,7 @@ cdef class RationalMatrix(LeanMatrix): """ return QQ - cpdef characteristic(self) noexcept: + cpdef characteristic(self): """ Return the characteristic of ``self.base_ring()``. @@ -3431,7 +3431,7 @@ cdef class RationalMatrix(LeanMatrix): res += 1 return res - cdef inline row_inner_product(self, long i, long j) noexcept: # Not a Sage matrix operation + cdef inline row_inner_product(self, long i, long j): # Not a Sage matrix operation """ Return the inner product between rows ``i`` and ``j``. """ @@ -3540,7 +3540,7 @@ cdef class RationalMatrix(LeanMatrix): mpq_clear(t) return 0 - cdef list nonzero_positions_in_row(self, long r) noexcept: + cdef list nonzero_positions_in_row(self, long r): """ Get coordinates of nonzero entries of row ``r``. """ @@ -3551,7 +3551,7 @@ cdef class RationalMatrix(LeanMatrix): res.append(j - r * self._ncols) return res - cdef LeanMatrix transpose(self) noexcept: + cdef LeanMatrix transpose(self): """ Return the transpose of the matrix. """ @@ -3563,7 +3563,7 @@ cdef class RationalMatrix(LeanMatrix): A.set(j, i, self._entries[self.index(i, j)]) return A - cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other) noexcept: + cdef LeanMatrix _matrix_times_matrix_(self, LeanMatrix other): """ Return the product ``self * other``. """ @@ -3583,7 +3583,7 @@ cdef class RationalMatrix(LeanMatrix): mpq_clear(s) return A - cdef list gauss_jordan_reduce(self, columns) noexcept: # Not a Sage matrix operation + cdef list gauss_jordan_reduce(self, columns): # Not a Sage matrix operation """ Row-reduce so the lexicographically first basis indexes an identity submatrix. diff --git a/src/sage/matroids/linear_matroid.pxd b/src/sage/matroids/linear_matroid.pxd index c7e6a402494..4902ccef6ef 100644 --- a/src/sage/matroids/linear_matroid.pxd +++ b/src/sage/matroids/linear_matroid.pxd @@ -10,87 +10,87 @@ cdef class LinearMatroid(BasisExchangeMatroid): cdef long *_prow cdef object _zero, _one - cpdef _forget(self) noexcept - cpdef base_ring(self) noexcept - cpdef characteristic(self) noexcept + cpdef _forget(self) + cpdef base_ring(self) + cpdef characteristic(self) - cdef list _setup_internal_representation(self, matrix, reduced_matrix, ring, keep_initial_representation) noexcept - cdef _exchange_value_internal(self, long x, long y) noexcept + cdef list _setup_internal_representation(self, matrix, reduced_matrix, ring, keep_initial_representation) + cdef _exchange_value_internal(self, long x, long y) - cpdef representation(self, B=*, reduced=*, labels=*, order=*, lift_map=*) noexcept - cpdef _current_rows_cols(self, B=*) noexcept - cpdef representation_vectors(self) noexcept - cpdef LeanMatrix _basic_representation(self, B=*) noexcept - cpdef LeanMatrix _reduced_representation(self, B=*) noexcept + cpdef representation(self, B=*, reduced=*, labels=*, order=*, lift_map=*) + cpdef _current_rows_cols(self, B=*) + cpdef representation_vectors(self) + cpdef LeanMatrix _basic_representation(self, B=*) + cpdef LeanMatrix _reduced_representation(self, B=*) cpdef bint _is_field_isomorphism(self, LinearMatroid other, morphism) noexcept - cpdef is_field_equivalent(self, other) noexcept - cpdef is_field_isomorphism(self, other, morphism) noexcept + cpdef is_field_equivalent(self, other) + cpdef is_field_isomorphism(self, other, morphism) # cpdef is_field_isomorphic(self, other) # TODO: currently only works as ``def`` - cpdef _fast_isom_test(self, other) noexcept - - cpdef _minor(self, contractions, deletions) noexcept - cpdef dual(self) noexcept - cpdef has_line_minor(self, k, hyperlines=*, certificate=*) noexcept - cpdef has_field_minor(self, N) noexcept - - cpdef _exchange_value(self, e, f) noexcept - cpdef fundamental_cycle(self, B, e) noexcept - cpdef fundamental_cocycle(self, B, e) noexcept - - cpdef _line_ratios(self, F) noexcept - cpdef _line_length(self, F) noexcept - - cpdef _line_cross_ratios(self, F) noexcept - cpdef cross_ratios(self, hyperlines=*) noexcept - cpdef cross_ratio(self, F, a, b, c, d) noexcept - cpdef _line_cross_ratio_test(self, F, x, fundamentals) noexcept - cpdef _cross_ratio_test(self, x, fundamentals, hyperlines=*) noexcept - - cpdef linear_extension(self, element, chain=*, col=*) noexcept - cpdef linear_coextension(self, element, cochain=*, row=*) noexcept - cpdef _linear_extensions(self, element, chains) noexcept - cpdef _linear_coextensions(self, element, cochains) noexcept - cdef _extend_chains(self, C, f, fundamentals=*) noexcept - cpdef _linear_extension_chains(self, F, fundamentals=*) noexcept - cpdef linear_extension_chains(self, F=*, simple=*, fundamentals=*) noexcept - cpdef linear_coextension_cochains(self, F=*, cosimple=*, fundamentals=*) noexcept - cpdef linear_extensions(self, element=*, F=*, simple=*, fundamentals=*) noexcept - cpdef linear_coextensions(self, element=*, F=*, cosimple=*, fundamentals=*) noexcept - - cpdef _is_3connected_shifting(self, certificate=*) noexcept - cpdef _is_4connected_shifting(self, certificate=*) noexcept - - cpdef is_valid(self) noexcept + cpdef _fast_isom_test(self, other) + + cpdef _minor(self, contractions, deletions) + cpdef dual(self) + cpdef has_line_minor(self, k, hyperlines=*, certificate=*) + cpdef has_field_minor(self, N) + + cpdef _exchange_value(self, e, f) + cpdef fundamental_cycle(self, B, e) + cpdef fundamental_cocycle(self, B, e) + + cpdef _line_ratios(self, F) + cpdef _line_length(self, F) + + cpdef _line_cross_ratios(self, F) + cpdef cross_ratios(self, hyperlines=*) + cpdef cross_ratio(self, F, a, b, c, d) + cpdef _line_cross_ratio_test(self, F, x, fundamentals) + cpdef _cross_ratio_test(self, x, fundamentals, hyperlines=*) + + cpdef linear_extension(self, element, chain=*, col=*) + cpdef linear_coextension(self, element, cochain=*, row=*) + cpdef _linear_extensions(self, element, chains) + cpdef _linear_coextensions(self, element, cochains) + cdef _extend_chains(self, C, f, fundamentals=*) + cpdef _linear_extension_chains(self, F, fundamentals=*) + cpdef linear_extension_chains(self, F=*, simple=*, fundamentals=*) + cpdef linear_coextension_cochains(self, F=*, cosimple=*, fundamentals=*) + cpdef linear_extensions(self, element=*, F=*, simple=*, fundamentals=*) + cpdef linear_coextensions(self, element=*, F=*, cosimple=*, fundamentals=*) + + cpdef _is_3connected_shifting(self, certificate=*) + cpdef _is_4connected_shifting(self, certificate=*) + + cpdef is_valid(self) cdef class BinaryMatroid(LinearMatroid): cdef tuple _b_invariant, _b_partition cdef BinaryMatrix _b_projection, _eq_part - cpdef base_ring(self) noexcept - cpdef characteristic(self) noexcept + cpdef base_ring(self) + cpdef characteristic(self) - cpdef _current_rows_cols(self, B=*) noexcept - cpdef LeanMatrix _basic_representation(self, B=*) noexcept - cpdef LeanMatrix _reduced_representation(self, B=*) noexcept + cpdef _current_rows_cols(self, B=*) + cpdef LeanMatrix _basic_representation(self, B=*) + cpdef LeanMatrix _reduced_representation(self, B=*) - cdef __fundamental_cocircuit(self, bitset_t, long x) noexcept + cdef __fundamental_cocircuit(self, bitset_t, long x) - cpdef _is_isomorphic(self, other, certificate=*) noexcept + cpdef _is_isomorphic(self, other, certificate=*) - cpdef _minor(self, contractions, deletions) noexcept + cpdef _minor(self, contractions, deletions) - cpdef _make_invariant(self) noexcept - cpdef _invariant(self) noexcept - cpdef bicycle_dimension(self) noexcept - cpdef brown_invariant(self) noexcept - cpdef _principal_tripartition(self) noexcept - cpdef BinaryMatrix _projection(self) noexcept - cpdef BinaryMatrix _projection_partition(self) noexcept - cpdef _fast_isom_test(self, other) noexcept + cpdef _make_invariant(self) + cpdef _invariant(self) + cpdef bicycle_dimension(self) + cpdef brown_invariant(self) + cpdef _principal_tripartition(self) + cpdef BinaryMatrix _projection(self) + cpdef BinaryMatrix _projection_partition(self) + cpdef _fast_isom_test(self, other) - cpdef is_graphic(self) noexcept - cpdef is_valid(self) noexcept + cpdef is_graphic(self) + cpdef is_valid(self) cdef class TernaryMatroid(LinearMatroid): @@ -98,74 +98,74 @@ cdef class TernaryMatroid(LinearMatroid): cdef tuple _t_invariant, _t_partition cdef TernaryMatrix _t_projection - cpdef base_ring(self) noexcept - cpdef characteristic(self) noexcept + cpdef base_ring(self) + cpdef characteristic(self) - cpdef _current_rows_cols(self, B=*) noexcept - cpdef LeanMatrix _basic_representation(self, B=*) noexcept - cpdef LeanMatrix _reduced_representation(self, B=*) noexcept + cpdef _current_rows_cols(self, B=*) + cpdef LeanMatrix _basic_representation(self, B=*) + cpdef LeanMatrix _reduced_representation(self, B=*) - cdef __fundamental_cocircuit(self, bitset_t, long x) noexcept + cdef __fundamental_cocircuit(self, bitset_t, long x) - cpdef _is_isomorphic(self, other, certificate=*) noexcept + cpdef _is_isomorphic(self, other, certificate=*) - cpdef _minor(self, contractions, deletions) noexcept + cpdef _minor(self, contractions, deletions) - cpdef _make_invariant(self) noexcept - cpdef _invariant(self) noexcept - cpdef bicycle_dimension(self) noexcept - cpdef character(self) noexcept - cpdef _principal_quadripartition(self) noexcept - cpdef TernaryMatrix _projection(self) noexcept - cpdef _fast_isom_test(self, other) noexcept + cpdef _make_invariant(self) + cpdef _invariant(self) + cpdef bicycle_dimension(self) + cpdef character(self) + cpdef _principal_quadripartition(self) + cpdef TernaryMatrix _projection(self) + cpdef _fast_isom_test(self, other) - cpdef is_valid(self) noexcept + cpdef is_valid(self) cdef class QuaternaryMatroid(LinearMatroid): cdef object _x_zero, _x_one cdef tuple _q_invariant, _q_partition cdef QuaternaryMatrix _q_projection - cpdef base_ring(self) noexcept - cpdef characteristic(self) noexcept + cpdef base_ring(self) + cpdef characteristic(self) - cpdef _current_rows_cols(self, B=*) noexcept - cpdef LeanMatrix _basic_representation(self, B=*) noexcept - cpdef LeanMatrix _reduced_representation(self, B=*) noexcept + cpdef _current_rows_cols(self, B=*) + cpdef LeanMatrix _basic_representation(self, B=*) + cpdef LeanMatrix _reduced_representation(self, B=*) - cdef __fundamental_cocircuit(self, bitset_t, long x) noexcept + cdef __fundamental_cocircuit(self, bitset_t, long x) - cpdef _is_isomorphic(self, other, certificate=*) noexcept + cpdef _is_isomorphic(self, other, certificate=*) - cpdef _minor(self, contractions, deletions) noexcept + cpdef _minor(self, contractions, deletions) - cpdef _make_invariant(self) noexcept - cpdef _invariant(self) noexcept - cpdef bicycle_dimension(self) noexcept - cpdef _principal_tripartition(self) noexcept - cpdef _fast_isom_test(self, other) noexcept + cpdef _make_invariant(self) + cpdef _invariant(self) + cpdef bicycle_dimension(self) + cpdef _principal_tripartition(self) + cpdef _fast_isom_test(self, other) - cpdef is_valid(self) noexcept + cpdef is_valid(self) cdef class RegularMatroid(LinearMatroid): cdef _bases_count, _r_invariant cdef _r_projection, _r_hypergraph cdef _hypergraph_vertex_partition, _hypergraph_tuples - cpdef base_ring(self) noexcept - cpdef characteristic(self) noexcept + cpdef base_ring(self) + cpdef characteristic(self) - cpdef _is_isomorphic(self, other, certificate=*) noexcept + cpdef _is_isomorphic(self, other, certificate=*) - cpdef _invariant(self) noexcept - cpdef _fast_isom_test(self, other) noexcept + cpdef _invariant(self) + cpdef _fast_isom_test(self, other) - cpdef bases_count(self) noexcept - cpdef _projection(self) noexcept - cpdef _hypergraph(self) noexcept - cdef _hypertest(self, other) noexcept - cpdef has_line_minor(self, k, hyperlines=*, certificate=*) noexcept - cpdef _linear_extension_chains(self, F, fundamentals=*) noexcept + cpdef bases_count(self) + cpdef _projection(self) + cpdef _hypergraph(self) + cdef _hypertest(self, other) + cpdef has_line_minor(self, k, hyperlines=*, certificate=*) + cpdef _linear_extension_chains(self, F, fundamentals=*) - cpdef is_graphic(self) noexcept - cpdef is_valid(self) noexcept + cpdef is_graphic(self) + cpdef is_valid(self) diff --git a/src/sage/matroids/linear_matroid.pyx b/src/sage/matroids/linear_matroid.pyx index bd277d891eb..7b6eb9bb711 100644 --- a/src/sage/matroids/linear_matroid.pyx +++ b/src/sage/matroids/linear_matroid.pyx @@ -148,10 +148,10 @@ cdef GF3, GF3_one, GF3_zero, GF3_minus_one # provide alternative implementations # Below is some code, commented out currently, to get you going. -cdef inline gauss_jordan_reduce(LeanMatrix A, columns) noexcept: +cdef inline gauss_jordan_reduce(LeanMatrix A, columns): return A.gauss_jordan_reduce(columns) # Not a Sage matrix operation -cdef inline characteristic(LeanMatrix A) noexcept: +cdef inline characteristic(LeanMatrix A): return A.characteristic() # Not a Sage matrix operation # Implementation using default Sage matrices @@ -297,7 +297,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): sig_free(self._prow) self._prow = NULL - cdef list _setup_internal_representation(self, matrix, reduced_matrix, ring, keep_initial_representation) noexcept: + cdef list _setup_internal_representation(self, matrix, reduced_matrix, ring, keep_initial_representation): """ Setup the internal representation matrix ``self._A`` and the array of row- and column indices ``self._prow``. @@ -345,7 +345,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): self._prow[self._A.nrows() + r] = r return P - cpdef _forget(self) noexcept: + cpdef _forget(self): """ Remove the internal representation matrix. @@ -364,7 +364,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): """ self._representation = None - cpdef base_ring(self) noexcept: + cpdef base_ring(self): """ Return the base ring of the matrix representing the matroid. @@ -377,7 +377,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): """ return self._A.base_ring() - cpdef characteristic(self) noexcept: + cpdef characteristic(self): """ Return the characteristic of the base ring of the matrix representing the matroid. @@ -422,7 +422,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): self._prow[x] = py BasisExchangeMatroid._exchange(self, x, y) - cdef _exchange_value_internal(self, long x, long y) noexcept: + cdef _exchange_value_internal(self, long x, long y): r""" Return the (x, y) entry of the current representation. """ @@ -471,7 +471,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): # representations - cpdef representation(self, B=None, reduced=False, labels=None, order=None, lift_map=None) noexcept: + cpdef representation(self, B=None, reduced=False, labels=None, order=None, lift_map=None): r""" Return a matrix representing the matroid. @@ -649,7 +649,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): else: return lift_cross_ratios(A._matrix_(), lift_map) - cpdef _current_rows_cols(self, B=None) noexcept: + cpdef _current_rows_cols(self, B=None): """ Return the current row and column labels of a reduced matrix. @@ -687,7 +687,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): cols[self._prow[self._idx[e]]] = e return rows, cols - cpdef LeanMatrix _basic_representation(self, B=None) noexcept: + cpdef LeanMatrix _basic_representation(self, B=None): """ Return a basic matrix representation of the matroid. @@ -735,7 +735,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): i += 1 return A - cpdef representation_vectors(self) noexcept: + cpdef representation_vectors(self): """ Return a dictionary that associates a column vector with each element of the matroid. @@ -755,7 +755,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): R = self._matrix_().columns() return {e: R[self._idx[e]] for e in self.groundset()} - cpdef LeanMatrix _reduced_representation(self, B=None) noexcept: + cpdef LeanMatrix _reduced_representation(self, B=None): r""" Return a reduced representation of the matroid, i.e. a matrix `R` such that `[I\ \ R]` represents the matroid. @@ -877,7 +877,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): normalization[N.pop()] = self._one return True - cpdef is_field_equivalent(self, other) noexcept: + cpdef is_field_equivalent(self, other): """ Test for matroid representation equality. @@ -964,7 +964,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): morphism = {e: e for e in self.groundset()} return self._is_field_isomorphism(other, morphism) - cpdef is_field_isomorphism(self, other, morphism) noexcept: + cpdef is_field_isomorphism(self, other, morphism): r""" Test if a provided morphism induces a bijection between represented matroids. @@ -1050,7 +1050,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): else: return self._is_field_isomorphism(copy(other), mf) - cpdef _fast_isom_test(self, other) noexcept: + cpdef _fast_isom_test(self, other): """ Fast (field) isomorphism test for some subclasses. @@ -1275,7 +1275,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): # minors, dual - cpdef _minor(self, contractions, deletions) noexcept: + cpdef _minor(self, contractions, deletions): r""" Return a minor. @@ -1319,7 +1319,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): M.set_unsafe(i, j, self._exchange_value(rows[i], cols[j])) return type(self)(reduced_matrix=M, groundset=rows + cols) - cpdef dual(self) noexcept: + cpdef dual(self): r""" Return the dual of the matroid. @@ -1350,7 +1350,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): rows, cols = self._current_rows_cols() return type(self)(reduced_matrix=R, groundset=cols + rows) - cpdef has_line_minor(self, k, hyperlines=None, certificate=False) noexcept: + cpdef has_line_minor(self, k, hyperlines=None, certificate=False): r""" Test if the matroid has a `U_{2, k}`-minor. @@ -1404,7 +1404,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): pass return Matroid.has_line_minor(self, k, hyperlines, certificate) - cpdef has_field_minor(self, N) noexcept: + cpdef has_field_minor(self, N): """ Check if ``self`` has a minor field isomorphic to ``N``. @@ -1462,7 +1462,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): # cycles, cocycles and cross ratios - cpdef _exchange_value(self, e, f) noexcept: + cpdef _exchange_value(self, e, f): """ Return the matrix entry indexed by row `e` and column `f`. @@ -1490,7 +1490,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): """ return self._exchange_value_internal(self._idx[e], self._idx[f]) - cpdef fundamental_cycle(self, B, e) noexcept: + cpdef fundamental_cycle(self, B, e): """ Return the fundamental cycle, relative to ``B``, containing element ``e``. @@ -1536,7 +1536,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): chain[f] = -x return chain - cpdef fundamental_cocycle(self, B, e) noexcept: + cpdef fundamental_cocycle(self, B, e): """ Return the fundamental cycle, relative to ``B``, containing element ``e``. @@ -1581,7 +1581,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): cochain[f] = x return cochain - cpdef _line_ratios(self, F) noexcept: + cpdef _line_ratios(self, F): """ Return the set of nonzero ratios of column entries after contracting a rank-`r-2` flat ``F``. @@ -1612,7 +1612,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): rat.add(s * (t ** (-1))) return rat - cpdef _line_length(self, F) noexcept: + cpdef _line_length(self, F): """ Return ``len(M.contract(F).simplify())``, where ``F`` is assumed to be a flat of rank 2 less than the matroid. @@ -1632,7 +1632,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): """ return 2 + len(self._line_ratios(F)) - cpdef _line_cross_ratios(self, F) noexcept: + cpdef _line_cross_ratios(self, F): """ Return the set of cross ratios of column entries after contracting a rank-`r-2` flat ``F``. @@ -1660,7 +1660,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): cr.add(r2 / r1) return cr - cpdef cross_ratios(self, hyperlines=None) noexcept: + cpdef cross_ratios(self, hyperlines=None): r""" Return the set of cross ratios that occur in this linear matroid. @@ -1718,7 +1718,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): CR.difference_update(asc) return CR2 - cpdef cross_ratio(self, F, a, b, c, d) noexcept: + cpdef cross_ratio(self, F, a, b, c, d): r""" Return the cross ratio of the four ordered points ``a, b, c, d`` after contracting a flat ``F`` of codimension 2. @@ -1775,7 +1775,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): raise ValueError("points a, b, c, d do not form a 4-point line in M/F") return cr1 / cr2 - cpdef _line_cross_ratio_test(self, F, x, fundamentals) noexcept: + cpdef _line_cross_ratio_test(self, F, x, fundamentals): r""" Check whether the cross ratios involving a fixed element in a fixed rank-2 minor are in a specified subset. @@ -1835,7 +1835,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): return False return True - cpdef _cross_ratio_test(self, x, fundamentals, hyperlines=None) noexcept: + cpdef _cross_ratio_test(self, x, fundamentals, hyperlines=None): r""" Test if the cross ratios using a given element of this linear matroid are contained in a given set of fundamentals. @@ -1883,7 +1883,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): return True # linear extension - cpdef linear_extension(self, element, chain=None, col=None) noexcept: + cpdef linear_extension(self, element, chain=None, col=None): r""" Return a linear extension of this matroid. @@ -1951,7 +1951,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): raise TypeError("chain argument needs to be a dictionary") return self._linear_extensions(element, [chain])[0] - cpdef linear_coextension(self, element, cochain=None, row=None) noexcept: + cpdef linear_coextension(self, element, cochain=None, row=None): r""" Return a linear coextension of this matroid. @@ -2052,7 +2052,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): raise TypeError("cochain argument needs to be a dictionary") return self._linear_coextensions(element, [cochain])[0] - cpdef _linear_extensions(self, element, chains) noexcept: + cpdef _linear_extensions(self, element, chains): r""" Return the linear extensions of this matroid representation specified by the given chains. @@ -2100,7 +2100,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): ext.append(type(self)(matrix=M, groundset=E)) return ext - cpdef _linear_coextensions(self, element, cochains) noexcept: + cpdef _linear_coextensions(self, element, cochains): r""" Return the linear coextensions of this matroid representation specified by the given cochains. @@ -2148,7 +2148,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): coext.append(type(self)(matrix=M, groundset=E)) return coext - cdef _extend_chains(self, C, f, fundamentals=None) noexcept: + cdef _extend_chains(self, C, f, fundamentals=None): r""" Extend a list of chains for ``self / f`` to a list of chains for ``self``. @@ -2210,7 +2210,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): res = [chain for chain in res if len(chain) < 2 or self._linear_extensions(ne, [chain])[0]._cross_ratio_test(ne, fundamentals, hyperlines)] return res - cpdef _linear_extension_chains(self, F, fundamentals=None) noexcept: # assumes independent F + cpdef _linear_extension_chains(self, F, fundamentals=None): # assumes independent F r""" Create a list of chains that determine single-element extensions of this linear matroid representation. @@ -2286,7 +2286,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): chains = new_chains return chains - cpdef linear_extension_chains(self, F=None, simple=False, fundamentals=None) noexcept: + cpdef linear_extension_chains(self, F=None, simple=False, fundamentals=None): r""" Create a list of chains that determine the single-element extensions of this linear matroid representation. @@ -2385,7 +2385,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): chains = simple_chains return chains - cpdef linear_coextension_cochains(self, F=None, cosimple=False, fundamentals=None) noexcept: + cpdef linear_coextension_cochains(self, F=None, cosimple=False, fundamentals=None): r""" Create a list of cochains that determine the single-element coextensions of this linear matroid representation. @@ -2443,7 +2443,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): """ return self.dual().linear_extension_chains(F=F, simple=cosimple, fundamentals=fundamentals) - cpdef linear_extensions(self, element=None, F=None, simple=False, fundamentals=None) noexcept: + cpdef linear_extensions(self, element=None, F=None, simple=False, fundamentals=None): r""" Create a list of linear matroids represented by rank-preserving single-element extensions of this linear matroid representation. @@ -2511,7 +2511,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): chains = self.linear_extension_chains(F, simple=simple, fundamentals=fundamentals) return self._linear_extensions(element, chains) - cpdef linear_coextensions(self, element=None, F=None, cosimple=False, fundamentals=None) noexcept: + cpdef linear_coextensions(self, element=None, F=None, cosimple=False, fundamentals=None): r""" Create a list of linear matroids represented by corank-preserving single-element coextensions of this linear matroid representation. @@ -2582,7 +2582,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): cochains = self.linear_coextension_cochains(F, cosimple=cosimple, fundamentals=fundamentals) return self._linear_coextensions(element, cochains) - cpdef is_valid(self) noexcept: + cpdef is_valid(self): r""" Test if the data represent an actual matroid. @@ -2633,7 +2633,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): # connectivity - cpdef _is_3connected_shifting(self, certificate=False) noexcept: + cpdef _is_3connected_shifting(self, certificate=False): r""" Return ``True`` if the matroid is 4-connected, ``False`` otherwise. It can optionally return a separator as a witness. @@ -2712,7 +2712,7 @@ cdef class LinearMatroid(BasisExchangeMatroid): return True, None return True - cpdef _is_4connected_shifting(self, certificate=False) noexcept: + cpdef _is_4connected_shifting(self, certificate=False): r""" Return ``True`` if the matroid is 4-connected, ``False`` otherwise. It can optionally return a separator as a witness. @@ -3116,7 +3116,7 @@ cdef class BinaryMatroid(LinearMatroid): self._zero = GF2_zero self._one = GF2_one - cpdef base_ring(self) noexcept: + cpdef base_ring(self): r""" Return the base ring of the matrix representing the matroid, in this case `\GF{2}`. @@ -3130,7 +3130,7 @@ cdef class BinaryMatroid(LinearMatroid): global GF2 return GF2 - cpdef characteristic(self) noexcept: + cpdef characteristic(self): """ Return the characteristic of the base ring of the matrix representing the matroid, in this case `2`. @@ -3158,13 +3158,13 @@ cdef class BinaryMatroid(LinearMatroid): self._prow[y] = p BasisExchangeMatroid._exchange(self, x, y) - cdef __fundamental_cocircuit(self, bitset_t C, long x) noexcept: + cdef __fundamental_cocircuit(self, bitset_t C, long x): r""" Fill bitset `C` with the incidence vector of the `B`-fundamental cocircuit using ``x``. Internal method using packed elements. """ bitset_copy(C, (self._A)._M[self._prow[x]]) - cdef _coclosure_internal(self, bitset_t R, bitset_t F) noexcept: + cdef _coclosure_internal(self, bitset_t R, bitset_t F): """ Bitpacked version of ``coclosure``. @@ -3187,7 +3187,7 @@ cdef class BinaryMatroid(LinearMatroid): bitset_add(R, y) y = bitset_next(self._inside, y + 1) - cdef _exchange_value_internal(self, long x, long y) noexcept: + cdef _exchange_value_internal(self, long x, long y): r""" Return the (x, y) entry of the current representation. """ @@ -3213,7 +3213,7 @@ cdef class BinaryMatroid(LinearMatroid): S = "Binary matroid of rank " + str(self.rank()) + " on " + str(self.size()) + " elements, type (" + str(self.bicycle_dimension()) + ', ' + str(self.brown_invariant()) + ')' return S - cpdef _current_rows_cols(self, B=None) noexcept: + cpdef _current_rows_cols(self, B=None): """ Return the current row and column labels of a reduced matrix. @@ -3254,7 +3254,7 @@ cdef class BinaryMatroid(LinearMatroid): c += 1 return rows, cols - cpdef LeanMatrix _basic_representation(self, B=None) noexcept: + cpdef LeanMatrix _basic_representation(self, B=None): """ Return a basic matrix representation of the matroid. @@ -3293,7 +3293,7 @@ cdef class BinaryMatroid(LinearMatroid): self._move_current_basis(B, set()) return self._A.copy() # Deprecated Sage matrix operation - cpdef LeanMatrix _reduced_representation(self, B=None) noexcept: + cpdef LeanMatrix _reduced_representation(self, B=None): r""" Return a reduced representation of the matroid, i.e. a matrix `R` such that `[I\ \ R]` represents the matroid. @@ -3335,7 +3335,7 @@ cdef class BinaryMatroid(LinearMatroid): # isomorphism - cpdef _is_isomorphic(self, other, certificate=False) noexcept: + cpdef _is_isomorphic(self, other, certificate=False): """ Test if ``self`` is isomorphic to ``other``. @@ -3383,7 +3383,7 @@ cdef class BinaryMatroid(LinearMatroid): else: return LinearMatroid._is_isomorphic(self, other) - cpdef _is_isomorphism(self, other, morphism) noexcept: + cpdef _is_isomorphism(self, other, morphism): r""" Test if a given bijection is an isomorphism. @@ -3414,7 +3414,7 @@ cdef class BinaryMatroid(LinearMatroid): return LinearMatroid._is_isomorphism(self, other, morphism) # invariants - cpdef _make_invariant(self) noexcept: + cpdef _make_invariant(self): """ Create an invariant. @@ -3504,7 +3504,7 @@ cdef class BinaryMatroid(LinearMatroid): self._b_invariant = tuple([d, b2, len(Fm), len(F0), len(Fp), p[0], p[1], p[2]]) self._b_partition = tuple([Fm, F0, Fp]) - cpdef _invariant(self) noexcept: + cpdef _invariant(self): r""" Return a matroid invariant. @@ -3533,7 +3533,7 @@ cdef class BinaryMatroid(LinearMatroid): self._make_invariant() return self._b_invariant - cpdef bicycle_dimension(self) noexcept: + cpdef bicycle_dimension(self): r""" Return the bicycle dimension of the binary matroid. @@ -3556,7 +3556,7 @@ cdef class BinaryMatroid(LinearMatroid): self._make_invariant() return self._b_invariant[0] - cpdef brown_invariant(self) noexcept: + cpdef brown_invariant(self): r""" Return the value of Brown's invariant for the binary matroid. @@ -3593,7 +3593,7 @@ cdef class BinaryMatroid(LinearMatroid): self._make_invariant() return self._b_invariant[1] - cpdef _principal_tripartition(self) noexcept: + cpdef _principal_tripartition(self): r""" Return the principal tripartition of the binary matroid. @@ -3631,7 +3631,7 @@ cdef class BinaryMatroid(LinearMatroid): P = self._b_partition return frozenset([self._E[e] for e in P[0]]), frozenset([self._E[e] for e in P[1]]), frozenset([self._E[e] for e in P[2]]) - cpdef BinaryMatrix _projection(self) noexcept: + cpdef BinaryMatrix _projection(self): """ Return the projection matrix onto the row space. @@ -3672,7 +3672,7 @@ cdef class BinaryMatroid(LinearMatroid): self._make_invariant() return self._b_projection - cpdef BinaryMatrix _projection_partition(self) noexcept: + cpdef BinaryMatrix _projection_partition(self): """ Return the equitable partition of the graph whose incidence matrix is the projection matrix of this matroid. @@ -3704,7 +3704,7 @@ cdef class BinaryMatroid(LinearMatroid): self._eq_part = self._b_projection.equitable_partition() # Not a Sage matrix operation return self._eq_part - cpdef _fast_isom_test(self, other) noexcept: + cpdef _fast_isom_test(self, other): r""" Run a quick test to see if two binary matroids are isomorphic. @@ -3738,7 +3738,7 @@ cdef class BinaryMatroid(LinearMatroid): # minors, dual - cpdef _minor(self, contractions, deletions) noexcept: + cpdef _minor(self, contractions, deletions): r""" Return a minor. @@ -3781,7 +3781,7 @@ cdef class BinaryMatroid(LinearMatroid): keep_initial_representation=False) # graphicness test - cpdef is_graphic(self) noexcept: + cpdef is_graphic(self): """ Test if the binary matroid is graphic. @@ -3852,7 +3852,7 @@ cdef class BinaryMatroid(LinearMatroid): # now self is graphic iff there is a binary vector x so that M*x = 0 and x_0 = 1, so: return BinaryMatroid(m).corank(frozenset([0])) > 0 - cpdef is_valid(self) noexcept: + cpdef is_valid(self): r""" Test if the data obey the matroid axioms. @@ -3873,7 +3873,7 @@ cdef class BinaryMatroid(LinearMatroid): # representability - cpdef binary_matroid(self, randomized_tests=1, verify = True) noexcept: + cpdef binary_matroid(self, randomized_tests=1, verify = True): r""" Return a binary matroid representing ``self``. @@ -3903,7 +3903,7 @@ cdef class BinaryMatroid(LinearMatroid): """ return self - cpdef is_binary(self, randomized_tests=1) noexcept: + cpdef is_binary(self, randomized_tests=1): r""" Decide if ``self`` is a binary matroid. @@ -4181,7 +4181,7 @@ cdef class TernaryMatroid(LinearMatroid): self._one = GF3_one self._two = GF3_minus_one - cpdef base_ring(self) noexcept: + cpdef base_ring(self): r""" Return the base ring of the matrix representing the matroid, in this case `\GF{3}`. @@ -4195,7 +4195,7 @@ cdef class TernaryMatroid(LinearMatroid): global GF3 return GF3 - cpdef characteristic(self) noexcept: + cpdef characteristic(self): """ Return the characteristic of the base ring of the matrix representing the matroid, in this case `3`. @@ -4223,13 +4223,13 @@ cdef class TernaryMatroid(LinearMatroid): self._prow[y] = p BasisExchangeMatroid._exchange(self, x, y) - cdef __fundamental_cocircuit(self, bitset_t C, long x) noexcept: + cdef __fundamental_cocircuit(self, bitset_t C, long x): r""" Fill bitset `C` with the incidence vector of the `B`-fundamental cocircuit using ``x``. Internal method using packed elements. """ bitset_copy(C, (self._A)._M0[self._prow[x]]) - cdef _coclosure_internal(self, bitset_t R, bitset_t F) noexcept: + cdef _coclosure_internal(self, bitset_t R, bitset_t F): """ Bitpacked version of ``coclosure``. @@ -4252,7 +4252,7 @@ cdef class TernaryMatroid(LinearMatroid): bitset_add(R, y) y = bitset_next(self._inside, y + 1) - cdef _exchange_value_internal(self, long x, long y) noexcept: + cdef _exchange_value_internal(self, long x, long y): r""" Return the (x, y) entry of the current representation. """ @@ -4284,7 +4284,7 @@ cdef class TernaryMatroid(LinearMatroid): S = S + '-' return S - cpdef _current_rows_cols(self, B=None) noexcept: + cpdef _current_rows_cols(self, B=None): """ Return the current row and column labels of a reduced matrix. @@ -4325,7 +4325,7 @@ cdef class TernaryMatroid(LinearMatroid): c += 1 return rows, cols - cpdef LeanMatrix _basic_representation(self, B=None) noexcept: + cpdef LeanMatrix _basic_representation(self, B=None): """ Return a basic matrix representation of the matroid. @@ -4364,7 +4364,7 @@ cdef class TernaryMatroid(LinearMatroid): self._move_current_basis(B, set()) return self._A.copy() # Deprecated Sage matrix operation - cpdef LeanMatrix _reduced_representation(self, B=None) noexcept: + cpdef LeanMatrix _reduced_representation(self, B=None): r""" Return a reduced representation of the matroid, i.e. a matrix `R` such that `[I\ \ R]` represents the matroid. @@ -4406,7 +4406,7 @@ cdef class TernaryMatroid(LinearMatroid): # isomorphism - cpdef _is_isomorphic(self, other, certificate=False) noexcept: + cpdef _is_isomorphic(self, other, certificate=False): """ Test if ``self`` is isomorphic to ``other``. Internal version that performs no checks on input. @@ -4445,7 +4445,7 @@ cdef class TernaryMatroid(LinearMatroid): # invariants - cpdef _make_invariant(self) noexcept: + cpdef _make_invariant(self): """ Create an invariant. @@ -4517,7 +4517,7 @@ cdef class TernaryMatroid(LinearMatroid): self._t_partition = tuple([F, Fa, Fb, Fc]) self._t_invariant = tuple([d, c, len(F), len(Fa), len(Fb), len(Fc), p[0], p[1], p[2], p[3], p[4], p[5]]) - cpdef _invariant(self) noexcept: + cpdef _invariant(self): r""" Return a matroid invariant. @@ -4546,7 +4546,7 @@ cdef class TernaryMatroid(LinearMatroid): self._make_invariant() return self._t_invariant - cpdef bicycle_dimension(self) noexcept: + cpdef bicycle_dimension(self): r""" Return the bicycle dimension of the ternary matroid. @@ -4569,7 +4569,7 @@ cdef class TernaryMatroid(LinearMatroid): self._make_invariant() return self._t_invariant[0] - cpdef character(self) noexcept: + cpdef character(self): r""" Return the character of the ternary matroid. @@ -4595,7 +4595,7 @@ cdef class TernaryMatroid(LinearMatroid): self._make_invariant() return self._t_invariant[1] - cpdef _principal_quadripartition(self) noexcept: + cpdef _principal_quadripartition(self): r""" Return an ordered partition of the ground set. @@ -4628,7 +4628,7 @@ cdef class TernaryMatroid(LinearMatroid): self._make_invariant() return tuple([[self._E[j] for j in self._t_partition[0]], [self._E[j] for j in self._t_partition[1]], [self._E[j] for j in self._t_partition[2]], [self._E[j] for j in self._t_partition[3]]]) - cpdef TernaryMatrix _projection(self) noexcept: + cpdef TernaryMatrix _projection(self): """ Return the projection matrix onto the row space. @@ -4669,7 +4669,7 @@ cdef class TernaryMatroid(LinearMatroid): self._make_invariant() return self._t_projection - cpdef _fast_isom_test(self, other) noexcept: + cpdef _fast_isom_test(self, other): r""" Run a quick test to see if two ternary matroids are isomorphic. @@ -4700,7 +4700,7 @@ cdef class TernaryMatroid(LinearMatroid): # minors, dual - cpdef _minor(self, contractions, deletions) noexcept: + cpdef _minor(self, contractions, deletions): r""" Return a minor. @@ -4742,7 +4742,7 @@ cdef class TernaryMatroid(LinearMatroid): basis=bas, keep_initial_representation=False) - cpdef is_valid(self) noexcept: + cpdef is_valid(self): r""" Test if the data obey the matroid axioms. @@ -4763,7 +4763,7 @@ cdef class TernaryMatroid(LinearMatroid): # representability - cpdef ternary_matroid(self, randomized_tests=1, verify = True) noexcept: + cpdef ternary_matroid(self, randomized_tests=1, verify = True): r""" Return a ternary matroid representing ``self``. @@ -4793,7 +4793,7 @@ cdef class TernaryMatroid(LinearMatroid): """ return self - cpdef is_ternary(self, randomized_tests=1) noexcept: + cpdef is_ternary(self, randomized_tests=1): r""" Decide if ``self`` is a binary matroid. @@ -5078,7 +5078,7 @@ cdef class QuaternaryMatroid(LinearMatroid): self._x_zero = (self._A)._x_zero self._x_one = (self._A)._x_one - cpdef base_ring(self) noexcept: + cpdef base_ring(self): r""" Return the base ring of the matrix representing the matroid, in this case `\GF{4}`. @@ -5092,7 +5092,7 @@ cdef class QuaternaryMatroid(LinearMatroid): """ return (self._A).base_ring() - cpdef characteristic(self) noexcept: + cpdef characteristic(self): """ Return the characteristic of the base ring of the matrix representing the matroid, in this case `2`. @@ -5121,13 +5121,13 @@ cdef class QuaternaryMatroid(LinearMatroid): self._prow[y] = p BasisExchangeMatroid._exchange(self, x, y) - cdef __fundamental_cocircuit(self, bitset_t C, long x) noexcept: + cdef __fundamental_cocircuit(self, bitset_t C, long x): r""" Fill bitset `C` with the incidence vector of the `B`-fundamental cocircuit using ``x``. Internal method using packed elements. """ bitset_union(C, (self._A)._M0[self._prow[x]], (self._A)._M1[self._prow[x]]) - cdef _coclosure_internal(self, bitset_t R, bitset_t F) noexcept: + cdef _coclosure_internal(self, bitset_t R, bitset_t F): """ Bitpacked version of ``coclosure``. @@ -5150,7 +5150,7 @@ cdef class QuaternaryMatroid(LinearMatroid): bitset_add(R, y) y = bitset_next(self._inside, y + 1) - cdef _exchange_value_internal(self, long x, long y) noexcept: + cdef _exchange_value_internal(self, long x, long y): r""" Return the (x, y) entry of the current representation. """ @@ -5170,7 +5170,7 @@ cdef class QuaternaryMatroid(LinearMatroid): S = "Quaternary matroid of rank " + str(self.rank()) + " on " + str(self.size()) + " elements" return S - cpdef _current_rows_cols(self, B=None) noexcept: + cpdef _current_rows_cols(self, B=None): """ Return the current row and column labels of a reduced matrix. @@ -5212,7 +5212,7 @@ cdef class QuaternaryMatroid(LinearMatroid): c += 1 return rows, cols - cpdef LeanMatrix _basic_representation(self, B=None) noexcept: + cpdef LeanMatrix _basic_representation(self, B=None): """ Return a basic matrix representation of the matroid. @@ -5255,7 +5255,7 @@ cdef class QuaternaryMatroid(LinearMatroid): self._move_current_basis(B, set()) return self._A.copy() # Deprecated Sage matrix operation - cpdef LeanMatrix _reduced_representation(self, B=None) noexcept: + cpdef LeanMatrix _reduced_representation(self, B=None): r""" Return a reduced representation of the matroid, i.e. a matrix `R` such that `[I\ \ R]` represents the matroid. @@ -5299,7 +5299,7 @@ cdef class QuaternaryMatroid(LinearMatroid): _, cols = self._current_rows_cols() return self._A.matrix_from_rows_and_columns(range(self.full_rank()), [self._idx[e] for e in cols]) - cpdef _make_invariant(self) noexcept: + cpdef _make_invariant(self): """ Create an invariant. @@ -5366,7 +5366,7 @@ cdef class QuaternaryMatroid(LinearMatroid): self._q_partition = tuple([F, Fa, Fb]) self._q_invariant = tuple([d, len(F), len(Fa), len(Fb), p[0], p[1], p[2]]) - cpdef _invariant(self) noexcept: + cpdef _invariant(self): r""" Return a matroid invariant. @@ -5394,7 +5394,7 @@ cdef class QuaternaryMatroid(LinearMatroid): self._make_invariant() return self._q_invariant - cpdef bicycle_dimension(self) noexcept: + cpdef bicycle_dimension(self): r""" Return the bicycle dimension of the quaternary matroid. @@ -5421,7 +5421,7 @@ cdef class QuaternaryMatroid(LinearMatroid): self._make_invariant() return self._q_invariant[0] - cpdef _principal_tripartition(self) noexcept: + cpdef _principal_tripartition(self): r""" Return the principal tripartition of the quaternary matroid. @@ -5460,7 +5460,7 @@ cdef class QuaternaryMatroid(LinearMatroid): P = self._q_partition return frozenset([self._E[e] for e in P[0]]), frozenset([self._E[e] for e in P[1]]), frozenset([self._E[e] for e in P[2]]) - cpdef _fast_isom_test(self, other) noexcept: + cpdef _fast_isom_test(self, other): r""" Run a quick test to see if two quaternary matroids are isomorphic. @@ -5489,7 +5489,7 @@ cdef class QuaternaryMatroid(LinearMatroid): # minors, dual - cpdef _minor(self, contractions, deletions) noexcept: + cpdef _minor(self, contractions, deletions): r""" Return a minor. @@ -5531,7 +5531,7 @@ cdef class QuaternaryMatroid(LinearMatroid): basis=bas, keep_initial_representation=False) - cpdef is_valid(self) noexcept: + cpdef is_valid(self): r""" Test if the data obey the matroid axioms. @@ -5751,7 +5751,7 @@ cdef class RegularMatroid(LinearMatroid): """ LinearMatroid.__init__(self, matrix, groundset, reduced_matrix, ring=ZZ, keep_initial_representation=keep_initial_representation) - cdef list _setup_internal_representation(self, matrix, reduced_matrix, ring, keep_initial_representation) noexcept: + cdef list _setup_internal_representation(self, matrix, reduced_matrix, ring, keep_initial_representation): """ Setup the internal representation matrix ``self._A`` and the array of row- and column indices ``self._prow``. @@ -5794,7 +5794,7 @@ cdef class RegularMatroid(LinearMatroid): self._prow[self._A.nrows() + r] = r return P - cpdef base_ring(self) noexcept: + cpdef base_ring(self): r""" Return the base ring of the matrix representing the matroid, in this case `\ZZ`. @@ -5807,7 +5807,7 @@ cdef class RegularMatroid(LinearMatroid): """ return ZZ - cpdef characteristic(self) noexcept: + cpdef characteristic(self): """ Return the characteristic of the base ring of the matrix representing the matroid, in this case `0`. @@ -5851,7 +5851,7 @@ cdef class RegularMatroid(LinearMatroid): self._prow[x] = py BasisExchangeMatroid._exchange(self, x, y) - cdef _exchange_value_internal(self, long x, long y) noexcept: + cdef _exchange_value_internal(self, long x, long y): r""" Return the (x, y) entry of the current representation. @@ -5878,7 +5878,7 @@ cdef class RegularMatroid(LinearMatroid): S = "Regular matroid of rank " + str(self.rank()) + " on " + str(self.size()) + " elements with " + str(self.bases_count()) + " bases" return S - cpdef bases_count(self) noexcept: + cpdef bases_count(self): """ Count the number of bases. @@ -5898,7 +5898,7 @@ cdef class RegularMatroid(LinearMatroid): self._bases_count = (R * R.transpose()).det() return self._bases_count - cpdef _projection(self) noexcept: + cpdef _projection(self): """ Return the projection matrix onto the row space. @@ -5938,7 +5938,7 @@ cdef class RegularMatroid(LinearMatroid): self._r_projection = R.transpose() * (R * R.transpose()).adjugate() * R return self._r_projection - cpdef _invariant(self) noexcept: + cpdef _invariant(self): """ Compute a regular matroid invariant. @@ -5988,7 +5988,7 @@ cdef class RegularMatroid(LinearMatroid): self._r_invariant = hash(tuple([tuple([(w, A[w]) for w in sorted(A)]), tuple([(w, B[w]) for w in sorted(B)]), N])) return self._r_invariant - cpdef _hypergraph(self) noexcept: + cpdef _hypergraph(self): """ Create a bipartite digraph and a vertex partition. @@ -6071,7 +6071,7 @@ cdef class RegularMatroid(LinearMatroid): # self._r_hypergraph = self._r_hypergraph.max_refined() # return self._r_hypergraph - cpdef _is_isomorphic(self, other, certificate=False) noexcept: + cpdef _is_isomorphic(self, other, certificate=False): """ Test if ``self`` is isomorphic to ``other``. @@ -6139,7 +6139,7 @@ cdef class RegularMatroid(LinearMatroid): else: return LinearMatroid._is_isomorphic(self, other) - cpdef _fast_isom_test(self, other) noexcept: + cpdef _fast_isom_test(self, other): r""" Run a quick test to see if two regular matroids are isomorphic. @@ -6180,7 +6180,7 @@ cdef class RegularMatroid(LinearMatroid): if self._is_field_isomorphism(other, m): return True - cdef _hypertest(self, other) noexcept: + cdef _hypertest(self, other): """ Test if the hypergraphs associated with ``self`` and ``other`` are isomorphic, and if so return an isomorphism. @@ -6213,7 +6213,7 @@ cdef class RegularMatroid(LinearMatroid): idx={str(f):f for f in other.groundset()} return {e:idx[m[str(e)]] for e in self.groundset() if str(e) in m} - cpdef has_line_minor(self, k, hyperlines=None, certificate=False) noexcept: + cpdef has_line_minor(self, k, hyperlines=None, certificate=False): r""" Test if the matroid has a `U_{2, k}`-minor. @@ -6266,7 +6266,7 @@ cdef class RegularMatroid(LinearMatroid): return False return Matroid.has_line_minor(self, k, hyperlines, certificate) - cpdef _linear_extension_chains(self, F, fundamentals=None) noexcept: + cpdef _linear_extension_chains(self, F, fundamentals=None): r""" Create a list of chains that determine single-element extensions of this linear matroid representation. @@ -6303,7 +6303,7 @@ cdef class RegularMatroid(LinearMatroid): fundamentals = set([1]) return LinearMatroid._linear_extension_chains(self, F, fundamentals) - cpdef is_graphic(self) noexcept: + cpdef is_graphic(self): """ Test if the regular matroid is graphic. @@ -6336,7 +6336,7 @@ cdef class RegularMatroid(LinearMatroid): """ return BinaryMatroid(reduced_matrix=self._reduced_representation()).is_graphic() - cpdef is_valid(self) noexcept: + cpdef is_valid(self): r""" Test if the data obey the matroid axioms. @@ -6367,7 +6367,7 @@ cdef class RegularMatroid(LinearMatroid): # representation - cpdef binary_matroid(self, randomized_tests=1, verify = True) noexcept: + cpdef binary_matroid(self, randomized_tests=1, verify = True): r""" Return a binary matroid representing ``self``. @@ -6398,7 +6398,7 @@ cdef class RegularMatroid(LinearMatroid): A, E = self.representation(B = self.basis(), reduced = False, labels = True) return BinaryMatroid(matrix = A, groundset = E) - cpdef is_binary(self, randomized_tests=1) noexcept: + cpdef is_binary(self, randomized_tests=1): r""" Decide if ``self`` is a binary matroid. @@ -6426,7 +6426,7 @@ cdef class RegularMatroid(LinearMatroid): """ return True - cpdef ternary_matroid(self, randomized_tests=1, verify = True) noexcept: + cpdef ternary_matroid(self, randomized_tests=1, verify = True): r""" Return a ternary matroid representing ``self``. @@ -6457,7 +6457,7 @@ cdef class RegularMatroid(LinearMatroid): A, E = self.representation(B = self.basis(), reduced = False, labels = True) return TernaryMatroid(matrix = A, groundset = E) - cpdef is_ternary(self, randomized_tests=1) noexcept: + cpdef is_ternary(self, randomized_tests=1): r""" Decide if ``self`` is a ternary matroid. diff --git a/src/sage/matroids/matroid.pxd b/src/sage/matroids/matroid.pxd index 7d2bc60078d..4e2d6877ac7 100644 --- a/src/sage/matroids/matroid.pxd +++ b/src/sage/matroids/matroid.pxd @@ -7,36 +7,36 @@ cdef class Matroid(SageObject): cdef int _stored_size # virtual methods - cpdef groundset(self) noexcept - cpdef _rank(self, X) noexcept + cpdef groundset(self) + cpdef _rank(self, X) # internal methods, assuming verified input - cpdef _max_independent(self, X) noexcept - cpdef _circuit(self, X) noexcept - cpdef _fundamental_circuit(self, B, e) noexcept - cpdef _closure(self, X) noexcept - cpdef _corank(self, X) noexcept - cpdef _max_coindependent(self, X) noexcept - cpdef _cocircuit(self, X) noexcept - cpdef _fundamental_cocircuit(self, B, e) noexcept - cpdef _coclosure(self, X) noexcept - cpdef _augment(self, X, Y) noexcept - - cpdef _is_independent(self, X) noexcept - cpdef _is_basis(self, X) noexcept - cpdef _is_circuit(self, X) noexcept - cpdef _is_closed(self, X) noexcept - cpdef _is_coindependent(self, X) noexcept - cpdef _is_cobasis(self, X) noexcept - cpdef _is_cocircuit(self, X) noexcept - cpdef _is_coclosed(self, X) noexcept - - cpdef _minor(self, contractions, deletions) noexcept - cpdef _has_minor(self, N, bint certificate=*) noexcept - cpdef _line_length(self, F) noexcept - cpdef _extension(self, element, hyperplanes) noexcept - - cdef inline _subset_internal(self, X) noexcept: + cpdef _max_independent(self, X) + cpdef _circuit(self, X) + cpdef _fundamental_circuit(self, B, e) + cpdef _closure(self, X) + cpdef _corank(self, X) + cpdef _max_coindependent(self, X) + cpdef _cocircuit(self, X) + cpdef _fundamental_cocircuit(self, B, e) + cpdef _coclosure(self, X) + cpdef _augment(self, X, Y) + + cpdef _is_independent(self, X) + cpdef _is_basis(self, X) + cpdef _is_circuit(self, X) + cpdef _is_closed(self, X) + cpdef _is_coindependent(self, X) + cpdef _is_cobasis(self, X) + cpdef _is_cocircuit(self, X) + cpdef _is_coclosed(self, X) + + cpdef _minor(self, contractions, deletions) + cpdef _has_minor(self, N, bint certificate=*) + cpdef _line_length(self, F) + cpdef _extension(self, element, hyperplanes) + + cdef inline _subset_internal(self, X): """ Convert ``X`` to a ``frozenset`` and check that it is a subset of the groundset. @@ -48,7 +48,7 @@ cdef class Matroid(SageObject): raise ValueError(f"{X!r} is not a subset of the groundset") return S - cdef inline __subset_all(self, X) noexcept: + cdef inline __subset_all(self, X): """ If ``X`` is ``None``, return the groundset. @@ -66,161 +66,161 @@ cdef class Matroid(SageObject): return S # ** user-facing methods ** - cpdef size(self) noexcept + cpdef size(self) # matroid oracle - cpdef rank(self, X=*) noexcept - cpdef full_rank(self) noexcept - cpdef basis(self) noexcept - cpdef max_independent(self, X) noexcept - cpdef circuit(self, X=*) noexcept - cpdef fundamental_circuit(self, B, e) noexcept - cpdef closure(self, X) noexcept - cpdef k_closure(self, X, k) noexcept - - cpdef augment(self, X, Y=*) noexcept - - cpdef corank(self, X=*) noexcept - cpdef full_corank(self) noexcept - cpdef cobasis(self) noexcept - cpdef max_coindependent(self, X) noexcept - cpdef cocircuit(self, X=*) noexcept - cpdef fundamental_cocircuit(self, B, e) noexcept - cpdef coclosure(self, X) noexcept - - cpdef loops(self) noexcept - cpdef is_independent(self, X) noexcept - cpdef is_dependent(self, X) noexcept - cpdef is_basis(self, X) noexcept - cpdef is_circuit(self, X) noexcept - cpdef is_closed(self, X) noexcept - cpdef is_subset_k_closed(self, X, int k) noexcept - - cpdef coloops(self) noexcept - cpdef is_coindependent(self, X) noexcept - cpdef is_codependent(self, X) noexcept - cpdef is_cobasis(self, X) noexcept - cpdef is_cocircuit(self, X) noexcept - cpdef is_coclosed(self, X) noexcept + cpdef rank(self, X=*) + cpdef full_rank(self) + cpdef basis(self) + cpdef max_independent(self, X) + cpdef circuit(self, X=*) + cpdef fundamental_circuit(self, B, e) + cpdef closure(self, X) + cpdef k_closure(self, X, k) + + cpdef augment(self, X, Y=*) + + cpdef corank(self, X=*) + cpdef full_corank(self) + cpdef cobasis(self) + cpdef max_coindependent(self, X) + cpdef cocircuit(self, X=*) + cpdef fundamental_cocircuit(self, B, e) + cpdef coclosure(self, X) + + cpdef loops(self) + cpdef is_independent(self, X) + cpdef is_dependent(self, X) + cpdef is_basis(self, X) + cpdef is_circuit(self, X) + cpdef is_closed(self, X) + cpdef is_subset_k_closed(self, X, int k) + + cpdef coloops(self) + cpdef is_coindependent(self, X) + cpdef is_codependent(self, X) + cpdef is_cobasis(self, X) + cpdef is_cocircuit(self, X) + cpdef is_coclosed(self, X) # verification - cpdef is_valid(self) noexcept + cpdef is_valid(self) # enumeration - cpdef circuits(self) noexcept - cpdef nonspanning_circuits(self) noexcept - cpdef cocircuits(self) noexcept - cpdef noncospanning_cocircuits(self) noexcept - cpdef circuit_closures(self) noexcept - cpdef nonspanning_circuit_closures(self) noexcept - cpdef bases(self) noexcept - cpdef independent_sets(self) noexcept - cpdef independent_r_sets(self, long r) noexcept - cpdef nonbases(self) noexcept - cpdef dependent_r_sets(self, long r) noexcept - cpdef _extend_flags(self, flags) noexcept - cpdef _flags(self, r) noexcept - cpdef flats(self, r) noexcept - cpdef coflats(self, r) noexcept - cpdef hyperplanes(self) noexcept - cpdef f_vector(self) noexcept - cpdef broken_circuits(self, ordering=*) noexcept - cpdef no_broken_circuits_sets(self, ordering=*) noexcept + cpdef circuits(self) + cpdef nonspanning_circuits(self) + cpdef cocircuits(self) + cpdef noncospanning_cocircuits(self) + cpdef circuit_closures(self) + cpdef nonspanning_circuit_closures(self) + cpdef bases(self) + cpdef independent_sets(self) + cpdef independent_r_sets(self, long r) + cpdef nonbases(self) + cpdef dependent_r_sets(self, long r) + cpdef _extend_flags(self, flags) + cpdef _flags(self, r) + cpdef flats(self, r) + cpdef coflats(self, r) + cpdef hyperplanes(self) + cpdef f_vector(self) + cpdef broken_circuits(self, ordering=*) + cpdef no_broken_circuits_sets(self, ordering=*) # isomorphism - cpdef is_isomorphic(self, other, certificate=*) noexcept - cpdef _is_isomorphic(self, other, certificate=*) noexcept - cpdef isomorphism(self, other) noexcept - cpdef _isomorphism(self, other) noexcept - cpdef equals(self, other) noexcept - cpdef is_isomorphism(self, other, morphism) noexcept - cpdef _is_isomorphism(self, other, morphism) noexcept + cpdef is_isomorphic(self, other, certificate=*) + cpdef _is_isomorphic(self, other, certificate=*) + cpdef isomorphism(self, other) + cpdef _isomorphism(self, other) + cpdef equals(self, other) + cpdef is_isomorphism(self, other, morphism) + cpdef _is_isomorphism(self, other, morphism) # minors, dual, truncation - cpdef minor(self, contractions=*, deletions=*) noexcept - cpdef contract(self, X) noexcept - cpdef delete(self, X) noexcept - cpdef _backslash_(self, X) noexcept - cpdef dual(self) noexcept - cpdef truncation(self) noexcept - cpdef has_minor(self, N, bint certificate=*) noexcept - cpdef has_line_minor(self, k, hyperlines=*, certificate=*) noexcept - cpdef _has_line_minor(self, k, hyperlines, certificate=*) noexcept + cpdef minor(self, contractions=*, deletions=*) + cpdef contract(self, X) + cpdef delete(self, X) + cpdef _backslash_(self, X) + cpdef dual(self) + cpdef truncation(self) + cpdef has_minor(self, N, bint certificate=*) + cpdef has_line_minor(self, k, hyperlines=*, certificate=*) + cpdef _has_line_minor(self, k, hyperlines, certificate=*) # extension - cpdef extension(self, element=*, subsets=*) noexcept - cpdef coextension(self, element=*, subsets=*) noexcept - cpdef modular_cut(self, subsets) noexcept - cpdef linear_subclasses(self, line_length=*, subsets=*) noexcept - cpdef extensions(self, element=*, line_length=*, subsets=*) noexcept + cpdef extension(self, element=*, subsets=*) + cpdef coextension(self, element=*, subsets=*) + cpdef modular_cut(self, subsets) + cpdef linear_subclasses(self, line_length=*, subsets=*) + cpdef extensions(self, element=*, line_length=*, subsets=*) # connectivity - cpdef simplify(self) noexcept - cpdef cosimplify(self) noexcept - cpdef is_simple(self) noexcept - cpdef is_cosimple(self) noexcept - cpdef components(self) noexcept - cpdef is_connected(self, certificate=*) noexcept - cpdef connectivity(self, S, T=*) noexcept - cpdef _connectivity(self, S, T) noexcept - cpdef is_kconnected(self, k, certificate=*) noexcept - cpdef link(self, S, T) noexcept - cpdef _link(self, S, T) noexcept - cpdef _is_3connected_shifting(self, certificate=*) noexcept - cpdef _is_4connected_shifting(self, certificate=*) noexcept - cpdef _shifting_all(self, X, P_rows, P_cols, Q_rows, Q_cols, m) noexcept - cpdef _shifting(self, X, X_1, Y_2, X_2, Y_1, m) noexcept - cpdef is_3connected(self, certificate=*, algorithm=*) noexcept - cpdef is_4connected(self, certificate=*, algorithm=*) noexcept - cpdef _is_3connected_CE(self, certificate=*) noexcept - cpdef _is_3connected_BC(self, certificate=*) noexcept - cpdef _is_3connected_BC_recursion(self, basis, fund_cocircuits) noexcept - cpdef is_paving(self) noexcept - cpdef is_sparse_paving(self) noexcept - cpdef girth(self) noexcept + cpdef simplify(self) + cpdef cosimplify(self) + cpdef is_simple(self) + cpdef is_cosimple(self) + cpdef components(self) + cpdef is_connected(self, certificate=*) + cpdef connectivity(self, S, T=*) + cpdef _connectivity(self, S, T) + cpdef is_kconnected(self, k, certificate=*) + cpdef link(self, S, T) + cpdef _link(self, S, T) + cpdef _is_3connected_shifting(self, certificate=*) + cpdef _is_4connected_shifting(self, certificate=*) + cpdef _shifting_all(self, X, P_rows, P_cols, Q_rows, Q_cols, m) + cpdef _shifting(self, X, X_1, Y_2, X_2, Y_1, m) + cpdef is_3connected(self, certificate=*, algorithm=*) + cpdef is_4connected(self, certificate=*, algorithm=*) + cpdef _is_3connected_CE(self, certificate=*) + cpdef _is_3connected_BC(self, certificate=*) + cpdef _is_3connected_BC_recursion(self, basis, fund_cocircuits) + cpdef is_paving(self) + cpdef is_sparse_paving(self) + cpdef girth(self) # representability - cpdef _local_binary_matroid(self, basis=*) noexcept - cpdef binary_matroid(self, randomized_tests=*, verify=*) noexcept - cpdef is_binary(self, randomized_tests=*) noexcept - cpdef _local_ternary_matroid(self, basis=*) noexcept - cpdef ternary_matroid(self, randomized_tests=*, verify=*) noexcept - cpdef is_ternary(self, randomized_tests=*) noexcept + cpdef _local_binary_matroid(self, basis=*) + cpdef binary_matroid(self, randomized_tests=*, verify=*) + cpdef is_binary(self, randomized_tests=*) + cpdef _local_ternary_matroid(self, basis=*) + cpdef ternary_matroid(self, randomized_tests=*, verify=*) + cpdef is_ternary(self, randomized_tests=*) # matroid k-closed - cpdef is_k_closed(self, int k) noexcept + cpdef is_k_closed(self, int k) # matroid chordality - cpdef _is_circuit_chordal(self, frozenset C, bint certificate=*) noexcept - cpdef is_circuit_chordal(self, C, bint certificate=*) noexcept - cpdef is_chordal(self, k1=*, k2=*, bint certificate=*) noexcept - cpdef chordality(self) noexcept + cpdef _is_circuit_chordal(self, frozenset C, bint certificate=*) + cpdef is_circuit_chordal(self, C, bint certificate=*) + cpdef is_chordal(self, k1=*, k2=*, bint certificate=*) + cpdef chordality(self) # optimization - cpdef max_weight_independent(self, X=*, weights=*) noexcept - cpdef max_weight_coindependent(self, X=*, weights=*) noexcept - cpdef is_max_weight_independent_generic(self, X=*, weights=*) noexcept - cpdef is_max_weight_coindependent_generic(self, X=*, weights=*) noexcept - cpdef intersection(self, other, weights=*) noexcept - cpdef _intersection(self, other, weights) noexcept - cpdef _intersection_augmentation(self, other, weights, Y) noexcept - cpdef intersection_unweighted(self, other) noexcept - cpdef _intersection_unweighted(self, other) noexcept - cpdef _intersection_augmentation_unweighted(self, other, Y) noexcept - cpdef partition(self) noexcept + cpdef max_weight_independent(self, X=*, weights=*) + cpdef max_weight_coindependent(self, X=*, weights=*) + cpdef is_max_weight_independent_generic(self, X=*, weights=*) + cpdef is_max_weight_coindependent_generic(self, X=*, weights=*) + cpdef intersection(self, other, weights=*) + cpdef _intersection(self, other, weights) + cpdef _intersection_augmentation(self, other, weights, Y) + cpdef intersection_unweighted(self, other) + cpdef _intersection_unweighted(self, other) + cpdef _intersection_augmentation_unweighted(self, other, Y) + cpdef partition(self) # invariants - cpdef _internal(self, B) noexcept - cpdef _external(self, B) noexcept - cpdef tutte_polynomial(self, x=*, y=*) noexcept - cpdef flat_cover(self, solver=*, verbose=*, integrality_tolerance=*) noexcept + cpdef _internal(self, B) + cpdef _external(self, B) + cpdef tutte_polynomial(self, x=*, y=*) + cpdef flat_cover(self, solver=*, verbose=*, integrality_tolerance=*) # misc - cpdef automorphism_group(self) noexcept - cpdef bergman_complex(self) noexcept - cpdef augmented_bergman_complex(self) noexcept + cpdef automorphism_group(self) + cpdef bergman_complex(self) + cpdef augmented_bergman_complex(self) # visualization - cpdef plot(self,B=*,lineorders=*,pos_method=*,pos_dict=*,save_pos=*) noexcept - cpdef show(self,B=*,lineorders=*,pos_method=*,pos_dict=*,save_pos=*,lims=*) noexcept - cpdef _fix_positions(self,pos_dict=*,lineorders=*) noexcept + cpdef plot(self,B=*,lineorders=*,pos_method=*,pos_dict=*,save_pos=*) + cpdef show(self,B=*,lineorders=*,pos_method=*,pos_dict=*,save_pos=*,lims=*) + cpdef _fix_positions(self,pos_dict=*,lineorders=*) diff --git a/src/sage/matroids/matroid.pyx b/src/sage/matroids/matroid.pyx index 2da743d35c9..a64501bbb9a 100644 --- a/src/sage/matroids/matroid.pyx +++ b/src/sage/matroids/matroid.pyx @@ -463,7 +463,7 @@ cdef class Matroid(SageObject): # virtual methods - cpdef groundset(self) noexcept: + cpdef groundset(self): """ Return the groundset of the matroid. @@ -488,7 +488,7 @@ cdef class Matroid(SageObject): """ raise NotImplementedError("subclasses need to implement this.") - cpdef _rank(self, X) noexcept: + cpdef _rank(self, X): r""" Return the rank of a set ``X``. @@ -522,7 +522,7 @@ cdef class Matroid(SageObject): # for better efficiency, its best to override the following methods in # each derived class - cpdef _max_independent(self, X) noexcept: + cpdef _max_independent(self, X): """ Compute a maximal independent subset. @@ -554,7 +554,7 @@ cdef class Matroid(SageObject): res.discard(e) return frozenset(res) - cpdef _circuit(self, X) noexcept: + cpdef _circuit(self, X): """ Return a minimal dependent subset. @@ -592,7 +592,7 @@ cdef class Matroid(SageObject): l -= 1 return frozenset(Z) - cpdef _fundamental_circuit(self, B, e) noexcept: + cpdef _fundamental_circuit(self, B, e): r""" Return the `B`-fundamental circuit using `e`. @@ -615,7 +615,7 @@ cdef class Matroid(SageObject): """ return self._circuit(B.union([e])) - cpdef _closure(self, X) noexcept: + cpdef _closure(self, X): """ Return the closure of a set. @@ -643,7 +643,7 @@ cdef class Matroid(SageObject): X.discard(y) return frozenset(X) - cpdef _corank(self, X) noexcept: + cpdef _corank(self, X): """ Return the corank of a set. @@ -664,7 +664,7 @@ cdef class Matroid(SageObject): """ return len(X) + self._rank(self.groundset().difference(X)) - self.full_rank() - cpdef _max_coindependent(self, X) noexcept: + cpdef _max_coindependent(self, X): """ Compute a maximal coindependent subset. @@ -696,7 +696,7 @@ cdef class Matroid(SageObject): res.discard(e) return frozenset(res) - cpdef _cocircuit(self, X) noexcept: + cpdef _cocircuit(self, X): """ Return a minimal codependent subset. @@ -734,7 +734,7 @@ cdef class Matroid(SageObject): l -= 1 return frozenset(Z) - cpdef _fundamental_cocircuit(self, B, e) noexcept: + cpdef _fundamental_cocircuit(self, B, e): r""" Return the `B`-fundamental circuit using `e`. @@ -757,7 +757,7 @@ cdef class Matroid(SageObject): """ return self._cocircuit(self.groundset().difference(B).union([e])) - cpdef _coclosure(self, X) noexcept: + cpdef _coclosure(self, X): """ Return the coclosure of a set. @@ -785,7 +785,7 @@ cdef class Matroid(SageObject): X.discard(y) return frozenset(X) - cpdef _augment(self, X, Y) noexcept: + cpdef _augment(self, X, Y): r""" Return a maximal subset `I` of `Y` such that `r(X + I)=r(X) + r(I)`. @@ -825,7 +825,7 @@ cdef class Matroid(SageObject): # override the following methods for even better efficiency - cpdef _is_independent(self, X) noexcept: + cpdef _is_independent(self, X): """ Test if input is independent. @@ -848,7 +848,7 @@ cdef class Matroid(SageObject): """ return len(X) == self._rank(X) - cpdef _is_basis(self, X) noexcept: + cpdef _is_basis(self, X): """ Test if input is a basis. @@ -883,7 +883,7 @@ cdef class Matroid(SageObject): """ return self._is_independent(X) - cpdef _is_circuit(self, X) noexcept: + cpdef _is_circuit(self, X): """ Test if input is a circuit. @@ -917,7 +917,7 @@ cdef class Matroid(SageObject): Z.add(x) return True - cpdef _is_closed(self, X) noexcept: + cpdef _is_closed(self, X): """ Test if input is a closed set. @@ -948,7 +948,7 @@ cdef class Matroid(SageObject): X.discard(y) return True - cpdef _is_coindependent(self, X) noexcept: + cpdef _is_coindependent(self, X): """ Test if input is coindependent. @@ -971,7 +971,7 @@ cdef class Matroid(SageObject): """ return self._corank(X) == len(X) - cpdef _is_cobasis(self, X) noexcept: + cpdef _is_cobasis(self, X): """ Test if input is a cobasis. @@ -1001,7 +1001,7 @@ cdef class Matroid(SageObject): """ return self._is_basis(self.groundset().difference(X)) - cpdef _is_cocircuit(self, X) noexcept: + cpdef _is_cocircuit(self, X): """ Test if input is a cocircuit. @@ -1035,7 +1035,7 @@ cdef class Matroid(SageObject): Z.add(x) return True - cpdef _is_coclosed(self, X) noexcept: + cpdef _is_coclosed(self, X): """ Test if input is a coclosed set. @@ -1066,7 +1066,7 @@ cdef class Matroid(SageObject): X.discard(y) return True - cpdef _minor(self, contractions, deletions) noexcept: + cpdef _minor(self, contractions, deletions): r""" Return a minor. @@ -1105,7 +1105,7 @@ cdef class Matroid(SageObject): from sage.matroids import minor_matroid return minor_matroid.MinorMatroid(self, contractions, deletions) - cpdef _has_minor(self, N, bint certificate=False) noexcept: + cpdef _has_minor(self, N, bint certificate=False): """ Test if matroid has the specified minor, and optionally return frozensets ``X`` and ``Y`` so that ``N`` is isomorphic to ``self.minor(X, Y)``. @@ -1161,7 +1161,7 @@ cdef class Matroid(SageObject): return False, None return False - cpdef _line_length(self, F) noexcept: + cpdef _line_length(self, F): """ Compute the length of the line specified through flat ``F``. @@ -1187,7 +1187,7 @@ cdef class Matroid(SageObject): """ return len(self.minor(contractions=F).simplify()) - cpdef _extension(self, element, hyperplanes) noexcept: + cpdef _extension(self, element, hyperplanes): """ Extend the matroid by a new element. @@ -1255,7 +1255,7 @@ cdef class Matroid(SageObject): """ return self.size() - cpdef size(self) noexcept: + cpdef size(self): """ Return the size of the groundset. @@ -1332,7 +1332,7 @@ cdef class Matroid(SageObject): # User-visible methods - cpdef rank(self, X=None) noexcept: + cpdef rank(self, X=None): r""" Return the rank of ``X``. @@ -1366,7 +1366,7 @@ cdef class Matroid(SageObject): return self.full_rank() return self._rank(self._subset_internal(X)) - cpdef full_rank(self) noexcept: + cpdef full_rank(self): r""" Return the rank of the matroid. @@ -1389,7 +1389,7 @@ cdef class Matroid(SageObject): self._stored_full_rank = self._rank(self.groundset()) return self._stored_full_rank - cpdef basis(self) noexcept: + cpdef basis(self): r""" Return an arbitrary basis of the matroid. @@ -1418,7 +1418,7 @@ cdef class Matroid(SageObject): """ return self._max_independent(self.groundset()) - cpdef max_independent(self, X) noexcept: + cpdef max_independent(self, X): """ Compute a maximal independent subset of ``X``. @@ -1445,7 +1445,7 @@ cdef class Matroid(SageObject): """ return self._max_independent(self._subset_internal(X)) - cpdef circuit(self, X=None) noexcept: + cpdef circuit(self, X=None): """ Return a circuit. @@ -1487,7 +1487,7 @@ cdef class Matroid(SageObject): """ return self._circuit(self.__subset_all(X)) - cpdef fundamental_circuit(self, B, e) noexcept: + cpdef fundamental_circuit(self, B, e): r""" Return the `B`-fundamental circuit using `e`. @@ -1522,7 +1522,7 @@ cdef class Matroid(SageObject): raise ValueError("input e is not an element of the groundset.") return self._fundamental_circuit(B, e) - cpdef closure(self, X) noexcept: + cpdef closure(self, X): """ Return the closure of a set ``X``. @@ -1550,7 +1550,7 @@ cdef class Matroid(SageObject): """ return self._closure(self._subset_internal(X)) - cpdef k_closure(self, X, k) noexcept: + cpdef k_closure(self, X, k): r""" Return the ``k``-closure of ``X``. @@ -1600,7 +1600,7 @@ cdef class Matroid(SageObject): S = cl return S - cpdef augment(self, X, Y=None) noexcept: + cpdef augment(self, X, Y=None): r""" Return a maximal subset `I` of `Y - X` such that `r(X + I) = r(X) + r(I)`. @@ -1638,7 +1638,7 @@ cdef class Matroid(SageObject): Y = self.__subset_all(Y) return self._augment(X, Y.difference(X)) - cpdef corank(self, X=None) noexcept: + cpdef corank(self, X=None): r""" Return the corank of ``X``, or the corank of the groundset if ``X`` is ``None``. @@ -1675,7 +1675,7 @@ cdef class Matroid(SageObject): """ return self._corank(self.__subset_all(X)) - cpdef full_corank(self) noexcept: + cpdef full_corank(self): """ Return the corank of the matroid. @@ -1699,7 +1699,7 @@ cdef class Matroid(SageObject): """ return self.size() - self.full_rank() - cpdef cobasis(self) noexcept: + cpdef cobasis(self): """ Return an arbitrary cobasis of the matroid. @@ -1734,7 +1734,7 @@ cdef class Matroid(SageObject): """ return self.max_coindependent(self.groundset()) - cpdef max_coindependent(self, X) noexcept: + cpdef max_coindependent(self, X): """ Compute a maximal coindependent subset of ``X``. @@ -1772,7 +1772,7 @@ cdef class Matroid(SageObject): """ return self._max_coindependent(self._subset_internal(X)) - cpdef coclosure(self, X) noexcept: + cpdef coclosure(self, X): """ Return the coclosure of a set ``X``. @@ -1804,7 +1804,7 @@ cdef class Matroid(SageObject): """ return self._coclosure(self._subset_internal(X)) - cpdef cocircuit(self, X=None) noexcept: + cpdef cocircuit(self, X=None): """ Return a cocircuit. @@ -1852,7 +1852,7 @@ cdef class Matroid(SageObject): """ return self._cocircuit(self.__subset_all(X)) - cpdef fundamental_cocircuit(self, B, e) noexcept: + cpdef fundamental_cocircuit(self, B, e): r""" Return the `B`-fundamental cocircuit using `e`. @@ -1891,7 +1891,7 @@ cdef class Matroid(SageObject): raise ValueError("input e is not an element of B.") return self._fundamental_cocircuit(B, e) - cpdef loops(self) noexcept: + cpdef loops(self): r""" Return the set of loops of the matroid. @@ -1912,7 +1912,7 @@ cdef class Matroid(SageObject): """ return self._closure(set()) - cpdef is_independent(self, X) noexcept: + cpdef is_independent(self, X): r""" Check if a subset ``X`` is independent in the matroid. @@ -1938,7 +1938,7 @@ cdef class Matroid(SageObject): """ return self._is_independent(self._subset_internal(X)) - cpdef is_dependent(self, X) noexcept: + cpdef is_dependent(self, X): r""" Check if a subset ``X`` is dependent in the matroid. @@ -1964,7 +1964,7 @@ cdef class Matroid(SageObject): """ return not self._is_independent(self._subset_internal(X)) - cpdef is_basis(self, X) noexcept: + cpdef is_basis(self, X): r""" Check if a subset is a basis of the matroid. @@ -1993,7 +1993,7 @@ cdef class Matroid(SageObject): return False return self._is_basis(X) - cpdef is_closed(self, X) noexcept: + cpdef is_closed(self, X): r""" Test if a subset is a closed set of the matroid. @@ -2026,7 +2026,7 @@ cdef class Matroid(SageObject): """ return self._is_closed(self._subset_internal(X)) - cpdef is_subset_k_closed(self, X, int k) noexcept: + cpdef is_subset_k_closed(self, X, int k): r""" Test if ``X`` is a ``k``-closed set of the matroid. @@ -2081,7 +2081,7 @@ cdef class Matroid(SageObject): return False return True - cpdef is_circuit(self, X) noexcept: + cpdef is_circuit(self, X): r""" Test if a subset is a circuit of the matroid. @@ -2109,7 +2109,7 @@ cdef class Matroid(SageObject): """ return self._is_circuit(self._subset_internal(X)) - cpdef coloops(self) noexcept: + cpdef coloops(self): r""" Return the set of coloops of the matroid. @@ -2136,7 +2136,7 @@ cdef class Matroid(SageObject): """ return self._coclosure(set()) - cpdef is_coindependent(self, X) noexcept: + cpdef is_coindependent(self, X): r""" Check if a subset is coindependent in the matroid. @@ -2169,7 +2169,7 @@ cdef class Matroid(SageObject): """ return self._is_coindependent(self._subset_internal(X)) - cpdef is_codependent(self, X) noexcept: + cpdef is_codependent(self, X): r""" Check if a subset is codependent in the matroid. @@ -2202,7 +2202,7 @@ cdef class Matroid(SageObject): """ return not self._is_coindependent(self._subset_internal(X)) - cpdef is_cobasis(self, X) noexcept: + cpdef is_cobasis(self, X): r""" Check if a subset is a cobasis of the matroid. @@ -2239,7 +2239,7 @@ cdef class Matroid(SageObject): return False return self._is_cobasis(X) - cpdef is_cocircuit(self, X) noexcept: + cpdef is_cocircuit(self, X): r""" Test if a subset is a cocircuit of the matroid. @@ -2273,7 +2273,7 @@ cdef class Matroid(SageObject): """ return self._is_cocircuit(self._subset_internal(X)) - cpdef is_coclosed(self, X) noexcept: + cpdef is_coclosed(self, X): r""" Test if a subset is a coclosed set of the matroid. @@ -2308,7 +2308,7 @@ cdef class Matroid(SageObject): # verification - cpdef is_valid(self) noexcept: + cpdef is_valid(self): r""" Test if the data obey the matroid axioms. @@ -2360,7 +2360,7 @@ cdef class Matroid(SageObject): # enumeration - cpdef circuits(self) noexcept: + cpdef circuits(self): """ Return the list of circuits of the matroid. @@ -2388,7 +2388,7 @@ cdef class Matroid(SageObject): for e in self.groundset().difference(B)]) return list(C) - cpdef nonspanning_circuits(self) noexcept: + cpdef nonspanning_circuits(self): """ Return the list of nonspanning circuits of the matroid. @@ -2418,7 +2418,7 @@ cdef class Matroid(SageObject): C.add(self._circuit(N)) return list(C) - cpdef cocircuits(self) noexcept: + cpdef cocircuits(self): """ Return the list of cocircuits of the matroid. @@ -2443,7 +2443,7 @@ cdef class Matroid(SageObject): C.update([self._cocircuit(self.groundset().difference(B).union(set([e]))) for e in B]) return list(C) - cpdef noncospanning_cocircuits(self) noexcept: + cpdef noncospanning_cocircuits(self): """ Return the list of noncospanning cocircuits of the matroid. @@ -2469,7 +2469,7 @@ cdef class Matroid(SageObject): """ return self.dual().nonspanning_circuits() - cpdef circuit_closures(self) noexcept: + cpdef circuit_closures(self): """ Return the list of closures of circuits of the matroid. @@ -2505,7 +2505,7 @@ cdef class Matroid(SageObject): CC[len(C) - 1].add(self.closure(C)) return {r: CC[r] for r in range(self.rank() + 1) if CC[r]} - cpdef nonspanning_circuit_closures(self) noexcept: + cpdef nonspanning_circuit_closures(self): """ Return the list of closures of nonspanning circuits of the matroid. @@ -2538,7 +2538,7 @@ cdef class Matroid(SageObject): CC[len(C) - 1].add(self.closure(C)) return {r: CC[r] for r in range(self.rank() + 1) if CC[r]} - cpdef nonbases(self) noexcept: + cpdef nonbases(self): r""" Return the list of nonbases of the matroid. @@ -2572,7 +2572,7 @@ cdef class Matroid(SageObject): res.append(X) return res - cpdef dependent_r_sets(self, long r) noexcept: + cpdef dependent_r_sets(self, long r): r""" Return the list of dependent subsets of fixed size. @@ -2605,7 +2605,7 @@ cdef class Matroid(SageObject): res.append(X) return res - cpdef bases(self) noexcept: + cpdef bases(self): r""" Return the list of bases of the matroid. @@ -2636,7 +2636,7 @@ cdef class Matroid(SageObject): res.append(X) return res - cpdef independent_sets(self) noexcept: + cpdef independent_sets(self): r""" Return the list of independent subsets of the matroid. @@ -2679,7 +2679,7 @@ cdef class Matroid(SageObject): r -= 1 return res - cpdef independent_r_sets(self, long r) noexcept: + cpdef independent_r_sets(self, long r): r""" Return the list of size-``r`` independent subsets of the matroid. @@ -2719,7 +2719,7 @@ cdef class Matroid(SageObject): res.append(X) return res - cpdef _extend_flags(self, flags) noexcept: + cpdef _extend_flags(self, flags): r""" Recursion for the ``self._flags(r)`` method. @@ -2745,7 +2745,7 @@ cdef class Matroid(SageObject): X = newX return newflags - cpdef _flags(self, r) noexcept: + cpdef _flags(self, r): r""" Compute rank-``r`` flats, with extra information for more speed. @@ -2783,7 +2783,7 @@ cdef class Matroid(SageObject): flags = self._extend_flags(flags) return flags - cpdef flats(self, r) noexcept: + cpdef flats(self, r): r""" Return the collection of flats of the matroid of specified rank. @@ -2812,7 +2812,7 @@ cdef class Matroid(SageObject): return SetSystem(list(self.groundset()), subsets=[f[0] for f in self._flags(r)]) - cpdef coflats(self, r) noexcept: + cpdef coflats(self, r): r""" Return the collection of coflats of the matroid of specified corank. @@ -2855,7 +2855,7 @@ cdef class Matroid(SageObject): for X in self.flats(i)] return LatticePoset((F, lambda x, y: x < y)) - cpdef hyperplanes(self) noexcept: + cpdef hyperplanes(self): """ Return the set of hyperplanes of the matroid. @@ -2878,7 +2878,7 @@ cdef class Matroid(SageObject): """ return self.flats(self.full_rank() - 1) - cpdef f_vector(self) noexcept: + cpdef f_vector(self): r""" Return the `f`-vector of the matroid. @@ -2903,7 +2903,7 @@ cdef class Matroid(SageObject): f_vec.append(len(flags)) return f_vec - cpdef broken_circuits(self, ordering=None) noexcept: + cpdef broken_circuits(self, ordering=None): r""" Return the list of broken circuits of ``self``. @@ -2945,7 +2945,7 @@ cdef class Matroid(SageObject): break return frozenset(ret) - cpdef no_broken_circuits_sets(self, ordering=None) noexcept: + cpdef no_broken_circuits_sets(self, ordering=None): r""" Return the no broken circuits (NBC) sets of ``self``. @@ -3183,7 +3183,7 @@ cdef class Matroid(SageObject): # isomorphism and equality - cpdef is_isomorphic(self, other, certificate=False) noexcept: + cpdef is_isomorphic(self, other, certificate=False): r""" Test matroid isomorphism. @@ -3227,7 +3227,7 @@ cdef class Matroid(SageObject): raise TypeError("can only test for isomorphism between matroids.") return self._is_isomorphic(other, certificate) - cpdef _is_isomorphic(self, other, certificate=False) noexcept: + cpdef _is_isomorphic(self, other, certificate=False): """ Test if ``self`` is isomorphic to ``other``. @@ -3267,7 +3267,7 @@ cdef class Matroid(SageObject): return True return (self.full_rank() == other.full_rank() and self.nonbases()._isomorphism(other.nonbases()) is not None) - cpdef isomorphism(self, other) noexcept: + cpdef isomorphism(self, other): r""" Return a matroid isomorphism. @@ -3306,7 +3306,7 @@ cdef class Matroid(SageObject): raise TypeError("can only give isomorphism between matroids.") return self._isomorphism(other) - cpdef _isomorphism(self, other) noexcept: + cpdef _isomorphism(self, other): """ Return isomorphism from ``self`` to ``other``, if such an isomorphism exists. @@ -3339,7 +3339,7 @@ cdef class Matroid(SageObject): else: return None - cpdef equals(self, other) noexcept: + cpdef equals(self, other): """ Test for matroid equality. @@ -3426,7 +3426,7 @@ cdef class Matroid(SageObject): morphism = {e: e for e in self.groundset()} return self._is_isomorphism(other, morphism) - cpdef is_isomorphism(self, other, morphism) noexcept: + cpdef is_isomorphism(self, other, morphism): r""" Test if a provided morphism induces a matroid isomorphism. @@ -3565,7 +3565,7 @@ cdef class Matroid(SageObject): return False return self._is_isomorphism(other, mf) - cpdef _is_isomorphism(self, other, morphism) noexcept: + cpdef _is_isomorphism(self, other, morphism): r""" Version of :meth:`is_isomorphism` that does no type checking. @@ -3684,7 +3684,7 @@ cdef class Matroid(SageObject): # Minors and duality - cpdef minor(self, contractions=None, deletions=None) noexcept: + cpdef minor(self, contractions=None, deletions=None): r""" Return the minor of ``self`` obtained by contracting, respectively deleting, the element(s) of ``contractions`` and ``deletions``. @@ -3800,7 +3800,7 @@ cdef class Matroid(SageObject): conset, delset = sanitize_contractions_deletions(self, contractions, deletions) return self._minor(conset, delset) - cpdef contract(self, X) noexcept: + cpdef contract(self, X): r""" Contract elements. @@ -3880,7 +3880,7 @@ cdef class Matroid(SageObject): """ return self.contract(X) - cpdef delete(self, X) noexcept: + cpdef delete(self, X): r""" Delete elements. @@ -3946,7 +3946,7 @@ cdef class Matroid(SageObject): """ return self.minor(deletions=X) - cpdef _backslash_(self, X) noexcept: + cpdef _backslash_(self, X): r""" Shorthand for ``self.delete(X)``. @@ -3963,7 +3963,7 @@ cdef class Matroid(SageObject): deprecation(36394, 'the backslash operator has been deprecated; use M.delete(X) instead') return self.delete(X) - cpdef dual(self) noexcept: + cpdef dual(self): r""" Return the dual of the matroid. @@ -3992,7 +3992,7 @@ cdef class Matroid(SageObject): from sage.matroids import dual_matroid return dual_matroid.DualMatroid(self) - cpdef truncation(self) noexcept: + cpdef truncation(self): """ Return a rank-1 truncation of the matroid. @@ -4023,7 +4023,7 @@ cdef class Matroid(SageObject): return self._extension(l, [])._minor(contractions=frozenset([l]), deletions=frozenset([])) - cpdef has_minor(self, N, bint certificate=False) noexcept: + cpdef has_minor(self, N, bint certificate=False): """ Check if ``self`` has a minor isomorphic to ``N``, and optionally return frozensets ``X`` and ``Y`` so that ``N`` is isomorphic to ``self.minor(X, Y)``. @@ -4070,7 +4070,7 @@ cdef class Matroid(SageObject): raise ValueError("N must be a matroid.") return self._has_minor(N, certificate) - cpdef has_line_minor(self, k, hyperlines=None, certificate=False) noexcept: + cpdef has_line_minor(self, k, hyperlines=None, certificate=False): r""" Test if the matroid has a `U_{2, k}`-minor. @@ -4140,7 +4140,7 @@ cdef class Matroid(SageObject): # get simplified away anyway. return self._has_line_minor(k, hyperlines, certificate) - cpdef _has_line_minor(self, k, hyperlines, certificate=False) noexcept: + cpdef _has_line_minor(self, k, hyperlines, certificate=False): r""" Test if the matroid has a `U_{2, k}`-minor. @@ -4187,7 +4187,7 @@ cdef class Matroid(SageObject): # extensions - cpdef extension(self, element=None, subsets=None) noexcept: + cpdef extension(self, element=None, subsets=None): r""" Return an extension of the matroid. @@ -4264,7 +4264,7 @@ cdef class Matroid(SageObject): hyperplanes = [H for H in self.modular_cut(subsets) if self._rank(H) == r] return self._extension(element, hyperplanes) - cpdef coextension(self, element=None, subsets=None) noexcept: + cpdef coextension(self, element=None, subsets=None): r""" Return a coextension of the matroid. @@ -4328,7 +4328,7 @@ cdef class Matroid(SageObject): """ return self.dual().extension(element, subsets).dual() - cpdef modular_cut(self, subsets) noexcept: + cpdef modular_cut(self, subsets): r""" Compute the modular cut generated by ``subsets``. @@ -4418,7 +4418,7 @@ cdef class Matroid(SageObject): final_list.add(F) return final_list - cpdef linear_subclasses(self, line_length=None, subsets=None) noexcept: + cpdef linear_subclasses(self, line_length=None, subsets=None): r""" Return an iterable set of linear subclasses of the matroid. @@ -4487,7 +4487,7 @@ cdef class Matroid(SageObject): from sage.matroids import extension return extension.LinearSubclasses(self, line_length=line_length, subsets=subsets) - cpdef extensions(self, element=None, line_length=None, subsets=None) noexcept: + cpdef extensions(self, element=None, line_length=None, subsets=None): r""" Return an iterable set of single-element extensions of the matroid. @@ -4616,7 +4616,7 @@ cdef class Matroid(SageObject): # connectivity - cpdef simplify(self) noexcept: + cpdef simplify(self): r""" Return the simplification of the matroid. @@ -4654,7 +4654,7 @@ cdef class Matroid(SageObject): return self._minor(contractions=frozenset([]), deletions=self.groundset().difference(res)) - cpdef cosimplify(self) noexcept: + cpdef cosimplify(self): r""" Return the cosimplification of the matroid. @@ -4692,7 +4692,7 @@ cdef class Matroid(SageObject): return self._minor(contractions=self.groundset().difference(res), deletions=frozenset([])) - cpdef is_simple(self) noexcept: + cpdef is_simple(self): """ Test if the matroid is simple. @@ -4725,7 +4725,7 @@ cdef class Matroid(SageObject): return False return True - cpdef is_cosimple(self) noexcept: + cpdef is_cosimple(self): r""" Test if the matroid is cosimple. @@ -4761,7 +4761,7 @@ cdef class Matroid(SageObject): return False return True - cpdef components(self) noexcept: + cpdef components(self): """ Return a list of the components of the matroid. @@ -4802,7 +4802,7 @@ cdef class Matroid(SageObject): components = components2 return components - cpdef is_connected(self, certificate=False) noexcept: + cpdef is_connected(self, certificate=False): r""" Test if the matroid is connected. @@ -4841,7 +4841,7 @@ cdef class Matroid(SageObject): else: return False - cpdef connectivity(self, S, T=None) noexcept: + cpdef connectivity(self, S, T=None): r""" Evaluate the connectivity function of the matroid. @@ -4882,7 +4882,7 @@ cdef class Matroid(SageObject): raise ValueError("S and T are not disjoint") return len(self._link(S, T)[0]) - self.full_rank() + self._rank(S) + self._rank(T) - cpdef _connectivity(self, S, T) noexcept: + cpdef _connectivity(self, S, T): r""" Return the connectivity of two subsets ``S`` and ``T`` in the matroid. @@ -4921,7 +4921,7 @@ cdef class Matroid(SageObject): """ return len(self._link(S,T)[0]) - self.full_rank() + self.rank(S) + self.rank(T) - cpdef link(self, S, T) noexcept: + cpdef link(self, S, T): r""" Given disjoint subsets `S` and `T`, return a connector `I` and a separation `X`, which are optimal dual solutions in Tutte's Linking Theorem: @@ -4968,7 +4968,7 @@ cdef class Matroid(SageObject): raise ValueError("S and T are not disjoint") return self._link(S, T) - cpdef _link(self, S, T) noexcept: + cpdef _link(self, S, T): r""" Given disjoint subsets `S` and `T`, return a connector `I` and a separation `X`, which are optimal dual solutions in Tutte's Linking Theorem: @@ -5051,7 +5051,7 @@ cdef class Matroid(SageObject): I = I.symmetric_difference(path) return frozenset(I), frozenset(predecessor)|S - cpdef is_kconnected(self, k, certificate=False) noexcept: + cpdef is_kconnected(self, k, certificate=False): r""" Return ``True`` if the matroid is `k`-connected, ``False`` otherwise. It can optionally return a separator as a witness. @@ -5177,7 +5177,7 @@ cdef class Matroid(SageObject): return True, None return True - cpdef is_3connected(self, certificate=False, algorithm=None) noexcept: + cpdef is_3connected(self, certificate=False, algorithm=None): r""" Return ``True`` if the matroid is 3-connected, ``False`` otherwise. It can optionally return a separator as a witness. @@ -5257,7 +5257,7 @@ cdef class Matroid(SageObject): return self._is_3connected_shifting(certificate) raise ValueError("Not a valid algorithm.") - cpdef is_4connected(self, certificate=False, algorithm=None) noexcept: + cpdef is_4connected(self, certificate=False, algorithm=None): r""" Return ``True`` if the matroid is 4-connected, ``False`` otherwise. It can optionally return a separator as a witness. @@ -5309,7 +5309,7 @@ cdef class Matroid(SageObject): return self._is_4connected_shifting(certificate) raise ValueError("Not a valid algorithm.") - cpdef _is_3connected_CE(self, certificate=False) noexcept: + cpdef _is_3connected_CE(self, certificate=False): r""" Return ``True`` if the matroid is 3-connected, ``False`` otherwise. @@ -5437,7 +5437,7 @@ cdef class Matroid(SageObject): else: return True - cpdef _is_3connected_shifting(self, certificate=False) noexcept: + cpdef _is_3connected_shifting(self, certificate=False): r""" Return ``True`` if the matroid is 3-connected, ``False`` otherwise. It can optionally return a separator as a witness. @@ -5515,7 +5515,7 @@ cdef class Matroid(SageObject): return True, None return True - cpdef _is_4connected_shifting(self, certificate=False) noexcept: + cpdef _is_4connected_shifting(self, certificate=False): r""" Return ``True`` if the matroid is 4-connected, ``False`` otherwise. It can optionally return a separator as a witness. @@ -5619,7 +5619,7 @@ cdef class Matroid(SageObject): return True, None return True - cpdef _shifting_all(self, X, P_rows, P_cols, Q_rows, Q_cols, m) noexcept: + cpdef _shifting_all(self, X, P_rows, P_cols, Q_rows, Q_cols, m): r""" Given a basis ``X``. If the submatrix of the partial matrix using rows `P_rows` columns `P_cols` and submatrix using rows `Q_rows` columns @@ -5680,7 +5680,7 @@ cdef class Matroid(SageObject): return True, cert return False, None - cpdef _shifting(self, X, X_1, Y_2, X_2, Y_1, m) noexcept: + cpdef _shifting(self, X, X_1, Y_2, X_2, Y_1, m): r""" Given a basis ``X``. If the submatrix of the partial matrix using rows `X_1` columns `Y_2` and submatrix using rows `X_2` columns @@ -5772,7 +5772,7 @@ cdef class Matroid(SageObject): return False, None return True, S_2 - cpdef _is_3connected_BC(self, certificate=False) noexcept: + cpdef _is_3connected_BC(self, certificate=False): r""" Return ``True`` if the matroid is 3-connected, ``False`` otherwise. @@ -5828,7 +5828,7 @@ cdef class Matroid(SageObject): fund_cocircuits = set([self._fundamental_cocircuit(basis, e) for e in basis]) return self._is_3connected_BC_recursion(self.basis(), fund_cocircuits) - cpdef _is_3connected_BC_recursion(self, basis, fund_cocircuits) noexcept: + cpdef _is_3connected_BC_recursion(self, basis, fund_cocircuits): r""" A helper function for ``_is_3connected_BC``. This method assumes the matroid is both simple and cosimple. Under the assumption, it return @@ -5926,7 +5926,7 @@ cdef class Matroid(SageObject): return False return True - cpdef is_paving(self) noexcept: + cpdef is_paving(self): """ Return if ``self`` is paving. @@ -5947,7 +5947,7 @@ cdef class Matroid(SageObject): return False return True - cpdef is_sparse_paving(self) noexcept: + cpdef is_sparse_paving(self): """ Return if ``self`` is sparse-paving. @@ -5975,7 +5975,7 @@ cdef class Matroid(SageObject): return False return True - cpdef girth(self) noexcept: + cpdef girth(self): r""" Return the girth of the matroid. @@ -6005,7 +6005,7 @@ cdef class Matroid(SageObject): # representability - cpdef _local_binary_matroid(self, basis=None) noexcept: + cpdef _local_binary_matroid(self, basis=None): r""" Return a binary matroid `M` so that relative to a fixed basis `B`, `X` is a basis of ``self`` if and only if `X` is a basis of `M` @@ -6046,7 +6046,7 @@ cdef class Matroid(SageObject): from sage.matroids.linear_matroid import BinaryMatroid return BinaryMatroid(groundset=E, matrix=A, basis=basis, keep_initial_representation=False) - cpdef binary_matroid(self, randomized_tests=1, verify = True) noexcept: + cpdef binary_matroid(self, randomized_tests=1, verify = True): r""" Return a binary matroid representing ``self``, if such a representation exists. @@ -6103,7 +6103,7 @@ cdef class Matroid(SageObject): else: return None - cpdef is_binary(self, randomized_tests=1) noexcept: + cpdef is_binary(self, randomized_tests=1): r""" Decide if ``self`` is a binary matroid. @@ -6140,7 +6140,7 @@ cdef class Matroid(SageObject): """ return self.binary_matroid(randomized_tests=randomized_tests, verify=True) is not None - cpdef _local_ternary_matroid(self, basis=None) noexcept: + cpdef _local_ternary_matroid(self, basis=None): r""" Return a ternary matroid `M` so that if ``self`` is ternary, then `M` is field isomorphic to ``self``. @@ -6231,7 +6231,7 @@ cdef class Matroid(SageObject): from sage.matroids.linear_matroid import TernaryMatroid return TernaryMatroid(groundset=E, matrix=A, basis=basis, keep_initial_representation=False) - cpdef ternary_matroid(self, randomized_tests=1, verify = True) noexcept: + cpdef ternary_matroid(self, randomized_tests=1, verify = True): r""" Return a ternary matroid representing ``self``, if such a representation exists. @@ -6288,7 +6288,7 @@ cdef class Matroid(SageObject): else: return None - cpdef is_ternary(self, randomized_tests=1) noexcept: + cpdef is_ternary(self, randomized_tests=1): r""" Decide if ``self`` is a ternary matroid. @@ -6327,7 +6327,7 @@ cdef class Matroid(SageObject): # matroid k-closed - cpdef is_k_closed(self, int k) noexcept: + cpdef is_k_closed(self, int k): r""" Return if ``self`` is a ``k``-closed matroid. @@ -6364,7 +6364,7 @@ cdef class Matroid(SageObject): # matroid chordality - cpdef _is_circuit_chordal(self, frozenset C, bint certificate=False) noexcept: + cpdef _is_circuit_chordal(self, frozenset C, bint certificate=False): """ Check if the circuit ``C`` has a chord. @@ -6412,7 +6412,7 @@ cdef class Matroid(SageObject): return False, None return False - cpdef is_circuit_chordal(self, C, bint certificate=False) noexcept: + cpdef is_circuit_chordal(self, C, bint certificate=False): r""" Check if the circuit ``C`` has a chord. @@ -6454,7 +6454,7 @@ cdef class Matroid(SageObject): raise ValueError("input C is not a circuit") return self._is_circuit_chordal(frozenset(C), certificate) - cpdef is_chordal(self, k1=4, k2=None, bint certificate=False) noexcept: + cpdef is_chordal(self, k1=4, k2=None, bint certificate=False): r""" Return if a matroid is ``[k1, k2]``-chordal. @@ -6509,7 +6509,7 @@ cdef class Matroid(SageObject): return False return True - cpdef chordality(self) noexcept: + cpdef chordality(self): r""" Return the minimal `k` such that the matroid ``M`` is `k`-chordal. @@ -6541,7 +6541,7 @@ cdef class Matroid(SageObject): # optimization - cpdef max_weight_independent(self, X=None, weights=None) noexcept: + cpdef max_weight_independent(self, X=None, weights=None): r""" Return a maximum-weight independent set contained in a subset. @@ -6628,7 +6628,7 @@ cdef class Matroid(SageObject): res.discard(e) return frozenset(res) - cpdef max_weight_coindependent(self, X=None, weights=None) noexcept: + cpdef max_weight_coindependent(self, X=None, weights=None): r""" Return a maximum-weight coindependent set contained in ``X``. @@ -6720,7 +6720,7 @@ cdef class Matroid(SageObject): res.discard(e) return frozenset(res) - cpdef is_max_weight_independent_generic(self, X=None, weights=None) noexcept: + cpdef is_max_weight_independent_generic(self, X=None, weights=None): r""" Test if only one basis of the subset ``X`` has maximal weight. @@ -6869,7 +6869,7 @@ cdef class Matroid(SageObject): del res[-1] return True - cpdef is_max_weight_coindependent_generic(self, X=None, weights=None) noexcept: + cpdef is_max_weight_coindependent_generic(self, X=None, weights=None): r""" Test if only one cobasis of the subset ``X`` has maximal weight. @@ -7026,7 +7026,7 @@ cdef class Matroid(SageObject): del res[-1] return True - cpdef intersection(self, other, weights=None) noexcept: + cpdef intersection(self, other, weights=None): r""" Return a maximum-weight common independent set. @@ -7084,7 +7084,7 @@ cdef class Matroid(SageObject): raise TypeError("the weights argument does not seem to be a collection of weights for the groundset.") return self._intersection(other, wt) - cpdef _intersection(self, other, weights) noexcept: + cpdef _intersection(self, other, weights): r""" Return a maximum-weight common independent. @@ -7124,7 +7124,7 @@ cdef class Matroid(SageObject): U = self._intersection_augmentation(other, weights, Y) return Y - cpdef _intersection_augmentation(self, other, weights, Y) noexcept: + cpdef _intersection_augmentation(self, other, weights, Y): r""" Return an augmenting set for the matroid intersection problem. @@ -7215,7 +7215,7 @@ cdef class Matroid(SageObject): path.add(u) return True, frozenset(path) - cpdef intersection_unweighted(self, other) noexcept: + cpdef intersection_unweighted(self, other): r""" Return a maximum-cardinality common independent set. @@ -7251,7 +7251,7 @@ cdef class Matroid(SageObject): raise ValueError("matroid intersection requires equal groundsets.") return self._intersection_unweighted(other) - cpdef _intersection_unweighted(self, other) noexcept: + cpdef _intersection_unweighted(self, other): r""" Return a maximum common independent. @@ -7287,7 +7287,7 @@ cdef class Matroid(SageObject): U = self._intersection_augmentation_unweighted(other, Y) return Y - cpdef _intersection_augmentation_unweighted(self, other, Y) noexcept: + cpdef _intersection_augmentation_unweighted(self, other, Y): r""" Return a common independent set larger than `Y` or report failure. @@ -7423,7 +7423,7 @@ cdef class Matroid(SageObject): predecessor[v] = u return True, Y - cpdef partition(self) noexcept: + cpdef partition(self): r""" Return a minimum number of disjoint independent sets that covers the groundset. @@ -7489,7 +7489,7 @@ cdef class Matroid(SageObject): # invariants - cpdef _internal(self, B) noexcept: + cpdef _internal(self, B): """ Return the set of internally active elements of a basis `B`. @@ -7528,7 +7528,7 @@ cdef class Matroid(SageObject): A.add(e) return A - cpdef _external(self, B) noexcept: + cpdef _external(self, B): """ Return the set of externally active elements of a basis `B`. @@ -7567,7 +7567,7 @@ cdef class Matroid(SageObject): A.add(e) return A - cpdef tutte_polynomial(self, x=None, y=None) noexcept: + cpdef tutte_polynomial(self, x=None, y=None): r""" Return the Tutte polynomial of the matroid. @@ -7628,7 +7628,7 @@ cdef class Matroid(SageObject): T = T(a, b) return T - cpdef flat_cover(self, solver=None, verbose=0, integrality_tolerance=1e-3) noexcept: + cpdef flat_cover(self, solver=None, verbose=0, integrality_tolerance=1e-3): """ Return a minimum-size cover of the nonbases by non-spanning flats. @@ -7782,7 +7782,7 @@ cdef class Matroid(SageObject): ret.rename("Chow ring of {} over {}".format(self, R)) return ret - cpdef plot(self, B=None, lineorders=None, pos_method=None,pos_dict=None,save_pos=False) noexcept: + cpdef plot(self, B=None, lineorders=None, pos_method=None,pos_dict=None,save_pos=False): """ Return geometric representation as a sage graphics object. @@ -7842,7 +7842,7 @@ cdef class Matroid(SageObject): lineorders2=matroids_plot_helpers.lineorders_union(self._cached_info['lineorders'],lineorders) return matroids_plot_helpers.geomrep(self,B,lineorders2,pd=pos_dict, sp=save_pos) - cpdef show(self,B=None,lineorders=None,pos_method=None,pos_dict=None,save_pos=False,lims=None) noexcept: + cpdef show(self,B=None,lineorders=None,pos_method=None,pos_dict=None,save_pos=False,lims=None): """ Show the geometric representation of the matroid. @@ -7891,7 +7891,7 @@ cdef class Matroid(SageObject): G.show(xmin=lims[0], xmax=lims[1], ymin=lims[2], ymax=lims[3]) return - cpdef _fix_positions(self,pos_dict=None,lineorders=None) noexcept: + cpdef _fix_positions(self,pos_dict=None,lineorders=None): """ Cache point positions and line orders without actually plotting @@ -7959,7 +7959,7 @@ cdef class Matroid(SageObject): from sage.topology.simplicial_complex import SimplicialComplex return SimplicialComplex(self.no_broken_circuits_sets(ordering)) - cpdef automorphism_group(self) noexcept: + cpdef automorphism_group(self): r""" Return the automorphism group of ``self``. @@ -7994,7 +7994,7 @@ cdef class Matroid(SageObject): from sage.topology.simplicial_complex import SimplicialComplex return SimplicialComplex(self.bases()).automorphism_group() - cpdef bergman_complex(self) noexcept: + cpdef bergman_complex(self): r""" Return the Bergman complex of ``self``. @@ -8019,7 +8019,7 @@ cdef class Matroid(SageObject): L = self.lattice_of_flats() return L.subposet(L.list()[1: -1]).order_complex() - cpdef augmented_bergman_complex(self) noexcept: + cpdef augmented_bergman_complex(self): r""" Return the augmented Bergman complex of ``self``. diff --git a/src/sage/matroids/set_system.pxd b/src/sage/matroids/set_system.pxd index 69a4bc8443c..a283244b53b 100644 --- a/src/sage/matroids/set_system.pxd +++ b/src/sage/matroids/set_system.pxd @@ -8,29 +8,29 @@ cdef class SetSystem: cdef long _len, _capacity cdef bitset_t _temp - cdef copy(self) noexcept - cdef _relabel(self, l) noexcept - cpdef _complements(self) noexcept + cdef copy(self) + cdef _relabel(self, l) + cpdef _complements(self) - cdef resize(self, k=*) noexcept - cdef _append(self, bitset_t X) noexcept - cdef append(self, X) noexcept - cdef _subset(self, long k) noexcept - cdef subset(self, k) noexcept - cpdef _get_groundset(self) noexcept + cdef resize(self, k=*) + cdef _append(self, bitset_t X) + cdef append(self, X) + cdef _subset(self, long k) + cdef subset(self, k) + cpdef _get_groundset(self) - cdef list _incidence_count(self, E) noexcept - cdef SetSystem _groundset_partition(self, SetSystem P, list cnt) noexcept + cdef list _incidence_count(self, E) + cdef SetSystem _groundset_partition(self, SetSystem P, list cnt) cdef long subset_characteristic(self, SetSystem P, long e) noexcept - cdef subsets_partition(self, SetSystem P=*, E=*) noexcept - cdef _distinguish(self, Py_ssize_t v) noexcept - cpdef is_connected(self) noexcept + cdef subsets_partition(self, SetSystem P=*, E=*) + cdef _distinguish(self, Py_ssize_t v) + cpdef is_connected(self) - cdef initial_partition(self, SetSystem P=*, E=*) noexcept - cpdef _equitable_partition(self, SetSystem P=*, EP=*) noexcept - cpdef _heuristic_partition(self, SetSystem P=*, EP=*) noexcept - cpdef _isomorphism(self, SetSystem other, SetSystem SP=*, SetSystem OP=*) noexcept - cpdef _equivalence(self, is_equiv, SetSystem other, SetSystem SP=*, SetSystem OP=*) noexcept + cdef initial_partition(self, SetSystem P=*, E=*) + cpdef _equitable_partition(self, SetSystem P=*, EP=*) + cpdef _heuristic_partition(self, SetSystem P=*, EP=*) + cpdef _isomorphism(self, SetSystem other, SetSystem SP=*, SetSystem OP=*) + cpdef _equivalence(self, is_equiv, SetSystem other, SetSystem SP=*, SetSystem OP=*) cdef class SetSystemIterator: cdef SetSystem _H diff --git a/src/sage/matroids/set_system.pyx b/src/sage/matroids/set_system.pyx index b02326eea55..606231a1734 100644 --- a/src/sage/matroids/set_system.pyx +++ b/src/sage/matroids/set_system.pyx @@ -200,14 +200,14 @@ cdef class SetSystem: """ return "Iterator over a system of subsets" - cdef copy(self) noexcept: + cdef copy(self): cdef SetSystem S S = SetSystem(self._groundset, capacity=len(self)) for i in range(len(self)): S._append(self._subsets[i]) return S - cdef _relabel(self, l) noexcept: + cdef _relabel(self, l): """ Relabel each element `e` of the ground set as `l(e)`, where `l` is a given injective map. @@ -232,7 +232,7 @@ cdef class SetSystem: for i in range(self._groundset_size): self._idx[self._groundset[i]] = i - cpdef _complements(self) noexcept: + cpdef _complements(self): """ Return a SetSystem containing the complements of each element in the groundset. @@ -256,7 +256,7 @@ cdef class SetSystem: S._append(self._temp) return S - cdef inline resize(self, k=None) noexcept: + cdef inline resize(self, k=None): """ Change the capacity of the SetSystem. """ @@ -269,7 +269,7 @@ cdef class SetSystem: self._subsets = check_reallocarray(self._subsets, k2, sizeof(bitset_t)) self._capacity = k2 - cdef inline _append(self, bitset_t X) noexcept: + cdef inline _append(self, bitset_t X): """ Append subset in internal, bitset format """ @@ -279,7 +279,7 @@ cdef class SetSystem: bitset_copy(self._subsets[self._len], X) self._len += 1 - cdef inline append(self, X) noexcept: + cdef inline append(self, X): """ Append subset. """ @@ -291,13 +291,13 @@ cdef class SetSystem: bitset_add(self._subsets[self._len], self._idx[x]) self._len += 1 - cdef inline _subset(self, long k) noexcept: + cdef inline _subset(self, long k): """ Return the k-th subset, in index format. """ return bitset_list(self._subsets[k]) - cdef subset(self, k) noexcept: + cdef subset(self, k): """ Return the k-th subset. """ @@ -309,7 +309,7 @@ cdef class SetSystem: i = bitset_next(self._subsets[k], i + 1) return frozenset(F) - cpdef _get_groundset(self) noexcept: + cpdef _get_groundset(self): """ Return the ground set of this SetSystem. @@ -322,7 +322,7 @@ cdef class SetSystem: """ return frozenset(self._groundset) - cpdef is_connected(self) noexcept: + cpdef is_connected(self): """ Test if the :class:`SetSystem` is connected. @@ -376,7 +376,7 @@ cdef class SetSystem: # isomorphism - cdef list _incidence_count(self, E) noexcept: + cdef list _incidence_count(self, E): """ For the sub-collection indexed by ``E``, count how often each element occurs. @@ -391,7 +391,7 @@ cdef class SetSystem: i = bitset_next(self._subsets[e], i + 1) return cnt - cdef SetSystem _groundset_partition(self, SetSystem P, list cnt) noexcept: + cdef SetSystem _groundset_partition(self, SetSystem P, list cnt): """ Helper method for partition methods below. """ @@ -444,7 +444,7 @@ cdef class SetSystem: c += bitset_len(self._temp) return c - cdef subsets_partition(self, SetSystem P=None, E=None) noexcept: + cdef subsets_partition(self, SetSystem P=None, E=None): """ Helper method for partition methods below. """ @@ -473,7 +473,7 @@ cdef class SetSystem: EP.append(ep) return EP, hash(tuple(eh)) - cdef _distinguish(self, Py_ssize_t v) noexcept: + cdef _distinguish(self, Py_ssize_t v): """ Helper method for partition methods below. """ @@ -488,7 +488,7 @@ cdef class SetSystem: return S # partition functions - cdef initial_partition(self, SetSystem P=None, E=None) noexcept: + cdef initial_partition(self, SetSystem P=None, E=None): """ Helper method for partition methods below. """ @@ -503,7 +503,7 @@ cdef class SetSystem: self._groundset_partition(P, cnt) return P - cpdef _equitable_partition(self, SetSystem P=None, EP=None) noexcept: + cpdef _equitable_partition(self, SetSystem P=None, EP=None): r""" Return an equitable ordered partition of the ground set of the hypergraph whose edges are the subsets in this SetSystem. @@ -584,7 +584,7 @@ cdef class SetSystem: return P, EP, h - cpdef _heuristic_partition(self, SetSystem P=None, EP=None) noexcept: + cpdef _heuristic_partition(self, SetSystem P=None, EP=None): """ Return a heuristic ordered partition into singletons of the ground set of the hypergraph whose edges are the subsets in this SetSystem. @@ -632,7 +632,7 @@ cdef class SetSystem: return self._heuristic_partition(P._distinguish(bitset_first(P._subsets[i])), EP) return P, EP, h - cpdef _isomorphism(self, SetSystem other, SetSystem SP=None, SetSystem OP=None) noexcept: + cpdef _isomorphism(self, SetSystem other, SetSystem SP=None, SetSystem OP=None): """ Return a groundset isomorphism between this SetSystem and an other. @@ -692,7 +692,7 @@ cdef class SetSystem: return None return dict([(self._groundset[bitset_first(SP._subsets[i])], other._groundset[bitset_first(OP._subsets[i])]) for i in range(len(SP))]) - cpdef _equivalence(self, is_equiv, SetSystem other, SetSystem SP=None, SetSystem OP=None) noexcept: + cpdef _equivalence(self, is_equiv, SetSystem other, SetSystem SP=None, SetSystem OP=None): """ Return a groundset isomorphism that is an equivalence between this SetSystem and an other. diff --git a/src/sage/matroids/union_matroid.pxd b/src/sage/matroids/union_matroid.pxd index a378cfe910d..d03ae476bda 100644 --- a/src/sage/matroids/union_matroid.pxd +++ b/src/sage/matroids/union_matroid.pxd @@ -4,17 +4,17 @@ from sage.matroids.matroid cimport Matroid cdef class MatroidUnion(Matroid): cdef list matroids cdef frozenset _groundset - cpdef groundset(self) noexcept - cpdef _rank(self, X) noexcept + cpdef groundset(self) + cpdef _rank(self, X) cdef class MatroidSum(Matroid): cdef list summands cdef frozenset _groundset - cpdef groundset(self) noexcept - cpdef _rank(self, X) noexcept + cpdef groundset(self) + cpdef _rank(self, X) cdef class PartitionMatroid(Matroid): cdef dict p cdef frozenset _groundset - cpdef groundset(self) noexcept - cpdef _rank(self, X) noexcept + cpdef groundset(self) + cpdef _rank(self, X) diff --git a/src/sage/matroids/union_matroid.pyx b/src/sage/matroids/union_matroid.pyx index 04f7eee4402..4e4d8e4eb0a 100644 --- a/src/sage/matroids/union_matroid.pyx +++ b/src/sage/matroids/union_matroid.pyx @@ -53,7 +53,7 @@ cdef class MatroidUnion(Matroid): E.update(M.groundset()) self._groundset = frozenset(E) - cpdef groundset(self) noexcept: + cpdef groundset(self): """ Return the groundset of the matroid. @@ -72,7 +72,7 @@ cdef class MatroidUnion(Matroid): """ return self._groundset - cpdef _rank(self, X) noexcept: + cpdef _rank(self, X): r""" Return the rank of a set ``X``. @@ -186,7 +186,7 @@ cdef class MatroidSum(Matroid): S = S + M._repr_() +"\n" return S[:-1] - cpdef groundset(self) noexcept: + cpdef groundset(self): """ Return the groundset of the matroid. @@ -205,7 +205,7 @@ cdef class MatroidSum(Matroid): """ return self._groundset - cpdef _rank(self, X) noexcept: + cpdef _rank(self, X): r""" Return the rank of a set ``X``. @@ -285,7 +285,7 @@ cdef class PartitionMatroid(Matroid): E.update(P) self._groundset = frozenset(E) - cpdef groundset(self) noexcept: + cpdef groundset(self): """ Return the groundset of the matroid. @@ -304,7 +304,7 @@ cdef class PartitionMatroid(Matroid): """ return self._groundset - cpdef _rank(self, X) noexcept: + cpdef _rank(self, X): r""" Return the rank of a set ``X``. diff --git a/src/sage/misc/allocator.pxd b/src/sage/misc/allocator.pxd index ba4321cf71c..7945a75241f 100644 --- a/src/sage/misc/allocator.pxd +++ b/src/sage/misc/allocator.pxd @@ -1,5 +1,5 @@ from cpython.object cimport * -cdef hook_tp_functions_type(object t, newfunc tp_new, destructor tp_dealloc, bint useGC) noexcept +cdef hook_tp_functions_type(object t, newfunc tp_new, destructor tp_dealloc, bint useGC) -cdef hook_tp_functions(object global_dummy, newfunc tp_new, destructor tp_dealloc, bint useGC) noexcept +cdef hook_tp_functions(object global_dummy, newfunc tp_new, destructor tp_dealloc, bint useGC) diff --git a/src/sage/misc/allocator.pyx b/src/sage/misc/allocator.pyx index b6d865b00e6..b7fafdce286 100644 --- a/src/sage/misc/allocator.pyx +++ b/src/sage/misc/allocator.pyx @@ -1,6 +1,6 @@ from cpython.ref cimport Py_INCREF -cdef _hook_tp_functions_type(PyTypeObject *t, newfunc tp_new, destructor tp_dealloc, bint useGC) noexcept: +cdef _hook_tp_functions_type(PyTypeObject *t, newfunc tp_new, destructor tp_dealloc, bint useGC): """ Initialize the fast integer creation functions. """ @@ -25,12 +25,12 @@ cdef _hook_tp_functions_type(PyTypeObject *t, newfunc tp_new, destructor tp_deal t.tp_dealloc = tp_dealloc -cdef hook_tp_functions_type(object tp, newfunc tp_new, destructor tp_dealloc, bint useGC) noexcept: +cdef hook_tp_functions_type(object tp, newfunc tp_new, destructor tp_dealloc, bint useGC): cdef PyTypeObject *t = tp _hook_tp_functions_type(t, tp_new, tp_dealloc, useGC) -cdef hook_tp_functions(object global_dummy, newfunc tp_new, destructor tp_dealloc, bint useGC) noexcept: +cdef hook_tp_functions(object global_dummy, newfunc tp_new, destructor tp_dealloc, bint useGC): """ Initialize the fast integer creation functions. """ diff --git a/src/sage/misc/binary_tree.pyx b/src/sage/misc/binary_tree.pyx index a566c17d752..8451e0b1e04 100644 --- a/src/sage/misc/binary_tree.pyx +++ b/src/sage/misc/binary_tree.pyx @@ -46,7 +46,7 @@ cdef void binary_tree_insert(binary_tree_node *self, int key, object value) noex else: binary_tree_insert(self.right, key, value) -cdef object binary_tree_get(binary_tree_node *self, int key) noexcept: +cdef object binary_tree_get(binary_tree_node *self, int key): if self.key == key: return self.value elif self.key > key: @@ -60,7 +60,7 @@ cdef object binary_tree_get(binary_tree_node *self, int key) noexcept: else: return binary_tree_get(self.right, key) -cdef object binary_tree_delete(binary_tree_node *self, int key) noexcept: +cdef object binary_tree_delete(binary_tree_node *self, int key): cdef object t if self.key > key: if self.left == NULL: @@ -152,7 +152,7 @@ LIST_POSTORDER = 4 LIST_KEYS = 8 LIST_VALUES = 16 -cdef object binary_tree_list(binary_tree_node *cur, int behavior) noexcept: +cdef object binary_tree_list(binary_tree_node *cur, int behavior): if behavior & LIST_KEYS: item = int(cur.key) else: diff --git a/src/sage/misc/c3.pyx b/src/sage/misc/c3.pyx index bab29641115..a3f37380faf 100644 --- a/src/sage/misc/c3.pyx +++ b/src/sage/misc/c3.pyx @@ -21,7 +21,7 @@ AUTHOR: # **************************************************************************** -cpdef list C3_algorithm(object start, str bases, str attribute, bint proper) noexcept: +cpdef list C3_algorithm(object start, str bases, str attribute, bint proper): """ An implementation of the C3 algorithm. diff --git a/src/sage/misc/c3_controlled.pxd b/src/sage/misc/c3_controlled.pxd index 7383b0cf999..d5dd5c23183 100644 --- a/src/sage/misc/c3_controlled.pxd +++ b/src/sage/misc/c3_controlled.pxd @@ -1 +1 @@ -cpdef tuple C3_sorted_merge(list lists, key=?) noexcept +cpdef tuple C3_sorted_merge(list lists, key=?) diff --git a/src/sage/misc/c3_controlled.pyx b/src/sage/misc/c3_controlled.pyx index 2b334565fdc..befaa7b5b32 100644 --- a/src/sage/misc/c3_controlled.pyx +++ b/src/sage/misc/c3_controlled.pyx @@ -659,7 +659,7 @@ def C3_merge(list lists): raise ValueError("Cannot merge the items %s."%', '.join(repr(head) for head in heads)) return out -cpdef identity(x) noexcept: +cpdef identity(x): r""" EXAMPLES:: @@ -669,7 +669,7 @@ cpdef identity(x) noexcept: """ return x -cpdef tuple C3_sorted_merge(list lists, key=identity) noexcept: +cpdef tuple C3_sorted_merge(list lists, key=identity): r""" Return the sorted input lists merged using the ``C3`` algorithm, with a twist. diff --git a/src/sage/misc/cachefunc.pxd b/src/sage/misc/cachefunc.pxd index 5590c41f4d3..1ebd6f25a9d 100644 --- a/src/sage/misc/cachefunc.pxd +++ b/src/sage/misc/cachefunc.pxd @@ -1,7 +1,7 @@ from sage.misc.function_mangling cimport ArgumentFixer -cpdef dict_key(o) noexcept -cpdef cache_key(o) noexcept +cpdef dict_key(o) +cpdef cache_key(o) cdef class CachedFunction(): cdef public str __name__ @@ -11,8 +11,8 @@ cdef class CachedFunction(): cdef public cache # not always of type cdef bint is_classmethod cdef int argfix_init(self) except -1 - cdef get_key_args_kwds(self, tuple args, dict kwds) noexcept - cdef fix_args_kwds(self, tuple args, dict kwds) noexcept + cdef get_key_args_kwds(self, tuple args, dict kwds) + cdef fix_args_kwds(self, tuple args, dict kwds) cdef empty_key cdef key cdef bint do_pickle @@ -23,7 +23,7 @@ cdef class CachedMethod(): cdef public str __cached_module__ cdef CachedFunction _cachedfunc cdef Py_ssize_t nargs - cpdef _get_instance_cache(self, inst) noexcept + cpdef _get_instance_cache(self, inst) cdef class CacheDict(dict): pass diff --git a/src/sage/misc/cachefunc.pyx b/src/sage/misc/cachefunc.pyx index ed0ef518dda..7b95ce26779 100644 --- a/src/sage/misc/cachefunc.pyx +++ b/src/sage/misc/cachefunc.pyx @@ -535,7 +535,7 @@ cdef class NonpicklingDict(dict): cdef unhashable_key = object() -cpdef inline dict_key(o) noexcept: +cpdef inline dict_key(o): """ Return a key to cache object ``o`` in a dict. @@ -560,7 +560,7 @@ cpdef inline dict_key(o) noexcept: return o -cpdef inline cache_key(o) noexcept: +cpdef inline cache_key(o): r""" Helper function to return a hashable key for ``o`` which can be used for caching. @@ -600,7 +600,7 @@ cpdef inline cache_key(o) noexcept: return o -cdef cache_key_unhashable(o) noexcept: +cdef cache_key_unhashable(o): """ Return a key for caching an item which is unhashable. """ @@ -786,7 +786,7 @@ cdef class CachedFunction(): def __module__(self): return self.__cached_module__ - cdef get_key_args_kwds(self, tuple args, dict kwds) noexcept: + cdef get_key_args_kwds(self, tuple args, dict kwds): """ Return the key in the cache to be used when ``args`` and ``kwds`` are passed in as parameters. @@ -814,7 +814,7 @@ cdef class CachedFunction(): self._argument_fixer = ArgumentFixer(self.f, classmethod=self.is_classmethod) - cdef fix_args_kwds(self, tuple args, dict kwds) noexcept: + cdef fix_args_kwds(self, tuple args, dict kwds): r""" Normalize parameters to obtain a key for the cache. @@ -1841,7 +1841,7 @@ cdef class CachedMethodCaller(CachedFunction): """ return self.f(self._instance, *args, **kwds) - cdef fix_args_kwds(self, tuple args, dict kwds) noexcept: + cdef fix_args_kwds(self, tuple args, dict kwds): r""" Normalize parameters to obtain a key for the cache. @@ -2505,7 +2505,7 @@ cdef class GloballyCachedMethodCaller(CachedMethodCaller): The only difference is that the instance is used as part of the key. """ - cdef get_key_args_kwds(self, tuple args, dict kwds) noexcept: + cdef get_key_args_kwds(self, tuple args, dict kwds): """ Return the key in the cache to be used when ``args`` and ``kwds`` are passed in as parameters. @@ -2750,7 +2750,7 @@ cdef class CachedMethod(): """ return self.__get__(inst)(*args, **kwds) - cpdef _get_instance_cache(self, inst) noexcept: + cpdef _get_instance_cache(self, inst): """ Return the cache dictionary. @@ -3238,7 +3238,7 @@ cdef class CachedInParentMethod(CachedMethod): self._cache_name = '_cache__' + 'element_' + (name or f.__name__) self._cachedfunc = CachedFunction(f, classmethod=True, name=name, key=key, do_pickle=do_pickle) - cpdef _get_instance_cache(self, inst) noexcept: + cpdef _get_instance_cache(self, inst): """ Return the cache dictionary, which is stored in the parent. diff --git a/src/sage/misc/cython.py b/src/sage/misc/cython.py index 7590158b279..93ce994c537 100644 --- a/src/sage/misc/cython.py +++ b/src/sage/misc/cython.py @@ -236,7 +236,7 @@ def cython(filename, verbose=0, compile_message=False, ... RuntimeError: Error compiling Cython file: ... - ...: 'sage/misc.pxd' not found... + ...: 'sage/misc.pxd' not found """ if not filename.endswith('pyx'): print("Warning: file (={}) should have extension .pyx".format(filename), file=sys.stderr) @@ -382,12 +382,6 @@ def cython(filename, verbose=0, compile_message=False, "Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.\n", "", cython_messages, 0, re.MULTILINE) - # workaround for https://github.com/sagemath/sage/issues/37560 - # triggered by Cython 3.0.9 - cython_messages = re.sub( - "^warning: .*noexcept clause is ignored for function returning Python object\n", - "", cython_messages, 0, re.MULTILINE) - sys.stderr.write(cython_messages) sys.stderr.flush() diff --git a/src/sage/misc/function_mangling.pxd b/src/sage/misc/function_mangling.pxd index 74f1a6e2282..01604088adc 100644 --- a/src/sage/misc/function_mangling.pxd +++ b/src/sage/misc/function_mangling.pxd @@ -7,4 +7,4 @@ cdef class ArgumentFixer: cdef dict _defaults cdef public tuple _default_tuple - cdef fix_to_pos_args_kwds(self, tuple args, dict kwargs) noexcept + cdef fix_to_pos_args_kwds(self, tuple args, dict kwargs) diff --git a/src/sage/misc/function_mangling.pyx b/src/sage/misc/function_mangling.pyx index c614f97e9df..1392fc4f2fd 100644 --- a/src/sage/misc/function_mangling.pyx +++ b/src/sage/misc/function_mangling.pyx @@ -284,7 +284,7 @@ cdef class ArgumentFixer: """ return self.fix_to_pos_args_kwds(args, kwds) - cdef fix_to_pos_args_kwds(self, tuple args, dict kwds) noexcept: + cdef fix_to_pos_args_kwds(self, tuple args, dict kwds): """ Fast Cython implementation of :meth:`fix_to_pos`. """ diff --git a/src/sage/misc/lazy_import.pyx b/src/sage/misc/lazy_import.pyx index 5a328c41b5d..d25b24a10dc 100644 --- a/src/sage/misc/lazy_import.pyx +++ b/src/sage/misc/lazy_import.pyx @@ -79,7 +79,7 @@ except ImportError: FeatureNotPresentError = () -cdef inline obj(x) noexcept: +cdef inline obj(x): if type(x) is LazyImport: return (x).get_object() else: @@ -92,7 +92,7 @@ cdef bint startup_guard = True cdef bint finish_startup_called = False -cpdef finish_startup() noexcept: +cpdef finish_startup(): """ Finish the startup phase. @@ -113,7 +113,7 @@ cpdef finish_startup() noexcept: finish_startup_called = True -cpdef ensure_startup_finished() noexcept: +cpdef ensure_startup_finished(): """ Make sure that the startup phase is finished. @@ -147,7 +147,7 @@ cpdef bint is_during_startup() noexcept: return startup_guard -cpdef test_fake_startup() noexcept: +cpdef test_fake_startup(): """ For testing purposes only. @@ -216,7 +216,7 @@ cdef class LazyImport(): self._deprecation = deprecation self._feature = feature - cdef inline get_object(self) noexcept: + cdef inline get_object(self): """ Faster, Cython-only partially-inlined version of ``_get_object``. """ @@ -224,7 +224,7 @@ cdef class LazyImport(): return self._object return self._get_object() - cpdef _get_object(self) noexcept: + cpdef _get_object(self): """ Return the wrapped object, importing it if necessary. diff --git a/src/sage/misc/lazy_list.pxd b/src/sage/misc/lazy_list.pxd index d512cfb69f4..f8b51b47835 100644 --- a/src/sage/misc/lazy_list.pxd +++ b/src/sage/misc/lazy_list.pxd @@ -3,10 +3,10 @@ cdef class lazy_list_generic(): cdef lazy_list_generic master # a reference if self is a slice cdef Py_ssize_t start, stop, step - cpdef get(self, Py_ssize_t i) noexcept + cpdef get(self, Py_ssize_t i) cpdef int _fit(self, Py_ssize_t n) except -1 cpdef int _update_cache_up_to(self, Py_ssize_t i) except -1 - cpdef list _get_cache_(self) noexcept + cpdef list _get_cache_(self) cdef class lazy_list_from_iterator(lazy_list_generic): cdef object iterator diff --git a/src/sage/misc/lazy_list.pyx b/src/sage/misc/lazy_list.pyx index 71847e566ad..cd750933860 100644 --- a/src/sage/misc/lazy_list.pyx +++ b/src/sage/misc/lazy_list.pyx @@ -610,7 +610,7 @@ cdef class lazy_list_generic(): return 1 return 0 - cpdef get(self, Py_ssize_t i) noexcept: + cpdef get(self, Py_ssize_t i): r""" Return the element at position ``i``. @@ -880,7 +880,7 @@ cdef class lazy_list_generic(): self.cache.extend(l) return 0 - cpdef list _get_cache_(self) noexcept: + cpdef list _get_cache_(self): r""" Return the internal cache. diff --git a/src/sage/misc/lazy_string.pxd b/src/sage/misc/lazy_string.pxd index d74a18763a2..7f7354e03ca 100644 --- a/src/sage/misc/lazy_string.pxd +++ b/src/sage/misc/lazy_string.pxd @@ -2,5 +2,5 @@ cdef class _LazyString(): cdef func cdef args cdef kwargs - cdef val(self) noexcept - cpdef update_lazy_string(self, args, kwds) noexcept + cdef val(self) + cpdef update_lazy_string(self, args, kwds) diff --git a/src/sage/misc/lazy_string.pyx b/src/sage/misc/lazy_string.pyx index 040999c84d6..a0efbb186bf 100644 --- a/src/sage/misc/lazy_string.pyx +++ b/src/sage/misc/lazy_string.pyx @@ -203,7 +203,7 @@ cdef class _LazyString(): self.args = args self.kwargs = kwargs - cdef val(self) noexcept: + cdef val(self): cdef f = self.func if isinstance(f, str): return f % self.args @@ -503,7 +503,7 @@ cdef class _LazyString(): except Exception: return '<%s broken>' % self.__class__.__name__ - cpdef update_lazy_string(self, args, kwds) noexcept: + cpdef update_lazy_string(self, args, kwds): """ Change this lazy string in-place. diff --git a/src/sage/misc/misc_c.pxd b/src/sage/misc/misc_c.pxd index 17ef467911a..acb36ab6d99 100644 --- a/src/sage/misc/misc_c.pxd +++ b/src/sage/misc/misc_c.pxd @@ -1,2 +1,2 @@ -cpdef list normalize_index(object key, int size) noexcept +cpdef list normalize_index(object key, int size) diff --git a/src/sage/misc/misc_c.pyx b/src/sage/misc/misc_c.pyx index e5ceb3e1ad3..56e7a323258 100644 --- a/src/sage/misc/misc_c.pyx +++ b/src/sage/misc/misc_c.pyx @@ -147,7 +147,7 @@ def prod(x, z=None, Py_ssize_t recursion_cutoff=5): return prod -cdef balanced_list_prod(L, Py_ssize_t offset, Py_ssize_t count, Py_ssize_t cutoff) noexcept: +cdef balanced_list_prod(L, Py_ssize_t offset, Py_ssize_t count, Py_ssize_t cutoff): """ INPUT: @@ -182,7 +182,7 @@ cdef balanced_list_prod(L, Py_ssize_t offset, Py_ssize_t count, Py_ssize_t cutof return balanced_list_prod(L, offset, k, cutoff) * balanced_list_prod(L, offset + k, count - k, cutoff) -cpdef iterator_prod(L, z=None) noexcept: +cpdef iterator_prod(L, z=None): """ Attempt to do a balanced product of an arbitrary and unknown length sequence (such as a generator). Intermediate multiplications are always @@ -397,7 +397,7 @@ def balanced_sum(x, z=None, Py_ssize_t recursion_cutoff=5): return sum -cdef balanced_list_sum(L, Py_ssize_t offset, Py_ssize_t count, Py_ssize_t cutoff) noexcept: +cdef balanced_list_sum(L, Py_ssize_t offset, Py_ssize_t count, Py_ssize_t cutoff): """ INPUT: @@ -432,7 +432,7 @@ cdef balanced_list_sum(L, Py_ssize_t offset, Py_ssize_t count, Py_ssize_t cutoff return balanced_list_sum(L, offset, k, cutoff) + balanced_list_sum(L, offset + k, count - k, cutoff) -cpdef list normalize_index(object key, int size) noexcept: +cpdef list normalize_index(object key, int size): """ Normalize an index key and return a valid index or list of indices within the range(0, size). diff --git a/src/sage/misc/nested_class.pyx b/src/sage/misc/nested_class.pyx index a2625c039ef..97ed312b08c 100644 --- a/src/sage/misc/nested_class.pyx +++ b/src/sage/misc/nested_class.pyx @@ -93,7 +93,7 @@ __all__ = ['modify_for_nested_pickle', 'nested_pickle', #, 'SubClass', 'CopiedClass', 'A1' ] -cpdef modify_for_nested_pickle(cls, str name_prefix, module, first_run=True) noexcept: +cpdef modify_for_nested_pickle(cls, str name_prefix, module, first_run=True): r""" Modify the subclasses of the given class to be picklable, by giving them a mangled name and putting the mangled name in the diff --git a/src/sage/misc/parser.pyx b/src/sage/misc/parser.pyx index 14896ce763c..a028e953f90 100644 --- a/src/sage/misc/parser.pyx +++ b/src/sage/misc/parser.pyx @@ -203,7 +203,7 @@ cdef class Tokenizer: token = self.next() return all - cpdef reset(self, int pos = 0) noexcept: + cpdef reset(self, int pos = 0): """ Reset the tokenizer to a given position. @@ -420,7 +420,7 @@ cdef class Tokenizer: self.pos = self.last_pos self.token = 0 - cpdef last_token_string(self) noexcept: + cpdef last_token_string(self): """ Return the actual contents of the last token. @@ -530,7 +530,7 @@ cdef class Parser: """ return self.callable_constructor - cpdef parse(self, s, bint accept_eqn=True) noexcept: + cpdef parse(self, s, bint accept_eqn=True): """ Parse the given string. @@ -552,7 +552,7 @@ cdef class Parser: self.parse_error(tokens) return expr - cpdef parse_expression(self, s) noexcept: + cpdef parse_expression(self, s): """ Parse an expression. @@ -569,7 +569,7 @@ cdef class Parser: self.parse_error(tokens) return expr - cpdef parse_sequence(self, s) noexcept: + cpdef parse_sequence(self, s): """ Parse a (possibly nested) set of lists and tuples. @@ -593,7 +593,7 @@ cdef class Parser: all = all[0] return all - cpdef p_matrix(self, Tokenizer tokens) noexcept: + cpdef p_matrix(self, Tokenizer tokens): """ Parse a matrix @@ -621,7 +621,7 @@ cdef class Parser: else: self.parse_error(tokens, "Malformed matrix") - cpdef p_sequence(self, Tokenizer tokens) noexcept: + cpdef p_sequence(self, Tokenizer tokens): """ Parse a (possibly nested) set of lists and tuples. @@ -666,7 +666,7 @@ cdef class Parser: tokens.backtrack() return all - cpdef p_list(self, Tokenizer tokens) noexcept: + cpdef p_list(self, Tokenizer tokens): """ Parse a list of items. @@ -688,7 +688,7 @@ cdef class Parser: self.parse_error(tokens, "Malformed list") return all - cpdef p_tuple(self, Tokenizer tokens) noexcept: + cpdef p_tuple(self, Tokenizer tokens): """ Parse a tuple of items. @@ -723,7 +723,7 @@ cdef class Parser: return self.p_eqn(tokens) # eqn ::= expr op expr | expr - cpdef p_eqn(self, Tokenizer tokens) noexcept: + cpdef p_eqn(self, Tokenizer tokens): r""" Parse an equation or expression. @@ -769,7 +769,7 @@ cdef class Parser: return lhs # expr ::= term | expr '+' term | expr '-' term - cpdef p_expr(self, Tokenizer tokens) noexcept: + cpdef p_expr(self, Tokenizer tokens): """ Parse a list of one or more terms. @@ -804,7 +804,7 @@ cdef class Parser: return operand1 # term ::= factor | term '*' factor | term '/' factor - cpdef p_term(self, Tokenizer tokens) noexcept: + cpdef p_term(self, Tokenizer tokens): """ Parse a single term (consisting of one or more factors). @@ -845,7 +845,7 @@ cdef class Parser: return operand1 # factor ::= '+' factor | '-' factor | power - cpdef p_factor(self, Tokenizer tokens) noexcept: + cpdef p_factor(self, Tokenizer tokens): """ Parse a single factor, which consists of any number of unary +/- and a power. @@ -872,7 +872,7 @@ cdef class Parser: return self.p_power(tokens) # power ::= (atom | atom!) ^ factor | atom | atom! - cpdef p_power(self, Tokenizer tokens) noexcept: + cpdef p_power(self, Tokenizer tokens): """ Parses a power. Note that exponentiation groups right to left. @@ -917,7 +917,7 @@ cdef class Parser: return operand1 # atom ::= int | float | name | '(' expr ')' | name '(' args ')' - cpdef p_atom(self, Tokenizer tokens) noexcept: + cpdef p_atom(self, Tokenizer tokens): """ Parse an atom. This is either a parenthesized expression, a function call, or a literal name/int/float. @@ -973,7 +973,7 @@ cdef class Parser: self.parse_error(tokens) # args = arg (',' arg)* | EMPTY - cpdef p_args(self, Tokenizer tokens) noexcept: + cpdef p_args(self, Tokenizer tokens): """ Returns a list, dict pair. @@ -1003,7 +1003,7 @@ cdef class Parser: return args, kwds # arg = expr | name '=' expr - cpdef p_arg(self, Tokenizer tokens) noexcept: + cpdef p_arg(self, Tokenizer tokens): """ Returns an expr, or a (name, expr) tuple corresponding to a single function call argument. @@ -1044,7 +1044,7 @@ cdef class Parser: tokens.backtrack() return self.p_expr(tokens) - cdef parse_error(self, Tokenizer tokens, msg="Malformed expression") noexcept: + cdef parse_error(self, Tokenizer tokens, msg="Malformed expression"): raise SyntaxError(msg, tokens.s, tokens.pos) diff --git a/src/sage/misc/persist.pyx b/src/sage/misc/persist.pyx index b6f4bb220f7..3e56e249d45 100644 --- a/src/sage/misc/persist.pyx +++ b/src/sage/misc/persist.pyx @@ -75,7 +75,7 @@ already_pickled = { } already_unpickled = { } -cdef _normalize_filename(s) noexcept: +cdef _normalize_filename(s): """ Append the .sobj extension to a filename if it doesn't already have it. """ diff --git a/src/sage/misc/randstate.pxd b/src/sage/misc/randstate.pxd index c83873a7c99..fc5e955eb79 100644 --- a/src/sage/misc/randstate.pxd +++ b/src/sage/misc/randstate.pxd @@ -16,14 +16,14 @@ cdef class randstate: cdef object _gp_saved_seeds - cpdef set_seed_libc(self, bint force) noexcept - cpdef set_seed_ntl(self, bint force) noexcept + cpdef set_seed_libc(self, bint force) + cpdef set_seed_ntl(self, bint force) cpdef int c_random(self) noexcept cpdef double c_rand_double(self) noexcept - cpdef ZZ_seed(self) noexcept - cpdef long_seed(self) noexcept + cpdef ZZ_seed(self) + cpdef long_seed(self) -cpdef randstate current_randstate() noexcept +cpdef randstate current_randstate() cpdef int random() noexcept diff --git a/src/sage/misc/randstate.pyx b/src/sage/misc/randstate.pyx index 756722d0b6a..5809e4d7cb4 100644 --- a/src/sage/misc/randstate.pyx +++ b/src/sage/misc/randstate.pyx @@ -443,7 +443,7 @@ cdef randstate _pari_seed_randstate # randstate object was the most recent one to seed it. _gp_seed_randstates = weakref.WeakKeyDictionary() -cpdef randstate current_randstate() noexcept: +cpdef randstate current_randstate(): r""" Return the current random number state. @@ -610,7 +610,7 @@ cdef class randstate: self._python_random = rand return rand - cpdef ZZ_seed(self) noexcept: + cpdef ZZ_seed(self): r""" When called on the current :class:`randstate`, returns a 128-bit :mod:`Integer ` suitable for seeding another @@ -625,7 +625,7 @@ cdef class randstate: from sage.rings.integer_ring import ZZ return ZZ.random_element(long(1)<<128) - cpdef long_seed(self) noexcept: + cpdef long_seed(self): r""" When called on the current :class:`randstate`, returns a 128-bit Python long suitable for seeding another random number generator. @@ -639,7 +639,7 @@ cdef class randstate: from sage.rings.integer_ring import ZZ return long(ZZ.random_element(long(1)<<128)) - cpdef set_seed_libc(self, bint force) noexcept: + cpdef set_seed_libc(self, bint force): r""" Checks to see if ``self`` was the most recent :class:`randstate` to seed the libc random number generator. If not, seeds the @@ -664,7 +664,7 @@ cdef class randstate: c_libc_srandom(gmp_urandomb_ui(self.gmp_state, sizeof(int)*8)) _libc_seed_randstate = self - cpdef set_seed_ntl(self, bint force) noexcept: + cpdef set_seed_ntl(self, bint force): r""" Checks to see if ``self`` was the most recent :class:`randstate` to seed the NTL random number generator. If not, seeds @@ -922,7 +922,7 @@ cdef class randstate: return False -cpdef set_random_seed(seed=None) noexcept: +cpdef set_random_seed(seed=None): r""" Set the current random number seed from the given ``seed`` (which must be coercible to a Python long). diff --git a/src/sage/misc/sage_ostools.pyx b/src/sage/misc/sage_ostools.pyx index 64e9c42809b..8a91afe54c2 100644 --- a/src/sage/misc/sage_ostools.pyx +++ b/src/sage/misc/sage_ostools.pyx @@ -80,7 +80,7 @@ def restore_cwd(chdir=None): os.chdir(orig_cwd) -cdef file_and_fd(x, int* fd) noexcept: +cdef file_and_fd(x, int* fd): """ If ``x`` is a file, return ``x`` and set ``*fd`` to its file descriptor. If ``x`` is an integer, return ``None`` and set diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py index 4f7678d3f67..424b9540696 100644 --- a/src/sage/misc/sageinspect.py +++ b/src/sage/misc/sageinspect.py @@ -2322,7 +2322,7 @@ def sage_getsourcelines(obj): '\n', ' cdef GEx _gobj\n', '\n', - ' cpdef object pyobject(self) noexcept:\n'] + ' cpdef object pyobject(self):\n'] sage: lines[-1] # last line # needs sage.symbolic ' return S\n' diff --git a/src/sage/misc/search.pxd b/src/sage/misc/search.pxd index 0986f27c51d..8cc43ba1b0f 100644 --- a/src/sage/misc/search.pxd +++ b/src/sage/misc/search.pxd @@ -1 +1 @@ -cpdef search(object v, object x) noexcept \ No newline at end of file +cpdef search(object v, object x) \ No newline at end of file diff --git a/src/sage/misc/search.pyx b/src/sage/misc/search.pyx index 3991bbc8f3e..a9e7149113e 100644 --- a/src/sage/misc/search.pyx +++ b/src/sage/misc/search.pyx @@ -25,7 +25,7 @@ extra comparison. Also, the function names make more sense. import bisect -cpdef search(object v, object x) noexcept: +cpdef search(object v, object x): """ Return (True,i) where i is such that v[i] == x if there is such an i, or (False,j) otherwise, where j is the position where x should be inserted diff --git a/src/sage/modular/arithgroup/arithgroup_element.pyx b/src/sage/modular/arithgroup/arithgroup_element.pyx index 52c6a692866..1b3db34a04c 100644 --- a/src/sage/modular/arithgroup/arithgroup_element.pyx +++ b/src/sage/modular/arithgroup/arithgroup_element.pyx @@ -158,7 +158,7 @@ cdef class ArithmeticSubgroupElement(MultiplicativeGroupElement): """ return '%s' % self.__x._latex_() - cpdef _richcmp_(self, right_r, int op) noexcept: + cpdef _richcmp_(self, right_r, int op): """ Compare self to right, where right is guaranteed to have the same parent as self. @@ -204,7 +204,7 @@ cdef class ArithmeticSubgroupElement(MultiplicativeGroupElement): """ return True - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Return self * right. diff --git a/src/sage/modular/arithgroup/farey_symbol.pyx b/src/sage/modular/arithgroup/farey_symbol.pyx index 4cfb4b12363..61c2446a16b 100644 --- a/src/sage/modular/arithgroup/farey_symbol.pyx +++ b/src/sage/modular/arithgroup/farey_symbol.pyx @@ -1040,26 +1040,26 @@ cdef public long convert_to_long(n) noexcept: cdef long m = n return m -cdef public object convert_to_Integer(mpz_class a) noexcept: +cdef public object convert_to_Integer(mpz_class a): A = Integer() A.set_from_mpz(a.get_mpz_t()) return A -cdef public object convert_to_rational(mpq_class r) noexcept: +cdef public object convert_to_rational(mpq_class r): a = Integer() a.set_from_mpz(r.get_num_mpz_t()) b = Integer() b.set_from_mpz(r.get_den_mpz_t()) return a/b -cdef public object convert_to_cusp(mpq_class r) noexcept: +cdef public object convert_to_cusp(mpq_class r): a = Integer() a.set_from_mpz(r.get_num_mpz_t()) b = Integer() b.set_from_mpz(r.get_den_mpz_t()) return Cusp(a/b) -cdef public object convert_to_SL2Z(cpp_SL2Z M) noexcept: +cdef public object convert_to_SL2Z(cpp_SL2Z M): a = convert_to_Integer(M.a()) b = convert_to_Integer(M.b()) c = convert_to_Integer(M.c()) diff --git a/src/sage/modular/hypergeometric_misc.pxd b/src/sage/modular/hypergeometric_misc.pxd index 4198ca8848b..00bf9a97e9a 100644 --- a/src/sage/modular/hypergeometric_misc.pxd +++ b/src/sage/modular/hypergeometric_misc.pxd @@ -1,2 +1,2 @@ cpdef hgm_coeffs(long long p, int f, int prec, gamma, m, int D, - gtable, int gtable_prec, bint use_longs) noexcept + gtable, int gtable_prec, bint use_longs) diff --git a/src/sage/modular/hypergeometric_misc.pyx b/src/sage/modular/hypergeometric_misc.pyx index bac57fa01d2..b8c39aeefa7 100644 --- a/src/sage/modular/hypergeometric_misc.pyx +++ b/src/sage/modular/hypergeometric_misc.pyx @@ -7,7 +7,7 @@ from cysignals.signals cimport sig_check cpdef hgm_coeffs(long long p, int f, int prec, gamma, m, int D, - gtable, int gtable_prec, bint use_longs) noexcept: + gtable, int gtable_prec, bint use_longs): r""" Compute coefficients for the hypergeometric trace formula. diff --git a/src/sage/modular/modform/eis_series_cython.pyx b/src/sage/modular/modform/eis_series_cython.pyx index fb8501622f6..70271d3f80b 100644 --- a/src/sage/modular/modform/eis_series_cython.pyx +++ b/src/sage/modular/modform/eis_series_cython.pyx @@ -14,7 +14,7 @@ from sage.libs.flint.fmpz_poly cimport * from sage.libs.gmp.mpz cimport * from sage.libs.flint.fmpz_poly_sage cimport Fmpz_poly, fmpz_poly_set_coeff_mpz, fmpz_poly_scalar_mul_mpz -cpdef Ek_ZZ(int k, int prec=10) noexcept: +cpdef Ek_ZZ(int k, int prec=10): """ Return list of prec integer coefficients of the weight k Eisenstein series of level 1, normalized so the coefficient of q @@ -140,7 +140,7 @@ cpdef Ek_ZZ(int k, int prec=10) noexcept: return val -cpdef eisenstein_series_poly(int k, int prec = 10) noexcept: +cpdef eisenstein_series_poly(int k, int prec=10): r""" Return the q-expansion up to precision ``prec`` of the weight `k` Eisenstein series, as a FLINT :class:`~sage.libs.flint.fmpz_poly.Fmpz_poly` diff --git a/src/sage/modular/modform/l_series_gross_zagier_coeffs.pyx b/src/sage/modular/modform/l_series_gross_zagier_coeffs.pyx index ffebe813c92..f91a3e256f0 100644 --- a/src/sage/modular/modform/l_series_gross_zagier_coeffs.pyx +++ b/src/sage/modular/modform/l_series_gross_zagier_coeffs.pyx @@ -12,7 +12,7 @@ from libc.math cimport ceil, floor, sqrt from libc.string cimport memcpy -cpdef to_series(L, var) noexcept: +cpdef to_series(L, var): """ Create a power series element out of a list ``L`` in the variable`` var``. diff --git a/src/sage/modular/modsym/heilbronn.pyx b/src/sage/modular/modsym/heilbronn.pyx index 7fc8ed28055..d2db35dd7ee 100644 --- a/src/sage/modular/modsym/heilbronn.pyx +++ b/src/sage/modular/modsym/heilbronn.pyx @@ -170,7 +170,7 @@ cdef class Heilbronn: self.list.v[4*i+2], self.list.v[4*i+3]]) return L - cdef apply_only(self, int u, int v, int N, int* a, int* b) noexcept: + cdef apply_only(self, int u, int v, int N, int* a, int* b): """ INPUT: @@ -210,7 +210,7 @@ cdef class Heilbronn: b[i] = llong_prod_mod(u,self.list.v[4*i+1],N) + llong_prod_mod(v,self.list.v[4*i+3], N) sig_off() - cdef apply_to_polypart(self, fmpz_poly_t* ans, int i, int k) noexcept: + cdef apply_to_polypart(self, fmpz_poly_t* ans, int i, int k): r""" INPUT: diff --git a/src/sage/modular/modsym/manin_symbol.pyx b/src/sage/modular/modsym/manin_symbol.pyx index a71533e1b73..6da79e21b2d 100644 --- a/src/sage/modular/modsym/manin_symbol.pyx +++ b/src/sage/modular/modsym/manin_symbol.pyx @@ -199,7 +199,7 @@ cdef class ManinSymbol(Element): """ return self._repr_() - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): """ Comparison function for ManinSymbols. diff --git a/src/sage/modular/modsym/p1list.pxd b/src/sage/modular/modsym/p1list.pxd index 17254d4a8fb..b66f28b8ad6 100644 --- a/src/sage/modular/modsym/p1list.pxd +++ b/src/sage/modular/modsym/p1list.pxd @@ -24,5 +24,5 @@ cdef class P1List: cdef int (*_normalize)(int N, int u, int v, int* uu, int* vv, int* ss, int compute_s) except -1 - cpdef index(self, int u, int v) noexcept - cdef index_and_scalar(self, int u, int v, int* i, int* s) noexcept + cpdef index(self, int u, int v) + cdef index_and_scalar(self, int u, int v, int* i, int* s) diff --git a/src/sage/modular/modsym/p1list.pyx b/src/sage/modular/modsym/p1list.pyx index 9104181da05..1613d90729a 100644 --- a/src/sage/modular/modsym/p1list.pyx +++ b/src/sage/modular/modsym/p1list.pyx @@ -991,7 +991,7 @@ cdef class P1List(): _, j = search(self.__list, (uu,vv)) return j - cpdef index(self, int u, int v) noexcept: + cpdef index(self, int u, int v): r""" Return the index of the class of `(u,v)` in the fixed list of representatives of @@ -1034,7 +1034,7 @@ cdef class P1List(): except KeyError: return -1 - cdef index_and_scalar(self, int u, int v, int* i, int* s) noexcept: + cdef index_and_scalar(self, int u, int v, int* i, int* s): r""" Compute the index of the class of `(u,v)` in the fixed list of representatives of `\mathbb{P}^1(\ZZ/N\ZZ)` and scalar s diff --git a/src/sage/modular/pollack_stevens/dist.pxd b/src/sage/modular/pollack_stevens/dist.pxd index 0a38551d8a6..4f0e63a559d 100644 --- a/src/sage/modular/pollack_stevens/dist.pxd +++ b/src/sage/modular/pollack_stevens/dist.pxd @@ -5,17 +5,17 @@ from sage.rings.padics.pow_computer cimport PowComputer_class cdef class Dist(ModuleElement): - cpdef normalize(self, include_zeroth_moment=*) noexcept + cpdef normalize(self, include_zeroth_moment=*) cdef long ordp cpdef long _ord_p(self) noexcept cdef long _relprec(self) noexcept - cdef _unscaled_moment(self, long i) noexcept + cdef _unscaled_moment(self, long i) cdef class Dist_vector(Dist): cdef public _moments - cdef Dist_vector _new_c(self) noexcept - cdef Dist_vector _addsub(self, Dist_vector right, bint negate) noexcept - cpdef _add_(self, other) noexcept + cdef Dist_vector _new_c(self) + cdef Dist_vector _addsub(self, Dist_vector right, bint negate) + cpdef _add_(self, other) cdef class WeightKAction(Action): @@ -30,8 +30,8 @@ cdef class WeightKAction(Action): cdef public _dettwist cdef public _Sigma0 - cpdef acting_matrix(self, g, M) noexcept - cpdef _compute_acting_matrix(self, g, M) noexcept + cpdef acting_matrix(self, g, M) + cpdef _compute_acting_matrix(self, g, M) cdef class WeightKAction_vector(WeightKAction): pass diff --git a/src/sage/modular/pollack_stevens/dist.pyx b/src/sage/modular/pollack_stevens/dist.pyx index e98333c9a40..1f79133f2f5 100644 --- a/src/sage/modular/pollack_stevens/dist.pyx +++ b/src/sage/modular/pollack_stevens/dist.pyx @@ -138,7 +138,7 @@ cdef class Dist(ModuleElement): """ return self.parent().prime() ** (self.ordp) * self._moments - cpdef normalize(self, include_zeroth_moment=True) noexcept: + cpdef normalize(self, include_zeroth_moment=True): r""" Normalize so that the precision of the `i`-th moment is `n-i`, where `n` is the number of moments. @@ -161,7 +161,7 @@ cdef class Dist(ModuleElement): cdef long _relprec(self) noexcept: raise NotImplementedError - cdef _unscaled_moment(self, long i) noexcept: + cdef _unscaled_moment(self, long i): raise NotImplementedError cpdef long _ord_p(self) noexcept: @@ -481,7 +481,7 @@ cdef class Dist(ModuleElement): pass return alpha - cpdef _richcmp_(_left, _right, int op) noexcept: + cpdef _richcmp_(_left, _right, int op): r""" Comparison. @@ -800,7 +800,7 @@ cdef class Dist_vector(Dist): """ return (self.__class__, (self._moments, self.parent(), self.ordp, False)) - cdef Dist_vector _new_c(self) noexcept: + cdef Dist_vector _new_c(self): r""" Creates an empty distribution. @@ -880,7 +880,7 @@ cdef class Dist_vector(Dist): """ return len(self._moments) - cdef _unscaled_moment(self, long n) noexcept: + cdef _unscaled_moment(self, long n): r""" Return the `n`-th moment, unscaled by the overall power of `p` stored in ``self.ordp``. @@ -894,7 +894,7 @@ cdef class Dist_vector(Dist): """ return self._moments[n] - cdef Dist_vector _addsub(self, Dist_vector right, bint negate) noexcept: + cdef Dist_vector _addsub(self, Dist_vector right, bint negate): r""" Common code for the sum and the difference of two distributions @@ -934,7 +934,7 @@ cdef class Dist_vector(Dist): ans._moments = smoments + rmoments return ans - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): r""" Sum of two distributions. @@ -947,7 +947,7 @@ cdef class Dist_vector(Dist): """ return self._addsub(_right, False) - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): r""" Difference of two distributions. @@ -960,7 +960,7 @@ cdef class Dist_vector(Dist): """ return self._addsub(_right, True) - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): r""" Scalar product of a distribution with a ring element that coerces into the base ring. @@ -1044,7 +1044,7 @@ cdef class Dist_vector(Dist): """ return Integer(len(self._moments) + self.ordp) - cpdef normalize(self, include_zeroth_moment=True) noexcept: + cpdef normalize(self, include_zeroth_moment=True): r""" Normalize by reducing modulo `Fil^N`, where `N` is the number of moments. @@ -1270,7 +1270,7 @@ cdef class WeightKAction(Action): self._actmat = {} self._maxprecs = {} - cpdef acting_matrix(self, g, M) noexcept: + cpdef acting_matrix(self, g, M): r""" The matrix defining the action of ``g`` at precision ``M``. @@ -1328,7 +1328,7 @@ cdef class WeightKAction(Action): mats[M] = A return A - cpdef _compute_acting_matrix(self, g, M) noexcept: + cpdef _compute_acting_matrix(self, g, M): r""" Compute the matrix defining the action of ``g`` at precision ``M``. @@ -1357,7 +1357,7 @@ cdef class WeightKAction(Action): cdef class WeightKAction_vector(WeightKAction): - cpdef _compute_acting_matrix(self, g, M) noexcept: + cpdef _compute_acting_matrix(self, g, M): r""" Compute the matrix defining the action of ``g`` at precision ``M``. @@ -1419,7 +1419,7 @@ cdef class WeightKAction_vector(WeightKAction): B *= (a * d - b * c) ** (self._dettwist) return B - cpdef _act_(self, g, _v) noexcept: + cpdef _act_(self, g, _v): r""" The right action of ``g`` on a distribution. diff --git a/src/sage/modules/finite_submodule_iter.pxd b/src/sage/modules/finite_submodule_iter.pxd index 900f041e3a0..8173f265673 100644 --- a/src/sage/modules/finite_submodule_iter.pxd +++ b/src/sage/modules/finite_submodule_iter.pxd @@ -13,7 +13,7 @@ cdef class FiniteZZsubmodule_iterator: cdef int _count cdef int _order cdef bint _immutable - cdef ModuleElement _iteration(FiniteZZsubmodule_iterator self) noexcept + cdef ModuleElement _iteration(FiniteZZsubmodule_iterator self) cdef class FiniteFieldsubspace_iterator(FiniteZZsubmodule_iterator): pass diff --git a/src/sage/modules/finite_submodule_iter.pyx b/src/sage/modules/finite_submodule_iter.pyx index 4f0fbbdca3b..f3ef152cb86 100644 --- a/src/sage/modules/finite_submodule_iter.pyx +++ b/src/sage/modules/finite_submodule_iter.pyx @@ -190,7 +190,7 @@ cdef class FiniteZZsubmodule_iterator: """ return self - cdef ModuleElement _iteration(FiniteZZsubmodule_iterator self) noexcept: + cdef ModuleElement _iteration(FiniteZZsubmodule_iterator self): """ This is the core implementation of the iteration. diff --git a/src/sage/modules/free_module_element.pxd b/src/sage/modules/free_module_element.pxd index e524a458474..084423a2714 100644 --- a/src/sage/modules/free_module_element.pxd +++ b/src/sage/modules/free_module_element.pxd @@ -2,7 +2,7 @@ from sage.structure.element cimport Vector cdef class FreeModuleElement(Vector): cdef int set_unsafe(self, Py_ssize_t i, value) except -1 - cdef get_unsafe(self, Py_ssize_t i) noexcept + cdef get_unsafe(self, Py_ssize_t i) cpdef int hamming_weight(self) noexcept cdef class FreeModuleElement_generic_dense(FreeModuleElement): @@ -10,7 +10,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): cdef list _entries # cdef'd methods - cdef _new_c(self, object v) noexcept + cdef _new_c(self, object v) cdef class FreeModuleElement_generic_sparse(FreeModuleElement): @@ -18,5 +18,5 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): cdef dict _entries # cdef'd methods - cdef _new_c(self, object v) noexcept + cdef _new_c(self, object v) diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx index d4705ffa022..c93c71f195e 100644 --- a/src/sage/modules/free_module_element.pyx +++ b/src/sage/modules/free_module_element.pyx @@ -1764,7 +1764,7 @@ cdef class FreeModuleElement(Vector): # abstract base class s = sum(a ** p for a in abs_self) return s**(__one__/p) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ EXAMPLES:: @@ -1844,7 +1844,7 @@ cdef class FreeModuleElement(Vector): # abstract base class raise IndexError("vector index out of range") return self.get_unsafe(n) - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): """ Cython function to get the `i`'th entry of this vector. @@ -2486,7 +2486,7 @@ cdef class FreeModuleElement(Vector): # abstract base class else: return points(v, **kwds) - cpdef _dot_product_coerce_(left, Vector right) noexcept: + cpdef _dot_product_coerce_(left, Vector right): """ Return the dot product of left and right. @@ -4312,7 +4312,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): sage: isinstance(hash(v), int) True """ - cdef _new_c(self, object v) noexcept: + cdef _new_c(self, object v): """ Create a new dense free module element with minimal overhead and no type checking. @@ -4456,7 +4456,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): @cython.boundscheck(False) @cython.wraparound(False) - cpdef _add_(left, right) noexcept: + cpdef _add_(left, right): """ Add left and right. @@ -4473,7 +4473,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): @cython.boundscheck(False) @cython.wraparound(False) - cpdef _sub_(left, right) noexcept: + cpdef _sub_(left, right): """ Subtract right from left. @@ -4491,7 +4491,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): v = [( a[i])._sub_( b[i]) for i in range(left._degree)] return left._new_c(v) - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): """ EXAMPLES:: @@ -4505,7 +4505,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): v = [left * x for x in self._entries] return self._new_c(v) - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ EXAMPLES:: @@ -4523,7 +4523,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): @cython.boundscheck(False) @cython.wraparound(False) - cpdef _pairwise_product_(left, Vector right) noexcept: + cpdef _pairwise_product_(left, Vector right): """ EXAMPLES:: @@ -4555,7 +4555,7 @@ cdef class FreeModuleElement_generic_dense(FreeModuleElement): @cython.boundscheck(False) @cython.wraparound(False) - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): """ EXAMPLES:: @@ -4764,7 +4764,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): sage: (b-a).dict() {2: -1} """ - cdef _new_c(self, object v) noexcept: + cdef _new_c(self, object v): """ Create a new sparse free module element with minimal overhead and no type checking. @@ -4914,7 +4914,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): entries_dict = dict(entries_dict) # make a copy/convert to dict self._entries = entries_dict - cpdef _add_(left, right) noexcept: + cpdef _add_(left, right): """ Add left and right. @@ -4936,7 +4936,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): v[i] = a return left._new_c(v) - cpdef _sub_(left, right) noexcept: + cpdef _sub_(left, right): """ EXAMPLES:: @@ -4956,7 +4956,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): v[i] = -a return left._new_c(v) - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ EXAMPLES:: @@ -4972,7 +4972,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): v[i] = prod return self._new_c(v) - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): """ EXAMPLES:: @@ -4988,7 +4988,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): v[i] = prod return self._new_c(v) - cpdef _dot_product_coerce_(left, Vector right) noexcept: + cpdef _dot_product_coerce_(left, Vector right): """ Return the dot product of left and right. @@ -5040,7 +5040,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): z += a * e[i] return z - cpdef _pairwise_product_(left, Vector right) noexcept: + cpdef _pairwise_product_(left, Vector right): """ EXAMPLES:: @@ -5058,7 +5058,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): v[i] = prod return left._new_c(v) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Compare two sparse free module elements. @@ -5189,7 +5189,7 @@ cdef class FreeModuleElement_generic_sparse(FreeModuleElement): raise IndexError("vector index out of range") return self.get_unsafe(n) - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): """ EXAMPLES:: diff --git a/src/sage/modules/module.pyx b/src/sage/modules/module.pyx index 9962bcba5d9..2d7d21422ac 100644 --- a/src/sage/modules/module.pyx +++ b/src/sage/modules/module.pyx @@ -132,7 +132,7 @@ cdef class Module(Parent): category = Modules(base) Parent.__init__(self, base=base, category=category, names=names) - cpdef _coerce_map_from_(self, M) noexcept: + cpdef _coerce_map_from_(self, M): """ Return a coercion map from `M` to ``self``, or None. diff --git a/src/sage/modules/vector_double_dense.pyx b/src/sage/modules/vector_double_dense.pyx index 1d5f6e8c4ab..b07fc9e71c2 100644 --- a/src/sage/modules/vector_double_dense.pyx +++ b/src/sage/modules/vector_double_dense.pyx @@ -81,7 +81,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): 30.0 """ - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add two vectors together. @@ -101,7 +101,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): return self._new(_left._vector_numpy + _right._vector_numpy) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Return self - right @@ -121,7 +121,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): return self._new(_left._vector_numpy - _right._vector_numpy) - cpdef _dot_product_(self, Vector right) noexcept: + cpdef _dot_product_(self, Vector right): """ Dot product of self and right. @@ -145,7 +145,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): return self._sage_dtype(numpy.dot(_left._vector_numpy, _right._vector_numpy)) - cpdef _pairwise_product_(self, Vector right) noexcept: + cpdef _pairwise_product_(self, Vector right): """ Return the component-wise product of self and right. @@ -168,7 +168,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): return self._new(_left._vector_numpy * _right._vector_numpy) - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): """ Multiply a scalar and vector @@ -184,7 +184,7 @@ cdef class Vector_double_dense(Vector_numpy_dense): return self._new(self._python_dtype(left)*self._vector_numpy) - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ Multiply a scalar and vector diff --git a/src/sage/modules/vector_integer_dense.pxd b/src/sage/modules/vector_integer_dense.pxd index 0db4808be63..ff2843f481f 100644 --- a/src/sage/modules/vector_integer_dense.pxd +++ b/src/sage/modules/vector_integer_dense.pxd @@ -7,7 +7,7 @@ cdef class Vector_integer_dense(FreeModuleElement): cdef mpz_t* _entries cdef int _init(self, Py_ssize_t degree, Parent parent) except -1 - cdef inline Vector_integer_dense _new_c(self) noexcept: + cdef inline Vector_integer_dense _new_c(self): cdef type t = type(self) cdef Vector_integer_dense x = (t.__new__(t)) x._init(self._degree, self._parent) diff --git a/src/sage/modules/vector_integer_dense.pyx b/src/sage/modules/vector_integer_dense.pyx index ac62a7cb6fa..c078db11fff 100644 --- a/src/sage/modules/vector_integer_dense.pyx +++ b/src/sage/modules/vector_integer_dense.pyx @@ -130,7 +130,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): mpz_clear(self._entries[i]) sig_free(self._entries) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ EXAMPLES:: @@ -159,7 +159,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): return rich_to_bool(op, 1) return rich_to_bool(op, 0) - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): """ EXAMPLES:: @@ -215,7 +215,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): return (unpickle_v1, (self._parent, self.list(), self._degree, not self._is_immutable)) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): cdef Vector_integer_dense z, r r = right z = self._new_c() @@ -225,7 +225,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): return z - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): cdef Vector_integer_dense z, r r = right z = self._new_c() @@ -234,7 +234,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): mpz_sub(z._entries[i], self._entries[i], r._entries[i]) return z - cpdef _dot_product_(self, Vector right) noexcept: + cpdef _dot_product_(self, Vector right): """ Dot product of dense vectors over the integers. @@ -258,7 +258,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): mpz_clear(t) return z - cpdef _pairwise_product_(self, Vector right) noexcept: + cpdef _pairwise_product_(self, Vector right): """ EXAMPLES:: @@ -274,7 +274,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): mpz_mul(z._entries[i], self._entries[i], r._entries[i]) return z - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): cdef Vector_integer_dense z cdef Integer a a = left @@ -284,7 +284,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): mpz_mul(z._entries[i], self._entries[i], a.value) return z - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): cdef Vector_integer_dense z cdef Integer a a = right @@ -294,7 +294,7 @@ cdef class Vector_integer_dense(free_module_element.FreeModuleElement): mpz_mul(z._entries[i], self._entries[i], a.value) return z - cpdef _neg_(self) noexcept: + cpdef _neg_(self): cdef Vector_integer_dense z z = self._new_c() cdef Py_ssize_t i diff --git a/src/sage/modules/vector_integer_sparse.pxd b/src/sage/modules/vector_integer_sparse.pxd index 4791b778497..42818124a82 100644 --- a/src/sage/modules/vector_integer_sparse.pxd +++ b/src/sage/modules/vector_integer_sparse.pxd @@ -19,7 +19,7 @@ cdef Py_ssize_t mpz_binary_search0(mpz_t* v, Py_ssize_t n, mpz_t x) noexcept cdef Py_ssize_t mpz_binary_search(mpz_t* v, Py_ssize_t n, mpz_t x, Py_ssize_t* ins) noexcept cdef int mpz_vector_get_entry(mpz_t ans, mpz_vector* v, Py_ssize_t n) except -1 cdef bint mpz_vector_is_entry_zero_unsafe(mpz_vector* v, Py_ssize_t n) noexcept -cdef object mpz_vector_to_list(mpz_vector* v) noexcept +cdef object mpz_vector_to_list(mpz_vector* v) cdef int mpz_vector_set_entry(mpz_vector* v, Py_ssize_t n, mpz_t x) except -1 cdef int mpz_vector_set_entry_str(mpz_vector* v, Py_ssize_t n, char *x_str) except -1 cdef int add_mpz_vector_init(mpz_vector* sum, mpz_vector* v, mpz_vector* w, mpz_t multiple) except -1 diff --git a/src/sage/modules/vector_integer_sparse.pyx b/src/sage/modules/vector_integer_sparse.pyx index d5f2958ea59..57a7b70bde4 100644 --- a/src/sage/modules/vector_integer_sparse.pyx +++ b/src/sage/modules/vector_integer_sparse.pyx @@ -151,7 +151,7 @@ cdef bint mpz_vector_is_entry_zero_unsafe(mpz_vector* v, Py_ssize_t n) noexcept: """ return binary_search0(v.positions, v.num_nonzero, n) == -1 -cdef object mpz_vector_to_list(mpz_vector* v) noexcept: +cdef object mpz_vector_to_list(mpz_vector* v): """ Returns a Python list of 2-tuples (i,x), where x=v[i] runs through the nonzero elements of x, in order. diff --git a/src/sage/modules/vector_mod2_dense.pxd b/src/sage/modules/vector_mod2_dense.pxd index 1292762a76e..4535fe3273d 100644 --- a/src/sage/modules/vector_mod2_dense.pxd +++ b/src/sage/modules/vector_mod2_dense.pxd @@ -6,5 +6,5 @@ cdef class Vector_mod2_dense(FreeModuleElement): cdef mzd_t* _entries cdef object _base_ring - cdef _new_c(self) noexcept - cdef _init(self, Py_ssize_t degree, parent) noexcept + cdef _new_c(self) + cdef _init(self, Py_ssize_t degree, parent) diff --git a/src/sage/modules/vector_mod2_dense.pyx b/src/sage/modules/vector_mod2_dense.pyx index 05b2bf04318..e6c2408b1f0 100644 --- a/src/sage/modules/vector_mod2_dense.pyx +++ b/src/sage/modules/vector_mod2_dense.pyx @@ -50,7 +50,7 @@ cimport sage.modules.free_module_element as free_module_element from sage.libs.m4ri cimport * cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): - cdef _new_c(self) noexcept: + cdef _new_c(self): """ EXAMPLES:: @@ -105,7 +105,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): mzd_copy(y._entries, self._entries) return y - cdef _init(self, Py_ssize_t degree, parent) noexcept: + cdef _init(self, Py_ssize_t degree, parent): """ EXAMPLES:: @@ -227,7 +227,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): if self._entries: mzd_free(self._entries) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ EXAMPLES:: @@ -253,7 +253,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): c = mzd_cmp(left._entries, (right)._entries) return rich_to_bool(op, c) - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): """ EXAMPLES:: @@ -302,7 +302,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): return unpickle_v0, (self._parent, self.list(), self._degree, self._is_immutable) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ EXAMPLES:: @@ -317,7 +317,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): mzd_add(z._entries, self._entries, (right)._entries) return z - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ EXAMPLES:: @@ -349,7 +349,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): return res - cpdef _dot_product_(self, Vector right) noexcept: + cpdef _dot_product_(self, Vector right): """ EXAMPLES:: @@ -397,7 +397,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): return n - cpdef _pairwise_product_(self, Vector right) noexcept: + cpdef _pairwise_product_(self, Vector right): """ EXAMPLES:: @@ -419,7 +419,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): zrow[i] = (lrow[i] & rrow[i]) return z - cpdef _lmul_(self, Element left) noexcept: + cpdef _lmul_(self, Element left): """ EXAMPLES:: @@ -447,7 +447,7 @@ cdef class Vector_mod2_dense(free_module_element.FreeModuleElement): return self.__copy__() return self._new_c() - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ EXAMPLES:: diff --git a/src/sage/modules/vector_modn_dense.pxd b/src/sage/modules/vector_modn_dense.pxd index 6e726651ea1..5de166f1b85 100644 --- a/src/sage/modules/vector_modn_dense.pxd +++ b/src/sage/modules/vector_modn_dense.pxd @@ -7,5 +7,5 @@ cdef class Vector_modn_dense(FreeModuleElement): cdef mod_int _p cdef object _base_ring - cdef _new_c(self) noexcept - cdef _init(self, Py_ssize_t degree, parent, mod_int p) noexcept + cdef _new_c(self) + cdef _init(self, Py_ssize_t degree, parent, mod_int p) diff --git a/src/sage/modules/vector_modn_dense.pyx b/src/sage/modules/vector_modn_dense.pyx index 29118746ee1..ed98d3e573d 100644 --- a/src/sage/modules/vector_modn_dense.pyx +++ b/src/sage/modules/vector_modn_dense.pyx @@ -135,7 +135,7 @@ cimport sage.modules.free_module_element as free_module_element cdef class Vector_modn_dense(free_module_element.FreeModuleElement): - cdef _new_c(self) noexcept: + cdef _new_c(self): cdef Vector_modn_dense y y = Vector_modn_dense.__new__(Vector_modn_dense) y._init(self._degree, self._parent, self._p) @@ -155,7 +155,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): y._entries[i] = self._entries[i] return y - cdef _init(self, Py_ssize_t degree, parent, mod_int p) noexcept: + cdef _init(self, Py_ssize_t degree, parent, mod_int p): self._degree = degree self._parent = parent self._p = p @@ -194,7 +194,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): def __dealloc__(self): sig_free(self._entries) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ EXAMPLES:: @@ -220,7 +220,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): return rich_to_bool(op, 1) return rich_to_bool(op, 0) - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): """ EXAMPLES:: @@ -276,7 +276,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): return unpickle_v1, (self._parent, self.list(), self._degree, self._p, not self._is_immutable) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): cdef Vector_modn_dense z, r r = right z = self._new_c() @@ -286,7 +286,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): return z - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): cdef Vector_modn_dense z, r r = right z = self._new_c() @@ -295,7 +295,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): z._entries[i] = (self._p + self._entries[i] - r._entries[i]) % self._p return z - cpdef _dot_product_(self, Vector right) noexcept: + cpdef _dot_product_(self, Vector right): cdef size_t i cdef IntegerMod_int n cdef IntegerMod_int64 m @@ -316,7 +316,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): m.ivalue = (m.ivalue + self._entries[i] * r._entries[i]) % self._p return m - cpdef _pairwise_product_(self, Vector right) noexcept: + cpdef _pairwise_product_(self, Vector right): """ EXAMPLES:: @@ -334,7 +334,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): z._entries[i] = (self._entries[i] * r._entries[i]) % self._p return z - cpdef _lmul_(self, Element left) noexcept: + cpdef _lmul_(self, Element left): cdef Vector_modn_dense z cdef mod_int a = ivalue(left) @@ -345,7 +345,7 @@ cdef class Vector_modn_dense(free_module_element.FreeModuleElement): z._entries[i] = (self._entries[i] * a) % self._p return z - cpdef _neg_(self) noexcept: + cpdef _neg_(self): cdef Vector_modn_dense z z = self._new_c() cdef Py_ssize_t i diff --git a/src/sage/modules/vector_modn_sparse.pxd b/src/sage/modules/vector_modn_sparse.pxd index d345ecd1e12..049b9ba27e8 100644 --- a/src/sage/modules/vector_modn_sparse.pxd +++ b/src/sage/modules/vector_modn_sparse.pxd @@ -14,7 +14,7 @@ cdef Py_ssize_t binary_search0_modn(Py_ssize_t* v, Py_ssize_t n, int_fast64_t x) cdef Py_ssize_t binary_search_modn(Py_ssize_t* v, Py_ssize_t n, int_fast64_t x, Py_ssize_t* ins) noexcept cdef int_fast64_t get_entry(c_vector_modint* v, Py_ssize_t n) except -1 cdef bint is_entry_zero_unsafe(c_vector_modint* v, Py_ssize_t n) noexcept -cdef object to_list(c_vector_modint* v) noexcept +cdef object to_list(c_vector_modint* v) cdef int set_entry(c_vector_modint* v, Py_ssize_t n, int_fast64_t x) except -1 cdef int add_c_vector_modint_init(c_vector_modint* sum, c_vector_modint* v, c_vector_modint* w, int multiple) except -1 cdef int scale_c_vector_modint(c_vector_modint* v, int_fast64_t scalar) except -1 diff --git a/src/sage/modules/vector_modn_sparse.pyx b/src/sage/modules/vector_modn_sparse.pyx index 0cde9644380..a6b59ae9ca5 100644 --- a/src/sage/modules/vector_modn_sparse.pyx +++ b/src/sage/modules/vector_modn_sparse.pyx @@ -130,7 +130,7 @@ cdef bint is_entry_zero_unsafe(c_vector_modint* v, Py_ssize_t n) noexcept: """ return binary_search0_modn(v.positions, v.num_nonzero, n) == -1 -cdef object to_list(c_vector_modint* v) noexcept: +cdef object to_list(c_vector_modint* v): """ Return a Python list of 2-tuples (i,x), where x=v[i] runs through the nonzero elements of x, in order. diff --git a/src/sage/modules/vector_numpy_dense.pxd b/src/sage/modules/vector_numpy_dense.pxd index 0cb384222c2..ec60da7a865 100644 --- a/src/sage/modules/vector_numpy_dense.pxd +++ b/src/sage/modules/vector_numpy_dense.pxd @@ -10,5 +10,5 @@ cdef class Vector_numpy_dense(FreeModuleElement): cdef object _sage_dtype cdef object _sage_vector_dtype cdef numpy.ndarray _vector_numpy - cdef Vector_numpy_dense _new(self, numpy.ndarray vector_numpy) noexcept - cdef _replace_self_with_numpy(self, numpy.ndarray numpy_array) noexcept + cdef Vector_numpy_dense _new(self, numpy.ndarray vector_numpy) + cdef _replace_self_with_numpy(self, numpy.ndarray numpy_array) diff --git a/src/sage/modules/vector_numpy_dense.pyx b/src/sage/modules/vector_numpy_dense.pyx index 433f77b11d3..9b16a6c354d 100644 --- a/src/sage/modules/vector_numpy_dense.pyx +++ b/src/sage/modules/vector_numpy_dense.pyx @@ -68,7 +68,7 @@ cdef class Vector_numpy_dense(FreeModuleElement): self._degree = parent.degree() self._parent = parent - cdef Vector_numpy_dense _new(self, numpy.ndarray vector_numpy) noexcept: + cdef Vector_numpy_dense _new(self, numpy.ndarray vector_numpy): """ Return a new vector with same parent as self. """ @@ -231,7 +231,7 @@ cdef class Vector_numpy_dense(FreeModuleElement): self._python_dtype(value)) # TODO: Throw an error if status == -1 - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): """ EXAMPLES:: @@ -248,7 +248,7 @@ cdef class Vector_numpy_dense(FreeModuleElement): return self._sage_dtype(numpy.PyArray_GETITEM(self._vector_numpy, numpy.PyArray_GETPTR1(self._vector_numpy, i))) - cdef _replace_self_with_numpy(self, numpy.ndarray numpy_array) noexcept: + cdef _replace_self_with_numpy(self, numpy.ndarray numpy_array): """ Replace the underlying numpy array with numpy_array. """ diff --git a/src/sage/modules/vector_rational_dense.pxd b/src/sage/modules/vector_rational_dense.pxd index 4820936580a..c5f2a4a7c3f 100644 --- a/src/sage/modules/vector_rational_dense.pxd +++ b/src/sage/modules/vector_rational_dense.pxd @@ -7,7 +7,7 @@ cdef class Vector_rational_dense(FreeModuleElement): cdef mpq_t* _entries cdef int _init(self, Py_ssize_t degree, Parent parent) except -1 - cdef inline Vector_rational_dense _new_c(self) noexcept: + cdef inline Vector_rational_dense _new_c(self): cdef type t = type(self) cdef Vector_rational_dense x = (t.__new__(t)) x._init(self._degree, self._parent) diff --git a/src/sage/modules/vector_rational_dense.pyx b/src/sage/modules/vector_rational_dense.pyx index 98424f3d3e1..864628f10c7 100644 --- a/src/sage/modules/vector_rational_dense.pyx +++ b/src/sage/modules/vector_rational_dense.pyx @@ -67,7 +67,7 @@ cimport sage.modules.free_module_element as free_module_element from sage.libs.gmp.mpq cimport * -cdef inline _Rational_from_mpq(mpq_t e) noexcept: +cdef inline _Rational_from_mpq(mpq_t e): cdef Rational z = Rational.__new__(Rational) mpq_set(z.value, e) return z @@ -162,7 +162,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): mpq_clear(self._entries[i]) sig_free(self._entries) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ EXAMPLES:: @@ -192,7 +192,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): return rich_to_bool(op, 1) return rich_to_bool(op, 0) - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): """ EXAMPLES:: @@ -253,7 +253,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): return (unpickle_v1, (self._parent, self.list(), self._degree, not self._is_immutable)) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): cdef Vector_rational_dense z, r r = right z = self._new_c() @@ -262,7 +262,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): mpq_add(z._entries[i], self._entries[i], r._entries[i]) return z - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): cdef Vector_rational_dense z, r r = right z = self._new_c() @@ -271,7 +271,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): mpq_sub(z._entries[i], self._entries[i], r._entries[i]) return z - cpdef _dot_product_(self, Vector right) noexcept: + cpdef _dot_product_(self, Vector right): """ Dot product of dense vectors over the rationals. @@ -296,7 +296,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): mpq_clear(t) return z - cpdef _pairwise_product_(self, Vector right) noexcept: + cpdef _pairwise_product_(self, Vector right): """ EXAMPLES:: @@ -312,7 +312,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): mpq_mul(z._entries[i], self._entries[i], r._entries[i]) return z - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): cdef Vector_rational_dense z cdef Rational a if isinstance(left, Rational): @@ -330,7 +330,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): mpq_mul(z._entries[i], self._entries[i], a.value) return z - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): cdef Vector_rational_dense z cdef Rational a if isinstance(right, Rational): @@ -348,7 +348,7 @@ cdef class Vector_rational_dense(free_module_element.FreeModuleElement): mpq_mul(z._entries[i], self._entries[i], a.value) return z - cpdef _neg_(self) noexcept: + cpdef _neg_(self): cdef Vector_rational_dense z z = self._new_c() cdef Py_ssize_t i diff --git a/src/sage/modules/vector_rational_sparse.pxd b/src/sage/modules/vector_rational_sparse.pxd index b738ad18edb..4dfbed73d6d 100644 --- a/src/sage/modules/vector_rational_sparse.pxd +++ b/src/sage/modules/vector_rational_sparse.pxd @@ -20,7 +20,7 @@ cdef Py_ssize_t mpq_binary_search0(mpq_t* v, Py_ssize_t n, mpq_t x) noexcept cdef Py_ssize_t mpq_binary_search(mpq_t* v, Py_ssize_t n, mpq_t x, Py_ssize_t* ins) noexcept cdef int mpq_vector_get_entry(mpq_t ans, mpq_vector* v, Py_ssize_t n) except -1 cdef bint mpq_vector_is_entry_zero_unsafe(mpq_vector* v, Py_ssize_t n) noexcept -cdef object mpq_vector_to_list(mpq_vector* v) noexcept +cdef object mpq_vector_to_list(mpq_vector* v) cdef int mpq_vector_set_entry(mpq_vector* v, Py_ssize_t n, mpq_t x) except -1 cdef int mpq_vector_set_entry_str(mpq_vector* v, Py_ssize_t n, char *x_str) except -1 cdef int add_mpq_vector_init(mpq_vector* sum, mpq_vector* v, mpq_vector* w, mpq_t multiple) except -1 diff --git a/src/sage/modules/vector_rational_sparse.pyx b/src/sage/modules/vector_rational_sparse.pyx index 58100ac033f..37466bab2da 100644 --- a/src/sage/modules/vector_rational_sparse.pyx +++ b/src/sage/modules/vector_rational_sparse.pyx @@ -158,7 +158,7 @@ cdef bint mpq_vector_is_entry_zero_unsafe(mpq_vector* v, Py_ssize_t n) noexcept: """ return binary_search0(v.positions, v.num_nonzero, n) == -1 -cdef object mpq_vector_to_list(mpq_vector* v) noexcept: +cdef object mpq_vector_to_list(mpq_vector* v): """ Returns a Python list of 2-tuples (i,x), where x=v[i] runs through the nonzero elements of x, in order. diff --git a/src/sage/modules/with_basis/indexed_element.pxd b/src/sage/modules/with_basis/indexed_element.pxd index 06fec702dcf..ebc785d7ccf 100644 --- a/src/sage/modules/with_basis/indexed_element.pxd +++ b/src/sage/modules/with_basis/indexed_element.pxd @@ -5,8 +5,8 @@ cdef class IndexedFreeModuleElement(ModuleElement): cdef long _hash cdef bint _hash_set - cpdef _add_(self, other) noexcept - cpdef _sub_(self, other) noexcept - cpdef _neg_(self) noexcept + cpdef _add_(self, other) + cpdef _sub_(self, other) + cpdef _neg_(self) - cpdef dict monomial_coefficients(self, bint copy=*) noexcept + cpdef dict monomial_coefficients(self, bint copy=*) diff --git a/src/sage/modules/with_basis/indexed_element.pyx b/src/sage/modules/with_basis/indexed_element.pyx index 43458c5fcc9..8f2907502ad 100644 --- a/src/sage/modules/with_basis/indexed_element.pyx +++ b/src/sage/modules/with_basis/indexed_element.pyx @@ -228,7 +228,7 @@ cdef class IndexedFreeModuleElement(ModuleElement): """ return self - cpdef dict monomial_coefficients(self, bint copy=True) noexcept: + cpdef dict monomial_coefficients(self, bint copy=True): """ Return the internal dictionary which has the combinatorial objects indexing the basis as keys and their corresponding coefficients as @@ -563,7 +563,7 @@ cdef class IndexedFreeModuleElement(ModuleElement): repr_monomial = self._parent._latex_term, is_latex=True, strip_one=True) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Rich comparison for equal parents. @@ -673,7 +673,7 @@ cdef class IndexedFreeModuleElement(ModuleElement): w = sorted(elt._monomial_coefficients.items()) return richcmp(v, w, op) - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): """ EXAMPLES:: @@ -696,7 +696,7 @@ cdef class IndexedFreeModuleElement(ModuleElement): add(self._monomial_coefficients, (other)._monomial_coefficients)) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ EXAMPLES:: @@ -714,7 +714,7 @@ cdef class IndexedFreeModuleElement(ModuleElement): """ return type(self)(self._parent, negate(self._monomial_coefficients)) - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): """ EXAMPLES:: @@ -853,7 +853,7 @@ cdef class IndexedFreeModuleElement(ModuleElement): to_vector = _vector_ - cpdef _acted_upon_(self, scalar, bint self_on_left) noexcept: + cpdef _acted_upon_(self, scalar, bint self_on_left): """ Return the action of ``scalar`` (an element of the base ring) on ``self``. @@ -927,7 +927,7 @@ cdef class IndexedFreeModuleElement(ModuleElement): scal(scalar, self._monomial_coefficients, factor_on_left=not self_on_left)) - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ For backward compatibility. @@ -939,7 +939,7 @@ cdef class IndexedFreeModuleElement(ModuleElement): """ return self._acted_upon_(right, True) - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): """ For backward compatibility. diff --git a/src/sage/monoids/free_abelian_monoid_element.pxd b/src/sage/monoids/free_abelian_monoid_element.pxd index fe65af79711..092cd343f05 100644 --- a/src/sage/monoids/free_abelian_monoid_element.pxd +++ b/src/sage/monoids/free_abelian_monoid_element.pxd @@ -8,7 +8,7 @@ cdef class FreeAbelianMonoidElement(MonoidElement): cdef int _init(self, Py_ssize_t n, Parent parent) except -1 - cdef inline FreeAbelianMonoidElement _new_c(self) noexcept: + cdef inline FreeAbelianMonoidElement _new_c(self): cdef type t = type(self) cdef FreeAbelianMonoidElement x = (t.__new__(t)) x._init(self._n, self._parent) diff --git a/src/sage/monoids/free_abelian_monoid_element.pyx b/src/sage/monoids/free_abelian_monoid_element.pyx index a9eec5f9065..c81c1fa5575 100644 --- a/src/sage/monoids/free_abelian_monoid_element.pyx +++ b/src/sage/monoids/free_abelian_monoid_element.pyx @@ -263,7 +263,7 @@ cdef class FreeAbelianMonoidElement(MonoidElement): s = "1" return s - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Rich comparison. diff --git a/src/sage/numerical/backends/cvxopt_backend.pyx b/src/sage/numerical/backends/cvxopt_backend.pyx index 01d4360d390..1d7ef20625c 100644 --- a/src/sage/numerical/backends/cvxopt_backend.pyx +++ b/src/sage/numerical/backends/cvxopt_backend.pyx @@ -93,7 +93,7 @@ cdef class CVXOPTBackend(GenericBackend): else: self.set_sense(-1) - cpdef __copy__(self) noexcept: + cpdef __copy__(self): # Added a second inequality to this doctest, # because otherwise CVXOPT complains: ValueError: Rank(A) < p or Rank([G; A]) < n """ @@ -205,7 +205,7 @@ cdef class CVXOPTBackend(GenericBackend): self.col_name_var.append(name) return len(self.objective_function) - 1 - cpdef set_variable_type(self, int variable, int vtype) noexcept: + cpdef set_variable_type(self, int variable, int vtype): """ Set the type of a variable. @@ -224,7 +224,7 @@ cdef class CVXOPTBackend(GenericBackend): if vtype != -1: raise ValueError('This backend does not handle integer variables ! Read the doc !') - cpdef set_sense(self, int sense) noexcept: + cpdef set_sense(self, int sense): """ Set the direction (maximization/minimization). @@ -250,7 +250,7 @@ cdef class CVXOPTBackend(GenericBackend): else: self.is_maximize = 0 - cpdef objective_coefficient(self, int variable, coeff=None) noexcept: + cpdef objective_coefficient(self, int variable, coeff=None): """ Set or get the coefficient of a variable in the objective function @@ -278,7 +278,7 @@ cdef class CVXOPTBackend(GenericBackend): else: return self.objective_function[variable] - cpdef set_objective(self, list coeff, d = 0.0) noexcept: + cpdef set_objective(self, list coeff, d = 0.0): """ Set the objective function. @@ -303,13 +303,13 @@ cdef class CVXOPTBackend(GenericBackend): self.objective_function[i] = coeff[i] obj_constant_term = d - cpdef set_verbosity(self, int level) noexcept: + cpdef set_verbosity(self, int level): """ Does not apply for the cvxopt solver """ pass - cpdef add_col(self, indices, coeffs) noexcept: + cpdef add_col(self, indices, coeffs): """ Add a column. @@ -357,7 +357,7 @@ cdef class CVXOPTBackend(GenericBackend): self.objective_function.append(0) self.col_name_var.append(None) - cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None) noexcept: + cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None): """ Add a linear constraint. @@ -564,7 +564,7 @@ cdef class CVXOPTBackend(GenericBackend): return 0 - cpdef get_objective_value(self) noexcept: + cpdef get_objective_value(self): """ Return the value of the objective function. @@ -596,7 +596,7 @@ cdef class CVXOPTBackend(GenericBackend): i+=1 return sum - cpdef get_variable_value(self, int variable) noexcept: + cpdef get_variable_value(self, int variable): """ Return the value of a variable given by the solver. @@ -679,7 +679,7 @@ cdef class CVXOPTBackend(GenericBackend): else: return 0 - cpdef problem_name(self, name=None) noexcept: + cpdef problem_name(self, name=None): """ Return or define the problem's name @@ -703,7 +703,7 @@ cdef class CVXOPTBackend(GenericBackend): self.prob_name = name - cpdef row(self, int i) noexcept: + cpdef row(self, int i): """ Return a row @@ -741,7 +741,7 @@ cdef class CVXOPTBackend(GenericBackend): return (idx, coeff) - cpdef row_bounds(self, int index) noexcept: + cpdef row_bounds(self, int index): """ Return the bounds of a specific constraint. @@ -769,7 +769,7 @@ cdef class CVXOPTBackend(GenericBackend): """ return (self.row_lower_bound[index], self.row_upper_bound[index]) - cpdef col_bounds(self, int index) noexcept: + cpdef col_bounds(self, int index): """ Return the bounds of a specific variable. @@ -880,7 +880,7 @@ cdef class CVXOPTBackend(GenericBackend): """ return True - cpdef row_name(self, int index) noexcept: + cpdef row_name(self, int index): """ Return the ``index`` th row name @@ -900,7 +900,7 @@ cdef class CVXOPTBackend(GenericBackend): return self.row_name_var[index] return "constraint_" + repr(index) - cpdef col_name(self, int index) noexcept: + cpdef col_name(self, int index): """ Return the ``index`` th col name @@ -924,7 +924,7 @@ cdef class CVXOPTBackend(GenericBackend): return self.col_name_var[index] return "x_" + repr(index) - cpdef variable_upper_bound(self, int index, value = False) noexcept: + cpdef variable_upper_bound(self, int index, value = False): """ Return or define the upper bound on a variable @@ -953,7 +953,7 @@ cdef class CVXOPTBackend(GenericBackend): else: return self.col_upper_bound[index] - cpdef variable_lower_bound(self, int index, value = False) noexcept: + cpdef variable_lower_bound(self, int index, value = False): """ Return or define the lower bound on a variable @@ -982,7 +982,7 @@ cdef class CVXOPTBackend(GenericBackend): else: return self.col_lower_bound[index] - cpdef solver_parameter(self, name, value = None) noexcept: + cpdef solver_parameter(self, name, value = None): """ Return or define a solver parameter diff --git a/src/sage/numerical/backends/cvxopt_sdp_backend.pyx b/src/sage/numerical/backends/cvxopt_sdp_backend.pyx index 7aa91de6158..5a5cf2c11a2 100644 --- a/src/sage/numerical/backends/cvxopt_sdp_backend.pyx +++ b/src/sage/numerical/backends/cvxopt_sdp_backend.pyx @@ -162,7 +162,7 @@ cdef class CVXOPTSDPBackend(MatrixSDPBackend): return 0 - cpdef get_objective_value(self) noexcept: + cpdef get_objective_value(self): """ Return the value of the objective function. @@ -197,7 +197,7 @@ cdef class CVXOPTSDPBackend(MatrixSDPBackend): i+=1 return sum - cpdef _get_answer(self) noexcept: + cpdef _get_answer(self): """ return the complete output dict of the solver @@ -223,7 +223,7 @@ cdef class CVXOPTSDPBackend(MatrixSDPBackend): """ return self.answer - cpdef get_variable_value(self, int variable) noexcept: + cpdef get_variable_value(self, int variable): """ Return the value of a variable given by the solver. @@ -257,7 +257,7 @@ cdef class CVXOPTSDPBackend(MatrixSDPBackend): """ return self.answer['x'][variable] - cpdef dual_variable(self, int i, sparse=False) noexcept: + cpdef dual_variable(self, int i, sparse=False): """ The `i`-th dual variable @@ -307,7 +307,7 @@ cdef class CVXOPTSDPBackend(MatrixSDPBackend): assert(n == self.answer['zs'][i].size[1]) # must be square matrix return Matrix(n, n, list(self.answer['zs'][i]), sparse=sparse) - cpdef slack(self, int i, sparse=False) noexcept: + cpdef slack(self, int i, sparse=False): """ Slack of the `i`-th constraint @@ -359,7 +359,7 @@ cdef class CVXOPTSDPBackend(MatrixSDPBackend): return Matrix(n, n, list(self.answer['ss'][i]), sparse=sparse) - cpdef solver_parameter(self, name, value=None) noexcept: + cpdef solver_parameter(self, name, value=None): """ Return or define a solver parameter diff --git a/src/sage/numerical/backends/cvxpy_backend.pxd b/src/sage/numerical/backends/cvxpy_backend.pxd index 96dd9c33390..ed4d63ccc63 100644 --- a/src/sage/numerical/backends/cvxpy_backend.pxd +++ b/src/sage/numerical/backends/cvxpy_backend.pxd @@ -37,4 +37,4 @@ cdef class CVXPYBackend(GenericBackend): coefficients=*) \ except -1 - cpdef cvxpy_problem(self) noexcept + cpdef cvxpy_problem(self) diff --git a/src/sage/numerical/backends/cvxpy_backend.pyx b/src/sage/numerical/backends/cvxpy_backend.pyx index c07d33e5ae7..145f84b363a 100644 --- a/src/sage/numerical/backends/cvxpy_backend.pyx +++ b/src/sage/numerical/backends/cvxpy_backend.pyx @@ -142,7 +142,7 @@ cdef class CVXPYBackend: objective = cvxpy.Minimize(0) self.problem = cvxpy.Problem(objective, ()) - cpdef __copy__(self) noexcept: + cpdef __copy__(self): """ Returns a copy of self. @@ -174,7 +174,7 @@ cdef class CVXPYBackend: cp.obj_constant_term = self.obj_constant_term return cp - cpdef cvxpy_problem(self) noexcept: + cpdef cvxpy_problem(self): return self.problem def cvxpy_variables(self): @@ -286,7 +286,7 @@ cdef class CVXPYBackend: return index - cpdef set_verbosity(self, int level) noexcept: + cpdef set_verbosity(self, int level): """ Set the log (verbosity) level @@ -304,7 +304,7 @@ cdef class CVXPYBackend: """ pass - cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None) noexcept: + cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None): """ Add a linear constraint. @@ -363,7 +363,7 @@ cdef class CVXPYBackend: self.constraint_names.append(name) self.problem = cvxpy.Problem(self.problem.objective, constraints) - cpdef add_col(self, indices, coeffs) noexcept: + cpdef add_col(self, indices, coeffs): """ Add a column. @@ -410,7 +410,7 @@ cdef class CVXPYBackend: #self.objective_coefficients.append(0) goes to "self.add_variable" self.add_variable(coefficients=zip(indices, coeffs)) - cpdef set_objective(self, list coeff, d=0.0) noexcept: + cpdef set_objective(self, list coeff, d=0.0): """ Set the objective function. @@ -442,7 +442,7 @@ cdef class CVXPYBackend: self.problem = cvxpy.Problem(objective, constraints) self.obj_constant_term = d - cpdef set_sense(self, int sense) noexcept: + cpdef set_sense(self, int sense): """ Set the direction (maximization/minimization). @@ -470,7 +470,7 @@ cdef class CVXPYBackend: objective = cvxpy.Minimize(expr) self.problem = cvxpy.Problem(objective, self.problem.constraints) - cpdef objective_coefficient(self, int variable, coeff=None) noexcept: + cpdef objective_coefficient(self, int variable, coeff=None): """ Set or get the coefficient of a variable in the objective function @@ -545,7 +545,7 @@ cdef class CVXPYBackend: raise MIPSolverException(f"cvxpy.Problem.solve: Problem is unbounded") raise MIPSolverException(f"cvxpy.Problem.solve reported an unknown problem status: {status}") - cpdef get_objective_value(self) noexcept: + cpdef get_objective_value(self): """ Return the value of the objective function. @@ -572,7 +572,7 @@ cdef class CVXPYBackend: """ return self.problem.value + self.obj_constant_term - cpdef get_variable_value(self, int variable) noexcept: + cpdef get_variable_value(self, int variable): """ Return the value of a variable given by the solver. @@ -648,7 +648,7 @@ cdef class CVXPYBackend: """ return isinstance(self.problem.objective, cvxpy.Maximize) - cpdef problem_name(self, name=None) noexcept: + cpdef problem_name(self, name=None): """ Return or define the problem's name @@ -673,7 +673,7 @@ cdef class CVXPYBackend: else: self.prob_name = str(name) - cpdef row(self, int i) noexcept: + cpdef row(self, int i): """ Return a row @@ -709,7 +709,7 @@ cdef class CVXPYBackend: coef.append(self.Matrix[i][j]) return (idx, coef) - cpdef row_bounds(self, int index) noexcept: + cpdef row_bounds(self, int index): """ Return the bounds of a specific constraint. @@ -738,7 +738,7 @@ cdef class CVXPYBackend: """ return (self.row_lower_bound[index], self.row_upper_bound[index]) - cpdef col_bounds(self, int index) noexcept: + cpdef col_bounds(self, int index): """ Return the bounds of a specific variable. @@ -829,7 +829,7 @@ cdef class CVXPYBackend: """ return not self.is_variable_binary(index) and not self.is_variable_integer(index) - cpdef row_name(self, int index) noexcept: + cpdef row_name(self, int index): """ Return the ``index`` th row name @@ -847,7 +847,7 @@ cdef class CVXPYBackend: """ return self.constraint_names[index] or ("constraint_" + repr(index)) - cpdef col_name(self, int index) noexcept: + cpdef col_name(self, int index): """ Return the ``index`` th col name @@ -869,7 +869,7 @@ cdef class CVXPYBackend: """ return self.variables[index].name() - cpdef variable_upper_bound(self, int index, value = False) noexcept: + cpdef variable_upper_bound(self, int index, value=False): """ Return or define the upper bound on a variable @@ -901,7 +901,7 @@ cdef class CVXPYBackend: else: return self.col_upper_bound[index] - cpdef variable_lower_bound(self, int index, value = False) noexcept: + cpdef variable_lower_bound(self, int index, value=False): """ Return or define the lower bound on a variable diff --git a/src/sage/numerical/backends/generic_backend.pxd b/src/sage/numerical/backends/generic_backend.pxd index 60983afc6f2..f2d315d249c 100644 --- a/src/sage/numerical/backends/generic_backend.pxd +++ b/src/sage/numerical/backends/generic_backend.pxd @@ -12,44 +12,44 @@ from sage.structure.sage_object cimport SageObject cdef class GenericBackend (SageObject): cpdef int add_variable(self, lower_bound=*, upper_bound=*, binary=*, continuous=*, integer=*, obj=*, name=*) except -1 cpdef int add_variables(self, int, lower_bound=*, upper_bound=*, binary=*, continuous=*, integer=*, obj=*, names=*) except -1 - cpdef set_variable_type(self, int variable, int vtype) noexcept - cpdef set_sense(self, int sense) noexcept - cpdef objective_coefficient(self, int variable, coeff=*) noexcept - cpdef objective_constant_term(self, d=*) noexcept - cpdef set_objective(self, list coeff, d=*) noexcept - cpdef set_verbosity(self, int level) noexcept - cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=*) noexcept - cpdef add_linear_constraint_vector(self, degree, coefficients, lower_bound, upper_bound, name=*) noexcept - cpdef remove_constraint(self, int) noexcept - cpdef remove_constraints(self, constraints) noexcept - cpdef add_col(self, indices, coeffs) noexcept - cpdef add_linear_constraints(self, int number, lower_bound, upper_bound, names=*) noexcept + cpdef set_variable_type(self, int variable, int vtype) + cpdef set_sense(self, int sense) + cpdef objective_coefficient(self, int variable, coeff=*) + cpdef objective_constant_term(self, d=*) + cpdef set_objective(self, list coeff, d=*) + cpdef set_verbosity(self, int level) + cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=*) + cpdef add_linear_constraint_vector(self, degree, coefficients, lower_bound, upper_bound, name=*) + cpdef remove_constraint(self, int) + cpdef remove_constraints(self, constraints) + cpdef add_col(self, indices, coeffs) + cpdef add_linear_constraints(self, int number, lower_bound, upper_bound, names=*) cpdef int solve(self) except -1 - cpdef get_objective_value(self) noexcept - cpdef best_known_objective_bound(self) noexcept - cpdef get_relative_objective_gap(self) noexcept - cpdef get_variable_value(self, int variable) noexcept + cpdef get_objective_value(self) + cpdef best_known_objective_bound(self) + cpdef get_relative_objective_gap(self) + cpdef get_variable_value(self, int variable) cpdef bint is_maximization(self) noexcept - cpdef write_lp(self, name) noexcept - cpdef write_mps(self, name, int modern) noexcept - cpdef row(self, int i) noexcept + cpdef write_lp(self, name) + cpdef write_mps(self, name, int modern) + cpdef row(self, int i) cpdef int ncols(self) noexcept cpdef int nrows(self) noexcept cpdef bint is_variable_binary(self, int) noexcept cpdef bint is_variable_integer(self, int) noexcept cpdef bint is_variable_continuous(self, int) noexcept - cpdef problem_name(self, name = *) noexcept - cpdef row_bounds(self, int index) noexcept - cpdef col_bounds(self, int index) noexcept - cpdef row_name(self, int index) noexcept - cpdef col_name(self, int index) noexcept - cpdef variable_upper_bound(self, int index, value = *) noexcept - cpdef variable_lower_bound(self, int index, value = *) noexcept - cpdef solver_parameter(self, name, value=*) noexcept - cpdef zero(self) noexcept - cpdef base_ring(self) noexcept - cpdef __copy__(self) noexcept - cpdef copy(self) noexcept + cpdef problem_name(self, name=*) + cpdef row_bounds(self, int index) + cpdef col_bounds(self, int index) + cpdef row_name(self, int index) + cpdef col_name(self, int index) + cpdef variable_upper_bound(self, int index, value=*) + cpdef variable_lower_bound(self, int index, value=*) + cpdef solver_parameter(self, name, value=*) + cpdef zero(self) + cpdef base_ring(self) + cpdef __copy__(self) + cpdef copy(self) cpdef bint is_variable_basic(self, int index) noexcept cpdef bint is_variable_nonbasic_at_lower_bound(self, int index) noexcept cpdef bint is_slack_variable_basic(self, int index) noexcept @@ -57,4 +57,4 @@ cdef class GenericBackend (SageObject): cdef object obj_constant_term -cpdef GenericBackend get_solver(constraint_generation = ?, solver = ?, base_ring = ?) noexcept +cpdef GenericBackend get_solver(constraint_generation=?, solver=?, base_ring=?) diff --git a/src/sage/numerical/backends/generic_backend.pyx b/src/sage/numerical/backends/generic_backend.pyx index b5db4b4aa9d..00909eb25a8 100644 --- a/src/sage/numerical/backends/generic_backend.pyx +++ b/src/sage/numerical/backends/generic_backend.pyx @@ -33,11 +33,11 @@ from copy import copy cdef class GenericBackend: - cpdef base_ring(self) noexcept: + cpdef base_ring(self): from sage.rings.real_double import RDF return RDF - cpdef zero(self) noexcept: + cpdef zero(self): return self.base_ring()(0) cpdef int add_variable(self, lower_bound=0, upper_bound=None, @@ -210,7 +210,7 @@ cdef class GenericBackend: tester.assertEqual(p.col_name(ncols_before), 'a') tester.assertAlmostEqual(p.objective_coefficient(ncols_before), 42.0) - cpdef set_variable_type(self, int variable, int vtype) noexcept: + cpdef set_variable_type(self, int variable, int vtype): """ Set the type of a variable @@ -239,7 +239,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef set_sense(self, int sense) noexcept: + cpdef set_sense(self, int sense): """ Set the direction (maximization/minimization). @@ -285,7 +285,7 @@ cdef class GenericBackend: tester.assertIsNone(p.set_sense(1)) tester.assertEqual(p.is_maximization(), True) - cpdef objective_coefficient(self, int variable, coeff=None) noexcept: + cpdef objective_coefficient(self, int variable, coeff=None): """ Set or get the coefficient of a variable in the objective function @@ -311,7 +311,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef objective_constant_term(self, d=None) noexcept: + cpdef objective_constant_term(self, d=None): """ Set or get the constant term in the objective function @@ -335,7 +335,7 @@ cdef class GenericBackend: else: self.obj_constant_term = d - cpdef set_objective(self, list coeff, d = 0.0) noexcept: + cpdef set_objective(self, list coeff, d=0.0): """ Set the objective function. @@ -371,7 +371,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef set_verbosity(self, int level) noexcept: + cpdef set_verbosity(self, int level): """ Set the log (verbosity) level @@ -387,7 +387,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef remove_constraint(self, int i) noexcept: + cpdef remove_constraint(self, int i): r""" Remove a constraint. @@ -415,7 +415,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef remove_constraints(self, constraints) noexcept: + cpdef remove_constraints(self, constraints): r""" Remove several constraints. @@ -445,7 +445,7 @@ cdef class GenericBackend: self.remove_constraint(c) last = c - cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None) noexcept: + cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None): """ Add a linear constraint. @@ -481,7 +481,7 @@ cdef class GenericBackend: """ raise NotImplementedError('add_linear_constraint') - cpdef add_linear_constraint_vector(self, degree, coefficients, lower_bound, upper_bound, name=None) noexcept: + cpdef add_linear_constraint_vector(self, degree, coefficients, lower_bound, upper_bound, name=None): """ Add a vector-valued linear constraint. @@ -561,7 +561,7 @@ cdef class GenericBackend: p.add_linear_constraint_vector(2, coeffs, lower, upper, 'foo') # FIXME: Tests here. Careful what we expect regarding ranged constraints with some solvers. - cpdef add_col(self, indices, coeffs) noexcept: + cpdef add_col(self, indices, coeffs): """ Add a column. @@ -622,7 +622,7 @@ cdef class GenericBackend: for 1 <= i <= 4: tester.assertEqual(p.row(i), ([0], [i])) - cpdef add_linear_constraints(self, int number, lower_bound, upper_bound, names=None) noexcept: + cpdef add_linear_constraints(self, int number, lower_bound, upper_bound, names=None): """ Add ``'number`` linear constraints. @@ -747,7 +747,7 @@ cdef class GenericBackend: with tester.assertRaises(MIPSolverException) as cm: # unbounded p.solve() - cpdef get_objective_value(self) noexcept: + cpdef get_objective_value(self): """ Return the value of the objective function. @@ -776,7 +776,7 @@ cdef class GenericBackend: raise NotImplementedError() - cpdef best_known_objective_bound(self) noexcept: + cpdef best_known_objective_bound(self): r""" Return the value of the currently best known bound. @@ -810,7 +810,7 @@ cdef class GenericBackend: raise NotImplementedError() - cpdef get_relative_objective_gap(self) noexcept: + cpdef get_relative_objective_gap(self): r""" Return the relative objective gap of the best known solution. @@ -846,7 +846,7 @@ cdef class GenericBackend: raise NotImplementedError() - cpdef get_variable_value(self, int variable) noexcept: + cpdef get_variable_value(self, int variable): """ Return the value of a variable given by the solver. @@ -937,7 +937,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef problem_name(self, name=None) noexcept: + cpdef problem_name(self, name=None): """ Return or define the problem's name @@ -957,7 +957,7 @@ cdef class GenericBackend: raise NotImplementedError() - cpdef write_lp(self, name) noexcept: + cpdef write_lp(self, name): """ Write the problem to a ``.lp`` file @@ -980,7 +980,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef write_mps(self, name, int modern) noexcept: + cpdef write_mps(self, name, int modern): """ Write the problem to a ``.mps`` file @@ -1004,7 +1004,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef copy(self) noexcept: + cpdef copy(self): """ Returns a copy of self. @@ -1022,7 +1022,7 @@ cdef class GenericBackend: return self.__copy__() # Override this method in backends. - cpdef __copy__(self) noexcept: + cpdef __copy__(self): """ Returns a copy of self. @@ -1062,7 +1062,7 @@ cdef class GenericBackend: """ return self.__copy__() - cpdef row(self, int i) noexcept: + cpdef row(self, int i): """ Return a row @@ -1092,7 +1092,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef row_bounds(self, int index) noexcept: + cpdef row_bounds(self, int index): """ Return the bounds of a specific constraint. @@ -1121,7 +1121,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef col_bounds(self, int index) noexcept: + cpdef col_bounds(self, int index): """ Return the bounds of a specific variable. @@ -1223,7 +1223,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef row_name(self, int index) noexcept: + cpdef row_name(self, int index): """ Return the ``index`` th row name @@ -1243,7 +1243,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef col_name(self, int index) noexcept: + cpdef col_name(self, int index): """ Return the ``index``-th column name @@ -1347,7 +1347,7 @@ cdef class GenericBackend: p._test_copy(**options) p._test_copy_does_not_share_data(**options) - cpdef variable_upper_bound(self, int index, value = False) noexcept: + cpdef variable_upper_bound(self, int index, value=False): """ Return or define the upper bound on a variable @@ -1374,7 +1374,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef variable_lower_bound(self, int index, value = False) noexcept: + cpdef variable_lower_bound(self, int index, value=False): """ Return or define the lower bound on a variable @@ -1401,7 +1401,7 @@ cdef class GenericBackend: """ raise NotImplementedError() - cpdef solver_parameter(self, name, value = None) noexcept: + cpdef solver_parameter(self, name, value=None): """ Return or define a solver parameter @@ -1723,7 +1723,7 @@ def default_mip_solver(solver=None): raise ValueError("'solver' should be set to 'GLPK', 'Coin', 'CPLEX', 'CVXOPT', 'CVXPY', 'Gurobi', 'PPL', 'SCIP', 'InteractiveLP', a callable, or None.") -cpdef GenericBackend get_solver(constraint_generation=False, solver=None, base_ring=None) noexcept: +cpdef GenericBackend get_solver(constraint_generation=False, solver=None, base_ring=None): """ Return a solver according to the given preferences diff --git a/src/sage/numerical/backends/generic_sdp_backend.pxd b/src/sage/numerical/backends/generic_sdp_backend.pxd index 446b9ce8c25..023f95653d6 100644 --- a/src/sage/numerical/backends/generic_sdp_backend.pxd +++ b/src/sage/numerical/backends/generic_sdp_backend.pxd @@ -10,28 +10,28 @@ cdef class GenericSDPBackend: cpdef int add_variable(self, obj=*, name=*) except -1 cpdef int add_variables(self, int, names=*) except -1 - cpdef set_sense(self, int sense) noexcept - cpdef objective_coefficient(self, int variable, coeff=*) noexcept - cpdef set_objective(self, list coeff, d=*) noexcept - cpdef add_linear_constraint(self, constraints, name=*) noexcept - cpdef add_linear_constraints(self, int number, names=*) noexcept + cpdef set_sense(self, int sense) + cpdef objective_coefficient(self, int variable, coeff=*) + cpdef set_objective(self, list coeff, d=*) + cpdef add_linear_constraint(self, constraints, name=*) + cpdef add_linear_constraints(self, int number, names=*) cpdef int solve(self) except -1 - cpdef get_objective_value(self) noexcept - cpdef get_variable_value(self, int variable) noexcept - cpdef dual_variable(self, int variable, sparse=*) noexcept - cpdef slack(self, int variable, sparse=*) noexcept + cpdef get_objective_value(self) + cpdef get_variable_value(self, int variable) + cpdef dual_variable(self, int variable, sparse=*) + cpdef slack(self, int variable, sparse=*) cpdef bint is_maximization(self) noexcept - cpdef row(self, int i) noexcept + cpdef row(self, int i) cpdef int ncols(self) noexcept cpdef int nrows(self) noexcept - cpdef problem_name(self, name=*) noexcept - cpdef row_name(self, int index) noexcept - cpdef col_name(self, int index) noexcept - cpdef solver_parameter(self, name, value=*) noexcept - cpdef zero(self) noexcept - cpdef base_ring(self) noexcept + cpdef problem_name(self, name=*) + cpdef row_name(self, int index) + cpdef col_name(self, int index) + cpdef solver_parameter(self, name, value=*) + cpdef zero(self) + cpdef base_ring(self) cdef obj_constant_term cdef dict matrices_dim -cpdef GenericSDPBackend get_solver(solver=?, base_ring=?) noexcept +cpdef GenericSDPBackend get_solver(solver=?, base_ring=?) diff --git a/src/sage/numerical/backends/generic_sdp_backend.pyx b/src/sage/numerical/backends/generic_sdp_backend.pyx index 45bfde5f89b..66876c68119 100644 --- a/src/sage/numerical/backends/generic_sdp_backend.pyx +++ b/src/sage/numerical/backends/generic_sdp_backend.pyx @@ -29,7 +29,7 @@ AUTHORS: cdef class GenericSDPBackend: - cpdef base_ring(self) noexcept: + cpdef base_ring(self): """ The base ring @@ -42,7 +42,7 @@ cdef class GenericSDPBackend: from sage.rings.real_double import RDF return RDF - cpdef zero(self) noexcept: + cpdef zero(self): """ Zero of the base ring @@ -122,7 +122,7 @@ cdef class GenericSDPBackend: """ raise NotImplementedError() - cpdef set_sense(self, int sense) noexcept: + cpdef set_sense(self, int sense): """ Set the direction (maximization/minimization). @@ -146,7 +146,7 @@ cdef class GenericSDPBackend: """ raise NotImplementedError() - cpdef objective_coefficient(self, int variable, coeff=None) noexcept: + cpdef objective_coefficient(self, int variable, coeff=None): """ Set or get the coefficient of a variable in the objective function @@ -172,7 +172,7 @@ cdef class GenericSDPBackend: """ raise NotImplementedError() - cpdef set_objective(self, list coeff, d=0.0) noexcept: + cpdef set_objective(self, list coeff, d=0.0): """ Set the objective function. @@ -199,7 +199,7 @@ cdef class GenericSDPBackend: raise NotImplementedError() - cpdef add_linear_constraint(self, coefficients, name=None) noexcept: + cpdef add_linear_constraint(self, coefficients, name=None): """ Add a linear constraint. @@ -234,7 +234,7 @@ cdef class GenericSDPBackend: raise NotImplementedError() - cpdef add_linear_constraints(self, int number, names=None) noexcept: + cpdef add_linear_constraints(self, int number, names=None): """ Add constraints. @@ -290,7 +290,7 @@ cdef class GenericSDPBackend: """ raise NotImplementedError() - cpdef get_objective_value(self) noexcept: + cpdef get_objective_value(self): """ Return the value of the objective function. @@ -318,7 +318,7 @@ cdef class GenericSDPBackend: """ raise NotImplementedError() - cpdef get_variable_value(self, int variable) noexcept: + cpdef get_variable_value(self, int variable): """ Return the value of a variable given by the solver. @@ -400,7 +400,7 @@ cdef class GenericSDPBackend: """ raise NotImplementedError() - cpdef problem_name(self, name=None) noexcept: + cpdef problem_name(self, name=None): """ Return or define the problem's name @@ -421,7 +421,7 @@ cdef class GenericSDPBackend: raise NotImplementedError() - cpdef row(self, int i) noexcept: + cpdef row(self, int i): """ Return a row @@ -451,7 +451,7 @@ cdef class GenericSDPBackend: """ raise NotImplementedError() - cpdef row_name(self, int index) noexcept: + cpdef row_name(self, int index): """ Return the ``index`` th row name @@ -471,7 +471,7 @@ cdef class GenericSDPBackend: """ raise NotImplementedError() - cpdef col_name(self, int index) noexcept: + cpdef col_name(self, int index): """ Return the ``index`` th col name @@ -494,7 +494,7 @@ cdef class GenericSDPBackend: """ raise NotImplementedError() - cpdef dual_variable(self, int i, sparse=False) noexcept: + cpdef dual_variable(self, int i, sparse=False): """ The `i`-th dual variable @@ -541,7 +541,7 @@ cdef class GenericSDPBackend: """ raise NotImplementedError() - cpdef slack(self, int i, sparse=False) noexcept: + cpdef slack(self, int i, sparse=False): """ Slack of the `i`-th constraint @@ -590,7 +590,7 @@ cdef class GenericSDPBackend: """ raise NotImplementedError() - cpdef solver_parameter(self, name, value = None) noexcept: + cpdef solver_parameter(self, name, value=None): """ Return or define a solver parameter @@ -702,7 +702,7 @@ def default_sdp_solver(solver=None): raise ValueError("'solver' should be set to 'CVXOPT', 'Matrix', a class, or None.") -cpdef GenericSDPBackend get_solver(solver=None, base_ring=None) noexcept: +cpdef GenericSDPBackend get_solver(solver=None, base_ring=None): """ Return a solver according to the given preferences. diff --git a/src/sage/numerical/backends/glpk_backend.pxd b/src/sage/numerical/backends/glpk_backend.pxd index 4ff1d4a8d76..5ff4a90a211 100644 --- a/src/sage/numerical/backends/glpk_backend.pxd +++ b/src/sage/numerical/backends/glpk_backend.pxd @@ -26,15 +26,15 @@ cdef class GLPKBackend(GenericBackend): cdef glp_smcp * smcp cdef int simplex_or_intopt cdef search_tree_data_t search_tree_data - cpdef __copy__(self) noexcept - cpdef int print_ranges(self, filename = *) except -1 + cpdef __copy__(self) + cpdef int print_ranges(self, filename=*) except -1 cpdef double get_row_dual(self, int variable) noexcept cpdef double get_col_dual(self, int variable) except? -1 cpdef int get_row_stat(self, int variable) except? -1 cpdef int get_col_stat(self, int variable) except? -1 - cpdef eval_tab_row(self, int k) noexcept - cpdef eval_tab_col(self, int k) noexcept - cpdef get_row_prim(self, int i) noexcept - cpdef set_row_stat(self, int i, int stat) noexcept - cpdef set_col_stat(self, int j, int stat) noexcept + cpdef eval_tab_row(self, int k) + cpdef eval_tab_col(self, int k) + cpdef get_row_prim(self, int i) + cpdef set_row_stat(self, int i, int stat) + cpdef set_col_stat(self, int j, int stat) cpdef int warm_up(self) noexcept diff --git a/src/sage/numerical/backends/glpk_backend.pyx b/src/sage/numerical/backends/glpk_backend.pyx index b24efb521ea..10ab452e1fa 100644 --- a/src/sage/numerical/backends/glpk_backend.pyx +++ b/src/sage/numerical/backends/glpk_backend.pyx @@ -228,7 +228,7 @@ cdef class GLPKBackend(GenericBackend): return n_var - 1 - cpdef set_variable_type(self, int variable, int vtype) noexcept: + cpdef set_variable_type(self, int variable, int vtype): """ Set the type of a variable @@ -278,7 +278,7 @@ cdef class GLPKBackend(GenericBackend): else: glp_set_col_kind(self.lp, variable+1, GLP_CV) - cpdef set_sense(self, int sense) noexcept: + cpdef set_sense(self, int sense): """ Set the direction (maximization/minimization). @@ -304,7 +304,7 @@ cdef class GLPKBackend(GenericBackend): else: glp_set_obj_dir(self.lp, GLP_MIN) - cpdef objective_coefficient(self, int variable, coeff=None) noexcept: + cpdef objective_coefficient(self, int variable, coeff=None): """ Set or get the coefficient of a variable in the objective function @@ -347,7 +347,7 @@ cdef class GLPKBackend(GenericBackend): else: glp_set_obj_coef(self.lp, variable + 1, coeff) - cpdef problem_name(self, name=None) noexcept: + cpdef problem_name(self, name=None): """ Return or define the problem's name @@ -379,7 +379,7 @@ cdef class GLPKBackend(GenericBackend): raise ValueError("Problem name for GLPK must not be longer than 255 characters.") glp_set_prob_name(self.lp, name) - cpdef set_objective(self, list coeff, d = 0.0) noexcept: + cpdef set_objective(self, list coeff, d=0.0): """ Set the objective function. @@ -409,7 +409,7 @@ cdef class GLPKBackend(GenericBackend): self.obj_constant_term = d - cpdef set_verbosity(self, int level) noexcept: + cpdef set_verbosity(self, int level): """ Set the verbosity level @@ -471,7 +471,7 @@ cdef class GLPKBackend(GenericBackend): self.iocp.msg_lev = GLP_MSG_ALL self.smcp.msg_lev = GLP_MSG_ALL - cpdef remove_constraint(self, int i) noexcept: + cpdef remove_constraint(self, int i): r""" Remove a constraint from self. @@ -510,7 +510,7 @@ cdef class GLPKBackend(GenericBackend): glp_del_rows(self.lp, 1, rows) glp_std_basis(self.lp) - cpdef remove_constraints(self, constraints) noexcept: + cpdef remove_constraints(self, constraints): r""" Remove several constraints. @@ -562,7 +562,7 @@ cdef class GLPKBackend(GenericBackend): sig_free(rows) glp_std_basis(self.lp) - cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None) noexcept: + cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None): """ Add a linear constraint. @@ -649,7 +649,7 @@ cdef class GLPKBackend(GenericBackend): if name is not None: glp_set_row_name(self.lp, n, str_to_bytes(name)) - cpdef add_linear_constraints(self, int number, lower_bound, upper_bound, names=None) noexcept: + cpdef add_linear_constraints(self, int number, lower_bound, upper_bound, names=None): """ Add ``'number`` linear constraints. @@ -697,7 +697,7 @@ cdef class GLPKBackend(GenericBackend): glp_set_row_name(self.lp, n-i, str_to_bytes(names[number-i-1])) - cpdef row(self, int index) noexcept: + cpdef row(self, int index): r""" Return a row @@ -754,7 +754,7 @@ cdef class GLPKBackend(GenericBackend): return (indices, values) - cpdef row_bounds(self, int index) noexcept: + cpdef row_bounds(self, int index): """ Return the bounds of a specific constraint. @@ -806,7 +806,7 @@ cdef class GLPKBackend(GenericBackend): (ub if ub != +DBL_MAX else None) ) - cpdef col_bounds(self, int index) noexcept: + cpdef col_bounds(self, int index): """ Return the bounds of a specific variable. @@ -859,7 +859,7 @@ cdef class GLPKBackend(GenericBackend): (ub if ub != +DBL_MAX else None) ) - cpdef add_col(self, indices, coeffs) noexcept: + cpdef add_col(self, indices, coeffs): """ Add a column. @@ -1151,7 +1151,7 @@ cdef class GLPKBackend(GenericBackend): raise MIPSolverException("GLPK: "+solution_status_msg.get(solution_status, "unknown error during call to GLPK : "+str(solution_status))) return 0 - cpdef get_objective_value(self) noexcept: + cpdef get_objective_value(self): """ Returns the value of the objective function. @@ -1182,7 +1182,7 @@ cdef class GLPKBackend(GenericBackend): else: return glp_get_obj_val(self.lp) - cpdef best_known_objective_bound(self) noexcept: + cpdef best_known_objective_bound(self): r""" Return the value of the currently best known bound. @@ -1216,7 +1216,7 @@ cdef class GLPKBackend(GenericBackend): """ return self.search_tree_data.best_bound - cpdef get_relative_objective_gap(self) noexcept: + cpdef get_relative_objective_gap(self): r""" Return the relative objective gap of the best known solution. @@ -1259,7 +1259,7 @@ cdef class GLPKBackend(GenericBackend): """ return self.search_tree_data.mip_gap - cpdef get_variable_value(self, int variable) noexcept: + cpdef get_variable_value(self, int variable): """ Returns the value of a variable given by the solver. @@ -1305,7 +1305,7 @@ cdef class GLPKBackend(GenericBackend): else: return glp_get_col_prim(self.lp, variable + 1) - cpdef get_row_prim(self, int i) noexcept: + cpdef get_row_prim(self, int i): r""" Returns the value of the auxiliary variable associated with i-th row. @@ -1387,7 +1387,7 @@ cdef class GLPKBackend(GenericBackend): return glp_get_num_rows(self.lp) - cpdef col_name(self, int index) noexcept: + cpdef col_name(self, int index): """ Return the ``index`` th col name @@ -1429,7 +1429,7 @@ cdef class GLPKBackend(GenericBackend): else: return "" - cpdef row_name(self, int index) noexcept: + cpdef row_name(self, int index): """ Return the ``index`` th row name @@ -1600,7 +1600,7 @@ cdef class GLPKBackend(GenericBackend): return glp_get_obj_dir(self.lp) == GLP_MAX - cpdef variable_upper_bound(self, int index, value = False) noexcept: + cpdef variable_upper_bound(self, int index, value=False): """ Return or define the upper bound on a variable @@ -1699,7 +1699,7 @@ cdef class GLPKBackend(GenericBackend): glp_set_col_bnds(self.lp, index + 1, GLP_DB, min, dvalue) sig_off() - cpdef variable_lower_bound(self, int index, value = False) noexcept: + cpdef variable_lower_bound(self, int index, value=False): """ Return or define the lower bound on a variable @@ -1799,7 +1799,7 @@ cdef class GLPKBackend(GenericBackend): glp_set_col_bnds(self.lp, index + 1, GLP_DB, value, max) sig_off() - cpdef write_lp(self, filename) noexcept: + cpdef write_lp(self, filename): """ Write the problem to a .lp file @@ -1826,7 +1826,7 @@ cdef class GLPKBackend(GenericBackend): filename = str_to_bytes(filename, FS_ENCODING, 'surrogateescape') glp_write_lp(self.lp, NULL, filename) - cpdef write_mps(self, filename, int modern) noexcept: + cpdef write_mps(self, filename, int modern): """ Write the problem to a .mps file @@ -1853,7 +1853,7 @@ cdef class GLPKBackend(GenericBackend): filename = str_to_bytes(filename, FS_ENCODING, 'surrogateescape') glp_write_mps(self.lp, modern, NULL, filename) - cpdef __copy__(self) noexcept: + cpdef __copy__(self): """ Returns a copy of self. @@ -1874,7 +1874,7 @@ cdef class GLPKBackend(GenericBackend): return p - cpdef solver_parameter(self, name, value = None) noexcept: + cpdef solver_parameter(self, name, value=None): """ Return or define a solver parameter @@ -2725,7 +2725,7 @@ cdef class GLPKBackend(GenericBackend): return glp_get_col_stat(self.lp, j+1) - cpdef set_row_stat(self, int i, int stat) noexcept: + cpdef set_row_stat(self, int i, int stat): r""" Set the status of a constraint. @@ -2760,7 +2760,7 @@ cdef class GLPKBackend(GenericBackend): glp_set_row_stat(self.lp, i+1, stat) - cpdef set_col_stat(self, int j, int stat) noexcept: + cpdef set_col_stat(self, int j, int stat): r""" Set the status of a variable. @@ -2831,7 +2831,7 @@ cdef class GLPKBackend(GenericBackend): """ return glp_warm_up(self.lp) - cpdef eval_tab_row(self, int k) noexcept: + cpdef eval_tab_row(self, int k): r""" Computes a row of the current simplex tableau. @@ -2930,7 +2930,7 @@ cdef class GLPKBackend(GenericBackend): values = [c_values[j+1] for j in range(i)] return (indices, values) - cpdef eval_tab_col(self, int k) noexcept: + cpdef eval_tab_col(self, int k): r""" Computes a column of the current simplex tableau. diff --git a/src/sage/numerical/backends/glpk_exact_backend.pxd b/src/sage/numerical/backends/glpk_exact_backend.pxd index 89326bf3604..8207347ce51 100644 --- a/src/sage/numerical/backends/glpk_exact_backend.pxd +++ b/src/sage/numerical/backends/glpk_exact_backend.pxd @@ -13,4 +13,4 @@ from sage.numerical.backends.glpk_backend cimport GLPKBackend cdef class GLPKExactBackend(GLPKBackend): cpdef int add_variable(self, lower_bound=*, upper_bound=*, binary=*, continuous=*, integer=*, obj=*, name=*) except -1 cpdef int add_variables(self, int, lower_bound=*, upper_bound=*, binary=*, continuous=*, integer=*, obj=*, names=*) except -1 - cpdef set_variable_type(self, int variable, int vtype) noexcept + cpdef set_variable_type(self, int variable, int vtype) diff --git a/src/sage/numerical/backends/glpk_exact_backend.pyx b/src/sage/numerical/backends/glpk_exact_backend.pyx index 3508942f5e4..3031748eb42 100644 --- a/src/sage/numerical/backends/glpk_exact_backend.pyx +++ b/src/sage/numerical/backends/glpk_exact_backend.pyx @@ -156,7 +156,7 @@ cdef class GLPKExactBackend(GLPKBackend): return GLPKBackend.add_variables(self, number, lower_bound, upper_bound, binary, continuous, integer, obj, names) - cpdef set_variable_type(self, int variable, int vtype) noexcept: + cpdef set_variable_type(self, int variable, int vtype): """ Set the type of a variable. diff --git a/src/sage/numerical/backends/glpk_graph_backend.pxd b/src/sage/numerical/backends/glpk_graph_backend.pxd index 926c60134dc..2e4b29a25a9 100644 --- a/src/sage/numerical/backends/glpk_graph_backend.pxd +++ b/src/sage/numerical/backends/glpk_graph_backend.pxd @@ -27,22 +27,22 @@ ctypedef struct c_a_data: cdef class GLPKGraphBackend(): cdef glp_graph * graph - cpdef add_vertex(self, name = ?) noexcept - cpdef list add_vertices(self, vertices) noexcept - cpdef __add_vertices_sage(self, g) noexcept - cpdef dict get_vertex(self, vertex) noexcept - cpdef dict get_vertices(self, verts) noexcept - cpdef set_vertex_demand(self, vertex, param) noexcept - cpdef set_vertices_demand(self, list pairs) noexcept - cpdef list vertices(self) noexcept - cpdef add_edge(self, u, v, dict params = ?) noexcept - cpdef __add_edges_sage(self, g) noexcept - cpdef list add_edges(self, edges) noexcept - cpdef delete_edge(self, u, v, dict params = ?) noexcept - cpdef tuple get_edge(self, u, v) noexcept - cpdef list edges(self) noexcept - cpdef delete_vertex(self, vert) noexcept - cpdef delete_vertices(self, list verts) noexcept + cpdef add_vertex(self, name=?) + cpdef list add_vertices(self, vertices) + cpdef __add_vertices_sage(self, g) + cpdef dict get_vertex(self, vertex) + cpdef dict get_vertices(self, verts) + cpdef set_vertex_demand(self, vertex, param) + cpdef set_vertices_demand(self, list pairs) + cpdef list vertices(self) + cpdef add_edge(self, u, v, dict params=?) + cpdef __add_edges_sage(self, g) + cpdef list add_edges(self, edges) + cpdef delete_edge(self, u, v, dict params=?) + cpdef tuple get_edge(self, u, v) + cpdef list edges(self) + cpdef delete_vertex(self, vert) + cpdef delete_vertices(self, list verts) cpdef int _find_vertex(self, vert) noexcept cpdef int write_graph(self, fname) noexcept cpdef int write_ccdata(self, fname) noexcept diff --git a/src/sage/numerical/backends/glpk_graph_backend.pyx b/src/sage/numerical/backends/glpk_graph_backend.pyx index 90431f8a481..63bc2a76305 100644 --- a/src/sage/numerical/backends/glpk_graph_backend.pyx +++ b/src/sage/numerical/backends/glpk_graph_backend.pyx @@ -231,7 +231,7 @@ cdef class GLPKGraphBackend(): else: ValueError("Input data is not supported") - cpdef add_vertex(self, name=None) noexcept: + cpdef add_vertex(self, name=None): """ Adds an isolated vertex to the graph. @@ -285,7 +285,7 @@ cdef class GLPKGraphBackend(): glp_set_vertex_name(self.graph, vn, str_to_bytes(s)) return s - cpdef __add_vertices_sage(self, g) noexcept: + cpdef __add_vertices_sage(self, g): """ Adds vertices to the GLPK Graph. @@ -327,7 +327,7 @@ cdef class GLPKGraphBackend(): glp_create_v_index(self.graph) - cpdef list add_vertices(self, vertices) noexcept: + cpdef list add_vertices(self, vertices): """ Adds vertices from an iterable container of vertices. @@ -379,7 +379,7 @@ cdef class GLPKGraphBackend(): else: return None - cpdef set_vertex_demand(self, vertex, demand) noexcept: + cpdef set_vertex_demand(self, vertex, demand): """ Sets the demand of the vertex in a mincost flow algorithm. @@ -416,7 +416,7 @@ cdef class GLPKGraphBackend(): cdef double val = demand (vert.data).rhs = val - cpdef set_vertices_demand(self, list pairs) noexcept: + cpdef set_vertices_demand(self, list pairs): """ Sets the parameters of selected vertices. @@ -444,7 +444,7 @@ cdef class GLPKGraphBackend(): except KeyError: pass - cpdef dict get_vertex(self, vertex) noexcept: + cpdef dict get_vertex(self, vertex): """ Returns a specific vertex as a ``dict`` Object. @@ -491,7 +491,7 @@ cdef class GLPKGraphBackend(): "ls" : vdata.ls } - cpdef dict get_vertices(self, verts) noexcept: + cpdef dict get_vertices(self, verts): """ Returns a dictionary of the dictionaries associated to each vertex. @@ -520,7 +520,7 @@ cdef class GLPKGraphBackend(): vl = [(v, self.get_vertex(v)) for v in verts] return dict([(v, p) for v, p in vl if p is not None]) - cpdef list vertices(self) noexcept: + cpdef list vertices(self): """ Returns the list of all vertices @@ -552,7 +552,7 @@ cdef class GLPKGraphBackend(): if self.graph.v[i+1].name is not NULL else None for i in range(self.graph.nv)] - cpdef add_edge(self, u, v, dict params=None) noexcept: + cpdef add_edge(self, u, v, dict params=None): """ Adds an edge between vertices ``u`` and ``v``. @@ -616,7 +616,7 @@ cdef class GLPKGraphBackend(): glp_del_arc(self.graph, a) raise TypeError("Invalid edge parameter.") - cpdef list add_edges(self, edges) noexcept: + cpdef list add_edges(self, edges): """ Adds edges to the graph. @@ -654,7 +654,7 @@ cdef class GLPKGraphBackend(): for ed in edges: self.add_edge(*ed) - cpdef __add_edges_sage(self, g) noexcept: + cpdef __add_edges_sage(self, g): """ Adds edges to the Graph. @@ -709,7 +709,7 @@ cdef class GLPKGraphBackend(): if "low" in label: (a.data).low = low - cpdef tuple get_edge(self, u, v) noexcept: + cpdef tuple get_edge(self, u, v): """ Returns an edge connecting two vertices. @@ -765,7 +765,7 @@ cdef class GLPKGraphBackend(): return None - cpdef list edges(self) noexcept: + cpdef list edges(self): """ Returns a ``list`` of all edges in the graph @@ -814,7 +814,7 @@ cdef class GLPKGraphBackend(): i += 1 return edge_list - cpdef delete_vertex(self, vert) noexcept: + cpdef delete_vertex(self, vert): r""" Removes a vertex from the graph. @@ -850,7 +850,7 @@ cdef class GLPKGraphBackend(): glp_del_vertices(self.graph, ndel, num) - cpdef delete_vertices(self, list verts) noexcept: + cpdef delete_vertices(self, list verts): r""" Removes vertices from the graph. @@ -894,7 +894,7 @@ cdef class GLPKGraphBackend(): sig_free(num) - cpdef delete_edge(self, u, v, dict params=None) noexcept: + cpdef delete_edge(self, u, v, dict params=None): """ Deletes an edge from the graph. diff --git a/src/sage/numerical/backends/interactivelp_backend.pxd b/src/sage/numerical/backends/interactivelp_backend.pxd index f29187632fc..07e63a7bb44 100644 --- a/src/sage/numerical/backends/interactivelp_backend.pxd +++ b/src/sage/numerical/backends/interactivelp_backend.pxd @@ -30,6 +30,6 @@ cdef class InteractiveLPBackend(GenericBackend): coefficients=*) \ except -1 - cpdef dictionary(self) noexcept + cpdef dictionary(self) - cpdef interactive_lp_problem(self) noexcept + cpdef interactive_lp_problem(self) diff --git a/src/sage/numerical/backends/interactivelp_backend.pyx b/src/sage/numerical/backends/interactivelp_backend.pyx index 3062a29eb1f..64ef561375a 100644 --- a/src/sage/numerical/backends/interactivelp_backend.pyx +++ b/src/sage/numerical/backends/interactivelp_backend.pyx @@ -82,7 +82,7 @@ cdef class InteractiveLPBackend: self.row_names = [] - cpdef __copy__(self) noexcept: + cpdef __copy__(self): """ Returns a copy of self. @@ -105,7 +105,7 @@ cdef class InteractiveLPBackend: cp.prob_name = self.prob_name return cp - cpdef base_ring(self) noexcept: + cpdef base_ring(self): """ Return the base ring. @@ -253,7 +253,7 @@ cdef class InteractiveLPBackend: problem_type, ring, objective_constant_term=d) return self.ncols() - 1 - cpdef set_variable_type(self, int variable, int vtype) noexcept: + cpdef set_variable_type(self, int variable, int vtype): """ Set the type of a variable. @@ -307,7 +307,7 @@ cdef class InteractiveLPBackend: d = self.lp.objective_constant_term() return A, b, c, x, constraint_types, variable_types, problem_type, base_ring, d - cpdef set_sense(self, int sense) noexcept: + cpdef set_sense(self, int sense): """ Set the direction (maximization/minimization). @@ -337,7 +337,7 @@ cdef class InteractiveLPBackend: constraint_types, variable_types, problem_type, ring, objective_constant_term=d) - cpdef objective_coefficient(self, int variable, coeff=None) noexcept: + cpdef objective_coefficient(self, int variable, coeff=None): """ Set or get the coefficient of a variable in the objective function @@ -370,7 +370,7 @@ cdef class InteractiveLPBackend: constraint_types, variable_types, problem_type, ring, objective_constant_term=d) - cpdef objective_constant_term(self, d=None) noexcept: + cpdef objective_constant_term(self, d=None): """ Set or get the constant term in the objective function @@ -396,7 +396,7 @@ cdef class InteractiveLPBackend: constraint_types, variable_types, problem_type, ring, objective_constant_term=d) - cpdef set_objective(self, list coeff, d = 0) noexcept: + cpdef set_objective(self, list coeff, d=0): """ Set the objective function. @@ -446,7 +446,7 @@ cdef class InteractiveLPBackend: constraint_types, variable_types, problem_type, ring, objective_constant_term=d) - cpdef set_verbosity(self, int level) noexcept: + cpdef set_verbosity(self, int level): """ Set the log (verbosity) level @@ -462,7 +462,7 @@ cdef class InteractiveLPBackend: """ self.verbosity = level - cpdef remove_constraint(self, int i) noexcept: + cpdef remove_constraint(self, int i): r""" Remove a constraint. @@ -496,7 +496,7 @@ cdef class InteractiveLPBackend: constraint_types, variable_types, problem_type, ring, objective_constant_term=d) - cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None) noexcept: + cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None): """ Add a linear constraint. @@ -558,7 +558,7 @@ cdef class InteractiveLPBackend: problem_type, ring, objective_constant_term=d) - cpdef add_col(self, indices, coeffs) noexcept: + cpdef add_col(self, indices, coeffs): """ Add a column. @@ -633,7 +633,7 @@ cdef class InteractiveLPBackend: else: raise MIPSolverException("InteractiveLP: Problem is unbounded") - cpdef get_objective_value(self) noexcept: + cpdef get_objective_value(self): """ Return the value of the objective function. @@ -664,7 +664,7 @@ cdef class InteractiveLPBackend: v = - v return v - cpdef get_variable_value(self, int variable) noexcept: + cpdef get_variable_value(self, int variable): """ Return the value of a variable given by the solver. @@ -741,7 +741,7 @@ cdef class InteractiveLPBackend: """ return self.lp.problem_type() == "max" - cpdef problem_name(self, name=None) noexcept: + cpdef problem_name(self, name=None): """ Return or define the problem's name @@ -766,7 +766,7 @@ cdef class InteractiveLPBackend: else: self.prob_name = str(name) - cpdef row(self, int i) noexcept: + cpdef row(self, int i): """ Return a row @@ -800,7 +800,7 @@ cdef class InteractiveLPBackend: coeffs.append(A[i][j]) return (indices, coeffs) - cpdef row_bounds(self, int index) noexcept: + cpdef row_bounds(self, int index): """ Return the bounds of a specific constraint. @@ -835,7 +835,7 @@ cdef class InteractiveLPBackend: else: raise ValueError("Bad constraint_type") - cpdef col_bounds(self, int index) noexcept: + cpdef col_bounds(self, int index): """ Return the bounds of a specific variable. @@ -936,7 +936,7 @@ cdef class InteractiveLPBackend: """ return True - cpdef row_name(self, int index) noexcept: + cpdef row_name(self, int index): """ Return the ``index`` th row name @@ -955,7 +955,7 @@ cdef class InteractiveLPBackend: """ return self.row_names[index] - cpdef col_name(self, int index) noexcept: + cpdef col_name(self, int index): """ Return the ``index``-th column name @@ -977,7 +977,7 @@ cdef class InteractiveLPBackend: """ return str(self.lp.decision_variables()[index]) - cpdef variable_upper_bound(self, int index, value = False) noexcept: + cpdef variable_upper_bound(self, int index, value=False): """ Return or define the upper bound on a variable @@ -1021,7 +1021,7 @@ cdef class InteractiveLPBackend: constraint_types, variable_types, problem_type, ring, objective_constant_term=d) - cpdef variable_lower_bound(self, int index, value = False) noexcept: + cpdef variable_lower_bound(self, int index, value=False): """ Return or define the lower bound on a variable @@ -1185,7 +1185,7 @@ cdef class InteractiveLPBackend: """ return self.lp_std_form.slack_variables()[index] in self.final_dictionary.nonbasic_variables() - cpdef dictionary(self) noexcept: + cpdef dictionary(self): # Proposed addition to the general interface, # which would for other solvers return backend dictionaries (#18804) """ @@ -1221,7 +1221,7 @@ cdef class InteractiveLPBackend: """ return self.final_dictionary - cpdef interactive_lp_problem(self) noexcept: + cpdef interactive_lp_problem(self): """ Return the :class:`InteractiveLPProblem` object associated with this backend. diff --git a/src/sage/numerical/backends/matrix_sdp_backend.pyx b/src/sage/numerical/backends/matrix_sdp_backend.pyx index 631a7bd6dde..f4e7ecb13f0 100644 --- a/src/sage/numerical/backends/matrix_sdp_backend.pyx +++ b/src/sage/numerical/backends/matrix_sdp_backend.pyx @@ -55,7 +55,7 @@ cdef class MatrixSDPBackend(GenericSDPBackend): base_ring = QQ self._base_ring = base_ring - cpdef base_ring(self) noexcept: + cpdef base_ring(self): """ The base ring @@ -166,7 +166,7 @@ cdef class MatrixSDPBackend(GenericSDPBackend): self.add_variable() return len(self.objective_function) - 1 - cpdef set_sense(self, int sense) noexcept: + cpdef set_sense(self, int sense): """ Set the direction (maximization/minimization). @@ -192,7 +192,7 @@ cdef class MatrixSDPBackend(GenericSDPBackend): else: self.is_maximize = 0 - cpdef objective_coefficient(self, int variable, coeff=None) noexcept: + cpdef objective_coefficient(self, int variable, coeff=None): """ Set or get the coefficient of a variable in the objective function @@ -220,7 +220,7 @@ cdef class MatrixSDPBackend(GenericSDPBackend): else: return self.objective_function[variable] - cpdef set_objective(self, list coeff, d=0.0) noexcept: + cpdef set_objective(self, list coeff, d=0.0): """ Set the objective function. @@ -245,7 +245,7 @@ cdef class MatrixSDPBackend(GenericSDPBackend): self.objective_function[i] = coeff[i] obj_constant_term = d - cpdef add_linear_constraint(self, coefficients, name=None) noexcept: + cpdef add_linear_constraint(self, coefficients, name=None): """ Add a linear constraint. @@ -292,7 +292,7 @@ cdef class MatrixSDPBackend(GenericSDPBackend): self.matrices_dim[self.nrows()] = m.dimensions()[0] # self.row_name_var.append(name) - cpdef add_linear_constraints(self, int number, names=None) noexcept: + cpdef add_linear_constraints(self, int number, names=None): """ Add constraints. @@ -373,7 +373,7 @@ cdef class MatrixSDPBackend(GenericSDPBackend): else: return 0 - cpdef problem_name(self, name=None) noexcept: + cpdef problem_name(self, name=None): """ Return or define the problem's name @@ -396,7 +396,7 @@ cdef class MatrixSDPBackend(GenericSDPBackend): self.name = name - cpdef row(self, int i) noexcept: + cpdef row(self, int i): """ Return a row @@ -436,7 +436,7 @@ cdef class MatrixSDPBackend(GenericSDPBackend): matrices.append(m) return (indices, matrices) - cpdef row_name(self, int index) noexcept: + cpdef row_name(self, int index): """ Return the ``index`` th row name @@ -457,7 +457,7 @@ cdef class MatrixSDPBackend(GenericSDPBackend): return self.row_name_var[index] return "constraint_" + repr(index) - cpdef col_name(self, int index) noexcept: + cpdef col_name(self, int index): """ Return the ``index`` th col name diff --git a/src/sage/numerical/backends/ppl_backend.pyx b/src/sage/numerical/backends/ppl_backend.pyx index 8bf18d7004b..987842f728c 100644 --- a/src/sage/numerical/backends/ppl_backend.pyx +++ b/src/sage/numerical/backends/ppl_backend.pyx @@ -91,14 +91,14 @@ cdef class PPLBackend(GenericBackend): else: self.set_sense(-1) - cpdef base_ring(self) noexcept: + cpdef base_ring(self): from sage.rings.rational_field import QQ return QQ - cpdef zero(self) noexcept: + cpdef zero(self): return self.base_ring()(0) - cpdef __copy__(self) noexcept: + cpdef __copy__(self): """ Returns a copy of self. @@ -378,7 +378,7 @@ cdef class PPLBackend(GenericBackend): self.col_name_var.append(None) return len(self.objective_function) - 1 - cpdef set_variable_type(self, int variable, int vtype) noexcept: + cpdef set_variable_type(self, int variable, int vtype): """ Set the type of a variable. @@ -431,7 +431,7 @@ cdef class PPLBackend(GenericBackend): else: raise ValueError("Invalid variable type: {}".format(vtype)) - cpdef set_sense(self, int sense) noexcept: + cpdef set_sense(self, int sense): """ Set the direction (maximization/minimization). @@ -457,7 +457,7 @@ cdef class PPLBackend(GenericBackend): else: self.is_maximize = 0 - cpdef objective_coefficient(self, int variable, coeff=None) noexcept: + cpdef objective_coefficient(self, int variable, coeff=None): """ Set or get the coefficient of a variable in the objective function @@ -485,7 +485,7 @@ cdef class PPLBackend(GenericBackend): else: return self.objective_function[variable] - cpdef set_objective(self, list coeff, d=0) noexcept: + cpdef set_objective(self, list coeff, d=0): """ Set the objective function. @@ -527,7 +527,7 @@ cdef class PPLBackend(GenericBackend): self.objective_function[i] = coeff[i] self.obj_constant_term = Rational(d) - cpdef set_verbosity(self, int level) noexcept: + cpdef set_verbosity(self, int level): """ Set the log (verbosity) level. Not Implemented. @@ -538,7 +538,7 @@ cdef class PPLBackend(GenericBackend): sage: p.set_verbosity(0) """ - cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None) noexcept: + cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None): """ Add a linear constraint. @@ -594,7 +594,7 @@ cdef class PPLBackend(GenericBackend): self.row_upper_bound.append(upper_bound) self.row_name_var.append(name) - cpdef add_col(self, indices, coeffs) noexcept: + cpdef add_col(self, indices, coeffs): """ Add a column. @@ -638,7 +638,7 @@ cdef class PPLBackend(GenericBackend): self.objective_function.append(0) self.col_name_var.append(None) - cpdef add_linear_constraints(self, int number, lower_bound, upper_bound, names=None) noexcept: + cpdef add_linear_constraints(self, int number, lower_bound, upper_bound, names=None): """ Add constraints. @@ -728,7 +728,7 @@ cdef class PPLBackend(GenericBackend): return 0 - cpdef get_objective_value(self) noexcept: + cpdef get_objective_value(self): """ Return the exact value of the objective function. @@ -763,7 +763,7 @@ cdef class PPLBackend(GenericBackend): ans = Rational(self.mip.optimal_value()) return ans / self.obj_denominator + self.obj_constant_term - cpdef get_variable_value(self, int variable) noexcept: + cpdef get_variable_value(self, int variable): """ Return the value of a variable given by the solver. @@ -843,7 +843,7 @@ cdef class PPLBackend(GenericBackend): else: return 0 - cpdef problem_name(self, name=None) noexcept: + cpdef problem_name(self, name=None): """ Return or define the problem's name @@ -864,7 +864,7 @@ cdef class PPLBackend(GenericBackend): return self.name self.name = name - cpdef row(self, int i) noexcept: + cpdef row(self, int i): """ Return a row @@ -899,7 +899,7 @@ cdef class PPLBackend(GenericBackend): coef.append(self.Matrix[i][j]) return (idx, coef) - cpdef row_bounds(self, int index) noexcept: + cpdef row_bounds(self, int index): """ Return the bounds of a specific constraint. @@ -927,7 +927,7 @@ cdef class PPLBackend(GenericBackend): """ return (self.row_lower_bound[index], self.row_upper_bound[index]) - cpdef col_bounds(self, int index) noexcept: + cpdef col_bounds(self, int index): """ Return the bounds of a specific variable. @@ -1019,7 +1019,7 @@ cdef class PPLBackend(GenericBackend): """ return index not in self.integer_variables - cpdef row_name(self, int index) noexcept: + cpdef row_name(self, int index): """ Return the ``index`` th row name @@ -1039,7 +1039,7 @@ cdef class PPLBackend(GenericBackend): return self.row_name_var[index] return "constraint_" + repr(index) - cpdef col_name(self, int index) noexcept: + cpdef col_name(self, int index): """ Return the ``index`` th col name @@ -1063,7 +1063,7 @@ cdef class PPLBackend(GenericBackend): return self.col_name_var[index] return "x_" + repr(index) - cpdef variable_upper_bound(self, int index, value = False) noexcept: + cpdef variable_upper_bound(self, int index, value=False): """ Return or define the upper bound on a variable @@ -1095,7 +1095,7 @@ cdef class PPLBackend(GenericBackend): else: return self.col_upper_bound[index] - cpdef variable_lower_bound(self, int index, value = False) noexcept: + cpdef variable_lower_bound(self, int index, value=False): """ Return or define the lower bound on a variable diff --git a/src/sage/numerical/backends/scip_backend.pxd b/src/sage/numerical/backends/scip_backend.pxd index 93f1b81ab96..0cd0600f955 100644 --- a/src/sage/numerical/backends/scip_backend.pxd +++ b/src/sage/numerical/backends/scip_backend.pxd @@ -16,6 +16,6 @@ cdef class SCIPBackend(GenericBackend): cdef object variables cdef object constraints - cpdef _get_model(self) noexcept - cpdef get_row_prim(self, int i) noexcept - cpdef write_cip(self, filename) noexcept + cpdef _get_model(self) + cpdef get_row_prim(self, int i) + cpdef write_cip(self, filename) diff --git a/src/sage/numerical/backends/scip_backend.pyx b/src/sage/numerical/backends/scip_backend.pyx index bec3bde160f..ad53659857b 100644 --- a/src/sage/numerical/backends/scip_backend.pyx +++ b/src/sage/numerical/backends/scip_backend.pyx @@ -80,7 +80,7 @@ cdef class SCIPBackend(GenericBackend): self.constraints = self.model.getConss() return self.constraints - cpdef _get_model(self) noexcept: + cpdef _get_model(self): """ Get the model as a pyscipopt Model. @@ -176,7 +176,7 @@ cdef class SCIPBackend(GenericBackend): return index - cpdef set_variable_type(self, int variable, int vtype) noexcept: + cpdef set_variable_type(self, int variable, int vtype): """ Set the type of a variable @@ -207,7 +207,7 @@ cdef class SCIPBackend(GenericBackend): vtypenames = {1: 'I', 0: 'B', -1: 'C'} self.model.chgVarType(var=self.variables[variable], vtype=vtypenames[vtype]) - cpdef set_sense(self, int sense) noexcept: + cpdef set_sense(self, int sense): """ Set the direction (maximization/minimization). @@ -237,7 +237,7 @@ cdef class SCIPBackend(GenericBackend): else: raise AssertionError("sense must be either 1 or -1") - cpdef objective_coefficient(self, int variable, coeff=None) noexcept: + cpdef objective_coefficient(self, int variable, coeff=None): """ Set or get the coefficient of a variable in the objective function @@ -270,7 +270,7 @@ cdef class SCIPBackend(GenericBackend): linfun = sum([e * c for e, c in objexpr.terms.iteritems() if e != var]) + var * coeff self.model.setObjective(linfun, sense=self.model.getObjectiveSense()) - cpdef problem_name(self, name=None) noexcept: + cpdef problem_name(self, name=None): """ Return or define the problem's name @@ -292,7 +292,7 @@ cdef class SCIPBackend(GenericBackend): else: self.model.setProbName(name) - cpdef set_objective(self, list coeff, d=0.0) noexcept: + cpdef set_objective(self, list coeff, d=0.0): """ Set the objective function. @@ -318,7 +318,7 @@ cdef class SCIPBackend(GenericBackend): linfun = sum([c * x for c, x in zip(coeff, self.variables)]) + d self.model.setObjective(linfun, sense=self.model.getObjectiveSense()) - cpdef set_verbosity(self, int level) noexcept: + cpdef set_verbosity(self, int level): """ Set the verbosity level @@ -346,7 +346,7 @@ cdef class SCIPBackend(GenericBackend): else: raise AssertionError('level must be "0" or "1"') - cpdef remove_constraint(self, int i) noexcept: + cpdef remove_constraint(self, int i): r""" Remove a constraint from self. @@ -384,7 +384,7 @@ cdef class SCIPBackend(GenericBackend): self.model.delCons(self.get_constraints()[i]) self.constraints = None - cpdef remove_constraints(self, constraints) noexcept: + cpdef remove_constraints(self, constraints): r""" Remove several constraints. @@ -420,7 +420,7 @@ cdef class SCIPBackend(GenericBackend): self.model.delCons(constraint) self.constraints = None - cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None) noexcept: + cpdef add_linear_constraint(self, coefficients, lower_bound, upper_bound, name=None): """ Add a linear constraint. @@ -468,7 +468,7 @@ cdef class SCIPBackend(GenericBackend): self.model.addCons(cons, name=name) self.constraints = None - cpdef row(self, int index) noexcept: + cpdef row(self, int index): r""" Return a row @@ -505,7 +505,7 @@ cdef class SCIPBackend(GenericBackend): values.append(coeff) return (indices, values) - cpdef row_bounds(self, int index) noexcept: + cpdef row_bounds(self, int index): """ Return the bounds of a specific constraint. @@ -538,7 +538,7 @@ cdef class SCIPBackend(GenericBackend): rhs = None return (lhs, rhs) - cpdef col_bounds(self, int index) noexcept: + cpdef col_bounds(self, int index): """ Return the bounds of a specific variable. @@ -573,7 +573,7 @@ cdef class SCIPBackend(GenericBackend): ub = None return (lb, ub) - cpdef add_col(self, indices, coeffs) noexcept: + cpdef add_col(self, indices, coeffs): """ Add a column. @@ -699,7 +699,7 @@ cdef class SCIPBackend(GenericBackend): # raise MIPSolverException("SCIP: Time limit reached") return 0 - cpdef get_objective_value(self) noexcept: + cpdef get_objective_value(self): """ Return the value of the objective function. @@ -726,7 +726,7 @@ cdef class SCIPBackend(GenericBackend): """ return self.model.getObjVal() - cpdef best_known_objective_bound(self) noexcept: + cpdef best_known_objective_bound(self): r""" Return the value of the currently best known bound. @@ -760,7 +760,7 @@ cdef class SCIPBackend(GenericBackend): """ return self.model.getPrimalbound() - cpdef get_relative_objective_gap(self) noexcept: + cpdef get_relative_objective_gap(self): r""" Return the relative objective gap of the best known solution. @@ -803,7 +803,7 @@ cdef class SCIPBackend(GenericBackend): """ return self.model.getGap() - cpdef get_variable_value(self, int variable) noexcept: + cpdef get_variable_value(self, int variable): """ Return the value of a variable given by the solver. @@ -830,7 +830,7 @@ cdef class SCIPBackend(GenericBackend): """ return self.model.getVal(self.variables[variable]) - cpdef get_row_prim(self, int i) noexcept: + cpdef get_row_prim(self, int i): r""" Return the value of the auxiliary variable associated with i-th row. @@ -914,7 +914,7 @@ cdef class SCIPBackend(GenericBackend): return self.model.getNConss() return len(self.get_constraints()) - cpdef col_name(self, int index) noexcept: + cpdef col_name(self, int index): """ Return the ``index``th col name @@ -933,7 +933,7 @@ cdef class SCIPBackend(GenericBackend): """ return self.variables[index].name - cpdef row_name(self, int index) noexcept: + cpdef row_name(self, int index): """ Return the ``index`` th row name @@ -1035,7 +1035,7 @@ cdef class SCIPBackend(GenericBackend): """ return self.model.getObjectiveSense() != 'minimize' - cpdef variable_upper_bound(self, int index, value=False) noexcept: + cpdef variable_upper_bound(self, int index, value=False): """ Return or define the upper bound on a variable @@ -1096,7 +1096,7 @@ cdef class SCIPBackend(GenericBackend): else: self.model.chgVarUb(var=var, ub=value) - cpdef variable_lower_bound(self, int index, value=False) noexcept: + cpdef variable_lower_bound(self, int index, value=False): """ Return or define the lower bound on a variable @@ -1158,7 +1158,7 @@ cdef class SCIPBackend(GenericBackend): else: self.model.chgVarLb(var=var, lb=value) - cpdef write_cip(self, filename) noexcept: + cpdef write_cip(self, filename): """ Write the problem to a .cip file @@ -1181,7 +1181,7 @@ cdef class SCIPBackend(GenericBackend): """ self.model.writeProblem(filename) - cpdef write_lp(self, filename) noexcept: + cpdef write_lp(self, filename): """ Write the problem to a .lp file @@ -1210,7 +1210,7 @@ cdef class SCIPBackend(GenericBackend): self.model.writeProblem(filenamestr) - cpdef write_mps(self, filename, int modern) noexcept: + cpdef write_mps(self, filename, int modern): """ Write the problem to a .mps file @@ -1239,7 +1239,7 @@ cdef class SCIPBackend(GenericBackend): self.model.writeProblem(filenamestr) - cpdef __copy__(self) noexcept: + cpdef __copy__(self): """ Return a copy of self. @@ -1260,7 +1260,7 @@ cdef class SCIPBackend(GenericBackend): cp.variables = cp.model.getVars() return cp - cpdef solver_parameter(self, name, value=None) noexcept: + cpdef solver_parameter(self, name, value=None): """ Return or define a solver parameter diff --git a/src/sage/numerical/linear_functions.pxd b/src/sage/numerical/linear_functions.pxd index 4ad836d8d6d..568f04b75af 100644 --- a/src/sage/numerical/linear_functions.pxd +++ b/src/sage/numerical/linear_functions.pxd @@ -1,30 +1,30 @@ from sage.structure.parent cimport Parent, Parent_richcmp_element_without_coercion from sage.structure.element cimport ModuleElement, RingElement, Element -cpdef is_LinearFunction(x) noexcept +cpdef is_LinearFunction(x) cdef class LinearFunctionOrConstraint(ModuleElement): pass cdef class LinearFunctionsParent_class(Parent): - cpdef _element_constructor_(self, x) noexcept - cpdef _coerce_map_from_(self, R) noexcept + cpdef _element_constructor_(self, x) + cpdef _coerce_map_from_(self, R) cdef public _multiplication_symbol cdef class LinearFunction(LinearFunctionOrConstraint): cdef dict _f - cpdef _add_(self, other) noexcept - cpdef iteritems(self) noexcept - cpdef _acted_upon_(self, x, bint self_on_left) noexcept - cpdef is_zero(self) noexcept - cpdef equals(LinearFunction left, LinearFunction right) noexcept + cpdef _add_(self, other) + cpdef iteritems(self) + cpdef _acted_upon_(self, x, bint self_on_left) + cpdef is_zero(self) + cpdef equals(LinearFunction left, LinearFunction right) cdef class LinearConstraintsParent_class(Parent): cdef LinearFunctionsParent_class _LF - cpdef _element_constructor_(self, left, right=?, equality=?) noexcept - cpdef _coerce_map_from_(self, R) noexcept + cpdef _element_constructor_(self, left, right=?, equality=?) + cpdef _coerce_map_from_(self, R) cdef class LinearConstraint(LinearFunctionOrConstraint): cdef bint equality cdef list constraints - cpdef equals(LinearConstraint left, LinearConstraint right) noexcept + cpdef equals(LinearConstraint left, LinearConstraint right) diff --git a/src/sage/numerical/linear_functions.pyx b/src/sage/numerical/linear_functions.pyx index 21b1d80efae..9c7e10744f2 100644 --- a/src/sage/numerical/linear_functions.pyx +++ b/src/sage/numerical/linear_functions.pyx @@ -114,7 +114,7 @@ from sage.misc.cachefunc import cached_function # #***************************************************************************** -cpdef is_LinearFunction(x) noexcept: +cpdef is_LinearFunction(x): """ Test whether ``x`` is a linear function @@ -663,7 +663,7 @@ cdef class LinearFunctionsParent_class(Parent): """ return 'Linear functions over ' + str(self.base_ring()) - cpdef _element_constructor_(self, x) noexcept: + cpdef _element_constructor_(self, x): """ Construct a :class:`LinearFunction` from ``x``. @@ -693,7 +693,7 @@ cdef class LinearFunctionsParent_class(Parent): return LinearFunction(self, (x)._f) return LinearFunction(self, x) - cpdef _coerce_map_from_(self, R) noexcept: + cpdef _coerce_map_from_(self, R): """ Allow coercion of scalars into linear functions. @@ -802,7 +802,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): else: self._f = {-1: R(f)} - cpdef iteritems(self) noexcept: + cpdef iteritems(self): """ Iterate over the index, coefficient pairs. @@ -905,7 +905,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): except KeyError: return self.parent().base_ring().zero() - cpdef _add_(self, b) noexcept: + cpdef _add_(self, b): r""" Defining the + operator @@ -922,7 +922,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): P = self.parent() return P(e) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): r""" Defining the - operator (opposite). @@ -936,7 +936,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): P = self.parent() return P({id: -coeff for id, coeff in self._f.iteritems()}) - cpdef _sub_(self, b) noexcept: + cpdef _sub_(self, b): r""" Defining the - operator (subtraction). @@ -955,7 +955,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): P = self.parent() return P(e) - cpdef _lmul_(self, Element b) noexcept: + cpdef _lmul_(self, Element b): r""" Multiplication by scalars @@ -971,7 +971,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): P = self.parent() return P(dict([(id,b*coeff) for (id, coeff) in self._f.iteritems()])) - cpdef _acted_upon_(self, x, bint self_on_left) noexcept: + cpdef _acted_upon_(self, x, bint self_on_left): """ Act with scalars that do not have a natural coercion into ``self.base_ring()`` @@ -1130,7 +1130,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): else: return t - cpdef is_zero(self) noexcept: + cpdef is_zero(self): """ Test whether ``self`` is zero. @@ -1150,7 +1150,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint): return False return True - cpdef equals(LinearFunction left, LinearFunction right) noexcept: + cpdef equals(LinearFunction left, LinearFunction right): """ Logically compare ``left`` and ``right``. @@ -1267,7 +1267,7 @@ cdef class LinearConstraintsParent_class(Parent): """ return 'Linear constraints over ' + str(self.linear_functions_parent().base_ring()) - cpdef _element_constructor_(self, left, right=None, equality=False) noexcept: + cpdef _element_constructor_(self, left, right=None, equality=False): """ Construct a :class:`LinearConstraint`. @@ -1332,7 +1332,7 @@ cdef class LinearConstraintsParent_class(Parent): else: return LinearConstraint(self, [left, right], equality=equality) - cpdef _coerce_map_from_(self, R) noexcept: + cpdef _coerce_map_from_(self, R): """ Allow coercion of scalars into linear functions. @@ -1432,7 +1432,7 @@ cdef class LinearConstraint(LinearFunctionOrConstraint): LF = parent.linear_functions_parent() self.constraints = [ LF(term) for term in terms ] - cpdef equals(LinearConstraint left, LinearConstraint right) noexcept: + cpdef equals(LinearConstraint left, LinearConstraint right): """ Compare ``left`` and ``right``. diff --git a/src/sage/numerical/linear_tensor_element.pxd b/src/sage/numerical/linear_tensor_element.pxd index 528f58b991c..1cd84d3e33f 100644 --- a/src/sage/numerical/linear_tensor_element.pxd +++ b/src/sage/numerical/linear_tensor_element.pxd @@ -2,4 +2,4 @@ from sage.structure.element cimport Element, ModuleElement cdef class LinearTensor(ModuleElement): cdef dict _f - cpdef _add_(self, other) noexcept + cpdef _add_(self, other) diff --git a/src/sage/numerical/linear_tensor_element.pyx b/src/sage/numerical/linear_tensor_element.pyx index e2c88619469..c77aa290e21 100644 --- a/src/sage/numerical/linear_tensor_element.pyx +++ b/src/sage/numerical/linear_tensor_element.pyx @@ -261,7 +261,7 @@ cdef class LinearTensor(ModuleElement): s += ']' return s - cpdef _add_(self, b) noexcept: + cpdef _add_(self, b): r""" Return sum. @@ -285,7 +285,7 @@ cdef class LinearTensor(ModuleElement): result[key] = self._f.get(key, 0) + coeff return self.parent()(result) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): r""" Return the negative. @@ -305,7 +305,7 @@ cdef class LinearTensor(ModuleElement): result[key] = -coeff return self.parent()(result) - cpdef _sub_(self, b) noexcept: + cpdef _sub_(self, b): r""" Return difference. @@ -331,7 +331,7 @@ cdef class LinearTensor(ModuleElement): result[key] = self._f.get(key, 0) - coeff return self.parent()(result) - cpdef _lmul_(self, Element b) noexcept: + cpdef _lmul_(self, Element b): r""" Return multiplication by scalar. diff --git a/src/sage/numerical/mip.pxd b/src/sage/numerical/mip.pxd index e73cc408d09..1422827e1e4 100644 --- a/src/sage/numerical/mip.pxd +++ b/src/sage/numerical/mip.pxd @@ -26,7 +26,7 @@ cdef class MixedIntegerLinearProgram(SageObject): cpdef int number_of_variables(self) noexcept cdef int _check_redundant cdef list _constraints - cpdef sum(self, L) noexcept + cpdef sum(self, L) cdef class MIPVariable(FiniteFamily): @@ -35,5 +35,5 @@ cdef class MIPVariable(FiniteFamily): cdef str _name cdef object _lower_bound cdef object _upper_bound - cdef _matrix_rmul_impl(self, m) noexcept - cdef _matrix_lmul_impl(self, m) noexcept + cdef _matrix_rmul_impl(self, m) + cdef _matrix_lmul_impl(self, m) diff --git a/src/sage/numerical/mip.pyx b/src/sage/numerical/mip.pyx index 62a3e18649e..368b9e4b0e3 100644 --- a/src/sage/numerical/mip.pyx +++ b/src/sage/numerical/mip.pyx @@ -2883,7 +2883,7 @@ cdef class MixedIntegerLinearProgram(SageObject): else: self._backend.solver_parameter(name, value) - cpdef sum(self, L) noexcept: + cpdef sum(self, L): r""" Efficiently computes the sum of a sequence of :class:`~sage.numerical.linear_functions.LinearFunction` elements @@ -3664,7 +3664,7 @@ cdef class MIPVariable(FiniteFamily): return NotImplemented return ( right)._matrix_lmul_impl(left) - cdef _matrix_rmul_impl(self, m) noexcept: + cdef _matrix_rmul_impl(self, m): """ Implement the action of a matrix multiplying from the right. """ @@ -3678,7 +3678,7 @@ cdef class MIPVariable(FiniteFamily): T = self._p.linear_functions_parent().tensor(V) return T(result) - cdef _matrix_lmul_impl(self, m) noexcept: + cdef _matrix_lmul_impl(self, m): """ Implement the action of a matrix multiplying from the left. """ diff --git a/src/sage/numerical/sdp.pxd b/src/sage/numerical/sdp.pxd index 47964ef1789..629e6c83f94 100644 --- a/src/sage/numerical/sdp.pxd +++ b/src/sage/numerical/sdp.pxd @@ -16,9 +16,9 @@ cdef class SemidefiniteProgram(SageObject): cpdef int number_of_constraints(self) noexcept cpdef int number_of_variables(self) noexcept cdef list _constraints - cpdef sum(self, L) noexcept - cpdef dual_variable(self, int i, sparse=*) noexcept - cpdef slack(self, int i, sparse=*) noexcept + cpdef sum(self, L) + cpdef dual_variable(self, int i, sparse=*) + cpdef slack(self, int i, sparse=*) cdef class SDPVariable(Element): @@ -26,9 +26,9 @@ cdef class SDPVariable(Element): cdef dict _dict cdef str _name cdef bint _hasname - cdef _matrix_rmul_impl(self, m) noexcept - cdef _matrix_lmul_impl(self, m) noexcept - cpdef _acted_upon_(self, mat, bint self_on_left) noexcept + cdef _matrix_rmul_impl(self, m) + cdef _matrix_lmul_impl(self, m) + cpdef _acted_upon_(self, mat, bint self_on_left) cdef class SDPVariableParent(Parent): diff --git a/src/sage/numerical/sdp.pyx b/src/sage/numerical/sdp.pyx index 97ba4eeff26..8701ed22150 100644 --- a/src/sage/numerical/sdp.pyx +++ b/src/sage/numerical/sdp.pyx @@ -961,7 +961,7 @@ cdef class SemidefiniteProgram(SageObject): return self._backend.get_objective_value() - cpdef dual_variable(self, int i, sparse=False) noexcept: + cpdef dual_variable(self, int i, sparse=False): """ The `i`-th dual variable. @@ -1013,7 +1013,7 @@ cdef class SemidefiniteProgram(SageObject): """ return self._backend.dual_variable(i, sparse=sparse) - cpdef slack(self, int i, sparse=False) noexcept: + cpdef slack(self, int i, sparse=False): """ Slack of the `i`-th constraint @@ -1109,7 +1109,7 @@ cdef class SemidefiniteProgram(SageObject): else: self._backend.solver_parameter(name, value) - cpdef sum(self, L) noexcept: + cpdef sum(self, L): r""" Efficiently computes the sum of a sequence of :class:`~sage.numerical.linear_functions.LinearFunction` elements. @@ -1332,7 +1332,7 @@ cdef class SDPVariable(Element): """ return self._dict.values() - cdef _matrix_rmul_impl(self, m) noexcept: + cdef _matrix_rmul_impl(self, m): """ Implement the action of a matrix multiplying from the right. """ @@ -1346,7 +1346,7 @@ cdef class SDPVariable(Element): T = self._p.linear_functions_parent().tensor(V) return T(result) - cdef _matrix_lmul_impl(self, m) noexcept: + cdef _matrix_lmul_impl(self, m): """ Implement the action of a matrix multiplying from the left. """ @@ -1360,7 +1360,7 @@ cdef class SDPVariable(Element): T = self._p.linear_functions_parent().tensor(V) return T(result) - cpdef _acted_upon_(self, mat, bint self_on_left) noexcept: + cpdef _acted_upon_(self, mat, bint self_on_left): """ Act with matrices on SDPVariables. diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx index 01d8060ea01..f1f2671a803 100644 --- a/src/sage/plot/complex_plot.pyx +++ b/src/sage/plot/complex_plot.pyx @@ -44,7 +44,7 @@ DEFAULT_LOGARITHMIC_CONTOUR_BASE = 2 DEFAULT_LINEAR_CONTOUR_BASE = 10 -cdef inline ComplexDoubleElement new_CDF_element(double x, double y) noexcept: +cdef inline ComplexDoubleElement new_CDF_element(double x, double y): z = ComplexDoubleElement.__new__(ComplexDoubleElement) GSL_SET_COMPLEX(&z._complex, x, y) return z diff --git a/src/sage/plot/plot3d/implicit_surface.pyx b/src/sage/plot/plot3d/implicit_surface.pyx index f5773a63d08..df28f7c6e6b 100644 --- a/src/sage/plot/plot3d/implicit_surface.pyx +++ b/src/sage/plot/plot3d/implicit_surface.pyx @@ -153,7 +153,7 @@ cdef class VertexInfo: return '<{}, {}, {}>'.format(self.pt.x, self.pt.y, self.pt.z) -cdef mk_VertexInfo(double x, double y, double z, point_c *eval_min, point_c *eval_scale) noexcept: +cdef mk_VertexInfo(double x, double y, double z, point_c *eval_min, point_c *eval_scale): cdef VertexInfo v v = VertexInfo.__new__(VertexInfo) v.pt.x = x @@ -452,7 +452,7 @@ cdef class MarchingCubesTriangles(MarchingCubes): self.process_cubes(self.slices[0], self.slices[1]) - cpdef _update_yz_vertices(self, int x, np.ndarray _prev, np.ndarray _cur, np.ndarray _next) noexcept: + cpdef _update_yz_vertices(self, int x, np.ndarray _prev, np.ndarray _cur, np.ndarray _next): """ TESTS:: @@ -560,7 +560,7 @@ cdef class MarchingCubesTriangles(MarchingCubes): else: z_vertices[y,z] = None - cpdef _update_x_vertices(self, int x, np.ndarray _prev, np.ndarray _left, np.ndarray _right, np.ndarray _next) noexcept: + cpdef _update_x_vertices(self, int x, np.ndarray _prev, np.ndarray _left, np.ndarray _right, np.ndarray _next): """ TESTS:: @@ -638,7 +638,7 @@ cdef class MarchingCubesTriangles(MarchingCubes): cdef bint in_region(self, VertexInfo v) noexcept: return (self.region(v.eval_pt.x, v.eval_pt.y, v.eval_pt.z) > 0) - cdef apply_point_func(self, point_c *pt, fn, VertexInfo v) noexcept: + cdef apply_point_func(self, point_c *pt, fn, VertexInfo v): if isinstance(fn, tuple): pt[0].x = fn[0](v.eval_pt.x, v.eval_pt.y, v.eval_pt.z) pt[0].y = fn[1](v.eval_pt.x, v.eval_pt.y, v.eval_pt.z) @@ -649,7 +649,7 @@ cdef class MarchingCubesTriangles(MarchingCubes): pt[0].y = t[1] pt[0].z = t[2] - cdef apply_color_func(self, color_c *pt, fn, cm, VertexInfo v) noexcept: + cdef apply_color_func(self, color_c *pt, fn, cm, VertexInfo v): t = fn(v.eval_pt.x, v.eval_pt.y, v.eval_pt.z) pt[0].r, pt[0].g, pt[0].b, _ = cm(t) @@ -659,7 +659,7 @@ cdef class MarchingCubesTriangles(MarchingCubes): double center, double lx, double ux, double ly, double uy, - double lz, double uz) noexcept: + double lz, double uz): # What a mess! It would be much nicer-looking code to pass slices # in here and do the subscripting in here. Unfortunately, # that would also be much slower, because we'd have to re-initialize @@ -684,7 +684,7 @@ cdef class MarchingCubesTriangles(MarchingCubes): g[0].y = gy g[0].z = gz - cpdef process_cubes(self, np.ndarray _left, np.ndarray _right) noexcept: + cpdef process_cubes(self, np.ndarray _left, np.ndarray _right): """ TESTS:: @@ -788,7 +788,7 @@ cdef class MarchingCubesTriangles(MarchingCubes): all_vertex_info[my_triangles[i+1]], all_vertex_info[my_triangles[i+2]]) - cpdef add_triangle(self, VertexInfo v1, VertexInfo v2, VertexInfo v3) noexcept: + cpdef add_triangle(self, VertexInfo v1, VertexInfo v2, VertexInfo v3): """ Called when a new triangle is generated by the marching cubes algorithm to update the results array. @@ -845,7 +845,7 @@ cdef class MarchingCubesTriangles(MarchingCubes): self.results.append(face) -cpdef render_implicit(f, xrange, yrange, zrange, plot_points, cube_marchers) noexcept: +cpdef render_implicit(f, xrange, yrange, zrange, plot_points, cube_marchers): """ INPUT: diff --git a/src/sage/plot/plot3d/index_face_set.pyx b/src/sage/plot/plot3d/index_face_set.pyx index dd7bfb2d38a..4288db70005 100644 --- a/src/sage/plot/plot3d/index_face_set.pyx +++ b/src/sage/plot/plot3d/index_face_set.pyx @@ -69,7 +69,7 @@ from sage.plot.plot3d.transform cimport Transformation # Fast routines for generating string representations of the polygons. # -------------------------------------------------------------------- -cdef inline format_tachyon_texture(color_c rgb) noexcept: +cdef inline format_tachyon_texture(color_c rgb): cdef char rs[200] cdef Py_ssize_t cr = sprintf_3d(rs, "TEXTURE\n AMBIENT 0.3 DIFFUSE 0.7 SPECULAR 0 OPACITY 1.0\n COLOR %g %g %g \n TEXFUNC 0", @@ -77,7 +77,7 @@ cdef inline format_tachyon_texture(color_c rgb) noexcept: return bytes_to_str(PyBytes_FromStringAndSize(rs, cr)) -cdef inline format_tachyon_triangle(point_c P, point_c Q, point_c R) noexcept: +cdef inline format_tachyon_triangle(point_c P, point_c Q, point_c R): cdef char ss[250] # PyBytes_FromFormat doesn't do floats? cdef Py_ssize_t r = sprintf_9d(ss, @@ -88,22 +88,22 @@ cdef inline format_tachyon_triangle(point_c P, point_c Q, point_c R) noexcept: return bytes_to_str(PyBytes_FromStringAndSize(ss, r)) -cdef inline format_json_vertex(point_c P) noexcept: +cdef inline format_json_vertex(point_c P): cdef char ss[100] cdef Py_ssize_t r = sprintf_3d(ss, '{"x":%g,"y":%g,"z":%g}', P.x, P.y, P.z) return bytes_to_str(PyBytes_FromStringAndSize(ss, r)) -cdef inline format_json_face(face_c face) noexcept: +cdef inline format_json_face(face_c face): s = "[{}]".format(",".join(str(face.vertices[i]) for i in range(face.n))) return s -cdef inline format_obj_vertex(point_c P) noexcept: +cdef inline format_obj_vertex(point_c P): cdef char ss[100] # PyBytes_FromFormat doesn't do floats? cdef Py_ssize_t r = sprintf_3d(ss, "v %g %g %g", P.x, P.y, P.z) return bytes_to_str(PyBytes_FromStringAndSize(ss, r)) -cdef inline format_obj_face(face_c face, int off) noexcept: +cdef inline format_obj_face(face_c face, int off): cdef char ss[100] cdef Py_ssize_t r, i if face.n == 3: @@ -115,7 +115,7 @@ cdef inline format_obj_face(face_c face, int off) noexcept: # PyBytes_FromFormat is almost twice as slow return bytes_to_str(PyBytes_FromStringAndSize(ss, r)) -cdef inline format_obj_face_back(face_c face, int off) noexcept: +cdef inline format_obj_face_back(face_c face, int off): cdef char ss[100] cdef Py_ssize_t r, i if face.n == 3: @@ -126,13 +126,13 @@ cdef inline format_obj_face_back(face_c face, int off) noexcept: return "f " + " ".join(str(face.vertices[i] + off) for i from face.n > i >= 0) return bytes_to_str(PyBytes_FromStringAndSize(ss, r)) -cdef inline format_pmesh_vertex(point_c P) noexcept: +cdef inline format_pmesh_vertex(point_c P): cdef char ss[100] # PyBytes_FromFormat doesn't do floats? cdef Py_ssize_t r = sprintf_3d(ss, "%g %g %g", P.x, P.y, P.z) return bytes_to_str(PyBytes_FromStringAndSize(ss, r)) -cdef inline format_pmesh_face(face_c face, int has_color) noexcept: +cdef inline format_pmesh_face(face_c face, int has_color): cdef char ss[100] cdef Py_ssize_t r, i cdef int color diff --git a/src/sage/plot/plot3d/transform.pxd b/src/sage/plot/plot3d/transform.pxd index 87695fc3d87..39fd2bb6381 100644 --- a/src/sage/plot/plot3d/transform.pxd +++ b/src/sage/plot/plot3d/transform.pxd @@ -13,8 +13,8 @@ cdef class Transformation: cdef matrix cdef double _matrix_data[12] cdef object _svd - cpdef transform_point(self, x) noexcept - cpdef transform_vector(self, v) noexcept - cpdef transform_bounding_box(self, box) noexcept + cpdef transform_point(self, x) + cpdef transform_vector(self, v) + cpdef transform_bounding_box(self, box) cdef void transform_point_c(self, point_c* res, point_c P) noexcept cdef void transform_vector_c(self, point_c* res, point_c P) noexcept diff --git a/src/sage/plot/plot3d/transform.pyx b/src/sage/plot/plot3d/transform.pyx index b6d8a2f643b..ad9aae98278 100644 --- a/src/sage/plot/plot3d/transform.pyx +++ b/src/sage/plot/plot3d/transform.pyx @@ -75,19 +75,19 @@ cdef class Transformation: len_a = a.dot_product(a) return max([abs(len_a - b.dot_product(b)) for b in basis]) < eps - cpdef transform_point(self, x) noexcept: + cpdef transform_point(self, x): cdef point_c res, P P.x, P.y, P.z = x point_c_transform(&res, self._matrix_data, P) return res.x, res.y, res.z - cpdef transform_vector(self, v) noexcept: + cpdef transform_vector(self, v): cdef point_c res, P P.x, P.y, P.z = v point_c_stretch(&res, self._matrix_data, P) return res.x, res.y, res.z - cpdef transform_bounding_box(self, box) noexcept: + cpdef transform_bounding_box(self, box): cdef point_c lower, upper, res, temp cdef point_c bounds[2] bounds[0].x, bounds[0].y, bounds[0].z = box[0] diff --git a/src/sage/quadratic_forms/count_local_2.pyx b/src/sage/quadratic_forms/count_local_2.pyx index 9b7d3e15178..3ce05a3a413 100644 --- a/src/sage/quadratic_forms/count_local_2.pyx +++ b/src/sage/quadratic_forms/count_local_2.pyx @@ -87,7 +87,7 @@ def count_modp__by_gauss_sum(n, p, m, Qdet): return count -cdef CountAllLocalTypesNaive_cdef(Q, p, k, m, zvec, nzvec) noexcept: +cdef CountAllLocalTypesNaive_cdef(Q, p, k, m, zvec, nzvec): """ This Cython routine is documented in its Python wrapper method QuadraticForm.count_congruence_solutions_by_type(). @@ -181,7 +181,7 @@ def CountAllLocalTypesNaive(Q, p, k, m, zvec, nzvec): return CountAllLocalTypesNaive_cdef(Q, p, k, m, zvec, nzvec) -cdef local_solution_type_cdef(Q, p, w, zvec, nzvec) noexcept: +cdef local_solution_type_cdef(Q, p, w, zvec, nzvec): """ Internal routine to check if a given solution vector `w` (of `Q(w) = m` mod `p^k`) is of a certain local type and satisfies certain diff --git a/src/sage/quadratic_forms/quadratic_form__evaluate.pyx b/src/sage/quadratic_forms/quadratic_form__evaluate.pyx index 8a5aeafd831..95e82e669dc 100644 --- a/src/sage/quadratic_forms/quadratic_form__evaluate.pyx +++ b/src/sage/quadratic_forms/quadratic_form__evaluate.pyx @@ -44,7 +44,7 @@ def QFEvaluateVector(Q, v): return QFEvaluateVector_cdef(Q, v) -cdef QFEvaluateVector_cdef(Q, v) noexcept: +cdef QFEvaluateVector_cdef(Q, v): r""" Routine to quickly evaluate a quadratic form `Q` on a vector `v`. See the Python wrapper function :meth:`QFEvaluate` above for details. @@ -111,7 +111,7 @@ def QFEvaluateMatrix(Q, M, Q2): return QFEvaluateMatrix_cdef(Q, M, Q2) -cdef QFEvaluateMatrix_cdef(Q, M, Q2) noexcept: +cdef QFEvaluateMatrix_cdef(Q, M, Q2): r""" Routine to quickly evaluate a quadratic form `Q` on a matrix `M`. See the Python wrapper function :func:`QFEvaluateMatrix` above for details. diff --git a/src/sage/quivers/algebra_elements.pxd b/src/sage/quivers/algebra_elements.pxd index e47696270da..3beb69914d0 100644 --- a/src/sage/quivers/algebra_elements.pxd +++ b/src/sage/quivers/algebra_elements.pxd @@ -83,14 +83,14 @@ cdef class PathAlgebraElement(RingElement): # functions. cdef path_order_t cmp_terms cdef long _hash - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept + cpdef _add_(self, other) + cpdef _mul_(self, other) cpdef ssize_t degree(self) except -2 - cpdef dict monomial_coefficients(self) noexcept - cpdef list coefficients(self) noexcept - cpdef list monomials(self) noexcept - cpdef list support(self) noexcept - cpdef list terms(self) noexcept - cpdef object coefficient(self, QuiverPath P) noexcept - cdef list _sorted_items_for_printing(self) noexcept - cdef inline PathAlgebraElement _new_(self, path_homog_poly_t *h) noexcept + cpdef dict monomial_coefficients(self) + cpdef list coefficients(self) + cpdef list monomials(self) + cpdef list support(self) + cpdef list terms(self) + cpdef object coefficient(self, QuiverPath P) + cdef list _sorted_items_for_printing(self) + cdef inline PathAlgebraElement _new_(self, path_homog_poly_t *h) diff --git a/src/sage/quivers/algebra_elements.pxi b/src/sage/quivers/algebra_elements.pxi index 7b9a9883f28..45d18478f60 100644 --- a/src/sage/quivers/algebra_elements.pxi +++ b/src/sage/quivers/algebra_elements.pxi @@ -88,7 +88,7 @@ cdef inline void mon_free(path_mon_t M) noexcept: biseq_dealloc(M.path) # Linearisation -cdef inline tuple mon_pickle(path_mon_t M) noexcept: +cdef inline tuple mon_pickle(path_mon_t M): return (bitset_pickle(M.path.data) if M.path.length>0 else (), M.path.itembitsize, M.path.length, M.pos, M.l_len, M.s_len) @@ -419,7 +419,7 @@ cdef inline mp_size_t term_total_degree(path_term_t *T) noexcept: return T.mon.path.length-T.mon.s_len # Linearisation -cdef inline tuple term_pickle(path_term_t *T) noexcept: +cdef inline tuple term_pickle(path_term_t *T): return (T.coef, mon_pickle(T.mon)) # De-linearisation @@ -689,7 +689,7 @@ cdef bint poly_icopy_scale(path_poly_t *out, path_poly_t *P, object coef) except return True # Linearisation of a path polynomials -cdef list poly_pickle(path_poly_t *P) noexcept: +cdef list poly_pickle(path_poly_t *P): cdef list L = [] cdef path_term_t *T = P.lead while T != NULL: @@ -1232,7 +1232,7 @@ cdef path_homog_poly_t *homog_poly_copy(path_homog_poly_t *H) except NULL: return out # Linearisation -cdef list homog_poly_pickle(path_homog_poly_t *H) noexcept: +cdef list homog_poly_pickle(path_homog_poly_t *H): cdef list L = [] while H != NULL: L.append((H.start, H.end, poly_pickle(H.poly))) diff --git a/src/sage/quivers/algebra_elements.pyx b/src/sage/quivers/algebra_elements.pyx index 54906701d26..3d05ba7e270 100644 --- a/src/sage/quivers/algebra_elements.pyx +++ b/src/sage/quivers/algebra_elements.pyx @@ -211,7 +211,7 @@ cdef class PathAlgebraElement(RingElement): """ return path_algebra_element_unpickle, (self._parent, homog_poly_pickle(self.data)) - cdef list _sorted_items_for_printing(self) noexcept: + cdef list _sorted_items_for_printing(self): """ Return list of pairs ``(M,c)``, where ``c`` is a coefficient and ``M`` will be passed to ``self.parent()._repr_monomial`` resp. to @@ -402,7 +402,7 @@ cdef class PathAlgebraElement(RingElement): H = H.nxt return True - cpdef dict monomial_coefficients(self) noexcept: + cpdef dict monomial_coefficients(self): """ Return the dictionary keyed by the monomials appearing in this element, the values being the coefficients. @@ -451,7 +451,7 @@ cdef class PathAlgebraElement(RingElement): H = H.nxt return D - cpdef list coefficients(self) noexcept: + cpdef list coefficients(self): """ Return the list of coefficients. @@ -485,7 +485,7 @@ cdef class PathAlgebraElement(RingElement): H = H.nxt return L - cpdef list monomials(self) noexcept: + cpdef list monomials(self): """ Return the list of monomials appearing in this element. @@ -547,7 +547,7 @@ cdef class PathAlgebraElement(RingElement): H = H.nxt return L - cpdef list terms(self) noexcept: + cpdef list terms(self): """ Return the list of terms. @@ -600,7 +600,7 @@ cdef class PathAlgebraElement(RingElement): H = H.nxt return L - cpdef list support(self) noexcept: + cpdef list support(self): """ Return the list of monomials, as elements of the underlying partial semigroup. @@ -685,7 +685,7 @@ cdef class PathAlgebraElement(RingElement): return tmp raise ValueError("{} is not a single term".format(self)) - cpdef object coefficient(self, QuiverPath P) noexcept: + cpdef object coefficient(self, QuiverPath P): """ Return the coefficient of a monomial. @@ -775,7 +775,7 @@ cdef class PathAlgebraElement(RingElement): T = T.nxt H = H.nxt - cdef PathAlgebraElement _new_(self, path_homog_poly_t *h) noexcept: + cdef PathAlgebraElement _new_(self, path_homog_poly_t *h): """ Create a new path algebra element from C interface data. """ @@ -941,7 +941,7 @@ cdef class PathAlgebraElement(RingElement): self._hash = hash(frozenset(self.monomial_coefficients().items())) return self._hash - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Helper for comparison of path algebra elements. @@ -999,7 +999,7 @@ cdef class PathAlgebraElement(RingElement): return rich_to_bool(op, 1) # negation - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ EXAMPLES:: @@ -1013,7 +1013,7 @@ cdef class PathAlgebraElement(RingElement): return self._new_(homog_poly_neg(self.data)) # addition - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): """ EXAMPLES:: @@ -1089,7 +1089,7 @@ cdef class PathAlgebraElement(RingElement): H1 = H1.nxt H2 = H2.nxt - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): """ EXAMPLES:: @@ -1178,7 +1178,7 @@ cdef class PathAlgebraElement(RingElement): # (scalar) multiplication - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ EXAMPLES:: @@ -1208,7 +1208,7 @@ cdef class PathAlgebraElement(RingElement): return self._new_(outnxt) return self._new_(out) - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): """ EXAMPLES:: @@ -1275,7 +1275,7 @@ cdef class PathAlgebraElement(RingElement): # Multiplication in the algebra - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): """ EXAMPLES:: @@ -1381,7 +1381,7 @@ cdef class PathAlgebraElement(RingElement): tmp = tmp.nxt return self._new_(out_orig) -cpdef PathAlgebraElement path_algebra_element_unpickle(P, list data) noexcept: +cpdef PathAlgebraElement path_algebra_element_unpickle(P, list data): """ Auxiliary function for unpickling. diff --git a/src/sage/quivers/paths.pxd b/src/sage/quivers/paths.pxd index 88bfe92ca0f..5757bf6e219 100644 --- a/src/sage/quivers/paths.pxd +++ b/src/sage/quivers/paths.pxd @@ -4,9 +4,9 @@ from sage.data_structures.bounded_integer_sequences cimport biseq_t cdef class QuiverPath(MonoidElement): cdef biseq_t _path cdef int _start, _end - cdef QuiverPath _new_(self, int start, int end) noexcept - cpdef _mul_(self, other) noexcept - cpdef _mod_(self, right) noexcept - cpdef tuple complement(self, QuiverPath subpath) noexcept + cdef QuiverPath _new_(self, int start, int end) + cpdef _mul_(self, other) + cpdef _mod_(self, right) + cpdef tuple complement(self, QuiverPath subpath) cpdef bint has_subpath(self, QuiverPath subpath) except -1 cpdef bint has_prefix(self, QuiverPath subpath) except -1 diff --git a/src/sage/quivers/paths.pyx b/src/sage/quivers/paths.pyx index 12cd7b4ad1e..aead99670ab 100644 --- a/src/sage/quivers/paths.pyx +++ b/src/sage/quivers/paths.pyx @@ -109,7 +109,7 @@ cdef class QuiverPath(MonoidElement): """ biseq_dealloc(self._path) - cdef QuiverPath _new_(self, int start, int end) noexcept: + cdef QuiverPath _new_(self, int start, int end): """ TESTS:: @@ -260,7 +260,7 @@ cdef class QuiverPath(MonoidElement): """ return self._path.length != 0 - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Comparison for :class:`QuiverPaths`. @@ -465,7 +465,7 @@ cdef class QuiverPath(MonoidElement): for i in range(self._path.length): yield E[biseq_getitem(self._path, i)] - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): """ Compose two paths. @@ -503,7 +503,7 @@ cdef class QuiverPath(MonoidElement): biseq_init_concat(OUT._path, self._path,right._path) return OUT - cpdef _mod_(self, other) noexcept: + cpdef _mod_(self, other): """ Return what remains of this path after removing the initial segment ``other``. @@ -606,7 +606,7 @@ cdef class QuiverPath(MonoidElement): return (None, None, None) return (self[:i], self[i:], P[self._path.length-i:]) - cpdef tuple complement(self, QuiverPath subpath) noexcept: + cpdef tuple complement(self, QuiverPath subpath): """ Return a pair ``(a,b)`` of paths s.t. ``self = a*subpath*b``, or ``(None, None)`` if ``subpath`` is not a subpath of this path. diff --git a/src/sage/rings/complex_arb.pxd b/src/sage/rings/complex_arb.pxd index a0836e8876c..4cd016d0798 100644 --- a/src/sage/rings/complex_arb.pxd +++ b/src/sage/rings/complex_arb.pxd @@ -14,15 +14,15 @@ cdef int acb_to_ComplexIntervalFieldElement( cdef class ComplexBall(RingElement): cdef acb_t value - cdef ComplexBall _new(self) noexcept - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cpdef ComplexIntervalFieldElement _complex_mpfi_(self, parent) noexcept - cpdef RealBall real(self) noexcept - cpdef RealBall imag(self) noexcept - cpdef pow(self, expo, analytic=?) noexcept + cdef ComplexBall _new(self) + cpdef _add_(self, other) + cpdef _mul_(self, other) + cpdef ComplexIntervalFieldElement _complex_mpfi_(self, parent) + cpdef RealBall real(self) + cpdef RealBall imag(self) + cpdef pow(self, expo, analytic=?) - cdef inline ComplexBall _new(self) noexcept: + cdef inline ComplexBall _new(self): cdef ComplexBall res = ComplexBall.__new__(ComplexBall) res._parent = self._parent return res diff --git a/src/sage/rings/complex_arb.pyx b/src/sage/rings/complex_arb.pyx index 91ecbe29425..cb4ee0ff6b8 100644 --- a/src/sage/rings/complex_arb.pyx +++ b/src/sage/rings/complex_arb.pyx @@ -1300,7 +1300,7 @@ cdef bint arb_gt_neg_one(arb_t b) noexcept: arb_clear(neg_one) return res -cdef inline real_ball_field(ComplexBall ball) noexcept: +cdef inline real_ball_field(ComplexBall ball): return ball._parent._base cdef class ComplexBall(RingElement): @@ -1552,7 +1552,7 @@ cdef class ComplexBall(RingElement): # Conversions - cpdef ComplexIntervalFieldElement _complex_mpfi_(self, parent) noexcept: + cpdef ComplexIntervalFieldElement _complex_mpfi_(self, parent): """ Return :class:`ComplexIntervalFieldElement` of the same value. @@ -1811,7 +1811,7 @@ cdef class ComplexBall(RingElement): # Real and imaginary part, midpoint, radius - cpdef RealBall real(self) noexcept: + cpdef RealBall real(self): """ Return the real part of this ball. @@ -1832,7 +1832,7 @@ cdef class ComplexBall(RingElement): arb_set(r.value, acb_realref(self.value)) return r - cpdef RealBall imag(self) noexcept: + cpdef RealBall imag(self): """ Return the imaginary part of this ball. @@ -2337,7 +2337,7 @@ cdef class ComplexBall(RingElement): """ return acb_is_real(self.value) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Compare ``left`` and ``right``. @@ -2624,7 +2624,7 @@ cdef class ComplexBall(RingElement): acb_conj(res.value, self.value) return res - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): """ Return the sum of two balls, rounded to the ambient field's precision. @@ -2642,7 +2642,7 @@ cdef class ComplexBall(RingElement): if _do_sig(prec(self)): sig_off() return res - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): """ Return the difference of two balls, rounded to the ambient field's precision. @@ -2683,7 +2683,7 @@ cdef class ComplexBall(RingElement): if _do_sig(prec(self)): sig_off() return res - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): """ Return the product of two balls, rounded to the ambient field's precision. @@ -2783,7 +2783,7 @@ cdef class ComplexBall(RingElement): raise TypeError("unsupported operand type(s) for >>: '{}' and '{}'" .format(type(val).__name__, type(shift).__name__)) - cpdef _div_(self, other) noexcept: + cpdef _div_(self, other): """ Return the quotient of two balls, rounded to the ambient field's precision. @@ -2850,7 +2850,7 @@ cdef class ComplexBall(RingElement): else: return sage.structure.element.bin_op(base, expo, operator.pow) - cpdef pow(self, expo, analytic=False) noexcept: + cpdef pow(self, expo, analytic=False): r""" Raise this ball to the power of ``expo``. diff --git a/src/sage/rings/complex_conversion.pxd b/src/sage/rings/complex_conversion.pxd index d6144974f9a..2053005e340 100644 --- a/src/sage/rings/complex_conversion.pxd +++ b/src/sage/rings/complex_conversion.pxd @@ -4,4 +4,4 @@ from sage.categories.map cimport Map cdef class CCtoCDF(Map): - cpdef Element _call_(self, x) noexcept + cpdef Element _call_(self, x) diff --git a/src/sage/rings/complex_conversion.pyx b/src/sage/rings/complex_conversion.pyx index 027c4426ea1..f601b4d5420 100644 --- a/src/sage/rings/complex_conversion.pyx +++ b/src/sage/rings/complex_conversion.pyx @@ -5,7 +5,7 @@ from sage.libs.gsl.complex cimport GSL_SET_COMPLEX cdef class CCtoCDF(Map): - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: sage: from sage.rings.complex_conversion import CCtoCDF diff --git a/src/sage/rings/complex_double.pxd b/src/sage/rings/complex_double.pxd index f2af4bd67b7..7352520c769 100644 --- a/src/sage/rings/complex_double.pxd +++ b/src/sage/rings/complex_double.pxd @@ -10,10 +10,10 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): cdef class ComplexDoubleElement(sage.structure.element.FieldElement): cdef gsl_complex _complex - cdef ComplexDoubleElement _new_c(self, gsl_complex x) noexcept - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cpdef _pow_(self, other) noexcept + cdef ComplexDoubleElement _new_c(self, gsl_complex x) + cpdef _add_(self, other) + cpdef _mul_(self, other) + cpdef _pow_(self, other) -cdef ComplexDoubleElement new_ComplexDoubleElement() noexcept +cdef ComplexDoubleElement new_ComplexDoubleElement() diff --git a/src/sage/rings/complex_double.pyx b/src/sage/rings/complex_double.pyx index 0b2096fbc3e..1dfa7dbd505 100644 --- a/src/sage/rings/complex_double.pyx +++ b/src/sage/rings/complex_double.pyx @@ -377,7 +377,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): else: return ComplexDoubleElement(x, 0) - cpdef _coerce_map_from_(self, S) noexcept: + cpdef _coerce_map_from_(self, S): """ Return the canonical coerce of `x` into the complex double field, if it is defined, otherwise raise a ``TypeError``. @@ -691,7 +691,7 @@ cdef class ComplexDoubleField_class(sage.rings.abc.ComplexDoubleField): return Factorization([(x - a, 1) for a in roots], unit) -cdef ComplexDoubleElement new_ComplexDoubleElement() noexcept: +cdef ComplexDoubleElement new_ComplexDoubleElement(): """ Creates a new (empty) :class:`ComplexDoubleElement`. """ @@ -761,7 +761,7 @@ cdef class ComplexDoubleElement(FieldElement): return (ComplexDoubleElement, (GSL_REAL(self._complex), GSL_IMAG(self._complex))) - cdef ComplexDoubleElement _new_c(self, gsl_complex x) noexcept: + cdef ComplexDoubleElement _new_c(self, gsl_complex x): """ C-level code for creating a :class:`ComplexDoubleElement` from a ``gsl_complex``. @@ -786,7 +786,7 @@ cdef class ComplexDoubleElement(FieldElement): """ return hash(complex(self)) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ We order the complex numbers in dictionary order by real parts then imaginary parts. @@ -1158,7 +1158,7 @@ cdef class ComplexDoubleElement(FieldElement): # Arithmetic ####################################################################### - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add ``self`` and ``right``. @@ -1170,7 +1170,7 @@ cdef class ComplexDoubleElement(FieldElement): return self._new_c(gsl_complex_add(self._complex, (right)._complex)) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract ``self`` and ``right``. @@ -1182,7 +1182,7 @@ cdef class ComplexDoubleElement(FieldElement): return self._new_c(gsl_complex_sub(self._complex, (right)._complex)) - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiply ``self`` and ``right``. @@ -1194,7 +1194,7 @@ cdef class ComplexDoubleElement(FieldElement): return self._new_c(gsl_complex_mul(self._complex, (right)._complex)) - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Divide ``self`` by ``right``. @@ -1228,7 +1228,7 @@ cdef class ComplexDoubleElement(FieldElement): """ return self._new_c(gsl_complex_inverse(self._complex)) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ This function returns the negative of the complex number `z`: @@ -1615,7 +1615,7 @@ cdef class ComplexDoubleElement(FieldElement): """ return self.real().is_NaN() or self.imag().is_NaN() - cpdef _pow_(self, other) noexcept: + cpdef _pow_(self, other): r""" The complex number ``self`` raised to the power ``other``. @@ -1681,7 +1681,7 @@ cdef class ComplexDoubleElement(FieldElement): z = other return self._new_c(gsl_complex_pow(self._complex, z._complex)) - cdef _pow_long(self, long other) noexcept: + cdef _pow_long(self, long other): if other == 1: return self elif other == 0: @@ -1697,7 +1697,7 @@ cdef class ComplexDoubleElement(FieldElement): res = gsl_complex_pow_real(self._complex, other) return self._new_c(res) - cpdef _pow_int(self, other) noexcept: + cpdef _pow_int(self, other): if not GSL_IMAG(self._complex): # If self is real, the result should be real too real = GSL_REAL(self._complex) ** other @@ -2515,7 +2515,7 @@ cdef class FloatToCDF(Morphism): R = Set_PythonType(R) Morphism.__init__(self, Hom(R, CDF)) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Create an :class:`ComplexDoubleElement`. @@ -2566,7 +2566,7 @@ cdef class ComplexToCDF(Morphism): R = Set_PythonType(R) Morphism.__init__(self, Hom(R, CDF)) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Create an :class:`ComplexDoubleElement`. @@ -2630,7 +2630,7 @@ cdef inline double complex extract_double_complex(ComplexDoubleElement x) noexce return z -cdef inline ComplexDoubleElement ComplexDoubleElement_from_doubles(double re, double im) noexcept: +cdef inline ComplexDoubleElement ComplexDoubleElement_from_doubles(double re, double im): """ Create a new :class:`ComplexDoubleElement` with the specified real and imaginary parts. diff --git a/src/sage/rings/complex_interval.pxd b/src/sage/rings/complex_interval.pxd index 60d8c010cd8..f5c59de4d7a 100644 --- a/src/sage/rings/complex_interval.pxd +++ b/src/sage/rings/complex_interval.pxd @@ -11,7 +11,7 @@ cdef class ComplexIntervalFieldElement(sage.structure.element.FieldElement): cdef mpfr_prec_t _prec cdef object _multiplicative_order - cdef inline ComplexIntervalFieldElement _new(self) noexcept: + cdef inline ComplexIntervalFieldElement _new(self): """ Quickly create a new complex interval with the same parent as ``self``. @@ -20,7 +20,7 @@ cdef class ComplexIntervalFieldElement(sage.structure.element.FieldElement): cdef object _multiplicative_order = None return t.__new__(t, self._parent) - cdef inline RealIntervalFieldElement _new_real(self) noexcept: + cdef inline RealIntervalFieldElement _new_real(self): """ Quickly create a new real interval with the same precision as ``self``. diff --git a/src/sage/rings/complex_interval.pyx b/src/sage/rings/complex_interval.pyx index 0fda5443a1a..d272a8e81db 100644 --- a/src/sage/rings/complex_interval.pyx +++ b/src/sage/rings/complex_interval.pyx @@ -681,7 +681,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): """ return mpfi_has_zero(self.__re) and mpfi_has_zero(self.__im) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add ``self`` and ``right``. @@ -695,7 +695,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): mpfi_add(x.__im, self.__im, (right).__im) return x - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract ``self`` by ``right``. @@ -709,7 +709,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): mpfi_sub(x.__im, self.__im, (right).__im) return x - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiply ``self`` and ``right``. @@ -779,7 +779,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): mpfi_clear(t) return x - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Divide ``self`` by ``right``. @@ -1512,7 +1512,7 @@ cdef class ComplexIntervalFieldElement(FieldElement): """ return bool(self.real()) or bool(self.imag()) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): r""" As with the real interval fields this never returns false positives. diff --git a/src/sage/rings/complex_mpc.pxd b/src/sage/rings/complex_mpc.pxd index 60b3e739f83..1c65618578b 100644 --- a/src/sage/rings/complex_mpc.pxd +++ b/src/sage/rings/complex_mpc.pxd @@ -6,9 +6,9 @@ from sage.rings.ring cimport Field cdef class MPComplexNumber(sage.structure.element.FieldElement): cdef mpc_t value cdef char init - cdef MPComplexNumber _new(self) noexcept - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept + cdef MPComplexNumber _new(self) + cpdef _add_(self, other) + cpdef _mul_(self, other) cdef class MPComplexField_class(Field): cdef readonly int _prec @@ -16,5 +16,5 @@ cdef class MPComplexField_class(Field): cdef object __rnd_str cdef object __real_field cdef object __imag_field - cdef MPComplexNumber _new(self) noexcept - cpdef _an_element_(self) noexcept + cdef MPComplexNumber _new(self) + cpdef _an_element_(self) diff --git a/src/sage/rings/complex_mpc.pyx b/src/sage/rings/complex_mpc.pyx index d06c6a386f9..79501000200 100644 --- a/src/sage/rings/complex_mpc.pyx +++ b/src/sage/rings/complex_mpc.pyx @@ -145,7 +145,7 @@ complex_ten = '(?P(?P' + sign + r')?\s*(?P' + sign + r')\s*(?P' + imaginary_ten + '))?)' re_complex_ten = re.compile(r'^\s*(?:' + complex_ten + r')\s*$', re.I) -cpdef inline split_complex_string(string, int base=10) noexcept: +cpdef inline split_complex_string(string, int base=10): """ Split and return in that order the real and imaginary parts of a complex in a string. @@ -323,7 +323,7 @@ cdef class MPComplexField_class(Field): category=Fields().Infinite()) self._populate_coercion_lists_(coerce_list=[MPFRtoMPC(self._real_field(), self)]) - cdef MPComplexNumber _new(self) noexcept: + cdef MPComplexNumber _new(self): """ Return a new complex number with parent ``self`. """ @@ -437,7 +437,7 @@ cdef class MPComplexField_class(Field): zz._set(z) return zz - cpdef _coerce_map_from_(self, S) noexcept: + cpdef _coerce_map_from_(self, S): """ Canonical coercion of `z` to this mpc complex field. @@ -539,7 +539,7 @@ cdef class MPComplexField_class(Field): """ return 1 - cpdef _an_element_(self) noexcept: + cpdef _an_element_(self): """ Return an element of this complex field. @@ -699,7 +699,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): A floating point approximation to a complex number using any specified precision common to both real and imaginary part. """ - cdef MPComplexNumber _new(self) noexcept: + cdef MPComplexNumber _new(self): """ Return a new complex number with same parent as ``self``. """ @@ -1259,7 +1259,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): """ return gmpy2.GMPy_MPC_From_mpfr(self.value.re, self.value.im) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): r""" Compare ``self`` to ``other``. @@ -1376,7 +1376,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): # Basic Arithmetic ################################ - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add two complex numbers with the same parent. @@ -1391,7 +1391,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): mpc_add(z.value, self.value, (right).value, (self._parent).__rnd) return z - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract two complex numbers with the same parent. @@ -1406,7 +1406,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): mpc_sub(z.value, self.value, (right).value, (self._parent).__rnd) return z - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiply two complex numbers with the same parent. @@ -1421,7 +1421,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): mpc_mul(z.value, self.value, (right).value, (self._parent).__rnd) return z - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Divide two complex numbers with the same parent. @@ -1440,7 +1440,7 @@ cdef class MPComplexNumber(sage.structure.element.FieldElement): mpc_div(z.value, self.value, x.value, (self._parent).__rnd) return z - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Return the negative of this complex number. @@ -2445,7 +2445,7 @@ __create_MPComplexNumber_version0 = __create__MPComplexNumber_version0 #***************************************************************************** cdef class MPCtoMPC(Map): - cpdef Element _call_(self, z) noexcept: + cpdef Element _call_(self, z): """ EXAMPLES:: @@ -2482,7 +2482,7 @@ cdef class MPCtoMPC(Map): return MPCtoMPC(self.codomain(), self.domain()) cdef class INTEGERtoMPC(Map): - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: @@ -2505,7 +2505,7 @@ cdef class INTEGERtoMPC(Map): return y cdef class MPFRtoMPC(Map): - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: @@ -2529,7 +2529,7 @@ cdef class MPFRtoMPC(Map): return y cdef class CCtoMPC(Map): - cpdef Element _call_(self, z) noexcept: + cpdef Element _call_(self, z): """ EXAMPLES:: diff --git a/src/sage/rings/complex_mpfr.pxd b/src/sage/rings/complex_mpfr.pxd index 95972c52bb5..385feec8c37 100644 --- a/src/sage/rings/complex_mpfr.pxd +++ b/src/sage/rings/complex_mpfr.pxd @@ -9,9 +9,9 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): cdef mpfr_prec_t _prec cdef object _multiplicative_order - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cdef RealNumber abs_c(ComplexNumber self) noexcept - cdef RealNumber norm_c(ComplexNumber self) noexcept + cpdef _add_(self, other) + cpdef _mul_(self, other) + cdef RealNumber abs_c(ComplexNumber self) + cdef RealNumber norm_c(ComplexNumber self) - cdef ComplexNumber _new(self) noexcept + cdef ComplexNumber _new(self) diff --git a/src/sage/rings/complex_mpfr.pyx b/src/sage/rings/complex_mpfr.pyx index f2d09cc1605..616a25241b0 100644 --- a/src/sage/rings/complex_mpfr.pyx +++ b/src/sage/rings/complex_mpfr.pyx @@ -888,7 +888,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): True """ - cdef ComplexNumber _new(self) noexcept: + cdef ComplexNumber _new(self): """ Quickly creates a new initialized complex number with the same parent as ``self``. @@ -1481,7 +1481,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): import sympy return self.real()._sympy_() + self.imag()._sympy_() * sympy.I - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add ``self`` to ``right``. @@ -1496,7 +1496,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): mpfr_add(x.__im, self.__im, (right).__im, rnd) return x - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract ``right`` from ``self``. @@ -1511,7 +1511,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): mpfr_sub(x.__im, self.__im, (right).__im, rnd) return x - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiply ``self`` by ``right``. @@ -1580,7 +1580,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): """ return self.norm_c() - cdef RealNumber norm_c(ComplexNumber self) noexcept: + cdef RealNumber norm_c(ComplexNumber self): cdef RealNumber x x = RealNumber(self._parent._real_field(), None) @@ -1597,7 +1597,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): mpfr_clear(t1) return x - cdef RealNumber abs_c(ComplexNumber self) noexcept: + cdef RealNumber abs_c(ComplexNumber self): cdef RealNumber x x = RealNumber(self._parent._real_field(), None) @@ -1615,7 +1615,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): mpfr_clear(t1) return x - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Divide ``self`` by ``right``. @@ -1972,7 +1972,7 @@ cdef class ComplexNumber(sage.structure.element.FieldElement): return complex(mpfr_get_d(self.__re, rnd), mpfr_get_d(self.__im, rnd)) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Compare ``left`` and ``right``. @@ -3361,7 +3361,7 @@ cdef class RRtoCC(Map): self._zero = ComplexNumber(CC, 0) self._repr_type_str = "Natural" - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ A helper for pickling and copying. @@ -3387,7 +3387,7 @@ cdef class RRtoCC(Map): slots['_zero'] = self._zero return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ A helper for unpickling and copying. @@ -3406,7 +3406,7 @@ cdef class RRtoCC(Map): Map._update_slots(self, _slots) self._zero = _slots['_zero'] - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: diff --git a/src/sage/rings/factorint.pyx b/src/sage/rings/factorint.pyx index 339d2c22b2d..3571c74bd8d 100644 --- a/src/sage/rings/factorint.pyx +++ b/src/sage/rings/factorint.pyx @@ -30,7 +30,7 @@ from sage.misc.misc_c import prod cdef extern from "limits.h": long LONG_MAX -cpdef aurifeuillian(n, m, F=None, bint check=True) noexcept: +cpdef aurifeuillian(n, m, F=None, bint check=True): r""" Return the Aurifeuillian factors `F_n^\pm(m^2n)`. @@ -120,7 +120,7 @@ cpdef aurifeuillian(n, m, F=None, bint check=True) noexcept: assert (not check or Fm.divides(F)) return [Fm, F // Fm] -cpdef factor_aurifeuillian(n, check=True) noexcept: +cpdef factor_aurifeuillian(n, check=True): r""" Return Aurifeuillian factors of `n` if `n = x^{(2k-1)x} \pm 1` (where the sign is '-' if x = 1 mod 4, and '+' otherwise) else `n` @@ -252,7 +252,7 @@ def factor_cunningham(m, proof=None): else: return IntegerFactorization(L)*n.factor(proof=proof) -cpdef factor_trial_division(m, long limit=LONG_MAX) noexcept: +cpdef factor_trial_division(m, long limit=LONG_MAX): r""" Return partial factorization of ``self`` obtained using trial division for all primes up to ``limit``, where ``limit`` must fit in a C ``signed long``. diff --git a/src/sage/rings/fast_arith.pxd b/src/sage/rings/fast_arith.pxd index c13e5e36548..7a99e658b91 100644 --- a/src/sage/rings/fast_arith.pxd +++ b/src/sage/rings/fast_arith.pxd @@ -1,4 +1,4 @@ -cpdef prime_range(start, stop=*, algorithm=*, bint py_ints=*) noexcept +cpdef prime_range(start, stop=*, algorithm=*, bint py_ints=*) cdef class arith_int: cdef int abs_int(self, int x) except -1 diff --git a/src/sage/rings/fast_arith.pyx b/src/sage/rings/fast_arith.pyx index fae966e4f6c..4796122c1b6 100644 --- a/src/sage/rings/fast_arith.pyx +++ b/src/sage/rings/fast_arith.pyx @@ -40,7 +40,7 @@ from libc.math cimport sqrt from sage.rings.integer cimport Integer -cpdef prime_range(start, stop=None, algorithm=None, bint py_ints=False) noexcept: +cpdef prime_range(start, stop=None, algorithm=None, bint py_ints=False): r""" Return a list of all primes between ``start`` and ``stop - 1``, inclusive. diff --git a/src/sage/rings/finite_rings/element_base.pxd b/src/sage/rings/finite_rings/element_base.pxd index ec09f9cc769..c214e4745a9 100644 --- a/src/sage/rings/finite_rings/element_base.pxd +++ b/src/sage/rings/finite_rings/element_base.pxd @@ -8,5 +8,5 @@ cdef class FinitePolyExtElement(FiniteRingElement): pass cdef class Cache_base(SageObject): - cpdef FinitePolyExtElement fetch_int(self, number) noexcept + cpdef FinitePolyExtElement fetch_int(self, number) diff --git a/src/sage/rings/finite_rings/element_base.pyx b/src/sage/rings/finite_rings/element_base.pyx index 42ca25b930e..f6a450edfa2 100755 --- a/src/sage/rings/finite_rings/element_base.pyx +++ b/src/sage/rings/finite_rings/element_base.pyx @@ -1136,7 +1136,7 @@ cdef class FinitePolyExtElement(FiniteRingElement): return self.to_integer().to_bytes(length=length, byteorder=byteorder) cdef class Cache_base(SageObject): - cpdef FinitePolyExtElement fetch_int(self, number) noexcept: + cpdef FinitePolyExtElement fetch_int(self, number): r""" Given an integer less than `p^n` with base `2` representation `a_0 + a_1 \cdot 2 + \cdots + a_k 2^k`, this returns diff --git a/src/sage/rings/finite_rings/element_givaro.pxd b/src/sage/rings/finite_rings/element_givaro.pxd index 1e5c4b46527..4b1e0430a1c 100644 --- a/src/sage/rings/finite_rings/element_givaro.pxd +++ b/src/sage/rings/finite_rings/element_givaro.pxd @@ -62,7 +62,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): cdef int element cdef Cache_givaro _cache cdef object _multiplicative_order - cdef FiniteField_givaroElement _new_c(self, int value) noexcept + cdef FiniteField_givaroElement _new_c(self, int value) cdef class Cache_givaro(Cache_base): cdef GivaroGfq *objectptr # C++ object @@ -73,13 +73,13 @@ cdef class Cache_givaro(Cache_base): cdef bint _has_array cdef bint _is_conway cdef Parent parent - cdef gen_array(self) noexcept + cdef gen_array(self) cpdef int exponent(self) noexcept cpdef int order_c(self) noexcept cpdef int characteristic(self) noexcept - cpdef FiniteField_givaroElement gen(self) noexcept - cpdef FiniteField_givaroElement element_from_data(self, e) noexcept - cdef FiniteField_givaroElement _new_c(self, int value) noexcept + cpdef FiniteField_givaroElement gen(self) + cpdef FiniteField_givaroElement element_from_data(self, e) + cdef FiniteField_givaroElement _new_c(self, int value) cpdef int int_to_log(self, int i) except -1 cpdef int log_to_int(self, int i) except -1 @@ -87,4 +87,4 @@ cdef class FiniteField_givaro_iterator: cdef int iterator cdef Cache_givaro _cache -cdef FiniteField_givaroElement make_FiniteField_givaroElement(Cache_givaro cache, int x) noexcept +cdef FiniteField_givaroElement make_FiniteField_givaroElement(Cache_givaro cache, int x) diff --git a/src/sage/rings/finite_rings/element_givaro.pyx b/src/sage/rings/finite_rings/element_givaro.pyx index fc53c30d180..c9b9e323181 100644 --- a/src/sage/rings/finite_rings/element_givaro.pyx +++ b/src/sage/rings/finite_rings/element_givaro.pyx @@ -209,7 +209,7 @@ cdef class Cache_givaro(Cache_base): self._array = self.gen_array() self._has_array = True - cdef gen_array(self) noexcept: + cdef gen_array(self): """ Generates an array/list/tuple containing all elements of ``self`` indexed by their power with respect to the internal generator. @@ -296,7 +296,7 @@ cdef class Cache_givaro(Cache_base): self.objectptr.random(generator, res) return make_FiniteField_givaroElement(self, res) - cpdef FiniteField_givaroElement element_from_data(self, e) noexcept: + cpdef FiniteField_givaroElement element_from_data(self, e): """ Coerces several data types to ``self``. @@ -471,7 +471,7 @@ cdef class Cache_givaro(Cache_base): return make_FiniteField_givaroElement(self, res) - cpdef FiniteField_givaroElement gen(self) noexcept: + cpdef FiniteField_givaroElement gen(self): """ Return a generator of the field. @@ -551,7 +551,7 @@ cdef class Cache_givaro(Cache_base): sig_off() return r - cpdef FiniteField_givaroElement fetch_int(self, number) noexcept: + cpdef FiniteField_givaroElement fetch_int(self, number): r""" Given an integer ``n`` return a finite field element in ``self`` which equals ``n`` under the condition that :meth:`gen()` is set to @@ -759,7 +759,7 @@ cdef class Cache_givaro(Cache_base): rep = 'int' return unpickle_Cache_givaro, (self.parent, p, k, self.parent.polynomial(), rep, self._has_array) - cdef FiniteField_givaroElement _new_c(self, int value) noexcept: + cdef FiniteField_givaroElement _new_c(self, int value): return make_FiniteField_givaroElement(self, value) @@ -877,7 +877,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): self._cache = parent._cache self.element = 0 - cdef FiniteField_givaroElement _new_c(self, int value) noexcept: + cdef FiniteField_givaroElement _new_c(self, int value): return make_FiniteField_givaroElement(self._cache, value) def __dealloc__(FiniteField_givaroElement self): @@ -1081,7 +1081,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): else: raise ValueError("must be a perfect square.") - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add two elements. @@ -1096,7 +1096,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): (right).element) return make_FiniteField_givaroElement(self._cache, r) - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiply two elements. @@ -1113,7 +1113,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): (right).element) return make_FiniteField_givaroElement(self._cache, r) - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Divide two elements @@ -1135,7 +1135,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): (right).element) return make_FiniteField_givaroElement(self._cache, r) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract two elements. @@ -1286,7 +1286,7 @@ cdef class FiniteField_givaroElement(FinitePolyExtElement): return make_FiniteField_givaroElement(cache, cache.objectptr.one) return make_FiniteField_givaroElement(cache, r) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Comparison of finite field elements is correct or equality tests and somewhat random for ``<`` and ``>`` type of @@ -1743,7 +1743,7 @@ def unpickle_FiniteField_givaroElement(parent, int x): from sage.misc.persist import register_unpickle_override register_unpickle_override('sage.rings.finite_field_givaro', 'unpickle_FiniteField_givaroElement', unpickle_FiniteField_givaroElement) -cdef inline FiniteField_givaroElement make_FiniteField_givaroElement(Cache_givaro cache, int x) noexcept: +cdef inline FiniteField_givaroElement make_FiniteField_givaroElement(Cache_givaro cache, int x): cdef FiniteField_givaroElement y if cache._has_array: diff --git a/src/sage/rings/finite_rings/element_ntl_gf2e.pxd b/src/sage/rings/finite_rings/element_ntl_gf2e.pxd index b699f6e3ef6..e98744413b5 100644 --- a/src/sage/rings/finite_rings/element_ntl_gf2e.pxd +++ b/src/sage/rings/finite_rings/element_ntl_gf2e.pxd @@ -13,9 +13,9 @@ cdef class Cache_ntl_gf2e(Cache_base): cdef public FiniteField_ntl_gf2eElement _gen cdef Integer _order cdef Integer _degree - cdef FiniteField_ntl_gf2eElement _new(self) noexcept + cdef FiniteField_ntl_gf2eElement _new(self) cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): cdef GF2E_c x cdef Cache_ntl_gf2e _cache - cdef FiniteField_ntl_gf2eElement _new(FiniteField_ntl_gf2eElement self) noexcept + cdef FiniteField_ntl_gf2eElement _new(FiniteField_ntl_gf2eElement self) diff --git a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx index 4e10ef927a9..399bb76815b 100644 --- a/src/sage/rings/finite_rings/element_ntl_gf2e.pyx +++ b/src/sage/rings/finite_rings/element_ntl_gf2e.pyx @@ -96,7 +96,7 @@ cdef int late_import() except -1: cdef extern from "arpa/inet.h": unsigned int htonl(unsigned int) -cdef little_endian() noexcept: +cdef little_endian(): return htonl(1) != 1 cdef unsigned int switch_endianess(unsigned int i) noexcept: @@ -205,7 +205,7 @@ cdef class Cache_ntl_gf2e(Cache_base): mod_poly = GF2XModulus_GF2X(modulus) print(ccrepr(mod_poly)) - cdef FiniteField_ntl_gf2eElement _new(self) noexcept: + cdef FiniteField_ntl_gf2eElement _new(self): """ Return a new element in ``self``. Use this method to construct 'empty' elements. @@ -377,7 +377,7 @@ cdef class Cache_ntl_gf2e(Cache_base): raise ValueError("Cannot coerce element %s to this field." % e) - cpdef FiniteField_ntl_gf2eElement fetch_int(self, number) noexcept: + cpdef FiniteField_ntl_gf2eElement fetch_int(self, number): r""" Given an integer less than `p^n` with base `2` representation `a_0 + a_1 \cdot 2 + \cdots + a_k 2^k`, this returns @@ -511,7 +511,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): self._parent = parent (self._parent._cache).F.restore() - cdef FiniteField_ntl_gf2eElement _new(FiniteField_ntl_gf2eElement self) noexcept: + cdef FiniteField_ntl_gf2eElement _new(FiniteField_ntl_gf2eElement self): cdef FiniteField_ntl_gf2eElement y (self._parent._cache).F.restore() y = FiniteField_ntl_gf2eElement.__new__(FiniteField_ntl_gf2eElement) @@ -657,7 +657,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): else: return a - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add two elements. @@ -673,7 +673,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): GF2E_add(r.x, (self).x, (right).x) return r - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiply two elements. @@ -689,7 +689,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): GF2E_mul(r.x, (self).x, (right).x) return r - cpdef _div_(self, other) noexcept: + cpdef _div_(self, other): """ Divide two elements. @@ -712,7 +712,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): GF2E_div(r.x, self.x, o.x) return r - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract two elements. @@ -761,7 +761,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): cdef FiniteField_ntl_gf2eElement o = self._parent._cache._one_element return o._div_(self) - cdef _pow_long(self, long n) noexcept: + cdef _pow_long(self, long n): """ EXAMPLES:: @@ -800,7 +800,7 @@ cdef class FiniteField_ntl_gf2eElement(FinitePolyExtElement): GF2E_power(r.x, self.x, n) return r - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Comparison of finite field elements. diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pxd b/src/sage/rings/finite_rings/element_pari_ffelt.pxd index f80aeb55532..06aabcaa6d5 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pxd +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pxd @@ -7,6 +7,6 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): # This holds a reference to a PARI clone. cdef GEN val - cdef FiniteFieldElement_pari_ffelt _new(self) noexcept + cdef FiniteFieldElement_pari_ffelt _new(self) cdef void construct(self, GEN g) noexcept cdef int construct_from(self, x) except -1 diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx index b786ada00de..989b0e20b9e 100644 --- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx +++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx @@ -345,7 +345,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): if self.val is not NULL: gunclone_deep(self.val) - cdef FiniteFieldElement_pari_ffelt _new(self) noexcept: + cdef FiniteFieldElement_pari_ffelt _new(self): """ Create an empty element with the same parent as ``self``. """ @@ -599,7 +599,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): # immutable return self - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Comparison of finite field elements. @@ -660,7 +660,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): sig_off() return rich_to_bool(op, r) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Addition. @@ -676,7 +676,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): (right).val)) return x - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtraction. @@ -692,7 +692,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): (right).val)) return x - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiplication. @@ -708,7 +708,7 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement): (right).val)) return x - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Division. diff --git a/src/sage/rings/finite_rings/finite_field_base.pyx b/src/sage/rings/finite_rings/finite_field_base.pyx index fecb77cc376..2c49f3bc9ae 100644 --- a/src/sage/rings/finite_rings/finite_field_base.pyx +++ b/src/sage/rings/finite_rings/finite_field_base.pyx @@ -1318,7 +1318,7 @@ cdef class FiniteField(Field): return V, phi, psi - cpdef _coerce_map_from_(self, R) noexcept: + cpdef _coerce_map_from_(self, R): r""" Canonical coercion to ``self``. @@ -1389,7 +1389,7 @@ cdef class FiniteField(Field): and hasattr(self, '_prefix') and hasattr(R, '_prefix')): return R.hom((self.gen() ** ((self.order() - 1)//(R.order() - 1)),)) - cpdef _convert_map_from_(self, R) noexcept: + cpdef _convert_map_from_(self, R): """ Conversion from p-adic fields. diff --git a/src/sage/rings/finite_rings/hom_finite_field.pxd b/src/sage/rings/finite_rings/hom_finite_field.pxd index 64da809024f..199d655d6d6 100644 --- a/src/sage/rings/finite_rings/hom_finite_field.pxd +++ b/src/sage/rings/finite_rings/hom_finite_field.pxd @@ -11,7 +11,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): cdef _gen cdef _section_class - cpdef Element _call_(self, x) noexcept + cpdef Element _call_(self, x) cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic): @@ -19,4 +19,4 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic): cdef long _degree_fixed cdef long _order - cpdef Element _call_(self, x) noexcept + cpdef Element _call_(self, x) diff --git a/src/sage/rings/finite_rings/hom_finite_field.pyx b/src/sage/rings/finite_rings/hom_finite_field.pyx index b7bbd417273..8a83bf48766 100644 --- a/src/sage/rings/finite_rings/hom_finite_field.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field.pyx @@ -124,7 +124,7 @@ cdef class SectionFiniteFieldHomomorphism_generic(Section): """ A class implementing sections of embeddings between finite fields. """ - cpdef Element _call_(self, x) noexcept: # Not optimized + cpdef Element _call_(self, x): # Not optimized """ TESTS:: @@ -299,7 +299,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): """ return self.domain()._latex_() + " \\hookrightarrow " + self.codomain()._latex_() - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ TESTS:: @@ -436,7 +436,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): """ return Morphism.__hash__(self) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): r""" Helper function for copying and pickling @@ -464,7 +464,7 @@ cdef class FiniteFieldHomomorphism_generic(RingHomomorphism_im_gens): slots['_section_class'] = self._section_class return slots - cdef _update_slots(self, dict slots) noexcept: + cdef _update_slots(self, dict slots): r""" Helper function for copying and pickling @@ -619,7 +619,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic): return s - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ TESTS:: @@ -842,7 +842,7 @@ cdef class FrobeniusEndomorphism_finite_field(FrobeniusEndomorphism_generic): """ return Morphism.__hash__(self) - cdef _update_slots(self, dict slots) noexcept: + cdef _update_slots(self, dict slots): r""" Helper function for copying and pickling diff --git a/src/sage/rings/finite_rings/hom_finite_field_givaro.pxd b/src/sage/rings/finite_rings/hom_finite_field_givaro.pxd index f5a70c975f9..dc401d526c0 100644 --- a/src/sage/rings/finite_rings/hom_finite_field_givaro.pxd +++ b/src/sage/rings/finite_rings/hom_finite_field_givaro.pxd @@ -11,7 +11,7 @@ cdef class SectionFiniteFieldHomomorphism_givaro(SectionFiniteFieldHomomorphism_ cdef long _power cdef Cache_givaro _codomain_cache - cpdef Element _call_(self, x) noexcept + cpdef Element _call_(self, x) cdef class FiniteFieldHomomorphism_givaro(FiniteFieldHomomorphism_generic): @@ -20,7 +20,7 @@ cdef class FiniteFieldHomomorphism_givaro(FiniteFieldHomomorphism_generic): cdef long _power cdef Cache_givaro _codomain_cache - cpdef Element _call_(self, x) noexcept + cpdef Element _call_(self, x) cdef class FrobeniusEndomorphism_givaro(FrobeniusEndomorphism_finite_field): diff --git a/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx b/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx index eebd20056e7..0e67cb6f123 100644 --- a/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx +++ b/src/sage/rings/finite_rings/hom_finite_field_givaro.pyx @@ -100,7 +100,7 @@ cdef class SectionFiniteFieldHomomorphism_givaro(SectionFiniteFieldHomomorphism_ self._codomain_cache = ((self._codomain.gen()))._cache - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ TESTS:: @@ -182,7 +182,7 @@ cdef class FiniteFieldHomomorphism_givaro(FiniteFieldHomomorphism_generic): self._order_codomain = codomain.cardinality() - 1 - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ TESTS:: @@ -273,7 +273,7 @@ cdef class FrobeniusEndomorphism_givaro(FrobeniusEndomorphism_finite_field): # copied from element_givaro.pyx -cdef inline FiniteField_givaroElement make_FiniteField_givaroElement(Cache_givaro cache, int x) noexcept: +cdef inline FiniteField_givaroElement make_FiniteField_givaroElement(Cache_givaro cache, int x): cdef FiniteField_givaroElement y if cache._has_array: diff --git a/src/sage/rings/finite_rings/hom_prime_finite_field.pyx b/src/sage/rings/finite_rings/hom_prime_finite_field.pyx index 4fc2c832f90..e45de1d83f9 100644 --- a/src/sage/rings/finite_rings/hom_prime_finite_field.pyx +++ b/src/sage/rings/finite_rings/hom_prime_finite_field.pyx @@ -35,7 +35,7 @@ from sage.rings.finite_rings.finite_field_base import FiniteField cdef class SectionFiniteFieldHomomorphism_prime(SectionFiniteFieldHomomorphism_generic): - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): try: return self._codomain._element_constructor_(x) except TypeError: @@ -75,7 +75,7 @@ cdef class FiniteFieldHomomorphism_prime(FiniteFieldHomomorphism_generic): FiniteFieldHomomorphism_generic.__init__(self, parent, im_gens, base_map=base_map, check=check, section_class=section_class) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ TESTS:: @@ -104,7 +104,7 @@ cdef class FrobeniusEndomorphism_prime(FrobeniusEndomorphism_finite_field): self._order = 1 self._power = 0 - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ TESTS:: diff --git a/src/sage/rings/finite_rings/integer_mod.pxd b/src/sage/rings/finite_rings/integer_mod.pxd index 5d16bad880e..34e72472a3e 100644 --- a/src/sage/rings/finite_rings/integer_mod.pxd +++ b/src/sage/rings/finite_rings/integer_mod.pxd @@ -10,7 +10,7 @@ cdef class NativeIntStruct: cdef int_fast64_t int64 cdef readonly list table # list of elements of IntegerModRing(n) cdef readonly list inverses # list of inverses (None if not invertible) - cdef inline type element_class(self) noexcept: + cdef inline type element_class(self): if self.int32 > 0: return IntegerMod_int elif self.int64 > 0: @@ -21,34 +21,34 @@ cdef class NativeIntStruct: cdef class IntegerMod_abstract(FiniteRingElement): cdef NativeIntStruct _modulus - cdef _new_c_from_long(self, long value) noexcept - cdef IntegerMod_abstract _new_c_fast(self, unsigned long value) noexcept + cdef _new_c_from_long(self, long value) + cdef IntegerMod_abstract _new_c_fast(self, unsigned long value) cdef void set_from_mpz(self, mpz_t value) noexcept cdef void set_from_long(self, long value) noexcept cdef void set_from_ulong_fast(self, unsigned long value) noexcept cdef bint is_square_c(self) except -2 cpdef bint is_one(self) noexcept cpdef bint is_unit(self) noexcept - cpdef _floordiv_(self, other) noexcept + cpdef _floordiv_(self, other) cdef class IntegerMod_gmp(IntegerMod_abstract): cdef mpz_t value - cdef IntegerMod_gmp _new_c(self) noexcept - cdef shift(IntegerMod_gmp self, long k) noexcept + cdef IntegerMod_gmp _new_c(self) + cdef shift(IntegerMod_gmp self, long k) cdef class IntegerMod_int(IntegerMod_abstract): cdef int_fast32_t ivalue cdef void set_from_int(IntegerMod_int self, int_fast32_t value) noexcept cdef int_fast32_t get_int_value(IntegerMod_int self) noexcept - cdef IntegerMod_int _new_c(self, int_fast32_t value) noexcept - cdef shift(IntegerMod_int self, int k) noexcept + cdef IntegerMod_int _new_c(self, int_fast32_t value) + cdef shift(IntegerMod_int self, int k) cdef class IntegerMod_int64(IntegerMod_abstract): cdef int_fast64_t ivalue cdef void set_from_int(IntegerMod_int64 self, int_fast64_t value) noexcept cdef int_fast64_t get_int_value(IntegerMod_int64 self) noexcept - cdef IntegerMod_int64 _new_c(self, int_fast64_t value) noexcept - cdef shift(IntegerMod_int64 self, int k) noexcept + cdef IntegerMod_int64 _new_c(self, int_fast64_t value) + cdef shift(IntegerMod_int64 self, int k) cdef int_fast32_t mod_inverse_int(int_fast32_t x, int_fast32_t n) except 0 diff --git a/src/sage/rings/finite_rings/integer_mod.pyx b/src/sage/rings/finite_rings/integer_mod.pyx index 73746905821..9a3f02b6ef0 100644 --- a/src/sage/rings/finite_rings/integer_mod.pyx +++ b/src/sage/rings/finite_rings/integer_mod.pyx @@ -219,7 +219,7 @@ def is_IntegerMod(x): return isinstance(x, IntegerMod_abstract) -cdef inline inverse_or_None(x) noexcept: +cdef inline inverse_or_None(x): try: return ~x except ArithmeticError: @@ -393,7 +393,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): raise self.set_from_mpz(z.value) - cdef IntegerMod_abstract _new_c_fast(self, unsigned long value) noexcept: + cdef IntegerMod_abstract _new_c_fast(self, unsigned long value): cdef type t = type(self) x = t.__new__(t) x._parent = self._parent @@ -401,7 +401,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): x.set_from_ulong_fast(value) return x - cdef _new_c_from_long(self, long value) noexcept: + cdef _new_c_from_long(self, long value): cdef type t = type(self) cdef IntegerMod_abstract x = t.__new__(t) x._parent = self._parent @@ -1917,7 +1917,7 @@ cdef class IntegerMod_abstract(FiniteRingElement): return infinity return r - cpdef _floordiv_(self, right) noexcept: + cpdef _floordiv_(self, right): """ Exact division for prime moduli, for compatibility with other fields. @@ -1976,7 +1976,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): def __cinit__(self): mpz_init(self.value) - cdef IntegerMod_gmp _new_c(self) noexcept: + cdef IntegerMod_gmp _new_c(self): cdef IntegerMod_gmp x x = IntegerMod_gmp.__new__(IntegerMod_gmp) x._modulus = self._modulus @@ -2033,7 +2033,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): """ return self.shift(-long(k)) - cdef shift(IntegerMod_gmp self, long k) noexcept: + cdef shift(IntegerMod_gmp self, long k): r""" Performs a bit-shift specified by ``k`` on ``self``. @@ -2075,7 +2075,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): mpz_fdiv_q_2exp(x.value, self.value, -k) return x - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ EXAMPLES:: @@ -2176,7 +2176,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): # immutable return self - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ EXAMPLES:: @@ -2191,7 +2191,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): mpz_sub(x.value, x.value, self._modulus.sageInteger.value) return x - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ EXAMPLES:: @@ -2206,7 +2206,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): mpz_add(x.value, x.value, self._modulus.sageInteger.value) return x - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ EXAMPLES:: @@ -2222,7 +2222,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): mpz_sub(x.value, self._modulus.sageInteger.value, self.value) return x - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ EXAMPLES:: @@ -2236,7 +2236,7 @@ cdef class IntegerMod_gmp(IntegerMod_abstract): mpz_fdiv_r(x.value, x.value, self._modulus.sageInteger.value) return x - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ EXAMPLES:: @@ -2420,7 +2420,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): True """ - cdef IntegerMod_int _new_c(self, int_fast32_t value) noexcept: + cdef IntegerMod_int _new_c(self, int_fast32_t value): if self._modulus.table is not None: return self._modulus.table[value] cdef IntegerMod_int x = IntegerMod_int.__new__(IntegerMod_int) @@ -2451,7 +2451,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): cdef int_fast32_t get_int_value(IntegerMod_int self) noexcept: return self.ivalue - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): """ EXAMPLES:: @@ -2575,7 +2575,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): # immutable return self - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ EXAMPLES:: @@ -2589,7 +2589,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): x = x - self._modulus.int32 return self._new_c(x) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ EXAMPLES:: @@ -2603,7 +2603,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): x = x + self._modulus.int32 return self._new_c(x) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ EXAMPLES:: @@ -2616,7 +2616,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): return self return self._new_c(self._modulus.int32 - self.ivalue) - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ EXAMPLES:: @@ -2626,7 +2626,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): """ return self._new_c((self.ivalue * (right).ivalue) % self._modulus.int32) - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ EXAMPLES:: @@ -2699,7 +2699,7 @@ cdef class IntegerMod_int(IntegerMod_abstract): """ return self.shift(-int(k)) - cdef shift(IntegerMod_int self, int k) noexcept: + cdef shift(IntegerMod_int self, int k): """ Performs a bit-shift specified by ``k`` on ``self``. @@ -3252,7 +3252,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): - Robert Bradshaw (2006-09-14) """ - cdef IntegerMod_int64 _new_c(self, int_fast64_t value) noexcept: + cdef IntegerMod_int64 _new_c(self, int_fast64_t value): cdef IntegerMod_int64 x x = IntegerMod_int64.__new__(IntegerMod_int64) x._modulus = self._modulus @@ -3282,7 +3282,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): cdef int_fast64_t get_int_value(IntegerMod_int64 self) noexcept: return self.ivalue - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): """ EXAMPLES:: @@ -3411,7 +3411,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): # immutable return self - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ EXAMPLES:: @@ -3425,7 +3425,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): x = x - self._modulus.int64 return self._new_c(x) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ EXAMPLES:: @@ -3439,7 +3439,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): x = x + self._modulus.int64 return self._new_c(x) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ EXAMPLES:: @@ -3452,7 +3452,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): return self return self._new_c(self._modulus.int64 - self.ivalue) - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ EXAMPLES:: @@ -3463,7 +3463,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): return self._new_c((self.ivalue * (right).ivalue) % self._modulus.int64) - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ EXAMPLES:: @@ -3519,7 +3519,7 @@ cdef class IntegerMod_int64(IntegerMod_abstract): """ return self.shift(-int(k)) - cdef shift(IntegerMod_int64 self, int k) noexcept: + cdef shift(IntegerMod_int64 self, int k): """ Performs a bit-shift specified by ``k`` on ``self``. @@ -3995,7 +3995,7 @@ def square_root_mod_prime_power(IntegerMod_abstract a, p, e): x *= p**(val//2) return x -cpdef square_root_mod_prime(IntegerMod_abstract a, p=None) noexcept: +cpdef square_root_mod_prime(IntegerMod_abstract a, p=None): r""" Calculates the square root of `a`, where `a` is an integer mod `p`; if `a` is not a perfect square, @@ -4270,7 +4270,7 @@ cdef class IntegerMod_hom(Morphism): self.zero = C._element_constructor_(0) self.modulus = C._pyx_order - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for pickling and copying. @@ -4297,7 +4297,7 @@ cdef class IntegerMod_hom(Morphism): slots['modulus'] = self.modulus return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for pickling and copying. @@ -4325,7 +4325,7 @@ cdef class IntegerMod_hom(Morphism): self.zero = _slots['zero'] self.modulus = _slots['modulus'] - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): return IntegerMod(self._codomain, x) cdef class IntegerMod_to_IntegerMod(IntegerMod_hom): @@ -4356,7 +4356,7 @@ cdef class IntegerMod_to_IntegerMod(IntegerMod_hom): import sage.categories.homset IntegerMod_hom.__init__(self, sage.categories.homset.Hom(R, S)) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): cdef IntegerMod_abstract a zero = self.zero cdef unsigned long value @@ -4424,7 +4424,7 @@ cdef class Integer_to_IntegerMod(IntegerMod_hom): import sage.categories.homset IntegerMod_hom.__init__(self, sage.categories.homset.Hom(integer_ring.ZZ, R)) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): cdef IntegerMod_abstract a cdef Py_ssize_t res if self.modulus.table is not None: @@ -4496,7 +4496,7 @@ cdef class IntegerMod_to_Integer(Map): from sage.categories.sets_cat import Sets Morphism.__init__(self, sage.categories.homset.Hom(R, integer_ring.ZZ, Sets())) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): cdef Integer ans = Integer.__new__(Integer) if isinstance(x, IntegerMod_gmp): mpz_set(ans.value, (x).value) @@ -4535,7 +4535,7 @@ cdef class Int_to_IntegerMod(IntegerMod_hom): from sage.sets.pythonclass import Set_PythonType IntegerMod_hom.__init__(self, sage.categories.homset.Hom(Set_PythonType(int), R)) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): cdef IntegerMod_abstract a zero = self.zero diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx index bb10c5cd417..83d78abb2aa 100644 --- a/src/sage/rings/finite_rings/residue_field.pyx +++ b/src/sage/rings/finite_rings/residue_field.pyx @@ -995,7 +995,7 @@ cdef class ReductionMap(Map): self._repr_type_str = "Partially defined reduction" Map.__init__(self, Hom(K, F, SetsWithPartialMaps())) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1026,7 +1026,7 @@ cdef class ReductionMap(Map): slots['_section'] = self._section return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1056,7 +1056,7 @@ cdef class ReductionMap(Map): self._PB = _slots['_PB'] self._section = _slots['_section'] - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Apply this reduction map to an element that coerces into the global field. @@ -1305,7 +1305,7 @@ cdef class ResidueFieldHomomorphism_global(RingHomomorphism): self._repr_type_str = "Reduction" RingHomomorphism.__init__(self, Hom(K,F)) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1338,7 +1338,7 @@ cdef class ResidueFieldHomomorphism_global(RingHomomorphism): slots['_section'] = self._section return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1370,7 +1370,7 @@ cdef class ResidueFieldHomomorphism_global(RingHomomorphism): self._PB = _slots['_PB'] self._section = _slots['_section'] - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Applies this morphism to an element. @@ -1574,7 +1574,7 @@ cdef class LiftingMap(Section): self._PB = PB Section.__init__(self, reduction) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1600,7 +1600,7 @@ cdef class LiftingMap(Section): slots['_PB'] = self._PB return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1625,7 +1625,7 @@ cdef class LiftingMap(Section): self._to_order = _slots['_to_order'] self._PB = _slots['_PB'] - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Lift from this residue class field to the number field. diff --git a/src/sage/rings/fraction_field_FpT.pxd b/src/sage/rings/fraction_field_FpT.pxd index a385a3d7742..7d5d960a0ca 100644 --- a/src/sage/rings/fraction_field_FpT.pxd +++ b/src/sage/rings/fraction_field_FpT.pxd @@ -10,14 +10,14 @@ cdef class FpTElement(FieldElement): cdef bint initialized cdef long p - cdef FpTElement _new_c(self) noexcept - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cdef FpTElement _copy_c(self) noexcept - cpdef numerator(self) noexcept - cpdef denominator(self) noexcept - cpdef FpTElement next(self) noexcept - cpdef _sqrt_or_None(self) noexcept + cdef FpTElement _new_c(self) + cpdef _add_(self, other) + cpdef _mul_(self, other) + cdef FpTElement _copy_c(self) + cpdef numerator(self) + cpdef denominator(self) + cpdef FpTElement next(self) + cpdef _sqrt_or_None(self) cpdef bint is_square(self) noexcept cdef class FpT_iter: diff --git a/src/sage/rings/fraction_field_FpT.pyx b/src/sage/rings/fraction_field_FpT.pyx index 75675060c69..14857c66732 100644 --- a/src/sage/rings/fraction_field_FpT.pyx +++ b/src/sage/rings/fraction_field_FpT.pyx @@ -171,7 +171,7 @@ cdef class FpTElement(FieldElement): return (unpickle_FpT_element, (self._parent, self.numer(), self.denom())) - cdef FpTElement _new_c(self) noexcept: + cdef FpTElement _new_c(self): """ Creates a new FpTElement in the same field, leaving the value to be initialized. """ @@ -183,7 +183,7 @@ cdef class FpTElement(FieldElement): x.initialized = True return x - cdef FpTElement _copy_c(self) noexcept: + cdef FpTElement _copy_c(self): """ Creates a new FpTElement in the same field, with the same value as self. """ @@ -210,7 +210,7 @@ cdef class FpTElement(FieldElement): """ return self.numerator() - cpdef numerator(self) noexcept: + cpdef numerator(self): """ Return the numerator of this element, as an element of the polynomial ring. @@ -241,7 +241,7 @@ cdef class FpTElement(FieldElement): """ return self.denominator() - cpdef denominator(self) noexcept: + cpdef denominator(self): """ Return the denominator of this element, as an element of the polynomial ring. @@ -369,7 +369,7 @@ cdef class FpTElement(FieldElement): else: return "\\frac{%s}{%s}" % (self.numer()._latex_(), self.denom()._latex_()) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Compare this with another element. @@ -474,7 +474,7 @@ cdef class FpTElement(FieldElement): nmod_poly_swap(x._numer, x._denom) return x - cpdef _add_(self, _other) noexcept: + cpdef _add_(self, _other): """ Return the sum of this fraction field element and another. @@ -502,7 +502,7 @@ cdef class FpTElement(FieldElement): normalize(x._numer, x._denom, self.p) return x - cpdef _sub_(self, _other) noexcept: + cpdef _sub_(self, _other): """ Return the difference of this fraction field element and another. @@ -524,7 +524,7 @@ cdef class FpTElement(FieldElement): normalize(x._numer, x._denom, self.p) return x - cpdef _mul_(self, _other) noexcept: + cpdef _mul_(self, _other): """ Return the product of this fraction field element and another. @@ -544,7 +544,7 @@ cdef class FpTElement(FieldElement): normalize(x._numer, x._denom, self.p) return x - cpdef _div_(self, _other) noexcept: + cpdef _div_(self, _other): """ Return the quotient of this fraction field element and another. @@ -568,7 +568,7 @@ cdef class FpTElement(FieldElement): normalize(x._numer, x._denom, self.p) return x - cpdef FpTElement next(self) noexcept: + cpdef FpTElement next(self): """ Iterate through all polynomials, returning the "next" polynomial after this one. @@ -674,7 +674,7 @@ cdef class FpTElement(FieldElement): nmod_poly_clear(g) return next - cpdef _sqrt_or_None(self) noexcept: + cpdef _sqrt_or_None(self): """ Return the square root of ``self``, or ``None``. @@ -1063,7 +1063,7 @@ cdef class Polyring_FpT_coerce(RingHomomorphism): RingHomomorphism.__init__(self, R.ring_of_integers().Hom(R)) self.p = R.base_ring().characteristic() - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1079,7 +1079,7 @@ cdef class Polyring_FpT_coerce(RingHomomorphism): slots['p'] = self.p return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1094,7 +1094,7 @@ cdef class Polyring_FpT_coerce(RingHomomorphism): self.p = _slots['p'] RingHomomorphism._update_slots(self, _slots) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Applies the coercion. @@ -1117,7 +1117,7 @@ cdef class Polyring_FpT_coerce(RingHomomorphism): ans.initialized = True return ans - cpdef Element _call_with_args(self, _x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, _x, args=(), kwds={}): """ This function allows the map to take multiple arguments, usually used to specify both numerator and denominator. @@ -1266,7 +1266,7 @@ cdef class FpT_Polyring_section(Section): self.p = f.p Section.__init__(self, f) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1288,7 +1288,7 @@ cdef class FpT_Polyring_section(Section): slots['p'] = self.p return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1309,7 +1309,7 @@ cdef class FpT_Polyring_section(Section): self.p = _slots['p'] Section._update_slots(self, _slots) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Applies the section. @@ -1381,7 +1381,7 @@ cdef class Fp_FpT_coerce(RingHomomorphism): RingHomomorphism.__init__(self, R.base_ring().Hom(R)) self.p = R.base_ring().characteristic() - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1400,7 +1400,7 @@ cdef class Fp_FpT_coerce(RingHomomorphism): slots['p'] = self.p return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1418,7 +1418,7 @@ cdef class Fp_FpT_coerce(RingHomomorphism): self.p = _slots['p'] RingHomomorphism._update_slots(self, _slots) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Applies the coercion. @@ -1441,7 +1441,7 @@ cdef class Fp_FpT_coerce(RingHomomorphism): ans.initialized = True return ans - cpdef Element _call_with_args(self, _x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, _x, args=(), kwds={}): """ This function allows the map to take multiple arguments, usually used to specify both numerator and denominator. @@ -1569,7 +1569,7 @@ cdef class FpT_Fp_section(Section): self.p = f.p Section.__init__(self, f) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1597,7 +1597,7 @@ cdef class FpT_Fp_section(Section): slots['p'] = self.p return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1624,7 +1624,7 @@ cdef class FpT_Fp_section(Section): self.p = _slots['p'] Section._update_slots(self, _slots) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Applies the section. @@ -1703,7 +1703,7 @@ cdef class ZZ_FpT_coerce(RingHomomorphism): RingHomomorphism.__init__(self, ZZ.Hom(R)) self.p = R.base_ring().characteristic() - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1724,7 +1724,7 @@ cdef class ZZ_FpT_coerce(RingHomomorphism): slots['p'] = self.p return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1744,7 +1744,7 @@ cdef class ZZ_FpT_coerce(RingHomomorphism): self.p = _slots['p'] RingHomomorphism._update_slots(self, _slots) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Applies the coercion. @@ -1767,7 +1767,7 @@ cdef class ZZ_FpT_coerce(RingHomomorphism): ans.initialized = True return ans - cpdef Element _call_with_args(self, _x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, _x, args=(), kwds={}): """ This function allows the map to take multiple arguments, usually used to specify both numerator and denominator. diff --git a/src/sage/rings/fraction_field_element.pyx b/src/sage/rings/fraction_field_element.pyx index 2abb8c4d326..ea323e2709f 100644 --- a/src/sage/rings/fraction_field_element.pyx +++ b/src/sage/rings/fraction_field_element.pyx @@ -160,7 +160,7 @@ cdef class FractionFieldElement(FieldElement): nden = codomain.coerce(self._denominator._im_gens_(codomain, im_gens, base_map=base_map)) return codomain.coerce(nnum/nden) - cpdef reduce(self) noexcept: + cpdef reduce(self): """ Reduce this fraction. @@ -584,7 +584,7 @@ cdef class FractionFieldElement(FieldElement): return s - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Compute the sum of ``self`` and ``right``. @@ -669,7 +669,7 @@ cdef class FractionFieldElement(FieldElement): return self.__class__(self._parent, rnum*sden + rden*snum, rden*sden, coerce=False, reduce=False) - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Computes the product of ``self`` and ``right``. @@ -735,7 +735,7 @@ cdef class FractionFieldElement(FieldElement): return self.__class__(self._parent, rnum * snum, rden * sden, coerce=False, reduce=False) - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Computes the quotient of ``self`` and ``right``. @@ -970,7 +970,7 @@ cdef class FractionFieldElement(FieldElement): return self.__class__(self._parent, self._denominator, self._numerator, coerce=False, reduce=False) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ EXAMPLES:: @@ -1207,7 +1207,7 @@ cdef class FractionFieldElement_1poly_field(FractionFieldElement): if not reduce: self.normalize_leading_coefficients() - cdef normalize_leading_coefficients(self) noexcept: + cdef normalize_leading_coefficients(self): """ See :meth:`reduce`. """ @@ -1252,7 +1252,7 @@ cdef class FractionFieldElement_1poly_field(FractionFieldElement): L.sort() return L - cpdef reduce(self) noexcept: + cpdef reduce(self): """ Pick a normalized representation of self. diff --git a/src/sage/rings/function_field/element.pxd b/src/sage/rings/function_field/element.pxd index 9ffdbd48383..09ac9221e76 100644 --- a/src/sage/rings/function_field/element.pxd +++ b/src/sage/rings/function_field/element.pxd @@ -5,6 +5,6 @@ cdef class FunctionFieldElement(FieldElement): cdef readonly object _x cdef readonly object _matrix - cdef FunctionFieldElement _new_c(self) noexcept + cdef FunctionFieldElement _new_c(self) cpdef bint is_nth_power(self, n) noexcept - cpdef FunctionFieldElement nth_root(self, n) noexcept + cpdef FunctionFieldElement nth_root(self, n) diff --git a/src/sage/rings/function_field/element.pyx b/src/sage/rings/function_field/element.pyx index d9c284d61e6..2765b805aba 100644 --- a/src/sage/rings/function_field/element.pyx +++ b/src/sage/rings/function_field/element.pyx @@ -122,7 +122,7 @@ cdef class FunctionFieldElement(FieldElement): return (make_FunctionFieldElement, (self._parent, type(self), self._x)) - cdef FunctionFieldElement _new_c(self) noexcept: + cdef FunctionFieldElement _new_c(self): cdef type t = type(self) cdef FunctionFieldElement x = t.__new__(t) x._parent = self._parent @@ -698,7 +698,7 @@ cdef class FunctionFieldElement(FieldElement): """ raise NotImplementedError("is_nth_power() not implemented for generic elements") - cpdef FunctionFieldElement nth_root(self, n) noexcept: + cpdef FunctionFieldElement nth_root(self, n): """ Return an ``n``-th root of this element in the function field. diff --git a/src/sage/rings/function_field/element_polymod.pyx b/src/sage/rings/function_field/element_polymod.pyx index c6fdea83b09..7a75bfe978e 100644 --- a/src/sage/rings/function_field/element_polymod.pyx +++ b/src/sage/rings/function_field/element_polymod.pyx @@ -112,7 +112,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): """ return hash(self._x) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Do rich comparison with the other element with respect to ``op`` @@ -129,7 +129,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): cdef FunctionFieldElement right = other return richcmp(left._x, right._x, op) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add the element with the other element. @@ -152,7 +152,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): res._x = self._x + (right)._x return res - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract the other element from the element. @@ -173,7 +173,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): res._x = self._x - (right)._x return res - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiply the element with the other element. @@ -192,7 +192,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): res._x = (self._x * (right)._x) % self._parent.polynomial() return res - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Divide the element with the other element. @@ -231,7 +231,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): P = self._parent return P(self._x.xgcd(P._polynomial)[1]) - cpdef list list(self) noexcept: + cpdef list list(self): """ Return the list of the coefficients representing the element. @@ -251,7 +251,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): """ return self._x.padded_list(self._parent.degree()) - cpdef FunctionFieldElement nth_root(self, n) noexcept: + cpdef FunctionFieldElement nth_root(self, n): r""" Return an ``n``-th root of this element in the function field. @@ -367,7 +367,7 @@ cdef class FunctionFieldElement_polymod(FunctionFieldElement): raise NotImplementedError("is_nth_power() not implemented for this n") - cdef FunctionFieldElement _pth_root(self) noexcept: + cdef FunctionFieldElement _pth_root(self): r""" Helper method for :meth:`nth_root` and :meth:`is_nth_power` which computes a `p`-th root if the characteristic is `p` and the constant diff --git a/src/sage/rings/function_field/element_rational.pyx b/src/sage/rings/function_field/element_rational.pyx index 986a46300b8..40d0d9734ef 100644 --- a/src/sage/rings/function_field/element_rational.pyx +++ b/src/sage/rings/function_field/element_rational.pyx @@ -85,7 +85,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): """ return self._x - cpdef list list(self) noexcept: + cpdef list list(self): """ Return a list with just the element. @@ -143,7 +143,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): """ return hash(self._x) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Compare the element with the other element with respect to ``op`` @@ -174,7 +174,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): except TypeError: return NotImplemented - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add the element with the other element. @@ -192,7 +192,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): res._x = self._x + (right)._x return res - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract the other element from the element. @@ -210,7 +210,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): res._x = self._x - (right)._x return res - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiply the element with the other element @@ -228,7 +228,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): res._x = self._x * (right)._x return res - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Divide the element with the other element @@ -412,7 +412,7 @@ cdef class FunctionFieldElement_rational(FunctionFieldElement): raise NotImplementedError("is_nth_power() not implemented for the given n") - cpdef FunctionFieldElement nth_root(self, n) noexcept: + cpdef FunctionFieldElement nth_root(self, n): r""" Return an ``n``-th root of this element in the function field. diff --git a/src/sage/rings/integer.pxd b/src/sage/rings/integer.pxd index b831f095eb1..1165895729e 100644 --- a/src/sage/rings/integer.pxd +++ b/src/sage/rings/integer.pxd @@ -11,34 +11,34 @@ cdef class Integer(EuclideanDomainElement): cdef __mpz_struct value[1] cdef void set_from_mpz(self, mpz_t value) noexcept - cdef hash_c(self) noexcept + cdef hash_c(self) - cpdef __pari__(self) noexcept + cpdef __pari__(self) - cpdef _shift_helper(Integer self, y, int sign) noexcept - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cpdef _pow_(self, other) noexcept - cdef _and(Integer self, Integer other) noexcept - cdef _or(Integer self, Integer other) noexcept - cdef _xor(Integer self, Integer other) noexcept + cpdef _shift_helper(Integer self, y, int sign) + cpdef _add_(self, other) + cpdef _mul_(self, other) + cpdef _pow_(self, other) + cdef _and(Integer self, Integer other) + cdef _or(Integer self, Integer other) + cdef _xor(Integer self, Integer other) cpdef size_t _exact_log_log2_iter(self,Integer m) noexcept cpdef size_t _exact_log_mpfi_log(self,m) noexcept - cpdef RingElement _valuation(Integer self, Integer p) noexcept - cdef object _val_unit(Integer self, Integer p) noexcept - cdef Integer _divide_knowing_divisible_by(Integer self, Integer right) noexcept + cpdef RingElement _valuation(Integer self, Integer p) + cdef object _val_unit(Integer self, Integer p) + cdef Integer _divide_knowing_divisible_by(Integer self, Integer right) cdef bint _is_power_of(Integer self, Integer n) noexcept cdef bint _pseudoprime_is_prime(self, proof) except -1 cdef int mpz_set_str_python(mpz_ptr z, char* s, int base) except -1 -cdef Integer smallInteger(long value) noexcept +cdef Integer smallInteger(long value) cdef bint _small_primes_table[500] -cdef inline Integer _Integer_from_mpz(mpz_t e) noexcept: +cdef inline Integer _Integer_from_mpz(mpz_t e): cdef Integer z = Integer.__new__(Integer) mpz_set(z.value, e) return z diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx index 55a9f9961ee..70d11efaf7a 100644 --- a/src/sage/rings/integer.pyx +++ b/src/sage/rings/integer.pyx @@ -211,11 +211,11 @@ cdef object numpy_long_interface = {'typestr': '=i4' if sizeof(long) == 4 else ' cdef object numpy_int64_interface = {'typestr': '=i8'} cdef object numpy_object_interface = {'typestr': '|O'} -cdef set_from_Integer(Integer self, Integer other) noexcept: +cdef set_from_Integer(Integer self, Integer other): mpz_set(self.value, other.value) -cdef _digits_naive(mpz_t v,l,int offset,Integer base,digits) noexcept: +cdef _digits_naive(mpz_t v,l,int offset,Integer base,digits): """ This method fills in digit entries in the list, l, using the most basic digit algorithm -- repeat division by base. @@ -262,7 +262,7 @@ cdef _digits_naive(mpz_t v,l,int offset,Integer base,digits) noexcept: mpz_clear(mpz_value) -cdef _digits_internal(mpz_t v,l,int offset,int power_index,power_list,digits) noexcept: +cdef _digits_internal(mpz_t v,l,int offset,int power_index,power_list,digits): """ INPUT: @@ -337,7 +337,7 @@ def is_Integer(x): return isinstance(x, Integer) -cdef inline Integer as_Integer(x) noexcept: +cdef inline Integer as_Integer(x): if isinstance(x, Integer): return x else: @@ -773,7 +773,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): """ return codomain.coerce(self) - cdef _xor(Integer self, Integer other) noexcept: + cdef _xor(Integer self, Integer other): cdef Integer x x = PY_NEW(Integer) mpz_xor(x.value, self.value, other.value) @@ -915,7 +915,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): return rich_to_bool_sgn(op, c) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): r""" EXAMPLES:: @@ -1764,7 +1764,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): return coercion_model.bin_op(left, right, operator.add) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Integer addition. @@ -1782,7 +1782,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): mpz_add(x.value, self.value, (right).value) return x - cdef _add_long(self, long n) noexcept: + cdef _add_long(self, long n): """ Fast path for adding a C long. @@ -1851,7 +1851,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): return coercion_model.bin_op(left, right, operator.sub) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Integer subtraction. @@ -1889,12 +1889,12 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): mpz_neg(x.value, self.value) return x - cpdef _neg_(self) noexcept: + cpdef _neg_(self): cdef Integer x = PY_NEW(Integer) mpz_neg(x.value, self.value) return x - cpdef _act_on_(self, s, bint self_on_left) noexcept: + cpdef _act_on_(self, s, bint self_on_left): """ EXAMPLES:: @@ -1911,7 +1911,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): else: return s * int(self) # will raise the appropriate exception - cdef _mul_long(self, long n) noexcept: + cdef _mul_long(self, long n): """ Fast path for multiplying a C long. @@ -1959,7 +1959,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): return coercion_model.bin_op(left, right, operator.mul) - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Integer multiplication. @@ -2032,7 +2032,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): return coercion_model.bin_op(left, right, operator.truediv) - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): r""" Computes `\frac{a}{b}` @@ -2049,7 +2049,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): mpq_div_zz(x.value, self.value, (right).value) return x - cpdef _floordiv_(self, right) noexcept: + cpdef _floordiv_(self, right): r""" Computes the whole part of `\frac{x}{y}`. @@ -2191,7 +2191,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): # left is a non-Element: do the powering with a Python int return left ** int(right) - cpdef _pow_(self, other) noexcept: + cpdef _pow_(self, other): """ Integer powering. @@ -2271,7 +2271,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): else: return ~r - cdef _pow_long(self, long n) noexcept: + cdef _pow_long(self, long n): if n == 0: return smallInteger(1) elif n == 1: @@ -2301,7 +2301,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sig_off() return q - cpdef _pow_int(self, n) noexcept: + cpdef _pow_int(self, n): """ Integer powering to an integer exponent. @@ -3683,7 +3683,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): """ return mpz_pythonhash(self.value) - cdef hash_c(self) noexcept: + cdef hash_c(self): """ A C version of the __hash__ function. """ @@ -4199,7 +4199,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): sig_off() return t - cpdef RingElement _valuation(Integer self, Integer p) noexcept: + cpdef RingElement _valuation(Integer self, Integer p): r""" Return the p-adic valuation of ``self``. @@ -4224,7 +4224,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): mpz_clear(u) return v - cdef object _val_unit(Integer self, Integer p) noexcept: + cdef object _val_unit(Integer self, Integer p): r""" Return a pair: the p-adic valuation of ``self``, and the p-adic unit of ``self``. @@ -4373,7 +4373,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): mpz_tdiv_q_2exp(odd.value, self.value, bits) return odd - cdef Integer _divide_knowing_divisible_by(Integer self, Integer right) noexcept: + cdef Integer _divide_knowing_divisible_by(Integer self, Integer right): r""" Return the integer ``self`` / ``right`` when ``self`` is divisible by right. @@ -6200,7 +6200,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): d = self // 4 return d % 4 in [2, 3] and d.is_squarefree() - cpdef __pari__(self) noexcept: + cpdef __pari__(self): """ Return the PARI version of this integer. @@ -6668,7 +6668,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): return g, s, t - cpdef _shift_helper(Integer self, y, int sign) noexcept: + cpdef _shift_helper(Integer self, y, int sign): """ Compute left and right shifts of integers. Shifts ``self`` ``y`` bits to the left if ``sign`` is `1`, and to the right @@ -6810,7 +6810,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): return x >> int(y) return (x)._shift_helper(y, -1) - cdef _and(Integer self, Integer other) noexcept: + cdef _and(Integer self, Integer other): cdef Integer x = PY_NEW(Integer) mpz_and(x.value, self.value, other.value) return x @@ -6831,7 +6831,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement): return (x)._and(y) return coercion_model.bin_op(x, y, operator.and_) - cdef _or(Integer self, Integer other) noexcept: + cdef _or(Integer self, Integer other): cdef Integer x = PY_NEW(Integer) mpz_ior(x.value, self.value, other.value) return x @@ -7440,7 +7440,7 @@ cdef class int_to_Z(Morphism): from sage.sets.pythonclass import Set_PythonType Morphism.__init__(self, sage.categories.homset.Hom(Set_PythonType(long), integer_ring.ZZ)) - cpdef Element _call_(self, a) noexcept: + cpdef Element _call_(self, a): cdef Integer r cdef long l cdef int err = 0 @@ -7624,7 +7624,7 @@ cdef void fast_tp_dealloc(PyObject* o) noexcept: from sage.misc.allocator cimport hook_tp_functions -cdef hook_fast_tp_functions() noexcept: +cdef hook_fast_tp_functions(): """ Initialize the fast integer creation functions. """ @@ -7642,7 +7642,7 @@ cdef hook_fast_tp_functions() noexcept: # to be constructed/destructed. hook_tp_functions(global_dummy_Integer, (&fast_tp_new), (&fast_tp_dealloc), False) -cdef integer(x) noexcept: +cdef integer(x): if isinstance(x, Integer): return x return Integer(x) @@ -7672,7 +7672,7 @@ hook_fast_tp_functions() # zero and one initialization initialized = False -cdef set_zero_one_elements() noexcept: +cdef set_zero_one_elements(): global the_integer_ring, initialized if initialized: return @@ -7692,7 +7692,7 @@ DEF small_pool_max = 256 # we could use the above zero and one here cdef list small_pool = [Integer(k) for k in range(small_pool_min, small_pool_max+1)] -cdef inline Integer smallInteger(long value) noexcept: +cdef inline Integer smallInteger(long value): """ This is the fastest way to create a (likely) small Integer. """ diff --git a/src/sage/rings/integer_ring.pyx b/src/sage/rings/integer_ring.pyx index 013e67fedc3..ab445056cc7 100644 --- a/src/sage/rings/integer_ring.pyx +++ b/src/sage/rings/integer_ring.pyx @@ -528,7 +528,7 @@ cdef class IntegerRing_class(PrincipalIdealDomain): yield -n n += 1 - cpdef _coerce_map_from_(self, S) noexcept: + cpdef _coerce_map_from_(self, S): r""" ``x`` canonically coerces to the integers `\ZZ` only if ``x`` is an int, long or already an element of `\ZZ`. diff --git a/src/sage/rings/laurent_series_ring_element.pxd b/src/sage/rings/laurent_series_ring_element.pxd index 2b37b80e3b0..8df5a92c9e7 100644 --- a/src/sage/rings/laurent_series_ring_element.pxd +++ b/src/sage/rings/laurent_series_ring_element.pxd @@ -4,7 +4,7 @@ cdef class LaurentSeries(AlgebraElement): cdef ModuleElement __u cdef long __n - cdef _normalize(self) noexcept - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept + cdef _normalize(self) + cpdef _add_(self, other) + cpdef _mul_(self, other) diff --git a/src/sage/rings/laurent_series_ring_element.pyx b/src/sage/rings/laurent_series_ring_element.pyx index a22f1c65db4..8bbf227e302 100644 --- a/src/sage/rings/laurent_series_ring_element.pyx +++ b/src/sage/rings/laurent_series_ring_element.pyx @@ -303,7 +303,7 @@ cdef class LaurentSeries(AlgebraElement): x = im_gens[0] return codomain(self.__u._im_gens_(codomain, im_gens, base_map=base_map) * x**self.__n) - cdef _normalize(self) noexcept: + cdef _normalize(self): r""" A Laurent series is a pair (u(t), n), where either u=0 (to some precision) or u is a unit. This pair corresponds to @@ -729,7 +729,7 @@ cdef class LaurentSeries(AlgebraElement): self.__u = self.__u._parent(coeffs) self._normalize() - cpdef _add_(self, right_m) noexcept: + cpdef _add_(self, right_m): """ Add two power series with the same parent. @@ -787,7 +787,7 @@ cdef class LaurentSeries(AlgebraElement): # 3. Add return type(self)(self._parent, f1 + f2, m) - cpdef _sub_(self, right_m) noexcept: + cpdef _sub_(self, right_m): """ Subtract two power series with the same parent. @@ -915,7 +915,7 @@ cdef class LaurentSeries(AlgebraElement): """ return type(self)(self._parent, -self.__u, self.__n) - cpdef _mul_(self, right_r) noexcept: + cpdef _mul_(self, right_r): """ EXAMPLES:: @@ -930,10 +930,10 @@ cdef class LaurentSeries(AlgebraElement): self.__u * right.__u, self.__n + right.__n) - cpdef _rmul_(self, Element c) noexcept: + cpdef _rmul_(self, Element c): return type(self)(self._parent, self.__u._rmul_(c), self.__n) - cpdef _lmul_(self, Element c) noexcept: + cpdef _lmul_(self, Element c): return type(self)(self._parent, self.__u._lmul_(c), self.__n) def __pow__(_self, r, dummy): @@ -1082,7 +1082,7 @@ cdef class LaurentSeries(AlgebraElement): """ return type(self)(self._parent, self.__u >> (n - self.__n), n) - cpdef _div_(self, right_r) noexcept: + cpdef _div_(self, right_r): """ EXAMPLES:: @@ -1203,7 +1203,7 @@ cdef class LaurentSeries(AlgebraElement): """ return min(self.valuation(), other.valuation()) - cpdef _richcmp_(self, right_r, int op) noexcept: + cpdef _richcmp_(self, right_r, int op): r""" Comparison of ``self`` and ``right``. diff --git a/src/sage/rings/morphism.pyx b/src/sage/rings/morphism.pyx index 05c5adcbbd1..6c78460a534 100644 --- a/src/sage/rings/morphism.pyx +++ b/src/sage/rings/morphism.pyx @@ -514,7 +514,7 @@ cdef class RingMap_lift(RingMap): H = R.Hom(S, Sets()) RingMap.__init__(self, H) - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -533,7 +533,7 @@ cdef class RingMap_lift(RingMap): self.to_S = _slots['to_S'] Morphism._update_slots(self, _slots) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -549,7 +549,7 @@ cdef class RingMap_lift(RingMap): slots['to_S'] = self.to_S return slots - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Compare a ring lifting maps ``self`` to ``other``. @@ -613,7 +613,7 @@ cdef class RingMap_lift(RingMap): """ return "Choice of lifting map" - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluate this function at ``x``. @@ -700,7 +700,7 @@ cdef class RingHomomorphism(RingMap): raise TypeError("lift must have correct codomain") self._lift = lift - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -719,7 +719,7 @@ cdef class RingHomomorphism(RingMap): self._lift = _slots['_lift'] Morphism._update_slots(self, _slots) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1810,7 +1810,7 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): """ return self._base_map - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1830,7 +1830,7 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): self._base_map = _slots.get('_base_map') RingHomomorphism._update_slots(self, _slots) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1851,7 +1851,7 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): slots['_base_map'] = self._base_map return slots - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): r""" EXAMPLES: @@ -1961,7 +1961,7 @@ cdef class RingHomomorphism_im_gens(RingHomomorphism): s += '\nwith map of base ring' return s - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluate this homomorphism at ``x``. @@ -2125,7 +2125,7 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): """ return self._underlying - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -2155,7 +2155,7 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): self._underlying = _slots['__underlying'] # double underscore for legacy pickles RingHomomorphism._update_slots(self, _slots) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -2186,7 +2186,7 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): slots['__underlying'] = self._underlying return slots - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): r""" EXAMPLES: @@ -2270,7 +2270,7 @@ cdef class RingHomomorphism_from_base(RingHomomorphism): U = repr(self._underlying).split('\n') return 'Induced from base ring by\n'+'\n'.join(U) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluate this homomorphism at ``x``. @@ -2374,7 +2374,7 @@ cdef class RingHomomorphism_from_fraction_field(RingHomomorphism): """ return self._morphism._repr_defn() - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): r""" Return the value of this morphism at ``x``. @@ -2393,7 +2393,7 @@ cdef class RingHomomorphism_from_fraction_field(RingHomomorphism): """ return self._morphism(x.numerator()) / self._morphism(x.denominator()) - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper function for copying and pickling. @@ -2412,7 +2412,7 @@ cdef class RingHomomorphism_from_fraction_field(RingHomomorphism): self._morphism = _slots['_morphism'] RingHomomorphism._update_slots(self, _slots) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper function for copying and pickling. @@ -2479,7 +2479,7 @@ cdef class RingHomomorphism_cover(RingHomomorphism): """ RingHomomorphism.__init__(self, parent) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluate this covering homomorphism at ``x``, which just involves coercing ``x`` into the domain, then codomain. @@ -2538,7 +2538,7 @@ cdef class RingHomomorphism_cover(RingHomomorphism): """ return self.codomain().defining_ideal() - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Compare ``self`` to ``other``. @@ -2689,7 +2689,7 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): self._lift = pi.lift() self.phi = phi - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -2718,7 +2718,7 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): self.phi = _slots['phi'] RingHomomorphism._update_slots(self, _slots) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -2782,7 +2782,7 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): """ return self.phi - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Compare ``self`` to ``other``. @@ -2843,7 +2843,7 @@ cdef class RingHomomorphism_from_quotient(RingHomomorphism): return '\n'.join('{} |--> {}'.format(D.gen(i), ig[i]) for i in range(D.ngens())) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluate this function at ``x``. @@ -2902,7 +2902,7 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): self._q = self._p ** self._power RingHomomorphism.__init__(self, Hom(domain, domain)) - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Update information with the given slots. @@ -2922,7 +2922,7 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): self._q = self._p ** self._power RingHomomorphism._update_slots(self, _slots) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Return additional information about this morphism as a dictionary. @@ -3012,7 +3012,7 @@ cdef class FrobeniusEndomorphism_generic(RingHomomorphism): s = '\\verb"Frob"^{%s}' % self._power return s - cpdef Element _call_ (self, x) noexcept: + cpdef Element _call_ (self, x): """ TESTS:: diff --git a/src/sage/rings/number_field/number_field_base.pxd b/src/sage/rings/number_field/number_field_base.pxd index f34a25d0dcb..ba6a8e98143 100644 --- a/src/sage/rings/number_field/number_field_base.pxd +++ b/src/sage/rings/number_field/number_field_base.pxd @@ -4,4 +4,4 @@ cdef class NumberField(Field): cdef int _embedded_real cdef list _gen_approx - cpdef _get_embedding_approx(self, size_t i) noexcept + cpdef _get_embedding_approx(self, size_t i) diff --git a/src/sage/rings/number_field/number_field_base.pyx b/src/sage/rings/number_field/number_field_base.pyx index 5730f957f6e..7f55d887a0f 100644 --- a/src/sage/rings/number_field/number_field_base.pyx +++ b/src/sage/rings/number_field/number_field_base.pyx @@ -413,7 +413,7 @@ cdef class NumberField(Field): self._gen_approx = [] self._embedded_real = 1 - cpdef _get_embedding_approx(self, size_t i) noexcept: + cpdef _get_embedding_approx(self, size_t i): r""" Return an interval approximation of the generator of this number field. diff --git a/src/sage/rings/number_field/number_field_element.pxd b/src/sage/rings/number_field/number_field_element.pxd index c73d1806fc7..df72e703017 100644 --- a/src/sage/rings/number_field/number_field_element.pxd +++ b/src/sage/rings/number_field/number_field_element.pxd @@ -20,23 +20,23 @@ cdef class NumberFieldElement(NumberFieldElement_base): cdef object __pari cdef object __matrix - cdef _new(self) noexcept - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept + cdef _new(self) + cpdef _add_(self, other) + cpdef _mul_(self, other) - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept + cpdef _add_(self, other) + cpdef _mul_(self, other) - cpdef _copy_for_parent(self, Parent parent) noexcept + cpdef _copy_for_parent(self, Parent parent) - cdef number_field(self) noexcept + cdef number_field(self) cdef void _ntl_coeff_as_mpz(self, mpz_t z, long i) noexcept cdef void _ntl_denom_as_mpz(self, mpz_t z) noexcept cdef void _reduce_c_(self) noexcept - cpdef list _coefficients(self) noexcept + cpdef list _coefficients(self) cpdef bint is_rational(self) noexcept cpdef bint is_one(self) noexcept diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx index 2212a4ac250..844a4ec3162 100644 --- a/src/sage/rings/number_field/number_field_element.pyx +++ b/src/sage/rings/number_field/number_field_element.pyx @@ -170,7 +170,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): sage: a^3 -a - 1 """ - cdef _new(self) noexcept: + cdef _new(self): """ Quickly creates a new initialized NumberFieldElement with the same parent as self. @@ -182,7 +182,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): x._fld_denominator = self._fld_denominator return x - cdef number_field(self) noexcept: + cdef number_field(self): r""" Return the number field of self. Only accessible from Cython. @@ -783,7 +783,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): return QQ.zero() return coeffs[n] - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): r""" EXAMPLES:: @@ -2443,7 +2443,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): self._numerator = t2 self._denominator = t1 - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): r""" EXAMPLES:: @@ -2469,7 +2469,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): x._reduce_c_() return x - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): r""" EXAMPLES:: @@ -2494,7 +2494,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): x._reduce_c_() return x - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Returns the product of self and other as elements of a number field. @@ -2542,7 +2542,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): # but asymptotically fast poly multiplication means it's # actually faster to *not* build a table!?! - cpdef _div_(self, other) noexcept: + cpdef _div_(self, other): """ Returns the quotient of self and other as elements of a number field. @@ -2654,7 +2654,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): """ return not IsZero_ZZX(self._numerator) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): r""" EXAMPLES:: @@ -2669,7 +2669,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): x._denominator = self._denominator return x - cpdef _copy_for_parent(self, Parent parent) noexcept: + cpdef _copy_for_parent(self, Parent parent): r""" Return a copy of ``self`` with the parent replaced by ``parent``. @@ -3232,7 +3232,7 @@ cdef class NumberFieldElement(NumberFieldElement_base): return h - cpdef list _coefficients(self) noexcept: + cpdef list _coefficients(self): """ Return the coefficients of the underlying polynomial corresponding to this number field element. @@ -5247,7 +5247,7 @@ cdef class OrderElement_absolute(NumberFieldElement_absolute): self._number_field = K (self)._parent = order - cdef _new(self) noexcept: + cdef _new(self): """ Quickly creates a new initialized NumberFieldElement with the same parent as ``self``. @@ -5269,7 +5269,7 @@ cdef class OrderElement_absolute(NumberFieldElement_absolute): x._fld_denominator = self._fld_denominator return x - cdef number_field(self) noexcept: + cdef number_field(self): r""" Return the number field of ``self``. Only accessible from Cython. @@ -5363,10 +5363,10 @@ cdef class OrderElement_relative(NumberFieldElement_relative): (self)._parent = order self._number_field = K - cdef number_field(self) noexcept: + cdef number_field(self): return self._number_field - cdef _new(self) noexcept: + cdef _new(self): """ Quickly creates a new initialized NumberFieldElement with the same parent as self. diff --git a/src/sage/rings/number_field/number_field_element_quadratic.pxd b/src/sage/rings/number_field/number_field_element_quadratic.pxd index cf679098a2f..6dce9c04d90 100644 --- a/src/sage/rings/number_field/number_field_element_quadratic.pxd +++ b/src/sage/rings/number_field/number_field_element_quadratic.pxd @@ -10,22 +10,22 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): cdef mpz_t a, b, denom cdef Integer D cdef bint standard_embedding - cpdef NumberFieldElement galois_conjugate(self) noexcept + cpdef NumberFieldElement galois_conjugate(self) - cpdef list _coefficients(self) noexcept + cpdef list _coefficients(self) cdef int _randomize(self, num_bound, den_bound, distribution) except -1 cdef int arb_set_real(self, arb_t x, long prec) except -1 cdef void arb_set_imag(self, arb_t x, long prec) noexcept - cpdef tuple parts(self) noexcept + cpdef tuple parts(self) cdef class NumberFieldElement_quadratic_sqrt(NumberFieldElement_quadratic): pass cdef class NumberFieldElement_gaussian(NumberFieldElement_quadratic_sqrt): - cpdef real_part(self) noexcept - cpdef imag_part(self) noexcept + cpdef real_part(self) + cpdef imag_part(self) cdef class OrderElement_quadratic(NumberFieldElement_quadratic): pass diff --git a/src/sage/rings/number_field/number_field_element_quadratic.pyx b/src/sage/rings/number_field/number_field_element_quadratic.pyx index 3ccac930076..f48df864b74 100644 --- a/src/sage/rings/number_field/number_field_element_quadratic.pyx +++ b/src/sage/rings/number_field/number_field_element_quadratic.pyx @@ -225,7 +225,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): # __cmp__, sign, real, imag, floor, ceil, ... self.standard_embedding = parent._standard_embedding - cdef _new(self) noexcept: + cdef _new(self): """ Quickly creates a new initialized NumberFieldElement_quadratic with the same parent as self. @@ -243,7 +243,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): x.D = self.D return x - cdef number_field(self) noexcept: + cdef number_field(self): r""" Return the number field to which this element belongs. Since this is a Cython cdef method, it is not directly accessible by the user, but the @@ -350,7 +350,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): mpz_set(denom.value, self.denom) return "new QuadraticExtension({}, {}, {})".format(a/denom, b/denom, self.D) - cpdef _copy_for_parent(self, Parent parent) noexcept: + cpdef _copy_for_parent(self, Parent parent): r""" Return a copy of ``self`` with the parent replaced by ``parent``. @@ -892,7 +892,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): self.arb_set_imag(acb_imagref(res.value), R._prec) return res - cpdef tuple parts(self) noexcept: + cpdef tuple parts(self): r""" Return a pair of rationals `a` and `b` such that ``self`` `= a+b\sqrt{D}`. @@ -1038,7 +1038,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): return test return -test - cpdef _richcmp_(left, _right, int op) noexcept: + cpdef _richcmp_(left, _right, int op): r""" Rich comparison of elements. @@ -1318,7 +1318,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): mpz_clear(gcd) - cpdef _add_(self, other_m) noexcept: + cpdef _add_(self, other_m): """ EXAMPLES:: @@ -1376,7 +1376,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): return res - cpdef _sub_(self, other_m) noexcept: + cpdef _sub_(self, other_m): """ EXAMPLES:: @@ -1444,7 +1444,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): mpz_set(res.denom, self.denom) return res - cpdef _mul_(self, other_m) noexcept: + cpdef _mul_(self, other_m): """ EXAMPLES:: @@ -1512,7 +1512,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): res._reduce_c_() return res - cpdef _rmul_(self, Element _c) noexcept: + cpdef _rmul_(self, Element _c): """ EXAMPLES:: @@ -1529,7 +1529,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): res._reduce_c_() return res - cpdef _lmul_(self, Element _c) noexcept: + cpdef _lmul_(self, Element _c): """ EXAMPLES:: @@ -1613,7 +1613,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): res._reduce_c_() return res - cpdef NumberFieldElement galois_conjugate(self) noexcept: + cpdef NumberFieldElement galois_conjugate(self): """ Return the image of this element under action of the nontrivial element of the Galois group of this field. @@ -1931,7 +1931,7 @@ cdef class NumberFieldElement_quadratic(NumberFieldElement_absolute): mpz_neg(q.b, self.b) return q - cpdef list _coefficients(self) noexcept: + cpdef list _coefficients(self): """ EXAMPLES:: @@ -2455,7 +2455,7 @@ cdef class NumberFieldElement_quadratic_sqrt(NumberFieldElement_quadratic): mpz_set(denom.value, self.denom) return denom - cpdef list _coefficients(self) noexcept: + cpdef list _coefficients(self): """ EXAMPLES:: @@ -2595,7 +2595,7 @@ cdef class NumberFieldElement_gaussian(NumberFieldElement_quadratic_sqrt): return qqbar.AlgebraicReal(coeffs[0]) raise ValueError(f"unable to convert {self!r} to an element of {parent!r}") - cpdef real_part(self) noexcept: + cpdef real_part(self): r""" Real part. @@ -2617,7 +2617,7 @@ cdef class NumberFieldElement_gaussian(NumberFieldElement_quadratic_sqrt): real = real_part - cpdef imag_part(self) noexcept: + cpdef imag_part(self): r""" Imaginary part. @@ -2782,14 +2782,14 @@ cdef class OrderElement_quadratic(NumberFieldElement_quadratic): else: return self.charpoly() - cdef number_field(self) noexcept: + cdef number_field(self): # So few functions actually use self.number_field() for quadratic elements, so # it is better *not* to return a cached value (since the call to _parent.number_field()) # is expensive. return self._parent.number_field() # We must override these since the basering is now ZZ not QQ. - cpdef _rmul_(self, Element _c) noexcept: + cpdef _rmul_(self, Element _c): """ EXAMPLES:: @@ -2809,7 +2809,7 @@ cdef class OrderElement_quadratic(NumberFieldElement_quadratic): res._reduce_c_() return res - cpdef _lmul_(self, Element _c) noexcept: + cpdef _lmul_(self, Element _c): """ EXAMPLES:: @@ -2878,7 +2878,7 @@ cdef class OrderElement_quadratic(NumberFieldElement_quadratic): R = self.parent() return R(_inverse_mod_generic(self, I)) - cpdef list _coefficients(self) noexcept: + cpdef list _coefficients(self): """ EXAMPLES:: @@ -2983,7 +2983,7 @@ cdef class Z_to_quadratic_field_element(Morphism): import sage.categories.homset Morphism.__init__(self, sage.categories.homset.Hom(ZZ, K)) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): r""" Evaluate at an integer ``x``. @@ -3085,7 +3085,7 @@ cdef class Q_to_quadratic_field_element(Morphism): import sage.categories.homset Morphism.__init__(self, sage.categories.homset.Hom(QQ, K)) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): r""" Evaluate at a rational ``x``. diff --git a/src/sage/rings/number_field/number_field_morphisms.pyx b/src/sage/rings/number_field/number_field_morphisms.pyx index 8a1865c3ceb..94a917b5322 100644 --- a/src/sage/rings/number_field/number_field_morphisms.pyx +++ b/src/sage/rings/number_field/number_field_morphisms.pyx @@ -62,7 +62,7 @@ cdef class NumberFieldEmbedding(Morphism): else: self._gen_image = R(gen_embedding) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ A helper for pickling and copying. @@ -93,7 +93,7 @@ cdef class NumberFieldEmbedding(Morphism): slots['_gen_image'] = self._gen_image return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ A helper for unpickling and copying. @@ -119,7 +119,7 @@ cdef class NumberFieldEmbedding(Morphism): Morphism._update_slots(self, _slots) self._gen_image = _slots['_gen_image'] - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: @@ -322,7 +322,7 @@ cdef class EmbeddedNumberFieldConversion(Map): self.ambient_field = ambient_field Map.__init__(self, K, L) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: @@ -344,7 +344,7 @@ cdef class EmbeddedNumberFieldConversion(Map): return gen_image -cpdef matching_root(poly, target, ambient_field=None, margin=1, max_prec=None) noexcept: +cpdef matching_root(poly, target, ambient_field=None, margin=1, max_prec=None): """ Given a polynomial and a ``target``, choose the root that ``target`` best approximates as compared in ``ambient_field``. @@ -407,7 +407,7 @@ cpdef matching_root(poly, target, ambient_field=None, margin=1, max_prec=None) n ambient_field = ambient_field.to_prec(ambient_field.prec() * 2) -cpdef closest(target, values, margin=1) noexcept: +cpdef closest(target, values, margin=1): """ This is a utility function that returns the item in ``values`` closest to target (with respect to the ``abs`` function). If ``margin`` is greater @@ -626,7 +626,7 @@ cdef class CyclotomicFieldEmbedding(NumberFieldEmbedding): self.ratio = L._log_gen(K.coerce_embedding()(K.gen())) self._gen_image = L.gen() ** self.ratio - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ A helper for pickling and copying. @@ -657,7 +657,7 @@ cdef class CyclotomicFieldEmbedding(NumberFieldEmbedding): slots['ratio'] = self.ratio return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ A helper for unpickling and copying. @@ -684,7 +684,7 @@ cdef class CyclotomicFieldEmbedding(NumberFieldEmbedding): self._gen_image = _slots['_gen_image'] self.ratio = _slots['ratio'] - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: @@ -765,7 +765,7 @@ cdef class CyclotomicFieldConversion(Map): self.phi = L.hom([M.gen()**(n3//n2)]) Map.__init__(self, K, L) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Call a conversion map between cyclotomic fields. diff --git a/src/sage/rings/number_field/totallyreal_data.pxd b/src/sage/rings/number_field/totallyreal_data.pxd index efa01dbb4b7..61973829ddb 100644 --- a/src/sage/rings/number_field/totallyreal_data.pxd +++ b/src/sage/rings/number_field/totallyreal_data.pxd @@ -1,7 +1,7 @@ cdef double eval_seq_as_poly(int *f, int n, double x) noexcept cdef double newton(int *f, int *df, int n, double x0, double eps) noexcept cdef void newton_in_intervals(int *f, int *df, int n, double *beta, double eps, double *rts) noexcept -cpdef lagrange_degree_3(int n, int an1, int an2, int an3) noexcept +cpdef lagrange_degree_3(int n, int an1, int an2, int an3) cimport sage.rings.integer diff --git a/src/sage/rings/number_field/totallyreal_data.pyx b/src/sage/rings/number_field/totallyreal_data.pyx index 4fae308299d..6336b16264b 100644 --- a/src/sage/rings/number_field/totallyreal_data.pyx +++ b/src/sage/rings/number_field/totallyreal_data.pyx @@ -189,7 +189,7 @@ cdef void newton_in_intervals(int *f, int *df, int n, double *beta, for i from 0 <= i < n: rts[i] = newton(f, df, n, (beta[i]+beta[i+1])/2, eps) -cpdef lagrange_degree_3(int n, int an1, int an2, int an3) noexcept: +cpdef lagrange_degree_3(int n, int an1, int an2, int an3): r""" Private function. Solves the equations which arise in the Lagrange multiplier for degree 3: for each `1 \leq r \leq n-2`, we solve diff --git a/src/sage/rings/padics/CA_template.pxi b/src/sage/rings/padics/CA_template.pxi index c1a5ecbca0e..e8d906b01c8 100644 --- a/src/sage/rings/padics/CA_template.pxi +++ b/src/sage/rings/padics/CA_template.pxi @@ -94,7 +94,7 @@ cdef class CAElement(pAdicTemplateElement): else: cconv(self.value, x, self.absprec, 0, self.prime_pow) - cdef CAElement _new_c(self) noexcept: + cdef CAElement _new_c(self): """ Create a new element with the same basic info. @@ -120,7 +120,7 @@ cdef class CAElement(pAdicTemplateElement): cconstruct(ans.value, ans.prime_pow) return ans - cdef pAdicTemplateElement _new_with_value(self, celement value, long absprec) noexcept: + cdef pAdicTemplateElement _new_with_value(self, celement value, long absprec): """ Create a new element with a given value and absolute precision. @@ -197,7 +197,7 @@ cdef class CAElement(pAdicTemplateElement): """ return unpickle_cae_v2, (self.__class__, self.parent(), cpickle(self.value, self.prime_pow), self.absprec) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Return the additive inverse of this element. @@ -214,7 +214,7 @@ cdef class CAElement(pAdicTemplateElement): creduce_small(ans.value, ans.value, ans.absprec, ans.prime_pow) return ans - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): """ Return the sum of this element and ``_right``. @@ -238,7 +238,7 @@ cdef class CAElement(pAdicTemplateElement): creduce(ans.value, ans.value, ans.absprec, ans.prime_pow) return ans - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): """ Return the difference of this element and ``_right``. @@ -282,7 +282,7 @@ cdef class CAElement(pAdicTemplateElement): """ return ~self.parent().fraction_field()(self) - cpdef _mul_(self, _right) noexcept: + cpdef _mul_(self, _right): """ Return the product of this element and ``_right``. @@ -305,7 +305,7 @@ cdef class CAElement(pAdicTemplateElement): creduce(ans.value, ans.value, ans.absprec, ans.prime_pow) return ans - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Return the quotient of this element and ``right``. @@ -534,7 +534,7 @@ cdef class CAElement(pAdicTemplateElement): pright.value, rval, pright.absprec, self.prime_pow) return ans - cdef pAdicTemplateElement _lshift_c(self, long shift) noexcept: + cdef pAdicTemplateElement _lshift_c(self, long shift): r""" Multiplies by `\pi^{\mbox{shift}}`. @@ -566,7 +566,7 @@ cdef class CAElement(pAdicTemplateElement): cshift_notrunc(ans.value, self.value, shift, ans.absprec, ans.prime_pow, self.prime_pow.e > 1) return ans - cdef pAdicTemplateElement _rshift_c(self, long shift) noexcept: + cdef pAdicTemplateElement _rshift_c(self, long shift): r""" Divides by ``π^{\mbox{shift}}``. @@ -815,7 +815,7 @@ cdef class CAElement(pAdicTemplateElement): return 0 return ccmp(self.value, right.value, aprec, aprec < self.absprec, aprec < right.absprec, self.prime_pow) - cdef pAdicTemplateElement lift_to_precision_c(self, long absprec) noexcept: + cdef pAdicTemplateElement lift_to_precision_c(self, long absprec): """ Return an arbitrary lift of this element to higher precision. @@ -1001,7 +1001,7 @@ cdef class CAElement(pAdicTemplateElement): mpz_set_si(ans.value, self.absprec - self.valuation_c()) return ans - cpdef pAdicTemplateElement unit_part(CAElement self) noexcept: + cpdef pAdicTemplateElement unit_part(CAElement self): r""" Return the unit part of this element. @@ -1049,7 +1049,7 @@ cdef class CAElement(pAdicTemplateElement): """ return cvaluation(self.value, self.absprec, self.prime_pow) - cpdef val_unit(self) noexcept: + cpdef val_unit(self): r""" Return a 2-tuple, the first element set to the valuation of this element, and the second to the unit part of this element. @@ -1118,7 +1118,7 @@ cdef class pAdicCoercion_ZZ_CA(RingHomomorphism): self._zero = R.element_class(R, 0) self._section = pAdicConvert_CA_ZZ(R) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1138,7 +1138,7 @@ cdef class pAdicCoercion_ZZ_CA(RingHomomorphism): _slots['_section'] = self.section() # use method since it copies coercion-internal sections. return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1157,7 +1157,7 @@ cdef class pAdicCoercion_ZZ_CA(RingHomomorphism): self._section = _slots['_section'] RingHomomorphism._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluation. @@ -1176,7 +1176,7 @@ cdef class pAdicCoercion_ZZ_CA(RingHomomorphism): cconv_mpz_t(ans.value, (x).value, ans.absprec, True, ans.prime_pow) return ans - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -1271,7 +1271,7 @@ cdef class pAdicConvert_CA_ZZ(RingMap): else: RingMap.__init__(self, Hom(R, ZZ, Sets())) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Evaluation. @@ -1312,7 +1312,7 @@ cdef class pAdicConvert_QQ_CA(Morphism): Morphism.__init__(self, Hom(QQ, R, SetsWithPartialMaps())) self._zero = R.element_class(R, 0) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1331,7 +1331,7 @@ cdef class pAdicConvert_QQ_CA(Morphism): _slots['_zero'] = self._zero return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1349,7 +1349,7 @@ cdef class pAdicConvert_QQ_CA(Morphism): self._zero = _slots['_zero'] Morphism._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluation. @@ -1368,7 +1368,7 @@ cdef class pAdicConvert_QQ_CA(Morphism): ans.absprec = ans.prime_pow.ram_prec_cap return ans - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -1451,7 +1451,7 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism): self._zero = K(0) self._section = pAdicConvert_CA_frac_field(K, R) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Evaluation. @@ -1476,7 +1476,7 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism): ans._normalize() return ans - cpdef Element _call_with_args(self, _x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, _x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -1554,7 +1554,7 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism): self._section = copy.copy(self._section) return self._section - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1584,7 +1584,7 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism): _slots['_section'] = self.section() # use method since it copies coercion-internal sections. return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1675,7 +1675,7 @@ cdef class pAdicConvert_CA_frac_field(Morphism): Morphism.__init__(self, Hom(K, R, SetsWithPartialMaps())) self._zero = R(0) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Evaluation. @@ -1707,7 +1707,7 @@ cdef class pAdicConvert_CA_frac_field(Morphism): ans.value._coeffs = [R(c) for c in ans.value._coeffs] return ans - cpdef Element _call_with_args(self, _x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, _x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -1763,7 +1763,7 @@ cdef class pAdicConvert_CA_frac_field(Morphism): ans.value._coeffs = [R(c) for c in ans.value._coeffs] return ans - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1792,7 +1792,7 @@ cdef class pAdicConvert_CA_frac_field(Morphism): _slots['_zero'] = self._zero return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. diff --git a/src/sage/rings/padics/CA_template_header.pxi b/src/sage/rings/padics/CA_template_header.pxi index 87194617daa..d15a055cb4d 100644 --- a/src/sage/rings/padics/CA_template_header.pxi +++ b/src/sage/rings/padics/CA_template_header.pxi @@ -31,7 +31,7 @@ cdef class CAElement(pAdicTemplateElement): cdef celement value cdef long absprec - cdef CAElement _new_c(self) noexcept + cdef CAElement _new_c(self) cdef class pAdicCoercion_ZZ_CA(RingHomomorphism): cdef CAElement _zero diff --git a/src/sage/rings/padics/CR_template.pxi b/src/sage/rings/padics/CR_template.pxi index 24d9c061697..acdc4803670 100644 --- a/src/sage/rings/padics/CR_template.pxi +++ b/src/sage/rings/padics/CR_template.pxi @@ -176,7 +176,7 @@ cdef class CRElement(pAdicTemplateElement): self.ordp = absprec self.relprec = 0 - cdef CRElement _new_c(self) noexcept: + cdef CRElement _new_c(self): """ Creates a new element with the same basic info. @@ -204,7 +204,7 @@ cdef class CRElement(pAdicTemplateElement): cconstruct(ans.unit, ans.prime_pow) return ans - cdef pAdicTemplateElement _new_with_value(self, celement value, long absprec) noexcept: + cdef pAdicTemplateElement _new_with_value(self, celement value, long absprec): """ Creates a new element with a given value and absolute precision. @@ -306,7 +306,7 @@ cdef class CRElement(pAdicTemplateElement): """ return unpickle_cre_v2, (self.__class__, self.parent(), cpickle(self.unit, self.prime_pow), self.ordp, self.relprec) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Return the additive inverse of this element. @@ -330,7 +330,7 @@ cdef class CRElement(pAdicTemplateElement): creduce(ans.unit, ans.unit, ans.relprec, ans.prime_pow) return ans - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): """ Return the sum of this element and ``_right``. @@ -374,7 +374,7 @@ cdef class CRElement(pAdicTemplateElement): creduce(ans.unit, ans.unit, ans.relprec, ans.prime_pow) return ans - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): """ Return the difference of this element and ``_right``. @@ -448,7 +448,7 @@ cdef class CRElement(pAdicTemplateElement): cinvert(ans.unit, self.unit, ans.relprec, ans.prime_pow) return ans - cpdef _mul_(self, _right) noexcept: + cpdef _mul_(self, _right): r""" Return the product of this element and ``_right``. @@ -479,7 +479,7 @@ cdef class CRElement(pAdicTemplateElement): check_ordp(ans.ordp) return ans - cpdef _div_(self, _right) noexcept: + cpdef _div_(self, _right): """ Return the quotient of this element and ``right``. @@ -734,7 +734,7 @@ cdef class CRElement(pAdicTemplateElement): ans.ordp = 0 return ans - cdef pAdicTemplateElement _lshift_c(self, long shift) noexcept: + cdef pAdicTemplateElement _lshift_c(self, long shift): r""" Multiplies by `\pi^{\mbox{shift}}`. @@ -765,7 +765,7 @@ cdef class CRElement(pAdicTemplateElement): ccopy(ans.unit, self.unit, ans.prime_pow) return ans - cdef pAdicTemplateElement _rshift_c(self, long shift) noexcept: + cdef pAdicTemplateElement _rshift_c(self, long shift): r""" Divides by ``\pi^{\mbox{shift}}``. @@ -1195,7 +1195,7 @@ cdef class CRElement(pAdicTemplateElement): return 0 return ccmp(self.unit, right.unit, rprec, rprec < self.relprec, rprec < right.relprec, self.prime_pow) - cdef pAdicTemplateElement lift_to_precision_c(self, long absprec) noexcept: + cdef pAdicTemplateElement lift_to_precision_c(self, long absprec): """ Lifts this element to another with precision at least ``absprec``. @@ -1421,7 +1421,7 @@ cdef class CRElement(pAdicTemplateElement): mpz_set_si(ans.value, self.relprec) return ans - cpdef pAdicTemplateElement unit_part(self) noexcept: + cpdef pAdicTemplateElement unit_part(self): r""" Return `u`, where this element is `\pi^v u`. @@ -1484,7 +1484,7 @@ cdef class CRElement(pAdicTemplateElement): """ return self.ordp - cpdef val_unit(self, p=None) noexcept: + cpdef val_unit(self, p=None): """ Return a pair ``(self.valuation(), self.unit_part())``. @@ -1574,7 +1574,7 @@ cdef class pAdicCoercion_ZZ_CR(RingHomomorphism): self._zero = R.element_class(R, 0) self._section = pAdicConvert_CR_ZZ(R) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1600,7 +1600,7 @@ cdef class pAdicCoercion_ZZ_CR(RingHomomorphism): _slots['_section'] = self.section() # use method since it copies coercion-internal sections. return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1626,7 +1626,7 @@ cdef class pAdicCoercion_ZZ_CR(RingHomomorphism): self._section = _slots['_section'] RingHomomorphism._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluation. @@ -1645,7 +1645,7 @@ cdef class pAdicCoercion_ZZ_CR(RingHomomorphism): ans.ordp = cconv_mpz_t(ans.unit, (x).value, ans.relprec, False, ans.prime_pow) return ans - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both), or an empty element is @@ -1741,7 +1741,7 @@ cdef class pAdicConvert_CR_ZZ(RingMap): else: RingMap.__init__(self, Hom(R, ZZ, Sets())) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Evaluation. @@ -1792,7 +1792,7 @@ cdef class pAdicCoercion_QQ_CR(RingHomomorphism): self._zero = R.element_class(R, 0) self._section = pAdicConvert_CR_QQ(R) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1818,7 +1818,7 @@ cdef class pAdicCoercion_QQ_CR(RingHomomorphism): _slots['_section'] = self.section() # use method since it copies coercion-internal sections. return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1844,7 +1844,7 @@ cdef class pAdicCoercion_QQ_CR(RingHomomorphism): self._section = _slots['_section'] RingHomomorphism._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluation. @@ -1865,7 +1865,7 @@ cdef class pAdicCoercion_QQ_CR(RingHomomorphism): ans.ordp = cconv_mpq_t(ans.unit, (x).value, ans.relprec, False, self._zero.prime_pow) return ans - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both), or an empty element is @@ -1959,7 +1959,7 @@ cdef class pAdicConvert_CR_QQ(RingMap): else: RingMap.__init__(self, Hom(R, QQ, Sets())) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Evaluation. @@ -2006,7 +2006,7 @@ cdef class pAdicConvert_QQ_CR(Morphism): self._zero = R.element_class(R, 0) self._section = pAdicConvert_CR_QQ(R) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -2026,7 +2026,7 @@ cdef class pAdicConvert_QQ_CR(Morphism): _slots['_section'] = self.section() # use method since it copies coercion-internal sections. return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -2045,7 +2045,7 @@ cdef class pAdicConvert_QQ_CR(Morphism): self._section = _slots['_section'] Morphism._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluation. @@ -2066,7 +2066,7 @@ cdef class pAdicConvert_QQ_CR(Morphism): raise ValueError("p divides the denominator") return ans - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both), or an empty element is @@ -2170,7 +2170,7 @@ cdef class pAdicCoercion_CR_frac_field(RingHomomorphism): self._zero = K(0) self._section = pAdicConvert_CR_frac_field(K, R) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Evaluation. @@ -2196,7 +2196,7 @@ cdef class pAdicCoercion_CR_frac_field(RingHomomorphism): ans.unit._coeffs = [K(c) for c in ans.unit._coeffs] return ans - cpdef Element _call_with_args(self, _x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, _x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -2278,7 +2278,7 @@ cdef class pAdicCoercion_CR_frac_field(RingHomomorphism): self._section = copy.copy(self._section) return self._section - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -2308,7 +2308,7 @@ cdef class pAdicCoercion_CR_frac_field(RingHomomorphism): _slots['_section'] = self.section() # use method since it copies coercion-internal sections. return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -2399,7 +2399,7 @@ cdef class pAdicConvert_CR_frac_field(Morphism): Morphism.__init__(self, Hom(K, R, SetsWithPartialMaps())) self._zero = R(0) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Evaluation. @@ -2425,7 +2425,7 @@ cdef class pAdicConvert_CR_frac_field(Morphism): ans.unit._coeffs = [K(c) for c in ans.unit._coeffs] return ans - cpdef Element _call_with_args(self, _x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, _x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -2485,7 +2485,7 @@ cdef class pAdicConvert_CR_frac_field(Morphism): ans.unit._coeffs = [K(c) for c in ans.unit._coeffs] return ans - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -2514,7 +2514,7 @@ cdef class pAdicConvert_CR_frac_field(Morphism): _slots['_zero'] = self._zero return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. diff --git a/src/sage/rings/padics/CR_template_header.pxi b/src/sage/rings/padics/CR_template_header.pxi index b969463bc72..54c482f7ff2 100644 --- a/src/sage/rings/padics/CR_template_header.pxi +++ b/src/sage/rings/padics/CR_template_header.pxi @@ -32,9 +32,9 @@ cdef class CRElement(pAdicTemplateElement): cdef long ordp cdef long relprec - cdef CRElement _new_c(self) noexcept + cdef CRElement _new_c(self) cdef int _normalize(self) except -1 - cpdef val_unit(self, p=*) noexcept + cpdef val_unit(self, p=*) cdef class pAdicCoercion_ZZ_CR(RingHomomorphism): cdef CRElement _zero diff --git a/src/sage/rings/padics/FM_template.pxi b/src/sage/rings/padics/FM_template.pxi index 5e6682c3e3b..8ce93d797a8 100644 --- a/src/sage/rings/padics/FM_template.pxi +++ b/src/sage/rings/padics/FM_template.pxi @@ -89,7 +89,7 @@ cdef class FMElement(pAdicTemplateElement): else: cconv(self.value, x, self.prime_pow.ram_prec_cap, 0, self.prime_pow) - cdef FMElement _new_c(self) noexcept: + cdef FMElement _new_c(self): """ Creates a new element with the same basic info. @@ -108,7 +108,7 @@ cdef class FMElement(pAdicTemplateElement): cconstruct(ans.value, ans.prime_pow) return ans - cdef pAdicTemplateElement _new_with_value(self, celement value, long absprec) noexcept: + cdef pAdicTemplateElement _new_with_value(self, celement value, long absprec): """ Creates a new element with a given value and absolute precision. @@ -179,7 +179,7 @@ cdef class FMElement(pAdicTemplateElement): """ return unpickle_fme_v2, (self.__class__, self.parent(), cpickle(self.value, self.prime_pow)) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): r""" Return the additive inverse of this element. @@ -194,7 +194,7 @@ cdef class FMElement(pAdicTemplateElement): creduce_small(ans.value, ans.value, ans.prime_pow.ram_prec_cap, ans.prime_pow) return ans - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): r""" Return the sum of this element and ``_right``. @@ -214,7 +214,7 @@ cdef class FMElement(pAdicTemplateElement): creduce_small(ans.value, ans.value, ans.prime_pow.ram_prec_cap, ans.prime_pow) return ans - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): r""" Return the difference of this element and ``_right``. @@ -259,7 +259,7 @@ cdef class FMElement(pAdicTemplateElement): cinvert(ans.value, self.value, ans.prime_pow.ram_prec_cap, ans.prime_pow) return ans - cpdef _mul_(self, _right) noexcept: + cpdef _mul_(self, _right): r""" Return the product of this element and ``_right``. @@ -277,7 +277,7 @@ cdef class FMElement(pAdicTemplateElement): creduce(ans.value, ans.value, ans.prime_pow.ram_prec_cap, ans.prime_pow) return ans - cpdef _div_(self, _right) noexcept: + cpdef _div_(self, _right): r""" Return the quotient of this element and ``right``. ``right`` must have valuation zero. @@ -379,7 +379,7 @@ cdef class FMElement(pAdicTemplateElement): cpow(ans.value, self.value, right.value, self.prime_pow.ram_prec_cap, self.prime_pow) return ans - cdef pAdicTemplateElement _lshift_c(self, long shift) noexcept: + cdef pAdicTemplateElement _lshift_c(self, long shift): r""" Multiplies self by `\pi^{shift}`. @@ -426,7 +426,7 @@ cdef class FMElement(pAdicTemplateElement): cshift_notrunc(ans.value, self.value, shift, ans.prime_pow.ram_prec_cap, ans.prime_pow, True) return ans - cdef pAdicTemplateElement _rshift_c(self, long shift) noexcept: + cdef pAdicTemplateElement _rshift_c(self, long shift): r""" Divides by `\pi^{shift}`, and truncates. @@ -647,7 +647,7 @@ cdef class FMElement(pAdicTemplateElement): cdef FMElement right = _right return ccmp(self.value, right.value, self.prime_pow.ram_prec_cap, False, False, self.prime_pow) - cdef pAdicTemplateElement lift_to_precision_c(self, long absprec) noexcept: + cdef pAdicTemplateElement lift_to_precision_c(self, long absprec): """ Lifts this element to another with precision at least absprec. @@ -779,7 +779,7 @@ cdef class FMElement(pAdicTemplateElement): mpz_set_si(ans.value, self.prime_pow.ram_prec_cap - self.valuation_c()) return ans - cpdef pAdicTemplateElement unit_part(FMElement self) noexcept: + cpdef pAdicTemplateElement unit_part(FMElement self): r""" Return the unit part of ``self``. @@ -835,7 +835,7 @@ cdef class FMElement(pAdicTemplateElement): # for backward compatibility return cvaluation(self.value, self.prime_pow.ram_prec_cap, self.prime_pow) - cpdef val_unit(self) noexcept: + cpdef val_unit(self): """ Return a 2-tuple, the first element set to the valuation of ``self``, and the second to the unit part of ``self``. @@ -897,7 +897,7 @@ cdef class pAdicCoercion_ZZ_FM(RingHomomorphism): self._zero = R.element_class(R, 0) self._section = pAdicConvert_FM_ZZ(R) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -917,7 +917,7 @@ cdef class pAdicCoercion_ZZ_FM(RingHomomorphism): _slots['_section'] = self.section() # use method since it copies coercion-internal sections. return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -936,7 +936,7 @@ cdef class pAdicCoercion_ZZ_FM(RingHomomorphism): self._section = _slots['_section'] RingHomomorphism._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluation. @@ -954,7 +954,7 @@ cdef class pAdicCoercion_ZZ_FM(RingHomomorphism): cconv_mpz_t(ans.value, (x).value, ans.prime_pow.ram_prec_cap, True, ans.prime_pow) return ans - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -1040,7 +1040,7 @@ cdef class pAdicConvert_FM_ZZ(RingMap): else: RingMap.__init__(self, Hom(R, ZZ, Sets())) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Evaluation. @@ -1081,7 +1081,7 @@ cdef class pAdicConvert_QQ_FM(Morphism): Morphism.__init__(self, Hom(QQ, R, SetsWithPartialMaps())) self._zero = R.element_class(R, 0) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1100,7 +1100,7 @@ cdef class pAdicConvert_QQ_FM(Morphism): _slots['_zero'] = self._zero return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1118,7 +1118,7 @@ cdef class pAdicConvert_QQ_FM(Morphism): self._zero = _slots['_zero'] Morphism._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluation. @@ -1136,7 +1136,7 @@ cdef class pAdicConvert_QQ_FM(Morphism): cconv_mpq_t(ans.value, (x).value, ans.prime_pow.ram_prec_cap, True, ans.prime_pow) return ans - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -1210,7 +1210,7 @@ cdef class pAdicCoercion_FM_frac_field(RingHomomorphism): self._zero = K(0) self._section = pAdicConvert_FM_frac_field(K, R) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Evaluation. @@ -1234,7 +1234,7 @@ cdef class pAdicCoercion_FM_frac_field(RingHomomorphism): ans.unit._coeffs = [K(c) for c in ans.unit._coeffs] return ans - cpdef Element _call_with_args(self, _x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, _x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -1305,7 +1305,7 @@ cdef class pAdicCoercion_FM_frac_field(RingHomomorphism): self._section = copy.copy(self._section) return self._section - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1334,7 +1334,7 @@ cdef class pAdicCoercion_FM_frac_field(RingHomomorphism): _slots['_section'] = self.section() # use method since it copies coercion-internal sections. return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1425,7 +1425,7 @@ cdef class pAdicConvert_FM_frac_field(Morphism): Morphism.__init__(self, Hom(K, R, SetsWithPartialMaps())) self._zero = R(0) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Evaluation. @@ -1451,7 +1451,7 @@ cdef class pAdicConvert_FM_frac_field(Morphism): ans.value._coeffs = [R(c) for c in ans.value._coeffs] return ans - cpdef Element _call_with_args(self, _x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, _x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -1500,7 +1500,7 @@ cdef class pAdicConvert_FM_frac_field(Morphism): ans.value._coeffs = [R(c) for c in ans.value._coeffs] return ans - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1529,7 +1529,7 @@ cdef class pAdicConvert_FM_frac_field(Morphism): _slots['_zero'] = self._zero return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. diff --git a/src/sage/rings/padics/FM_template_header.pxi b/src/sage/rings/padics/FM_template_header.pxi index d9ecc7d0715..bd651167622 100644 --- a/src/sage/rings/padics/FM_template_header.pxi +++ b/src/sage/rings/padics/FM_template_header.pxi @@ -31,7 +31,7 @@ cdef class FMElement(pAdicTemplateElement): cdef celement value cdef long absprec - cdef FMElement _new_c(self) noexcept + cdef FMElement _new_c(self) cdef class pAdicCoercion_ZZ_FM(RingHomomorphism): cdef FMElement _zero diff --git a/src/sage/rings/padics/FP_template.pxi b/src/sage/rings/padics/FP_template.pxi index 29ddd1e72c7..5c7f94051e7 100644 --- a/src/sage/rings/padics/FP_template.pxi +++ b/src/sage/rings/padics/FP_template.pxi @@ -171,7 +171,7 @@ cdef class FPElement(pAdicTemplateElement): csetone(self.unit, self.prime_pow) self.ordp = minusmaxordp - cdef FPElement _new_c(self) noexcept: + cdef FPElement _new_c(self): """ Creates a new element with the same basic info. @@ -197,7 +197,7 @@ cdef class FPElement(pAdicTemplateElement): cconstruct(ans.unit, ans.prime_pow) return ans - cdef pAdicTemplateElement _new_with_value(self, celement value, long absprec) noexcept: + cdef pAdicTemplateElement _new_with_value(self, celement value, long absprec): """ Creates a new element with a given value and absolute precision. @@ -313,7 +313,7 @@ cdef class FPElement(pAdicTemplateElement): # """ # return (self)._richcmp(right, op) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): r""" Return the additive inverse of this element. @@ -332,7 +332,7 @@ cdef class FPElement(pAdicTemplateElement): creduce_small(ans.unit, ans.unit, ans.prime_pow.ram_prec_cap, ans.prime_pow) return ans - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): r""" Return the sum of this element and ``_right``. @@ -376,7 +376,7 @@ cdef class FPElement(pAdicTemplateElement): creduce(ans.unit, ans.unit, ans.prime_pow.ram_prec_cap, ans.prime_pow) return ans - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): r""" Return the difference of this element and ``_right``. @@ -455,7 +455,7 @@ cdef class FPElement(pAdicTemplateElement): cinvert(ans.unit, self.unit, ans.prime_pow.ram_prec_cap, ans.prime_pow) return ans - cpdef _mul_(self, _right) noexcept: + cpdef _mul_(self, _right): r""" Return the product of this element and ``_right``. @@ -488,7 +488,7 @@ cdef class FPElement(pAdicTemplateElement): creduce(ans.unit, ans.unit, ans.prime_pow.ram_prec_cap, ans.prime_pow) return ans - cpdef _div_(self, _right) noexcept: + cpdef _div_(self, _right): r""" Return the quotient of this element and ``right``. @@ -665,7 +665,7 @@ cdef class FPElement(pAdicTemplateElement): ans.ordp = 0 return ans - cdef pAdicTemplateElement _lshift_c(self, long shift) noexcept: + cdef pAdicTemplateElement _lshift_c(self, long shift): r""" Multiplies self by `\pi^{shift}`. @@ -718,7 +718,7 @@ cdef class FPElement(pAdicTemplateElement): ccopy(ans.unit, self.unit, ans.prime_pow) return ans - cdef pAdicTemplateElement _rshift_c(self, long shift) noexcept: + cdef pAdicTemplateElement _rshift_c(self, long shift): r""" Divides by `\pi^{shift}`. @@ -987,7 +987,7 @@ cdef class FPElement(pAdicTemplateElement): cdef FPElement right = _right return ccmp(self.unit, right.unit, self.prime_pow.ram_prec_cap, False, False, self.prime_pow) - cdef pAdicTemplateElement lift_to_precision_c(self, long absprec) noexcept: + cdef pAdicTemplateElement lift_to_precision_c(self, long absprec): """ Lift this element to another with precision at least absprec. @@ -1138,7 +1138,7 @@ cdef class FPElement(pAdicTemplateElement): mpz_set_si(ans.value, self.prime_pow.ram_prec_cap) return ans - cpdef pAdicTemplateElement unit_part(FPElement self) noexcept: + cpdef pAdicTemplateElement unit_part(FPElement self): r""" Return the unit part of this element. @@ -1205,7 +1205,7 @@ cdef class FPElement(pAdicTemplateElement): """ return self.ordp - cpdef val_unit(self, p=None) noexcept: + cpdef val_unit(self, p=None): """ Return a 2-tuple, the first element set to the valuation of this element, and the second to the unit part. @@ -1279,7 +1279,7 @@ cdef class pAdicCoercion_ZZ_FP(RingHomomorphism): self._zero = R.element_class(R, 0) self._section = pAdicConvert_FP_ZZ(R) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1299,7 +1299,7 @@ cdef class pAdicCoercion_ZZ_FP(RingHomomorphism): _slots['_section'] = self.section() # use method since it copies coercion-internal sections. return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1318,7 +1318,7 @@ cdef class pAdicCoercion_ZZ_FP(RingHomomorphism): self._section = _slots['_section'] RingHomomorphism._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluation. @@ -1336,7 +1336,7 @@ cdef class pAdicCoercion_ZZ_FP(RingHomomorphism): ans.ordp = cconv_mpz_t(ans.unit, (x).value, ans.prime_pow.ram_prec_cap, False, ans.prime_pow) return ans - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -1430,7 +1430,7 @@ cdef class pAdicConvert_FP_ZZ(RingMap): else: RingMap.__init__(self, Hom(R, ZZ, Sets())) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Evaluation. @@ -1491,7 +1491,7 @@ cdef class pAdicCoercion_QQ_FP(RingHomomorphism): self._zero = R.element_class(R, 0) self._section = pAdicConvert_FP_QQ(R) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1517,7 +1517,7 @@ cdef class pAdicCoercion_QQ_FP(RingHomomorphism): _slots['_section'] = self.section() # use method since it copies coercion-internal sections. return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1542,7 +1542,7 @@ cdef class pAdicCoercion_QQ_FP(RingHomomorphism): self._section = _slots['_section'] RingHomomorphism._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluation. @@ -1564,7 +1564,7 @@ cdef class pAdicCoercion_QQ_FP(RingHomomorphism): ans.ordp = cconv_mpq_t(ans.unit, (x).value, ans.prime_pow.ram_prec_cap, False, self._zero.prime_pow) return ans - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -1647,7 +1647,7 @@ cdef class pAdicConvert_FP_QQ(RingMap): """ RingMap.__init__(self, Hom(R, QQ, SetsWithPartialMaps())) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): """ Evaluation. @@ -1694,7 +1694,7 @@ cdef class pAdicConvert_QQ_FP(Morphism): Morphism.__init__(self, Hom(QQ, R, SetsWithPartialMaps())) self._zero = R.element_class(R, 0) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -1713,7 +1713,7 @@ cdef class pAdicConvert_QQ_FP(Morphism): _slots['_zero'] = self._zero return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -1731,7 +1731,7 @@ cdef class pAdicConvert_QQ_FP(Morphism): self._zero = _slots['_zero'] Morphism._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluation. @@ -1751,7 +1751,7 @@ cdef class pAdicConvert_QQ_FP(Morphism): raise ValueError("p divides the denominator") return ans - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ This function is used when some precision cap is passed in (relative or absolute or both). @@ -1833,7 +1833,7 @@ cdef class pAdicCoercion_FP_frac_field(RingHomomorphism): self._zero = K(0) self._section = pAdicConvert_FP_frac_field(K, R) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): r""" Evaluation. @@ -1858,7 +1858,7 @@ cdef class pAdicCoercion_FP_frac_field(RingHomomorphism): ans.unit._coeffs = [K(c) for c in ans.unit._coeffs] return ans - cpdef Element _call_with_args(self, _x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, _x, args=(), kwds={}): r""" This function is used when some precision cap is passed in (relative or absolute or both). @@ -1929,7 +1929,7 @@ cdef class pAdicCoercion_FP_frac_field(RingHomomorphism): """ return self._section - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): r""" Helper for copying and pickling. @@ -1958,7 +1958,7 @@ cdef class pAdicCoercion_FP_frac_field(RingHomomorphism): _slots['_section'] = self.section() # use method since it copies coercion-internal sections. return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): r""" Helper for copying and pickling. @@ -2016,7 +2016,7 @@ cdef class pAdicConvert_FP_frac_field(Morphism): Morphism.__init__(self, Hom(K, R, SetsWithPartialMaps())) self._zero = R(0) - cpdef Element _call_(self, _x) noexcept: + cpdef Element _call_(self, _x): r""" Evaluation. @@ -2041,7 +2041,7 @@ cdef class pAdicConvert_FP_frac_field(Morphism): ans.unit._coeffs = [K(c) for c in ans.unit._coeffs] return ans - cpdef Element _call_with_args(self, _x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, _x, args=(), kwds={}): r""" This function is used when some precision cap is passed in (relative or absolute or both). @@ -2098,7 +2098,7 @@ cdef class pAdicConvert_FP_frac_field(Morphism): ans.unit._coeffs = [K(c) for c in ans.unit._coeffs] return ans - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): r""" Helper for copying and pickling. @@ -2127,7 +2127,7 @@ cdef class pAdicConvert_FP_frac_field(Morphism): _slots['_zero'] = self._zero return _slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): r""" Helper for copying and pickling. diff --git a/src/sage/rings/padics/FP_template_header.pxi b/src/sage/rings/padics/FP_template_header.pxi index 108d8042850..fde598e05fd 100644 --- a/src/sage/rings/padics/FP_template_header.pxi +++ b/src/sage/rings/padics/FP_template_header.pxi @@ -31,10 +31,10 @@ cdef class FPElement(pAdicTemplateElement): cdef celement unit cdef long ordp - cdef FPElement _new_c(self) noexcept + cdef FPElement _new_c(self) cdef int _normalize(self) except -1 cdef int _set_infinity(self) except -1 - cpdef val_unit(self, p=*) noexcept + cpdef val_unit(self, p=*) cdef class pAdicCoercion_ZZ_FP(RingHomomorphism): cdef FPElement _zero diff --git a/src/sage/rings/padics/local_generic_element.pyx b/src/sage/rings/padics/local_generic_element.pyx index f63cc114e96..e1f5a7a04a0 100644 --- a/src/sage/rings/padics/local_generic_element.pyx +++ b/src/sage/rings/padics/local_generic_element.pyx @@ -32,7 +32,7 @@ cdef class LocalGenericElement(CommutativeRingElement): #cpdef _add_(self, right): # raise NotImplementedError - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): r""" Returns the quotient of ``self`` by ``right``. @@ -435,7 +435,7 @@ cdef class LocalGenericElement(CommutativeRingElement): #def __pow__(self, right): # raise NotImplementedError - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): r""" Returns the difference between ``self`` and ``right``. diff --git a/src/sage/rings/padics/morphism.pxd b/src/sage/rings/padics/morphism.pxd index a904ba14ca0..b6afedd2377 100644 --- a/src/sage/rings/padics/morphism.pxd +++ b/src/sage/rings/padics/morphism.pxd @@ -7,4 +7,4 @@ cdef class FrobeniusEndomorphism_padics(RingHomomorphism): cdef long _power cdef long _order - cpdef Element _call_(self, x) noexcept + cpdef Element _call_(self, x) diff --git a/src/sage/rings/padics/morphism.pyx b/src/sage/rings/padics/morphism.pyx index a50c92a06f9..c8238bdc9fa 100644 --- a/src/sage/rings/padics/morphism.pyx +++ b/src/sage/rings/padics/morphism.pyx @@ -86,7 +86,7 @@ cdef class FrobeniusEndomorphism_padics(RingHomomorphism): self._order = self._degree / domain.absolute_f().gcd(self._power) RingHomomorphism.__init__(self, Hom(domain, domain)) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -105,7 +105,7 @@ cdef class FrobeniusEndomorphism_padics(RingHomomorphism): slots['_order'] = self._order return slots - cdef _update_slots(self, dict slots) noexcept: + cdef _update_slots(self, dict slots): """ Helper for copying and pickling. @@ -166,7 +166,7 @@ cdef class FrobeniusEndomorphism_padics(RingHomomorphism): s = "Frob^%s" % self._power return s - cpdef Element _call_ (self, x) noexcept: + cpdef Element _call_ (self, x): """ TESTS:: @@ -330,7 +330,7 @@ cdef class FrobeniusEndomorphism_padics(RingHomomorphism): codomain = self.codomain() return hash((domain, codomain, ('Frob', self._power))) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Compare ``left`` and ``right`` diff --git a/src/sage/rings/padics/padic_ZZ_pX_CA_element.pxd b/src/sage/rings/padics/padic_ZZ_pX_CA_element.pxd index 2bcb237be77..7afe94b1bf3 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_CA_element.pxd +++ b/src/sage/rings/padics/padic_ZZ_pX_CA_element.pxd @@ -13,12 +13,12 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): cdef int _set(self, ZZ_pX_c* value, long absprec) except -1 cdef int _set_from_mpq_part2(self, mpq_t x) except -1 - cpdef pAdicZZpXCRElement to_fraction_field(self) noexcept - cdef pAdicZZpXCAElement _new_c(self, long absprec) noexcept - cdef pAdicZZpXCAElement _lshift_c(self, long n) noexcept - cdef pAdicZZpXCAElement _rshift_c(self, long n) noexcept - cpdef pAdicZZpXCAElement unit_part(self) noexcept - cpdef _ntl_rep_abs(self) noexcept - cpdef ntl_ZZ_pX _ntl_rep(self) noexcept + cpdef pAdicZZpXCRElement to_fraction_field(self) + cdef pAdicZZpXCAElement _new_c(self, long absprec) + cdef pAdicZZpXCAElement _lshift_c(self, long n) + cdef pAdicZZpXCAElement _rshift_c(self, long n) + cpdef pAdicZZpXCAElement unit_part(self) + cpdef _ntl_rep_abs(self) + cpdef ntl_ZZ_pX _ntl_rep(self) - cpdef pAdicZZpXCAElement lift_to_precision(self, absprec=*) noexcept + cpdef pAdicZZpXCAElement lift_to_precision(self, absprec=*) diff --git a/src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx index 023e58ebc04..58f5670aa05 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_CA_element.pyx @@ -846,7 +846,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): else: self._set_prec_abs(ordp + relprec) - cdef pAdicZZpXCAElement _new_c(self, long absprec) noexcept: + cdef pAdicZZpXCAElement _new_c(self, long absprec): """ Returns a new element with the same parent as ``self`` and absolute precision ``absprec``. @@ -944,7 +944,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): """ return ~self.to_fraction_field() - cpdef pAdicZZpXCRElement to_fraction_field(self) noexcept: + cpdef pAdicZZpXCRElement to_fraction_field(self): """ Returns ``self`` cast into the fraction field of ``self.parent()``. @@ -971,7 +971,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): ans.unit = self.value return ans - cdef pAdicZZpXCAElement _lshift_c(self, long n) noexcept: + cdef pAdicZZpXCAElement _lshift_c(self, long n): """ Multiplies ``self`` by the uniformizer raised to the power ``n``. If ``n`` is negative, right shifts by ``-n``. @@ -1022,7 +1022,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): return ans return self._rshift_c(-mpz_get_si((shift).value)) - cdef pAdicZZpXCAElement _rshift_c(self, long n) noexcept: + cdef pAdicZZpXCAElement _rshift_c(self, long n): """ Divides ``self`` by the uniformizer raised to the power ``n``. If parent is not a field, throws away the non-positive part of @@ -1120,7 +1120,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): return ans return self._rshift_c(mpz_get_si((shift).value)) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Returns ``-self``. @@ -1386,7 +1386,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): sig_off() return ans - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): """ Computes the sum of ``self`` and ``right``. @@ -1424,7 +1424,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): ZZ_pX_add(ans.value, tmpP, right.value) return ans - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): """ Returns the difference of ``self`` and ``right``. @@ -1465,7 +1465,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): ZZ_pX_sub(ans.value, tmpP, right.value) return ans - cpdef _mul_(self, _right) noexcept: + cpdef _mul_(self, _right): """ Returns the product of ``self`` and ``right``. @@ -1518,7 +1518,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): ZZ_pX_MulMod_pre(ans.value, self_adapted, right_adapted, self.prime_pow.get_modulus_capdiv(ans_absprec)[0]) return ans - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Returns the quotient of ``self`` by ``right``. @@ -1651,7 +1651,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): ans = (self.valuation_c() >= aprec) return ans - cpdef ntl_ZZ_pX _ntl_rep(self) noexcept: + cpdef ntl_ZZ_pX _ntl_rep(self): """ Return an ``ntl_ZZ_pX`` that holds the value of ``self``. @@ -1673,7 +1673,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): ans.x = self.value return ans - cpdef _ntl_rep_abs(self) noexcept: + cpdef _ntl_rep_abs(self): """ Return a pair ``(f, 0)`` where ``f = self._ntl_rep()``. @@ -1792,7 +1792,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): # Should be sped up later return (self - right).is_zero(absprec) - cpdef pAdicZZpXCAElement lift_to_precision(self, absprec=None) noexcept: + cpdef pAdicZZpXCAElement lift_to_precision(self, absprec=None): """ Returns a ``pAdicZZpXCAElement`` congruent to ``self`` but with absolute precision at least ``absprec``. @@ -2271,7 +2271,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): else: return self.absprec - cpdef pAdicZZpXCAElement unit_part(self) noexcept: + cpdef pAdicZZpXCAElement unit_part(self): """ Returns the unit part of ``self``, ie ``self / uniformizer^(self.valuation())`` @@ -2294,7 +2294,7 @@ cdef class pAdicZZpXCAElement(pAdicZZpXElement): """ return self._rshift_c(self.valuation_c()) - cdef ext_p_list(self, bint pos) noexcept: + cdef ext_p_list(self, bint pos): """ Returns a list of integers (in the Eisenstein case) or a list of lists of integers (in the unramified case). ``self`` can diff --git a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pxd b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pxd index 4d458507ee0..9744b2a3f62 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pxd +++ b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pxd @@ -19,14 +19,14 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): cdef int _set_from_ZZ_pX_part1(self, ZZ_pX_c* poly) except -1 cdef int _set_from_ZZ_pX_part2(self, ZZ_pX_c* poly) except -1 - cdef pAdicZZpXCRElement _new_c(self, long relprec) noexcept + cdef pAdicZZpXCRElement _new_c(self, long relprec) cdef int _internal_lshift(self, long shift) except -1 cdef int _normalize(self) except -1 - cdef pAdicZZpXCRElement _lshift_c(self, long n) noexcept - cdef pAdicZZpXCRElement _rshift_c(self, long n) noexcept - cpdef pAdicZZpXCRElement unit_part(self) noexcept - cpdef ntl_ZZ_pX _ntl_rep_unnormalized(self) noexcept - cpdef _ntl_rep_abs(self) noexcept - cpdef ntl_ZZ_pX _ntl_rep(self) noexcept + cdef pAdicZZpXCRElement _lshift_c(self, long n) + cdef pAdicZZpXCRElement _rshift_c(self, long n) + cpdef pAdicZZpXCRElement unit_part(self) + cpdef ntl_ZZ_pX _ntl_rep_unnormalized(self) + cpdef _ntl_rep_abs(self) + cpdef ntl_ZZ_pX _ntl_rep(self) - cpdef pAdicZZpXCRElement lift_to_precision(self, absprec=*) noexcept + cpdef pAdicZZpXCRElement lift_to_precision(self, absprec=*) diff --git a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx index 9de1a39b8de..ec86b03535b 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_CR_element.pyx @@ -1469,7 +1469,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): shift = shift >> 1 i += 1 - cdef pAdicZZpXCRElement _new_c(self, long relprec) noexcept: + cdef pAdicZZpXCRElement _new_c(self, long relprec): """ Return a new element with the same parent as ``self`` and relative precision ``relprec`` @@ -1594,7 +1594,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): sig_off() return ans - cdef pAdicZZpXCRElement _lshift_c(self, long n) noexcept: + cdef pAdicZZpXCRElement _lshift_c(self, long n): """ Multiplies ``self`` by the uniformizer raised to the power ``n``. If ``n`` is negative, right shifts by ``-n``. @@ -1661,7 +1661,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): return ans return self._lshift_c(mpz_get_si((shift).value)) - cdef pAdicZZpXCRElement _rshift_c(self, long n) noexcept: + cdef pAdicZZpXCRElement _rshift_c(self, long n): """ Divides self by the uniformizer raised to the power ``n``. If parent is not a field, throws away the non-positive part of @@ -1764,7 +1764,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): return ans return self._rshift_c(mpz_get_si((shift).value)) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Negation @@ -2044,7 +2044,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): sig_off() return ans - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): """ Compute the sum of ``self`` and ``right``. @@ -2161,7 +2161,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): ans.relprec = -ans.relprec return ans - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Return the difference of two elements @@ -2187,7 +2187,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): # For now, a simple implementation return self + (-right) - cpdef _mul_(self, _right) noexcept: + cpdef _mul_(self, _right): """ Return the product of two elements @@ -2240,7 +2240,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): sig_off() return ans - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Return the quotient of two elements @@ -2384,7 +2384,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): ans = (self.ordp >= aprec) return ans - cpdef ntl_ZZ_pX _ntl_rep_unnormalized(self) noexcept: + cpdef ntl_ZZ_pX _ntl_rep_unnormalized(self): """ Return an ``ntl_ZZ_pX`` holding the current unit part of this element @@ -2413,7 +2413,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): ans.x = self.unit return ans - cpdef ntl_ZZ_pX _ntl_rep(self) noexcept: + cpdef ntl_ZZ_pX _ntl_rep(self): """ Return an ``ntl_ZZ_pX`` that holds the unit part of this element @@ -2434,7 +2434,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): self._normalize() return self._ntl_rep_unnormalized() - cpdef _ntl_rep_abs(self) noexcept: + cpdef _ntl_rep_abs(self): """ Return a pair ``(f, k)`` where ``f`` is an ``ntl_ZZ_pX`` and ``k`` is a non-positive integer such that ``self = f(self.parent.gen())*p^k`` @@ -2620,7 +2620,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): # """ # raise NotImplementedError - cpdef pAdicZZpXCRElement lift_to_precision(self, absprec=None) noexcept: + cpdef pAdicZZpXCRElement lift_to_precision(self, absprec=None): """ Return a ``pAdicZZpXCRElement`` congruent to this element but with absolute precision at least ``absprec``. @@ -3168,7 +3168,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): self._normalize() return self.ordp - cpdef pAdicZZpXCRElement unit_part(self) noexcept: + cpdef pAdicZZpXCRElement unit_part(self): """ Return the unit part of this element, ie ``self / uniformizer^(self.valuation())``. @@ -3206,7 +3206,7 @@ cdef class pAdicZZpXCRElement(pAdicZZpXElement): ans.unit = self.unit return ans - cdef ext_p_list(self, bint pos) noexcept: + cdef ext_p_list(self, bint pos): """ Return a list of integers (in the Eisenstein case) or a list of lists of integers (in the unramified case). ``self`` can be diff --git a/src/sage/rings/padics/padic_ZZ_pX_FM_element.pxd b/src/sage/rings/padics/padic_ZZ_pX_FM_element.pxd index 33754581e48..90626089442 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_FM_element.pxd +++ b/src/sage/rings/padics/padic_ZZ_pX_FM_element.pxd @@ -4,8 +4,8 @@ from sage.structure.element cimport RingElement, ModuleElement cdef class pAdicZZpXFMElement(pAdicZZpXElement): cdef ZZ_pX_c value - cdef pAdicZZpXFMElement _new_c(self) noexcept - cdef pAdicZZpXFMElement _lshift_c(self, long n) noexcept - cdef pAdicZZpXFMElement _rshift_c(self, long n) noexcept + cdef pAdicZZpXFMElement _new_c(self) + cdef pAdicZZpXFMElement _lshift_c(self, long n) + cdef pAdicZZpXFMElement _rshift_c(self, long n) - cpdef pAdicZZpXFMElement unit_part(self) noexcept + cpdef pAdicZZpXFMElement unit_part(self) diff --git a/src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx index 01539421dd7..44d549847a9 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_FM_element.pyx @@ -419,7 +419,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): holder.x = self.value return make_ZZpXFMElement, (self.parent(), holder) - cdef pAdicZZpXFMElement _new_c(self) noexcept: + cdef pAdicZZpXFMElement _new_c(self): """ Return a new element with the same parent as ``self``. @@ -438,7 +438,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): ans.prime_pow = self.prime_pow return ans - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ First compare valuations, then compare the values. @@ -508,7 +508,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): sig_off() return ans - cdef pAdicZZpXFMElement _lshift_c(self, long n) noexcept: + cdef pAdicZZpXFMElement _lshift_c(self, long n): """ Multiply ``self`` by the uniformizer raised to the power ``n``. @@ -569,7 +569,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): return ans return self._lshift_c(mpz_get_si((shift).value)) - cdef pAdicZZpXFMElement _rshift_c(self, long n) noexcept: + cdef pAdicZZpXFMElement _rshift_c(self, long n): """ Divide ``self`` by the uniformizer raised to the power ``n``. @@ -660,7 +660,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): return ans return self._rshift_c(mpz_get_si((shift).value)) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Returns ``-self``. @@ -751,7 +751,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): sig_off() return ans - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Return ``self`` + ``right``. @@ -770,7 +770,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): ZZ_pX_add(ans.value, self.value, (right).value) return ans - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Return the product of ``self`` and ``right``. @@ -794,7 +794,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): ZZ_pX_MulMod_pre(ans.value, self.value, (right).value, self.prime_pow.get_top_modulus()[0]) return ans - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Return the difference of ``self`` and ``right``. @@ -817,7 +817,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): ZZ_pX_sub(ans.value, self.value, (right).value) return ans - cpdef _div_(self, _right) noexcept: + cpdef _div_(self, _right): """ Returns the quotient of ``self`` by ``right``. @@ -1601,7 +1601,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): mpz_set_ui(ans.value, self.prime_pow.ram_prec_cap - self.valuation_c()) return ans - cpdef pAdicZZpXFMElement unit_part(self) noexcept: + cpdef pAdicZZpXFMElement unit_part(self): """ Return the unit part of ``self``, ie ``self / uniformizer^(self.valuation())`` @@ -1673,7 +1673,7 @@ cdef class pAdicZZpXFMElement(pAdicZZpXElement): else: return index + valuation * self.prime_pow.e - cdef ext_p_list(self, bint pos) noexcept: + cdef ext_p_list(self, bint pos): r""" Return a list giving a series representation of ``self``. diff --git a/src/sage/rings/padics/padic_ZZ_pX_element.pyx b/src/sage/rings/padics/padic_ZZ_pX_element.pyx index a556082a9df..b88bd5053bf 100644 --- a/src/sage/rings/padics/padic_ZZ_pX_element.pyx +++ b/src/sage/rings/padics/padic_ZZ_pX_element.pyx @@ -228,7 +228,7 @@ cdef class pAdicZZpXElement(pAdicExtElement): else: raise ValueError("context must be a power of the appropriate prime") - cdef ext_p_list_precs(self, bint pos, long prec) noexcept: + cdef ext_p_list_precs(self, bint pos, long prec): """ Returns a list giving a series representation of ``self``. @@ -623,7 +623,7 @@ def _test_preprocess_list(R, L): return preprocess_list(R(0), L) -cdef preprocess_list(pAdicZZpXElement elt, L) noexcept: +cdef preprocess_list(pAdicZZpXElement elt, L): """ See the documentation for :func:`_test_preprocess_list`. """ @@ -738,7 +738,7 @@ def _find_val_aprec_test(R, L): """ return find_val_aprec(R.prime_pow, L) -cdef find_val_aprec(PowComputer_ext pp, L) noexcept: +cdef find_val_aprec(PowComputer_ext pp, L): r""" Given a list ``L``, finds the minimum valuation, minimum absolute precision and minimum common type of the elements. @@ -843,7 +843,7 @@ def _test_get_val_prec(R, a): """ return get_val_prec(R.prime_pow, a) -cdef get_val_prec(PowComputer_ext pp, a) noexcept: +cdef get_val_prec(PowComputer_ext pp, a): r""" Return valuation, absolute precision and type of an input element. diff --git a/src/sage/rings/padics/padic_capped_absolute_element.pxd b/src/sage/rings/padics/padic_capped_absolute_element.pxd index b80b6593bf6..48c8500a678 100644 --- a/src/sage/rings/padics/padic_capped_absolute_element.pxd +++ b/src/sage/rings/padics/padic_capped_absolute_element.pxd @@ -6,8 +6,8 @@ ctypedef mpz_t celement include "CA_template_header.pxi" cdef class pAdicCappedAbsoluteElement(CAElement): - cdef lift_c(self) noexcept - cdef pari_gen _to_gen(self) noexcept + cdef lift_c(self) + cdef pari_gen _to_gen(self) from sage.rings.padics.pow_computer cimport PowComputer_base cdef class PowComputer_(PowComputer_base): diff --git a/src/sage/rings/padics/padic_capped_absolute_element.pyx b/src/sage/rings/padics/padic_capped_absolute_element.pyx index d4f76f08efe..d21b2c18acb 100644 --- a/src/sage/rings/padics/padic_capped_absolute_element.pyx +++ b/src/sage/rings/padics/padic_capped_absolute_element.pyx @@ -97,7 +97,7 @@ cdef class pAdicCappedAbsoluteElement(CAElement): """ return self.lift_c() - cdef lift_c(self) noexcept: + cdef lift_c(self): """ Implementation of lift. @@ -124,7 +124,7 @@ cdef class pAdicCappedAbsoluteElement(CAElement): """ return self._to_gen() - cdef pari_gen _to_gen(self) noexcept: + cdef pari_gen _to_gen(self): """ Converts this element to an equivalent pari element. diff --git a/src/sage/rings/padics/padic_capped_relative_element.pxd b/src/sage/rings/padics/padic_capped_relative_element.pxd index 5c929be226d..2cf6d5276f5 100644 --- a/src/sage/rings/padics/padic_capped_relative_element.pxd +++ b/src/sage/rings/padics/padic_capped_relative_element.pxd @@ -5,8 +5,8 @@ ctypedef mpz_t celement include "CR_template_header.pxi" cdef class pAdicCappedRelativeElement(CRElement): - cdef lift_c(self) noexcept - cdef pari_gen _to_gen(self) noexcept + cdef lift_c(self) + cdef pari_gen _to_gen(self) from sage.rings.padics.pow_computer cimport PowComputer_base cdef class PowComputer_(PowComputer_base): diff --git a/src/sage/rings/padics/padic_capped_relative_element.pyx b/src/sage/rings/padics/padic_capped_relative_element.pyx index e2e652798fe..701c9575417 100644 --- a/src/sage/rings/padics/padic_capped_relative_element.pyx +++ b/src/sage/rings/padics/padic_capped_relative_element.pyx @@ -160,7 +160,7 @@ cdef class pAdicCappedRelativeElement(CRElement): """ return self.lift_c() - cdef lift_c(self) noexcept: + cdef lift_c(self): """ Implementation of lift. @@ -210,7 +210,7 @@ cdef class pAdicCappedRelativeElement(CRElement): """ return self._to_gen() - cdef pari_gen _to_gen(self) noexcept: + cdef pari_gen _to_gen(self): """ Convert this element to an equivalent pari element. diff --git a/src/sage/rings/padics/padic_ext_element.pxd b/src/sage/rings/padics/padic_ext_element.pxd index e267f0129c7..d8e2ca0a5a0 100644 --- a/src/sage/rings/padics/padic_ext_element.pxd +++ b/src/sage/rings/padics/padic_ext_element.pxd @@ -32,6 +32,6 @@ cdef class pAdicExtElement(pAdicGenericElement): cdef long _check_ZZ_pContext(self, ntl_ZZ_pContext_class ctx) except -1 cdef long _check_ZZ_pEContext(self, ntl_ZZ_pEContext_class ctx) except -1 - cdef ext_p_list(self, bint pos) noexcept - cdef ext_p_list_precs(self, bint pos, long prec) noexcept + cdef ext_p_list(self, bint pos) + cdef ext_p_list_precs(self, bint pos, long prec) cdef ZZ_p_c _const_term(self) noexcept diff --git a/src/sage/rings/padics/padic_ext_element.pyx b/src/sage/rings/padics/padic_ext_element.pyx index a79dc1a4a97..2327c8085a0 100644 --- a/src/sage/rings/padics/padic_ext_element.pyx +++ b/src/sage/rings/padics/padic_ext_element.pyx @@ -263,10 +263,10 @@ cdef class pAdicExtElement(pAdicGenericElement): cdef long _check_ZZ_pEContext(self, ntl_ZZ_pEContext_class ctx) except -1: raise NotImplementedError - cdef ext_p_list(self, bint pos) noexcept: + cdef ext_p_list(self, bint pos): raise NotImplementedError - cdef ext_p_list_precs(self, bint pos, long prec) noexcept: + cdef ext_p_list_precs(self, bint pos, long prec): raise NotImplementedError def _const_term_test(self): diff --git a/src/sage/rings/padics/padic_fixed_mod_element.pxd b/src/sage/rings/padics/padic_fixed_mod_element.pxd index 4d9bff415d0..cd619a1bcb2 100644 --- a/src/sage/rings/padics/padic_fixed_mod_element.pxd +++ b/src/sage/rings/padics/padic_fixed_mod_element.pxd @@ -6,8 +6,8 @@ ctypedef mpz_t celement include "FM_template_header.pxi" cdef class pAdicFixedModElement(FMElement): - cdef lift_c(self) noexcept - cdef pari_gen _to_gen(self) noexcept + cdef lift_c(self) + cdef pari_gen _to_gen(self) from sage.rings.padics.pow_computer cimport PowComputer_base cdef class PowComputer_(PowComputer_base): diff --git a/src/sage/rings/padics/padic_fixed_mod_element.pyx b/src/sage/rings/padics/padic_fixed_mod_element.pyx index 42b92c0a961..bb4b8f3e0db 100644 --- a/src/sage/rings/padics/padic_fixed_mod_element.pyx +++ b/src/sage/rings/padics/padic_fixed_mod_element.pyx @@ -156,7 +156,7 @@ cdef class pAdicFixedModElement(FMElement): """ return self.lift_c() - cdef lift_c(self) noexcept: + cdef lift_c(self): r""" Returns an integer congruent to this element modulo the precision. @@ -188,7 +188,7 @@ cdef class pAdicFixedModElement(FMElement): """ return self._to_gen() - cdef pari_gen _to_gen(self) noexcept: + cdef pari_gen _to_gen(self): """ Convert ``self`` to an equivalent pari element. diff --git a/src/sage/rings/padics/padic_floating_point_element.pxd b/src/sage/rings/padics/padic_floating_point_element.pxd index 816a9fce705..721c471d253 100644 --- a/src/sage/rings/padics/padic_floating_point_element.pxd +++ b/src/sage/rings/padics/padic_floating_point_element.pxd @@ -5,8 +5,8 @@ ctypedef mpz_t celement include "FP_template_header.pxi" cdef class pAdicFloatingPointElement(FPElement): - cdef lift_c(self) noexcept - cdef pari_gen _to_gen(self) noexcept + cdef lift_c(self) + cdef pari_gen _to_gen(self) from sage.rings.padics.pow_computer cimport PowComputer_base cdef class PowComputer_(PowComputer_base): diff --git a/src/sage/rings/padics/padic_floating_point_element.pyx b/src/sage/rings/padics/padic_floating_point_element.pyx index 22529fffc6f..ed80e7c853d 100644 --- a/src/sage/rings/padics/padic_floating_point_element.pyx +++ b/src/sage/rings/padics/padic_floating_point_element.pyx @@ -158,7 +158,7 @@ cdef class pAdicFloatingPointElement(FPElement): """ return self.lift_c() - cdef lift_c(self) noexcept: + cdef lift_c(self): r""" Implementation of lift. @@ -204,7 +204,7 @@ cdef class pAdicFloatingPointElement(FPElement): """ return self._to_gen() - cdef pari_gen _to_gen(self) noexcept: + cdef pari_gen _to_gen(self): """ Convert this element to an equivalent pari element. diff --git a/src/sage/rings/padics/padic_generic_element.pxd b/src/sage/rings/padics/padic_generic_element.pxd index 091d56bb912..dadf7099c00 100644 --- a/src/sage/rings/padics/padic_generic_element.pxd +++ b/src/sage/rings/padics/padic_generic_element.pxd @@ -8,11 +8,11 @@ from sage.rings.padics.pow_computer cimport PowComputer_class from sage.rings.integer cimport Integer from sage.rings.rational cimport Rational -cpdef gauss_table(long long p, int f, int prec, bint use_longs) noexcept +cpdef gauss_table(long long p, int f, int prec, bint use_longs) cdef class pAdicGenericElement(LocalGenericElement): cdef long valuation_c(self) noexcept - cpdef val_unit(self) noexcept + cpdef val_unit(self) cdef int _set_from_Integer(self, Integer x, absprec, relprec) except -1 cdef int _set_from_mpz(self, mpz_t x) except -1 @@ -41,7 +41,7 @@ cdef class pAdicGenericElement(LocalGenericElement): cdef bint _set_prec_rel(self, long relprec) except -1 cdef bint _set_prec_both(self, long absprec, long relprec) except -1 - cpdef abs(self, prec=*) noexcept - cpdef _mod_(self, right) noexcept - cpdef _floordiv_(self, right) noexcept + cpdef abs(self, prec=*) + cpdef _mod_(self, right) + cpdef _floordiv_(self, right) cpdef bint _is_base_elt(self, p) except -1 diff --git a/src/sage/rings/padics/padic_generic_element.pyx b/src/sage/rings/padics/padic_generic_element.pyx index 035e404773b..b8f02e31970 100644 --- a/src/sage/rings/padics/padic_generic_element.pyx +++ b/src/sage/rings/padics/padic_generic_element.pyx @@ -43,7 +43,7 @@ from sage.structure.richcmp cimport rich_to_bool cdef long maxordp = (1L << (sizeof(long) * 8 - 2)) - 1 cdef class pAdicGenericElement(LocalGenericElement): - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): r""" First compare valuations, then compare normalized residue of unit part. @@ -354,7 +354,7 @@ cdef class pAdicGenericElement(LocalGenericElement): raise ZeroDivisionError("cannot divide by zero") return self._floordiv_(right) - cpdef _floordiv_(self, right) noexcept: + cpdef _floordiv_(self, right): """ Implements floor division. @@ -465,7 +465,7 @@ cdef class pAdicGenericElement(LocalGenericElement): """ return ~self.parent().fraction_field()(self, relprec = self.precision_relative()) - cpdef _mod_(self, right) noexcept: + cpdef _mod_(self, right): """ If self is in a field, returns 0. If in a ring, returns a p-adic integer such that @@ -2115,7 +2115,7 @@ cdef class pAdicGenericElement(LocalGenericElement): """ raise NotImplementedError - cpdef val_unit(self) noexcept: + cpdef val_unit(self): r""" Return ``(self.valuation(), self.unit_part())``. To be overridden in derived classes. @@ -4022,7 +4022,7 @@ cdef class pAdicGenericElement(LocalGenericElement): """ return self.abs() - cpdef abs(self, prec=None) noexcept: + cpdef abs(self, prec=None): """ Return the `p`-adic absolute value of ``self``. @@ -4515,7 +4515,7 @@ def _compute_g(p, n, prec, terms): g[i+1] = -(g[i]/(v-v**2)).integral() return [x.truncate(terms) for x in g] -cpdef dwork_mahler_coeffs(R, int bd=20) noexcept: +cpdef dwork_mahler_coeffs(R, int bd=20): r""" Compute Dwork's formula for Mahler coefficients of `p`-adic Gamma. @@ -4563,7 +4563,7 @@ cpdef dwork_mahler_coeffs(R, int bd=20) noexcept: v.append(R(x << i)) return v -cpdef evaluate_dwork_mahler(v, x, long long p, int bd, long long a) noexcept: +cpdef evaluate_dwork_mahler(v, x, long long p, int bd, long long a): """ Evaluate Dwork's Mahler series for `p`-adic Gamma. @@ -4607,7 +4607,7 @@ cdef long long evaluate_dwork_mahler_long(array.array v, long long x, long long s = s % q return -s -cpdef gauss_table(long long p, int f, int prec, bint use_longs) noexcept: +cpdef gauss_table(long long p, int f, int prec, bint use_longs): r""" Compute a table of Gauss sums using the Gross-Koblitz formula. diff --git a/src/sage/rings/padics/padic_printing.pxd b/src/sage/rings/padics/padic_printing.pxd index e0ce12540c6..44698b3d73d 100644 --- a/src/sage/rings/padics/padic_printing.pxd +++ b/src/sage/rings/padics/padic_printing.pxd @@ -22,16 +22,16 @@ cdef class pAdicPrinter_class(SageObject): cdef long max_terse_terms cdef object show_prec - cdef base_p_list(self, value, bint pos) noexcept - cdef _repr_gen(self, pAdicGenericElement elt, bint do_latex, bint pos, int mode, pname) noexcept - cdef _repr_spec(self, pAdicGenericElement elt, bint do_latex, bint pos, int _mode, bint paren, pname) noexcept - cdef _print_list_as_poly(self, L, bint do_latex, polyname, long expshift, bint increasing) noexcept - cdef _truncate_list(self, L, max_terms, zero) noexcept - cdef _var(self, x, exp, do_latex) noexcept - cdef _dot_var(self, x, exp, do_latex) noexcept - cdef _co_dot_var(self, co, x, exp, do_latex) noexcept - cdef _plus_ellipsis(self, bint do_latex) noexcept - cdef _ellipsis(self, bint do_latex) noexcept - cdef _terse_frac(self, a, v, u, ram_name, bint do_latex) noexcept - cdef _print_unram_term(self, L, bint do_latex, polyname, long max_unram_terms, long expshift, bint increasing) noexcept - cdef _print_term_of_poly(self, s, coeff, bint do_latex, polyname, long exp) noexcept + cdef base_p_list(self, value, bint pos) + cdef _repr_gen(self, pAdicGenericElement elt, bint do_latex, bint pos, int mode, pname) + cdef _repr_spec(self, pAdicGenericElement elt, bint do_latex, bint pos, int _mode, bint paren, pname) + cdef _print_list_as_poly(self, L, bint do_latex, polyname, long expshift, bint increasing) + cdef _truncate_list(self, L, max_terms, zero) + cdef _var(self, x, exp, do_latex) + cdef _dot_var(self, x, exp, do_latex) + cdef _co_dot_var(self, co, x, exp, do_latex) + cdef _plus_ellipsis(self, bint do_latex) + cdef _ellipsis(self, bint do_latex) + cdef _terse_frac(self, a, v, u, ram_name, bint do_latex) + cdef _print_unram_term(self, L, bint do_latex, polyname, long max_unram_terms, long expshift, bint increasing) + cdef _print_term_of_poly(self, s, coeff, bint do_latex, polyname, long exp) diff --git a/src/sage/rings/padics/padic_printing.pyx b/src/sage/rings/padics/padic_printing.pyx index 2a376264b4b..fc9f15b07b1 100644 --- a/src/sage/rings/padics/padic_printing.pyx +++ b/src/sage/rings/padics/padic_printing.pyx @@ -816,7 +816,7 @@ cdef class pAdicPrinter_class(SageObject): """ return self.base_p_list(value, pos) - cdef base_p_list(self, value, bint pos) noexcept: + cdef base_p_list(self, value, bint pos): """ Returns a list of integers forming the base p expansion of value. @@ -894,7 +894,7 @@ cdef class pAdicPrinter_class(SageObject): pprint = latex_variable_name(pprint) return self._repr_gen(elt, do_latex, _pos, _mode, pprint) - cdef _repr_gen(self, pAdicGenericElement elt, bint do_latex, bint pos, int mode, ram_name) noexcept: + cdef _repr_gen(self, pAdicGenericElement elt, bint do_latex, bint pos, int mode, ram_name): r""" Prints a string representation of the element. See __init__ for more details on print modes. @@ -1054,7 +1054,7 @@ cdef class pAdicPrinter_class(SageObject): if s == "": s = "0" return s - cdef _repr_spec(self, pAdicGenericElement elt, bint do_latex, bint pos, int mode, bint paren, ram_name) noexcept: + cdef _repr_spec(self, pAdicGenericElement elt, bint do_latex, bint pos, int mode, bint paren, ram_name): """ A function used by repr_gen for terse and series printing. @@ -1271,7 +1271,7 @@ cdef class pAdicPrinter_class(SageObject): s = "(" + s + ")" return s - cdef _var(self, x, exp, do_latex) noexcept: + cdef _var(self, x, exp, do_latex): """ Returns a representation of 'x^exp', latexed if necessary. """ @@ -1284,7 +1284,7 @@ cdef class pAdicPrinter_class(SageObject): else: return "%s^%s"%(x, exp) - cdef _dot_var(self, x, exp, do_latex) noexcept: + cdef _dot_var(self, x, exp, do_latex): """ Returns a representation of '*x^exp', latexed if necessary. """ @@ -1300,7 +1300,7 @@ cdef class pAdicPrinter_class(SageObject): else: return "*%s^%s"%(x, exp) - cdef _co_dot_var(self, co, x, exp, do_latex) noexcept: + cdef _co_dot_var(self, co, x, exp, do_latex): """ Returns a representation of 'co*x^exp', latexed if necessary. @@ -1325,7 +1325,7 @@ cdef class pAdicPrinter_class(SageObject): else: return "%s*%s^%s"%(co, x, exp) - cdef _plus_ellipsis(self, bint do_latex) noexcept: + cdef _plus_ellipsis(self, bint do_latex): """ Returns a representation of '+ ...', latexed if necessary. """ @@ -1334,7 +1334,7 @@ cdef class pAdicPrinter_class(SageObject): else: return " + ..." - cdef _ellipsis(self, bint do_latex) noexcept: + cdef _ellipsis(self, bint do_latex): """ Returns a representation of '...', latexed if necessary. """ @@ -1343,7 +1343,7 @@ cdef class pAdicPrinter_class(SageObject): else: return "..." - cdef _truncate_list(self, L, max_terms, zero) noexcept: + cdef _truncate_list(self, L, max_terms, zero): """ Takes a list L of coefficients and returns a list with at most max_terms nonzero terms. @@ -1375,7 +1375,7 @@ cdef class pAdicPrinter_class(SageObject): ans.append(c) return ans, False - cdef _print_unram_term(self, L, bint do_latex, polyname, long max_unram_terms, long expshift, bint increasing) noexcept: + cdef _print_unram_term(self, L, bint do_latex, polyname, long max_unram_terms, long expshift, bint increasing): """ Returns a string representation of L when considered as a polynomial, truncating to at most max_unram_terms nonzero terms. @@ -1448,7 +1448,7 @@ cdef class pAdicPrinter_class(SageObject): s = self._print_term_of_poly(s, L[j], do_latex, polyname, exp) return s - cdef _terse_frac(self, a, v, u, ram_name, bint do_latex) noexcept: + cdef _terse_frac(self, a, v, u, ram_name, bint do_latex): """ Returns a representation of a=u/ram_name^v, latexed if necessary. """ @@ -1468,7 +1468,7 @@ cdef class pAdicPrinter_class(SageObject): arep = "%s/%s^%s"%(u, ram_name, -v) return arep - cdef _print_list_as_poly(self, L, bint do_latex, polyname, long expshift, bint increasing) noexcept: + cdef _print_list_as_poly(self, L, bint do_latex, polyname, long expshift, bint increasing): """ Prints a list L as a polynomial. @@ -1499,7 +1499,7 @@ cdef class pAdicPrinter_class(SageObject): s = self._print_term_of_poly(s, L[j], do_latex, polyname, exp) return s - cdef _print_term_of_poly(self, s, coeff, bint do_latex, polyname, long exp) noexcept: + cdef _print_term_of_poly(self, s, coeff, bint do_latex, polyname, long exp): """ Appends +coeff*polyname^exp to s, latexed if necessary. """ diff --git a/src/sage/rings/padics/padic_template_element.pxi b/src/sage/rings/padics/padic_template_element.pxi index 4b7db8726af..4b5b9c6dbe9 100644 --- a/src/sage/rings/padics/padic_template_element.pxi +++ b/src/sage/rings/padics/padic_template_element.pxi @@ -188,7 +188,7 @@ cdef class pAdicTemplateElement(pAdicGenericElement): """ raise NotImplementedError - cdef pAdicTemplateElement _new_with_value(self, celement value, long absprec) noexcept: + cdef pAdicTemplateElement _new_with_value(self, celement value, long absprec): """ Creates a new element with a given value and absolute precision. @@ -264,7 +264,7 @@ cdef class pAdicTemplateElement(pAdicGenericElement): check_ordp(s) return self._lshift_c(s) - cdef pAdicTemplateElement _lshift_c(self, long shift) noexcept: + cdef pAdicTemplateElement _lshift_c(self, long shift): raise NotImplementedError def __rshift__(pAdicTemplateElement self, shift): @@ -312,7 +312,7 @@ cdef class pAdicTemplateElement(pAdicGenericElement): check_ordp(s) return self._rshift_c(s) - cdef pAdicTemplateElement _rshift_c(self, long shift) noexcept: + cdef pAdicTemplateElement _rshift_c(self, long shift): """ Divides by ``p^shift`` and truncates (if the parent is not a field). """ @@ -380,7 +380,7 @@ cdef class pAdicTemplateElement(pAdicGenericElement): ans.check_preccap() return ans - cdef pAdicTemplateElement lift_to_precision_c(self, long absprec) noexcept: + cdef pAdicTemplateElement lift_to_precision_c(self, long absprec): """ Lift this element to another with precision at least ``absprec``. """ @@ -626,7 +626,7 @@ cdef class pAdicTemplateElement(pAdicGenericElement): else: return trim_zeros(list(self.unit_part().expansion(lift_mode='smallest'))) - cpdef pAdicTemplateElement unit_part(self) noexcept: + cpdef pAdicTemplateElement unit_part(self): r""" Returns the unit part of this element. @@ -761,7 +761,7 @@ cdef class pAdicTemplateElement(pAdicGenericElement): else: raise NotImplementedError("reduction modulo p^n with n>1") -cdef Integer exact_pow_helper(long *ansrelprec, long relprec, _right, PowComputer_ prime_pow) noexcept: +cdef Integer exact_pow_helper(long *ansrelprec, long relprec, _right, PowComputer_ prime_pow): """ This function is used by exponentiation in both ``CR_template.pxi`` and ``CA_template.pxi`` to determine the extra precision gained from @@ -875,7 +875,7 @@ cdef long padic_pow_helper(celement result, celement base, long base_val, long b cpow(result, prime_pow.powhelper_oneunit, right.value, bloga_aprec, prime_pow) return bloga_aprec -cdef _zero(expansion_mode mode, teich_ring) noexcept: +cdef _zero(expansion_mode mode, teich_ring): """ Return an appropriate zero for a given expansion mode. diff --git a/src/sage/rings/padics/padic_template_element_header.pxi b/src/sage/rings/padics/padic_template_element_header.pxi index 4cd07b8c4bd..11e1cc7fab7 100644 --- a/src/sage/rings/padics/padic_template_element_header.pxi +++ b/src/sage/rings/padics/padic_template_element_header.pxi @@ -39,11 +39,11 @@ cdef enum expansion_mode: cdef class pAdicTemplateElement(pAdicGenericElement): cdef PowComputer_ prime_pow cdef int _set(self, x, long val, long xprec, absprec, relprec) except -1 - cdef pAdicTemplateElement _new_with_value(self, celement value, long absprec) noexcept + cdef pAdicTemplateElement _new_with_value(self, celement value, long absprec) cdef int _get_unit(self, celement value) except -1 - cdef pAdicTemplateElement _lshift_c(self, long shift) noexcept - cdef pAdicTemplateElement _rshift_c(self, long shift) noexcept + cdef pAdicTemplateElement _lshift_c(self, long shift) + cdef pAdicTemplateElement _rshift_c(self, long shift) #cpdef RingElement _floordiv_c_impl(self, RingElement right) cdef int check_preccap(self) except -1 - cdef pAdicTemplateElement lift_to_precision_c(self, long absprec) noexcept - cpdef pAdicTemplateElement unit_part(self) noexcept + cdef pAdicTemplateElement lift_to_precision_c(self, long absprec) + cpdef pAdicTemplateElement unit_part(self) diff --git a/src/sage/rings/padics/pow_computer.pxd b/src/sage/rings/padics/pow_computer.pxd index b70553b77e0..5cb6a474849 100644 --- a/src/sage/rings/padics/pow_computer.pxd +++ b/src/sage/rings/padics/pow_computer.pxd @@ -22,7 +22,7 @@ cdef class PowComputer_class(SageObject): cdef unsigned long cache_limit cdef unsigned long prec_cap - cdef Integer pow_Integer(self, long n) noexcept + cdef Integer pow_Integer(self, long n) cdef mpz_srcptr pow_mpz_t_top(self) noexcept cdef mpz_srcptr pow_mpz_t_tmp(self, long n) except NULL cdef mpz_t temp_m diff --git a/src/sage/rings/padics/pow_computer.pyx b/src/sage/rings/padics/pow_computer.pyx index 942b2a6323e..dda423f4a0f 100644 --- a/src/sage/rings/padics/pow_computer.pyx +++ b/src/sage/rings/padics/pow_computer.pyx @@ -146,7 +146,7 @@ cdef class PowComputer_class(SageObject): return richcmp(s.in_field, o.in_field, op) - cdef Integer pow_Integer(self, long n) noexcept: + cdef Integer pow_Integer(self, long n): """ Returns self.prime^n @@ -601,7 +601,7 @@ cdef class PowComputer_base(PowComputer_class): return self.temp_m pow_comp_cache = {} -cdef PowComputer_base PowComputer_c(Integer m, Integer cache_limit, Integer prec_cap, in_field, prec_type=None) noexcept: +cdef PowComputer_base PowComputer_c(Integer m, Integer cache_limit, Integer prec_cap, in_field, prec_type=None): """ Returns a PowComputer. diff --git a/src/sage/rings/padics/pow_computer_ext.pxd b/src/sage/rings/padics/pow_computer_ext.pxd index e4eca660bb3..5d31790e02e 100644 --- a/src/sage/rings/padics/pow_computer_ext.pxd +++ b/src/sage/rings/padics/pow_computer_ext.pxd @@ -21,11 +21,11 @@ cdef class PowComputer_ext(PowComputer_class): cdef void cleanup_ext(self) noexcept cdef class PowComputer_ZZ_pX(PowComputer_ext): - cdef ntl_ZZ_pContext_class get_context(self, long n) noexcept - cdef ntl_ZZ_pContext_class get_context_capdiv(self, long n) noexcept - cdef ntl_ZZ_pContext_class get_top_context(self) noexcept - cdef restore_context(self, long n) noexcept - cdef restore_context_capdiv(self, long n) noexcept + cdef ntl_ZZ_pContext_class get_context(self, long n) + cdef ntl_ZZ_pContext_class get_context_capdiv(self, long n) + cdef ntl_ZZ_pContext_class get_top_context(self) + cdef restore_context(self, long n) + cdef restore_context_capdiv(self, long n) cdef void restore_top_context(self) noexcept cdef ZZ_pX_Modulus_c* get_modulus(self, long n) noexcept cdef ZZ_pX_Modulus_c* get_modulus_capdiv(self, long n) noexcept diff --git a/src/sage/rings/padics/pow_computer_ext.pyx b/src/sage/rings/padics/pow_computer_ext.pyx index 3f6e8eb875b..89a073550f5 100644 --- a/src/sage/rings/padics/pow_computer_ext.pyx +++ b/src/sage/rings/padics/pow_computer_ext.pyx @@ -760,7 +760,7 @@ cdef class PowComputer_ZZ_pX(PowComputer_ext): r.x = (self.get_top_modulus()[0]).val() return r - cdef ntl_ZZ_pContext_class get_context(self, long n) noexcept: + cdef ntl_ZZ_pContext_class get_context(self, long n): """ Returns a ZZ_pContext for self.prime^(abs(n)). @@ -793,7 +793,7 @@ cdef class PowComputer_ZZ_pX(PowComputer_ext): cdef Integer _n = Integer(n) return self.get_context(mpz_get_si(_n.value)) - cdef ntl_ZZ_pContext_class get_context_capdiv(self, long n) noexcept: + cdef ntl_ZZ_pContext_class get_context_capdiv(self, long n): """ Returns a ZZ_pContext for self.prime^((n-1) // self.e + 1) @@ -853,7 +853,7 @@ cdef class PowComputer_ZZ_pX(PowComputer_ext): self.get_modulus(_n) return cputime(t) - cdef ntl_ZZ_pContext_class get_top_context(self) noexcept: + cdef ntl_ZZ_pContext_class get_top_context(self): """ Returns a ZZ_pContext for self.prime^self.prec_cap @@ -877,7 +877,7 @@ cdef class PowComputer_ZZ_pX(PowComputer_ext): """ return self.get_top_context() - cdef restore_context(self, long n) noexcept: + cdef restore_context(self, long n): """ Restores the contest corresponding to self.prime^n @@ -900,7 +900,7 @@ cdef class PowComputer_ZZ_pX(PowComputer_ext): cdef Integer _n = Integer(n) self.restore_context(mpz_get_si(_n.value)) - cdef restore_context_capdiv(self, long n) noexcept: + cdef restore_context_capdiv(self, long n): """ Restores the context for self.prime^((n-1) // self.e + 1) @@ -1248,7 +1248,7 @@ cdef class PowComputer_ZZ_pX_FM(PowComputer_ZZ_pX): else: raise NotImplementedError("NOT IMPLEMENTED IN PowComputer_ZZ_pX_FM") - cdef ntl_ZZ_pContext_class get_top_context(self) noexcept: + cdef ntl_ZZ_pContext_class get_top_context(self): """ Returns a ZZ_pContext for self.prime^self.prec_cap @@ -1620,7 +1620,7 @@ cdef class PowComputer_ZZ_pX_small(PowComputer_ZZ_pX): """ Delete_ZZ_pX_Modulus_array(self.mod) - cdef ntl_ZZ_pContext_class get_context(self, long n) noexcept: + cdef ntl_ZZ_pContext_class get_context(self, long n): """ Return the context for p^n. This will use the cache if ``abs(n) <= self.cache_limit``. @@ -1646,7 +1646,7 @@ cdef class PowComputer_ZZ_pX_small(PowComputer_ZZ_pX): except IndexError: return PowComputer_ZZ_pX.get_context(self, n) - cdef restore_context(self, long n) noexcept: + cdef restore_context(self, long n): """ Restore the context for p^n. This will use the cache if ``abs(n) <= self.cache_limit``. @@ -1667,7 +1667,7 @@ cdef class PowComputer_ZZ_pX_small(PowComputer_ZZ_pX): except IndexError: (PowComputer_ZZ_pX.get_context(self, n)).restore_c() - cdef ntl_ZZ_pContext_class get_top_context(self) noexcept: + cdef ntl_ZZ_pContext_class get_top_context(self): """ Returns a ZZ_pContext for self.prime^self.prec_cap @@ -2043,7 +2043,7 @@ cdef class PowComputer_ZZ_pX_big(PowComputer_ZZ_pX): """ return self.modulus_dict - cdef ntl_ZZ_pContext_class get_context(self, long n) noexcept: + cdef ntl_ZZ_pContext_class get_context(self, long n): """ Returns the context for p^n. @@ -2079,7 +2079,7 @@ cdef class PowComputer_ZZ_pX_big(PowComputer_ZZ_pX): self.context_dict[n] = PowComputer_ZZ_pX.get_context(self, n) return self.context_dict[n] - cdef ntl_ZZ_pContext_class get_top_context(self) noexcept: + cdef ntl_ZZ_pContext_class get_top_context(self): """ Returns a ZZ_pContext for self.prime^self.prec_cap diff --git a/src/sage/rings/padics/pow_computer_flint.pxd b/src/sage/rings/padics/pow_computer_flint.pxd index 83185ec9cc9..7b0d042115d 100644 --- a/src/sage/rings/padics/pow_computer_flint.pxd +++ b/src/sage/rings/padics/pow_computer_flint.pxd @@ -23,7 +23,7 @@ cdef class PowComputer_flint_1step(PowComputer_flint): cdef fmpz_poly_t* _moduli cdef fmpz_poly_t* get_modulus(self, unsigned long n) noexcept cdef fmpz_poly_t* get_modulus_capdiv(self, unsigned long n) noexcept - cdef _new_fmpz_poly(self, fmpz_poly_t value, var=*) noexcept + cdef _new_fmpz_poly(self, fmpz_poly_t value, var=*) cdef class PowComputer_flint_unram(PowComputer_flint_1step): # WARNING: diff --git a/src/sage/rings/padics/pow_computer_flint.pyx b/src/sage/rings/padics/pow_computer_flint.pyx index 2ef7ff9e879..2a9c937923f 100644 --- a/src/sage/rings/padics/pow_computer_flint.pyx +++ b/src/sage/rings/padics/pow_computer_flint.pyx @@ -432,7 +432,7 @@ cdef class PowComputer_flint_1step(PowComputer_flint): fmpz_poly_set(ans._poly, self.get_modulus(_n)[0]) return ans - cdef _new_fmpz_poly(self, fmpz_poly_t value, var='x') noexcept: + cdef _new_fmpz_poly(self, fmpz_poly_t value, var='x'): """ Returns a polynomial with the value stored in ``value`` and variable name ``var``. diff --git a/src/sage/rings/padics/pow_computer_relative.pxd b/src/sage/rings/padics/pow_computer_relative.pxd index 9bc6f1b487a..df989768720 100644 --- a/src/sage/rings/padics/pow_computer_relative.pxd +++ b/src/sage/rings/padics/pow_computer_relative.pxd @@ -26,4 +26,4 @@ cdef class PowComputer_relative_eis(PowComputer_relative): # (x^e - modulus)/p cdef public Polynomial_generic_dense _shift_seed cdef public Polynomial_generic_dense _inv_shift_seed - cpdef Polynomial_generic_dense invert(self, Polynomial_generic_dense element, long prec) noexcept + cpdef Polynomial_generic_dense invert(self, Polynomial_generic_dense element, long prec) diff --git a/src/sage/rings/padics/pow_computer_relative.pyx b/src/sage/rings/padics/pow_computer_relative.pyx index 55c53a12a63..98b3a6f5fa4 100644 --- a/src/sage/rings/padics/pow_computer_relative.pyx +++ b/src/sage/rings/padics/pow_computer_relative.pyx @@ -228,7 +228,7 @@ cdef class PowComputer_relative_eis(PowComputer_relative): PowComputer_relative.__init__(self, prime, cache_limit, prec_cap, ram_prec_cap, in_field, poly, shift_seed) self._inv_shift_seed = self.invert(shift_seed, self.ram_prec_cap) - cpdef Polynomial_generic_dense invert(self, Polynomial_generic_dense a, long prec) noexcept: + cpdef Polynomial_generic_dense invert(self, Polynomial_generic_dense a, long prec): r""" Return the inverse of ``a``. diff --git a/src/sage/rings/padics/relaxed_template.pxi b/src/sage/rings/padics/relaxed_template.pxi index fe70657acda..7068a1425a2 100644 --- a/src/sage/rings/padics/relaxed_template.pxi +++ b/src/sage/rings/padics/relaxed_template.pxi @@ -1710,7 +1710,7 @@ cdef class RelaxedElement(pAdicGenericElement): """ return self.__rshift__(-s) - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): r""" Return the sum of this element with ``other``. @@ -1729,7 +1729,7 @@ cdef class RelaxedElement(pAdicGenericElement): return self return element_class_add(self._parent, self, other) - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): r""" Return the difference of this element and ``other``. @@ -1751,7 +1751,7 @@ cdef class RelaxedElement(pAdicGenericElement): return self return element_class_sub(self._parent, self, other) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): r""" Return the opposite of this element. @@ -1768,7 +1768,7 @@ cdef class RelaxedElement(pAdicGenericElement): return self return element_class_sub(self._parent, self._parent.zero(), self) - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): r""" Return the product of this element with ``other``. @@ -1790,7 +1790,7 @@ cdef class RelaxedElement(pAdicGenericElement): return other return element_class_mul(self._parent, self, other) - cpdef _div_(self, other) noexcept: + cpdef _div_(self, other): r""" Return the quotient if this element by ``other``. @@ -3838,7 +3838,7 @@ cdef class RelaxedElement_unknown(RelaxedElementWithDigits): definition = self._definition return unpickle_unknown, (id(self), self.__class__, self._parent, self._initialvaluation, digits, definition) - cpdef set(self, RelaxedElement definition) noexcept: + cpdef set(self, RelaxedElement definition): r""" Set the recursive definition of this self-referent number. @@ -4155,7 +4155,7 @@ cdef class ExpansionIter(): """ return self - cdef _next_simple(self) noexcept: + cdef _next_simple(self): r""" Return the next digit of this expansion (simple mode). """ @@ -4165,7 +4165,7 @@ cdef class ExpansionIter(): self.current += 1 return digit_get_sage(self.digit) - cdef _next_smallest(self) noexcept: + cdef _next_smallest(self): r""" Return the next digit of this expansion (smallest mode). """ @@ -4176,7 +4176,7 @@ cdef class ExpansionIter(): self.current += 1 return digit_get_sage(self.digit) - cdef _next_teichmuller(self) noexcept: + cdef _next_teichmuller(self): r""" Return the next digit of this expansion (Teichmüller mode). """ diff --git a/src/sage/rings/padics/relaxed_template_header.pxi b/src/sage/rings/padics/relaxed_template_header.pxi index 1baa4bfdbe7..7a57141e922 100644 --- a/src/sage/rings/padics/relaxed_template_header.pxi +++ b/src/sage/rings/padics/relaxed_template_header.pxi @@ -130,7 +130,7 @@ cdef class RelaxedElement_teichmuller(RelaxedElementWithDigits): cdef class RelaxedElement_unknown(RelaxedElementWithDigits): cdef RelaxedElement _definition cdef long _next - cpdef set(self, RelaxedElement definition) noexcept + cpdef set(self, RelaxedElement definition) # for pickling cdef long _initialvaluation cdef long _initialprecrel @@ -149,11 +149,11 @@ cdef class ExpansionIter(): cdef long current cdef cdigit digit # simple mode - cdef _next_simple(self) noexcept + cdef _next_simple(self) # smallest mode cdef cdigit carry - cdef _next_smallest(self) noexcept + cdef _next_smallest(self) # teichmuller mode cdef RelaxedElement tail cdef dict coefficients - cdef _next_teichmuller(self) noexcept + cdef _next_teichmuller(self) diff --git a/src/sage/rings/polynomial/evaluation_flint.pxd b/src/sage/rings/polynomial/evaluation_flint.pxd index 4504e8af63c..b699871ba0c 100644 --- a/src/sage/rings/polynomial/evaluation_flint.pxd +++ b/src/sage/rings/polynomial/evaluation_flint.pxd @@ -2,5 +2,5 @@ from sage.libs.flint.types cimport fmpz_poly_t from sage.libs.mpfr.types cimport mpfr_t from sage.libs.mpfi.types cimport mpfi_t -cdef fmpz_poly_evaluation_mpfr(mpfr_t res, const fmpz_poly_t poly, const mpfr_t a) noexcept -cdef fmpz_poly_evaluation_mpfi(mpfi_t res, const fmpz_poly_t poly, const mpfi_t a) noexcept +cdef fmpz_poly_evaluation_mpfr(mpfr_t res, const fmpz_poly_t poly, const mpfr_t a) +cdef fmpz_poly_evaluation_mpfi(mpfi_t res, const fmpz_poly_t poly, const mpfi_t a) diff --git a/src/sage/rings/polynomial/evaluation_flint.pyx b/src/sage/rings/polynomial/evaluation_flint.pyx index fef3bddecb5..1c5909c37b0 100644 --- a/src/sage/rings/polynomial/evaluation_flint.pyx +++ b/src/sage/rings/polynomial/evaluation_flint.pyx @@ -36,7 +36,7 @@ from sage.libs.flint.fmpz_poly cimport * from sage.libs.flint.fmpz_poly_sage cimport * -cdef fmpz_poly_evaluation_mpfr(mpfr_t res, const fmpz_poly_t poly, const mpfr_t a) noexcept: +cdef fmpz_poly_evaluation_mpfr(mpfr_t res, const fmpz_poly_t poly, const mpfr_t a): cdef mpz_t c cdef long i @@ -51,7 +51,7 @@ cdef fmpz_poly_evaluation_mpfr(mpfr_t res, const fmpz_poly_t poly, const mpfr_t mpz_clear(c) -cdef fmpz_poly_evaluation_mpfi(mpfi_t res, const fmpz_poly_t poly, const mpfi_t a) noexcept: +cdef fmpz_poly_evaluation_mpfi(mpfi_t res, const fmpz_poly_t poly, const mpfi_t a): cdef mpz_t c cdef long i diff --git a/src/sage/rings/polynomial/evaluation_ntl.pxd b/src/sage/rings/polynomial/evaluation_ntl.pxd index 4551037ecca..9af0a0b9d40 100644 --- a/src/sage/rings/polynomial/evaluation_ntl.pxd +++ b/src/sage/rings/polynomial/evaluation_ntl.pxd @@ -2,5 +2,5 @@ from sage.libs.ntl.types cimport ZZX_c from sage.libs.mpfr.types cimport mpfr_t from sage.libs.mpfi.types cimport mpfi_t -cdef ZZX_evaluation_mpfr(mpfr_t res, ZZX_c poly, const mpfr_t a) noexcept -cdef ZZX_evaluation_mpfi(mpfi_t res, ZZX_c poly, const mpfi_t a) noexcept +cdef ZZX_evaluation_mpfr(mpfr_t res, ZZX_c poly, const mpfr_t a) +cdef ZZX_evaluation_mpfi(mpfi_t res, ZZX_c poly, const mpfi_t a) diff --git a/src/sage/rings/polynomial/evaluation_ntl.pyx b/src/sage/rings/polynomial/evaluation_ntl.pyx index b6ff4732542..28b3917d3a1 100644 --- a/src/sage/rings/polynomial/evaluation_ntl.pyx +++ b/src/sage/rings/polynomial/evaluation_ntl.pyx @@ -38,7 +38,7 @@ from sage.libs.ntl.ZZ cimport * from sage.libs.ntl.ZZX cimport * -cdef ZZX_evaluation_mpfr(mpfr_t res, ZZX_c poly, const mpfr_t a) noexcept: +cdef ZZX_evaluation_mpfr(mpfr_t res, ZZX_c poly, const mpfr_t a): cdef mpz_t c cdef long i @@ -53,7 +53,7 @@ cdef ZZX_evaluation_mpfr(mpfr_t res, ZZX_c poly, const mpfr_t a) noexcept: mpz_clear(c) -cdef ZZX_evaluation_mpfi(mpfi_t res, ZZX_c poly, const mpfi_t a) noexcept: +cdef ZZX_evaluation_mpfi(mpfi_t res, ZZX_c poly, const mpfi_t a): cdef mpz_t c cdef long i diff --git a/src/sage/rings/polynomial/hilbert.pyx b/src/sage/rings/polynomial/hilbert.pyx index 9e61c4b129e..439d2ed893e 100644 --- a/src/sage/rings/polynomial/hilbert.pyx +++ b/src/sage/rings/polynomial/hilbert.pyx @@ -84,7 +84,7 @@ cdef inline bint indivisible_in_list(ETuple m, list L, size_t i) noexcept: return False return True -cdef inline list interred(list L) noexcept: +cdef inline list interred(list L): """ Return interreduction of a list of monomials. @@ -116,7 +116,7 @@ cdef inline list interred(list L) noexcept: result.append(m) return result -cdef list quotient(list L, ETuple m) noexcept: +cdef list quotient(list L, ETuple m): """ Return the quotient of the ideal represented by ``L`` and the monomial represented by ``m``. @@ -127,7 +127,7 @@ cdef list quotient(list L, ETuple m) noexcept: result.append((PyList_GET_ITEM(L,i)).divide_by_gcd(m)) return interred(result) -cdef list quotient_by_var(list L, size_t index) noexcept: +cdef list quotient_by_var(list L, size_t index): """ Return the quotient of the ideal represented by ``L`` and the variable number ``index``. @@ -140,7 +140,7 @@ cdef list quotient_by_var(list L, size_t index) noexcept: result.append(( PyList_GET_ITEM(L, i)).divide_by_var(index)) return interred(result) -cdef ETuple sum_from_list(list L, size_t s, size_t l) noexcept: +cdef ETuple sum_from_list(list L, size_t s, size_t l): """ Compute the vector sum of the ETuples in ``L[s:s+l]`` in a balanced way. """ @@ -286,7 +286,7 @@ cdef bint HilbertBaseCase(Polynomial_integer_dense_flint fhs, Node D, tuple w) n # We are in a truly difficult case and give up for now... return False -cdef make_children(Node D, tuple w) noexcept: +cdef make_children(Node D, tuple w): """ Create child nodes in ``D`` that allow to compute the first Hilbert series of ``D.Id``. diff --git a/src/sage/rings/polynomial/laurent_polynomial.pxd b/src/sage/rings/polynomial/laurent_polynomial.pxd index d99243aaf3d..8e9107aeb47 100644 --- a/src/sage/rings/polynomial/laurent_polynomial.pxd +++ b/src/sage/rings/polynomial/laurent_polynomial.pxd @@ -2,16 +2,16 @@ from sage.structure.element cimport CommutativeAlgebraElement, ModuleElement, Ri cdef class LaurentPolynomial(CommutativeAlgebraElement): - cdef LaurentPolynomial _new_c(self) noexcept - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cpdef _floordiv_(self, other) noexcept + cdef LaurentPolynomial _new_c(self) + cpdef _add_(self, other) + cpdef _mul_(self, other) + cpdef _floordiv_(self, other) cpdef long number_of_terms(self) except -1 - cpdef dict dict(self) noexcept + cpdef dict dict(self) cdef class LaurentPolynomial_univariate(LaurentPolynomial): cdef ModuleElement __u cdef long __n - cpdef _normalize(self) noexcept - cpdef _unsafe_mutate(self, i, value) noexcept + cpdef _normalize(self) + cpdef _unsafe_mutate(self, i, value) diff --git a/src/sage/rings/polynomial/laurent_polynomial.pyx b/src/sage/rings/polynomial/laurent_polynomial.pyx index f63b256ee13..a830ef7f510 100644 --- a/src/sage/rings/polynomial/laurent_polynomial.pyx +++ b/src/sage/rings/polynomial/laurent_polynomial.pyx @@ -21,7 +21,7 @@ cdef class LaurentPolynomial(CommutativeAlgebraElement): """ Base class for Laurent polynomials. """ - cdef LaurentPolynomial _new_c(self) noexcept: + cdef LaurentPolynomial _new_c(self): """ Return a new Laurent polynomial. @@ -37,7 +37,7 @@ cdef class LaurentPolynomial(CommutativeAlgebraElement): ans._parent = self._parent return ans - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): """ Abstract addition method @@ -52,7 +52,7 @@ cdef class LaurentPolynomial(CommutativeAlgebraElement): """ raise NotImplementedError - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): """ Abstract multiplication method @@ -67,7 +67,7 @@ cdef class LaurentPolynomial(CommutativeAlgebraElement): """ raise NotImplementedError - cpdef _floordiv_(self, other) noexcept: + cpdef _floordiv_(self, other): """ Abstract floor division method @@ -221,7 +221,7 @@ cdef class LaurentPolynomial(CommutativeAlgebraElement): """ return self.number_of_terms() - cpdef dict dict(self) noexcept: + cpdef dict dict(self): """ Abstract ``dict`` method. @@ -533,7 +533,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial): u = u.map_coefficients(base_map) return codomain(u(x) * x**self.__n) - cpdef _normalize(self) noexcept: + cpdef _normalize(self): r""" A Laurent series is a pair `(u(t), n)`, where either `u = 0` (to some precision) or `u` is a unit. This pair corresponds to @@ -842,7 +842,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial): d = {repr(g): R.var(g) for g in self._parent.gens()} return self.subs(**d) - cpdef dict dict(self) noexcept: + cpdef dict dict(self): """ Return a dictionary representing ``self``. @@ -897,7 +897,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial): """ raise IndexError("Laurent polynomials are immutable") - cpdef _unsafe_mutate(self, i, value) noexcept: + cpdef _unsafe_mutate(self, i, value): r""" Sage assumes throughout that commutative ring elements are immutable. This is relevant for caching, etc. But sometimes you @@ -923,7 +923,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial): self.__u = self.__u._parent(coeffs) self._normalize() - cpdef _add_(self, right_m) noexcept: + cpdef _add_(self, right_m): """ Add two Laurent polynomials with the same parent. @@ -977,7 +977,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial): ret._normalize() return ret - cpdef _sub_(self, right_m) noexcept: + cpdef _sub_(self, right_m): """ Subtract two Laurent polynomials with the same parent. @@ -1050,7 +1050,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial): # No need to normalize return ret - cpdef _mul_(self, right_r) noexcept: + cpdef _mul_(self, right_r): """ EXAMPLES:: @@ -1068,7 +1068,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial): ret._normalize() return ret - cpdef _rmul_(self, Element c) noexcept: + cpdef _rmul_(self, Element c): """ EXAMPLES:: @@ -1084,7 +1084,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial): ret._normalize() return ret - cpdef _lmul_(self, Element c) noexcept: + cpdef _lmul_(self, Element c): """ EXAMPLES:: @@ -1154,7 +1154,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial): c = self._parent._R(self.__u.leading_coefficient() ** right) return self._parent.element_class(self._parent, c, self.__n*right) - cpdef _floordiv_(self, rhs) noexcept: + cpdef _floordiv_(self, rhs): """ Perform division with remainder and return the quotient. @@ -1242,7 +1242,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial): # No need to normalize return ret - cpdef _div_(self, rhs) noexcept: + cpdef _div_(self, rhs): """ EXAMPLES:: @@ -1474,7 +1474,7 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial): qr._normalize() return ql, qr - cpdef _richcmp_(self, right_r, int op) noexcept: + cpdef _richcmp_(self, right_r, int op): r""" Comparison of ``self`` and ``right_r``. diff --git a/src/sage/rings/polynomial/laurent_polynomial_mpair.pxd b/src/sage/rings/polynomial/laurent_polynomial_mpair.pxd index f71ccb57030..79f09def6aa 100644 --- a/src/sage/rings/polynomial/laurent_polynomial_mpair.pxd +++ b/src/sage/rings/polynomial/laurent_polynomial_mpair.pxd @@ -7,8 +7,8 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): cdef ETuple _mon cdef MPolynomial _poly cdef PolyDict _prod - cdef _compute_polydict(self) noexcept - cdef _normalize(self, i=*) noexcept - cpdef rescale_vars(self, dict d, h=*, new_ring=*) noexcept - cpdef toric_coordinate_change(self, M, h=*, new_ring=*) noexcept - cpdef toric_substitute(self, v, v1, a, h=*, new_ring=*) noexcept + cdef _compute_polydict(self) + cdef _normalize(self, i=*) + cpdef rescale_vars(self, dict d, h=*, new_ring=*) + cpdef toric_coordinate_change(self, M, h=*, new_ring=*) + cpdef toric_substitute(self, v, v1, a, h=*, new_ring=*) diff --git a/src/sage/rings/polynomial/laurent_polynomial_mpair.pyx b/src/sage/rings/polynomial/laurent_polynomial_mpair.pyx index cfc21b219e4..c03239cebde 100644 --- a/src/sage/rings/polynomial/laurent_polynomial_mpair.pyx +++ b/src/sage/rings/polynomial/laurent_polynomial_mpair.pyx @@ -251,7 +251,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): from sage.misc.misc_c import prod return codomain(p(im_gens) * prod(ig**m[im_gens.index(ig)] for ig in im_gens)) - cdef _normalize(self, i=None) noexcept: + cdef _normalize(self, i=None): r""" Remove the common monomials from ``self._poly`` and store them in ``self._mon``. @@ -302,7 +302,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): self._poly = (self._poly // self._poly._parent.gen(i)) self._mon = self._mon.eadd_p(e, i) - cdef _compute_polydict(self) noexcept: + cdef _compute_polydict(self): """ EXAMPLES:: @@ -796,7 +796,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): v.sort() return tuple(v) - cpdef dict dict(self) noexcept: + cpdef dict dict(self): """ Return ``self`` represented as a ``dict``. @@ -838,7 +838,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): denom *= var[i] ** (-j) return (numer, denom) - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): """ Return the Laurent polynomial ``self + right``. @@ -863,7 +863,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): ans._poly += right._poly return ans - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): """ Return the Laurent polynomial ``self - right``. @@ -889,7 +889,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): ans._poly -= right._poly return ans - cpdef _div_(self, rhs) noexcept: + cpdef _div_(self, rhs): """ Return the division of ``self`` by ``rhs``. @@ -940,7 +940,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): """ return self._poly.is_monomial() - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Return ``-self``. @@ -956,7 +956,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): ans._poly = -self._poly return ans - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ Return ``self * right`` where ``right`` is in ``self``'s base ring. @@ -972,7 +972,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): ans._poly = self._poly * right return ans - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): """ Return ``left * self`` where ``left`` is in ``self``'s base ring. @@ -988,7 +988,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): ans._poly = left * self._poly return ans - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Return ``self * right``. @@ -1005,7 +1005,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): ans._poly = self._poly * ( < LaurentPolynomial_mpair > right)._poly return ans - cpdef _floordiv_(self, right) noexcept: + cpdef _floordiv_(self, right): """ Perform division with remainder and return the quotient. @@ -1107,7 +1107,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): rl._normalize() return (ql, rl) - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): """ Compare two polynomials in a `LaurentPolynomialRing` based on the term order from the parent ring. If the parent ring does not specify a term @@ -1741,7 +1741,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): ans._poly = root return (True, ans) - cpdef rescale_vars(self, dict d, h=None, new_ring=None) noexcept: + cpdef rescale_vars(self, dict d, h=None, new_ring=None): r""" Rescale variables in a Laurent polynomial. @@ -1808,7 +1808,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): return new_ring(ans) return ans - cpdef toric_coordinate_change(self, M, h=None, new_ring=None) noexcept: + cpdef toric_coordinate_change(self, M, h=None, new_ring=None): r""" Apply a matrix to the exponents in a Laurent polynomial. @@ -1877,7 +1877,7 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial): return new_ring(ans) return ans - cpdef toric_substitute(self, v, v1, a, h=None, new_ring=None) noexcept: + cpdef toric_substitute(self, v, v1, a, h=None, new_ring=None): r""" Perform a single-variable substitution up to a toric coordinate change. diff --git a/src/sage/rings/polynomial/multi_polynomial.pxd b/src/sage/rings/polynomial/multi_polynomial.pxd index 3f4fe16888c..9c96ce7a505 100644 --- a/src/sage/rings/polynomial/multi_polynomial.pxd +++ b/src/sage/rings/polynomial/multi_polynomial.pxd @@ -3,8 +3,8 @@ from sage.rings.polynomial.commutative_polynomial cimport CommutativePolynomial cdef class MPolynomial(CommutativePolynomial): cdef long _hash_c(self) except -1 - cpdef _mod_(self, right) noexcept - cpdef dict _mpoly_dict_recursive(self, tuple vars=*, base_ring=*) noexcept + cpdef _mod_(self, right) + cpdef dict _mpoly_dict_recursive(self, tuple vars=*, base_ring=*) cdef class MPolynomial_libsingular(MPolynomial): diff --git a/src/sage/rings/polynomial/multi_polynomial.pyx b/src/sage/rings/polynomial/multi_polynomial.pyx index 65290e9e2d7..37247f36571 100644 --- a/src/sage/rings/polynomial/multi_polynomial.pyx +++ b/src/sage/rings/polynomial/multi_polynomial.pyx @@ -434,7 +434,7 @@ cdef class MPolynomial(CommutativePolynomial): z *= var return ring(v) - cpdef dict _mpoly_dict_recursive(self, tuple vars=None, base_ring=None) noexcept: + cpdef dict _mpoly_dict_recursive(self, tuple vars=None, base_ring=None): r""" Return a ``dict`` of coefficient entries suitable for construction of a ``MPolynomial_polydict`` with the given variables. @@ -813,7 +813,7 @@ cdef class MPolynomial(CommutativePolynomial): d[e.unweighted_degree()][e] = c return {k: self._parent(d[k]) for k in d} - cpdef _mod_(self, other) noexcept: + cpdef _mod_(self, other): r""" EXAMPLES:: @@ -2926,7 +2926,7 @@ def _is_M_convex_(points): return True -cdef remove_from_tuple(e, int ind) noexcept: +cdef remove_from_tuple(e, int ind): w = list(e) del w[ind] if len(w) == 1: diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal_libsingular.pxd b/src/sage/rings/polynomial/multi_polynomial_ideal_libsingular.pxd index fefa241523d..58f853973dc 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ideal_libsingular.pxd +++ b/src/sage/rings/polynomial/multi_polynomial_ideal_libsingular.pxd @@ -1,4 +1,4 @@ from sage.libs.singular.decl cimport ideal, ring -cdef object singular_ideal_to_sage_sequence(ideal *i, ring *r, object parent) noexcept +cdef object singular_ideal_to_sage_sequence(ideal *i, ring *r, object parent) cdef ideal *sage_ideal_to_singular_ideal(I) except NULL diff --git a/src/sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx index 38e251d84ce..14820418454 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx @@ -67,7 +67,7 @@ from sage.structure.sequence import Sequence from sage.rings.polynomial.plural cimport NCPolynomialRing_plural, NCPolynomial_plural -cdef object singular_ideal_to_sage_sequence(ideal *i, ring *r, object parent) noexcept: +cdef object singular_ideal_to_sage_sequence(ideal *i, ring *r, object parent): """ convert a SINGULAR ideal to a Sage Sequence (the format Sage stores a Groebner basis in) diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pxd b/src/sage/rings/polynomial/multi_polynomial_libsingular.pxd index 744774ea231..5cc546112c9 100644 --- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pxd +++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pxd @@ -8,13 +8,13 @@ cdef class MPolynomialRing_libsingular cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): cdef poly *_poly cdef ring *_parent_ring - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cpdef _floordiv_(self, right) noexcept - cpdef _repr_short_(self) noexcept - cpdef is_constant(self) noexcept - cpdef _homogenize(self, int var) noexcept - cpdef MPolynomial_libsingular _new_constant_poly(self, x, MPolynomialRing_libsingular P) noexcept + cpdef _add_(self, other) + cpdef _mul_(self, other) + cpdef _floordiv_(self, right) + cpdef _repr_short_(self) + cpdef is_constant(self) + cpdef _homogenize(self, int var) + cpdef MPolynomial_libsingular _new_constant_poly(self, x, MPolynomialRing_libsingular P) cpdef long number_of_terms(self) noexcept cdef class MPolynomialRing_libsingular(MPolynomialRing_base): @@ -26,4 +26,4 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base): cdef ring *_ring # new polynomials -cdef MPolynomial_libsingular new_MP(MPolynomialRing_libsingular parent, poly *p) noexcept +cdef MPolynomial_libsingular new_MP(MPolynomialRing_libsingular parent, poly *p) diff --git a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx index 33f45813027..40fbc8c69aa 100644 --- a/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx @@ -464,7 +464,7 @@ cdef class MPolynomialRing_libsingular(MPolynomialRing_base): memo[id(self)] = self return self - cpdef _coerce_map_from_(self, other) noexcept: + cpdef _coerce_map_from_(self, other): """ Return ``True`` if and only if there exists a coercion map from ``other`` to ``self``. @@ -1975,7 +1975,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): memo[id(self)] = cpy return cpy - cpdef MPolynomial_libsingular _new_constant_poly(self, x, MPolynomialRing_libsingular P) noexcept: + cpdef MPolynomial_libsingular _new_constant_poly(self, x, MPolynomialRing_libsingular P): r""" Quickly create a new constant polynomial with value x in the parent P. @@ -2137,7 +2137,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): """ return self._hash_c() - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Compare left and right. @@ -2195,7 +2195,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): cdef ring *r = (left)._parent_ring return rich_to_bool(op, singular_polynomial_cmp(p, q, r)) - cpdef _add_(left, right) noexcept: + cpdef _add_(left, right): """ Add left and right. @@ -2211,7 +2211,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): (right)._poly, r) return new_MP((left)._parent, _p) - cpdef _sub_(left, right) noexcept: + cpdef _sub_(left, right): """ Subtract left and right. @@ -2228,7 +2228,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): _ring) return new_MP((left)._parent, _p) - cpdef _lmul_(self, Element left) noexcept: + cpdef _lmul_(self, Element left): """ Multiply self with a base ring element. @@ -2252,7 +2252,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): singular_polynomial_rmul(&_p, self._poly, left, _ring) return new_MP((self)._parent, _p) - cpdef _mul_(left, right) noexcept: + cpdef _mul_(left, right): """ Multiply left and right. @@ -2276,7 +2276,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): (left)._parent_ring) return new_MP((left)._parent,_p) - cpdef _div_(left, right_ringelement) noexcept: + cpdef _div_(left, right_ringelement): r""" Divide left by right @@ -2479,7 +2479,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): s = singular_polynomial_str(self._poly, _ring) return s - cpdef _repr_short_(self) noexcept: + cpdef _repr_short_(self): """ This is a faster but less pretty way to print polynomials. If available it uses the short SINGULAR notation. @@ -3325,7 +3325,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): rChangeCurrRing(_ring) return bool(p_IsHomogeneous(self._poly,_ring)) - cpdef _homogenize(self, int var) noexcept: + cpdef _homogenize(self, int var): """ Return ``self`` if ``self`` is homogeneous. Otherwise return a homogenized polynomial constructed by modifying the degree @@ -3957,7 +3957,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): """ return len(self._variable_indices_(sort=False)) - cpdef is_constant(self) noexcept: + cpdef is_constant(self): """ Return ``True`` if this polynomial is constant. @@ -4099,7 +4099,7 @@ cdef class MPolynomial_libsingular(MPolynomial_libsingular_base): else: return False - cpdef _floordiv_(self, right) noexcept: + cpdef _floordiv_(self, right): """ Perform division with remainder and return the quotient. @@ -5952,7 +5952,7 @@ cdef inline poly *addwithcarry(poly *tempvector, poly *maxvector, int pos, ring return tempvector -cdef inline MPolynomial_libsingular new_MP(MPolynomialRing_libsingular parent, poly *juice) noexcept: +cdef inline MPolynomial_libsingular new_MP(MPolynomialRing_libsingular parent, poly *juice): """ Construct MPolynomial_libsingular from parent and SINGULAR poly. diff --git a/src/sage/rings/polynomial/multi_polynomial_ring_base.pxd b/src/sage/rings/polynomial/multi_polynomial_ring_base.pxd index d6350c020d3..4ce9033dadb 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ring_base.pxd +++ b/src/sage/rings/polynomial/multi_polynomial_ring_base.pxd @@ -8,7 +8,7 @@ cdef class MPolynomialRing_base(CommutativeRing): cdef public object _magma_gens cdef public dict _magma_cache - cdef _coerce_c_impl(self, x) noexcept + cdef _coerce_c_impl(self, x) cdef class BooleanPolynomialRing_base(MPolynomialRing_base): diff --git a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx index ba2ac0daef4..4ad2a3f1fa9 100644 --- a/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx +++ b/src/sage/rings/polynomial/multi_polynomial_ring_base.pyx @@ -555,7 +555,7 @@ cdef class MPolynomialRing_base(CommutativeRing): else: return self._generic_coerce_map(self.base_ring()) - cdef _coerce_c_impl(self, x) noexcept: + cdef _coerce_c_impl(self, x): """ Return the canonical coercion of x to this multivariate polynomial ring, if one is defined, or raise a TypeError. diff --git a/src/sage/rings/polynomial/ore_polynomial_element.pxd b/src/sage/rings/polynomial/ore_polynomial_element.pxd index 86b14f7d213..f38bcb0f0c5 100644 --- a/src/sage/rings/polynomial/ore_polynomial_element.pxd +++ b/src/sage/rings/polynomial/ore_polynomial_element.pxd @@ -9,23 +9,23 @@ cdef class OrePolynomial(AlgebraElement): cdef _is_gen cdef long _hash_c(self) noexcept - cdef OrePolynomial _new_c(self, list coeffs, Parent P, char check=*) noexcept - cpdef OrePolynomial _new_constant_poly(self, RingElement a, Parent P, char check=*) noexcept - cpdef _neg_(self) noexcept - cpdef _floordiv_(self, right) noexcept - cpdef _mod_(self, right) noexcept + cdef OrePolynomial _new_c(self, list coeffs, Parent P, char check=*) + cpdef OrePolynomial _new_constant_poly(self, RingElement a, Parent P, char check=*) + cpdef _neg_(self) + cpdef _floordiv_(self, right) + cpdef _mod_(self, right) cpdef bint is_zero(self) noexcept cpdef bint is_one(self) noexcept - cdef _left_quo_rem(self, OrePolynomial other) noexcept - cdef _right_quo_rem(self, OrePolynomial other) noexcept - cdef OrePolynomial _left_lcm_cofactor(self, OrePolynomial other) noexcept - cdef OrePolynomial _right_lcm_cofactor(self, OrePolynomial other) noexcept + cdef _left_quo_rem(self, OrePolynomial other) + cdef _right_quo_rem(self, OrePolynomial other) + cdef OrePolynomial _left_lcm_cofactor(self, OrePolynomial other) + cdef OrePolynomial _right_lcm_cofactor(self, OrePolynomial other) # Abstract methods - cpdef Integer degree(self) noexcept - cpdef list coefficients(self, sparse=*) noexcept + cpdef Integer degree(self) + cpdef list coefficients(self, sparse=*) cdef void lmul_gen(list A, Morphism m, d) noexcept @@ -34,12 +34,12 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): cdef list _coeffs cdef void _normalize(self) noexcept - cpdef _add_(self, other) noexcept - cdef list _mul_list(self, list A) noexcept - cpdef _mul_(self, other) noexcept + cpdef _add_(self, other) + cdef list _mul_list(self, list A) + cpdef _mul_(self, other) - cpdef dict dict(self) noexcept - cpdef list list(self, bint copy=*) noexcept + cpdef dict dict(self) + cpdef list list(self, bint copy=*) cdef class OrePolynomialBaseringInjection(Morphism): diff --git a/src/sage/rings/polynomial/ore_polynomial_element.pyx b/src/sage/rings/polynomial/ore_polynomial_element.pyx index 86c2a057353..47b5b7e6ad7 100644 --- a/src/sage/rings/polynomial/ore_polynomial_element.pyx +++ b/src/sage/rings/polynomial/ore_polynomial_element.pyx @@ -251,7 +251,7 @@ cdef class OrePolynomial(AlgebraElement): """ return self._hash_c() - cpdef Integer degree(self) noexcept: + cpdef Integer degree(self): r""" Return the degree of ``self``. @@ -272,7 +272,7 @@ cdef class OrePolynomial(AlgebraElement): """ raise NotImplementedError - cdef OrePolynomial _new_c(self, list coeffs, Parent P, char check=0) noexcept: + cdef OrePolynomial _new_c(self, list coeffs, Parent P, char check=0): r""" Fast creation of a new Ore polynomial @@ -283,7 +283,7 @@ cdef class OrePolynomial(AlgebraElement): """ return P(coeffs) - cpdef OrePolynomial _new_constant_poly(self, RingElement a, Parent P, char check=0) noexcept: + cpdef OrePolynomial _new_constant_poly(self, RingElement a, Parent P, char check=0): r""" Fast creation of a new constant Ore polynomial @@ -580,7 +580,7 @@ cdef class OrePolynomial(AlgebraElement): raise NotImplementedError("the leading coefficient is not a unit") return a * self - cpdef _mod_(self, other) noexcept: + cpdef _mod_(self, other): r""" Return the remainder in the *right* Euclidean division of ``self`` by ``other```. @@ -602,7 +602,7 @@ cdef class OrePolynomial(AlgebraElement): """ return self.right_quo_rem(other)[1] - cpdef _floordiv_(self, right) noexcept: + cpdef _floordiv_(self, right): r""" Return the quotient of the *right* Euclidean division of ``self`` by ``right``. @@ -628,7 +628,7 @@ cdef class OrePolynomial(AlgebraElement): q, _ = self.right_quo_rem(right) return q - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): r""" Return the quotient of this Ore polynomial by ``right`` in the fraction field. @@ -940,7 +940,7 @@ cdef class OrePolynomial(AlgebraElement): V = V * lc return G, U, V - cdef _left_quo_rem(self, OrePolynomial other) noexcept: + cdef _left_quo_rem(self, OrePolynomial other): r""" Return the quotient and remainder of the left Euclidean division of ``self`` by ``other`` (C implementation). @@ -1000,7 +1000,7 @@ cdef class OrePolynomial(AlgebraElement): raise ZeroDivisionError("division by zero is not valid") return self._left_quo_rem(other) - cdef _right_quo_rem(self, OrePolynomial other) noexcept: + cdef _right_quo_rem(self, OrePolynomial other): r""" Return the quotient and remainder of the right Euclidean division of ``self`` by ``other`` (C implementation). @@ -1309,7 +1309,7 @@ cdef class OrePolynomial(AlgebraElement): A = A.left_monic() return A - cdef OrePolynomial _left_lcm_cofactor(self, OrePolynomial other) noexcept: + cdef OrePolynomial _left_lcm_cofactor(self, OrePolynomial other): r""" Return an Ore polynomial `U` such that `U P = c L` where `P` is this Ore polynomial (``self``), `L` @@ -1387,7 +1387,7 @@ cdef class OrePolynomial(AlgebraElement): V1 = s * V1 return L, V1, L // other - cdef OrePolynomial _right_lcm_cofactor(self, OrePolynomial other) noexcept: + cdef OrePolynomial _right_lcm_cofactor(self, OrePolynomial other): r""" Return an Ore polynomial `U` such that `P U = L c` where `P` is this Ore polynomial (``self``), `L` @@ -1942,7 +1942,7 @@ cdef class OrePolynomial(AlgebraElement): """ return self.is_term() and self.leading_coefficient() == 1 - cpdef list coefficients(self, sparse=True) noexcept: + cpdef list coefficients(self, sparse=True): r""" Return the coefficients of the monomials appearing in ``self``. @@ -2354,7 +2354,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): return -2 return result - cdef OrePolynomial _new_c(self, list coeffs, Parent P, char check=0) noexcept: + cdef OrePolynomial _new_c(self, list coeffs, Parent P, char check=0): r""" Fast creation of a new Ore polynomial given a list of coefficients. @@ -2397,7 +2397,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): del x[n] n -= 1 - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): r""" Compare the two Ore polynomials ``self`` and ``other``. @@ -2463,7 +2463,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): except IndexError: return self.base_ring().zero() - cpdef list list(self, bint copy=True) noexcept: + cpdef list list(self, bint copy=True): r""" Return a list of the coefficients of ``self``. @@ -2491,7 +2491,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): else: return (self)._coeffs - cpdef dict dict(self) noexcept: + cpdef dict dict(self): r""" Return a dictionary representation of ``self``. @@ -2513,7 +2513,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): X[i] = c return X - cpdef Integer degree(self) noexcept: + cpdef Integer degree(self): r""" Return the degree of ``self``. @@ -2552,7 +2552,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): """ return Integer(len(self._coeffs) - 1) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): r""" Add two polynomials. @@ -2583,7 +2583,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): r = self._new_c([x[i] + y[i] for i in range(dx)], self._parent, 1) return r - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): r""" Subtract polynomial ``right`` from ``self``. @@ -2615,7 +2615,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): r = self._new_c([x[i] - y[i] for i in range(dx)], self._parent, 1) return r - cpdef _neg_(self) noexcept: + cpdef _neg_(self): r""" Return the negative of ``self``. @@ -2678,7 +2678,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): """ return self._new_c(self._coeffs[:n], self._parent, 1) - cdef list _mul_list(self, list A) noexcept: + cdef list _mul_list(self, list A): r""" Return the list of coefficients of the product of this Ore polynomial by that whose coefficients are given by ``A``. @@ -2699,7 +2699,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): BA[j] += coeff * A[j] return BA - cpdef _lmul_(self, Element s) noexcept: + cpdef _lmul_(self, Element s): r""" Return the product ``self * right``. @@ -2718,7 +2718,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): cdef coeffs = self._mul_list([s]) return self._new_c(coeffs, self._parent, 1) - cpdef _rmul_(self, Element s) noexcept: + cpdef _rmul_(self, Element s): r""" Return the product ``left * self``. @@ -2746,7 +2746,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): """ return self._new_c([s * c for c in self._coeffs], self._parent, 1) - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): r""" Return the product ``self * right``. @@ -2785,7 +2785,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): coeffs = self._mul_list(coeffs) return self._new_c(coeffs, self._parent, 1) - cdef _left_quo_rem(self, OrePolynomial other) noexcept: + cdef _left_quo_rem(self, OrePolynomial other): r""" Return the quotient and remainder of the left Euclidean division of ``self`` by ``other`` (C implementation). @@ -2814,7 +2814,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): quo.reverse() return self._new_c(quo, self._parent), self._new_c(A[:degB], self._parent, 1) - cdef _right_quo_rem(self, OrePolynomial other) noexcept: + cdef _right_quo_rem(self, OrePolynomial other): r""" Return the quotient and remainder of the right Euclidean division of ``self`` by ``other`` (C implementation). @@ -2852,7 +2852,7 @@ cdef class OrePolynomial_generic_dense(OrePolynomial): quo.reverse() return self._new_c(quo, self._parent), self._new_c(A[:degB], self._parent, 1) - cpdef list coefficients(self, sparse=True) noexcept: + cpdef list coefficients(self, sparse=True): r""" Return the coefficients of the monomials appearing in ``self``. @@ -2988,7 +2988,7 @@ cdef class ConstantOrePolynomialSection(Map): over Rational Field twisted by t |--> t + 1 To: Univariate Polynomial Ring in t over Rational Field """ - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): r""" Return the corresponding element of the base ring if ``self`` is a constant Ore polynomial. Otherwise, it fails. @@ -3096,7 +3096,7 @@ cdef class OrePolynomialBaseringInjection(Morphism): """ return self._an_element - cpdef Element _call_(self, e) noexcept: + cpdef Element _call_(self, e): r""" Return the corresponding Ore polynomial to the element from the base ring according to ``self``. diff --git a/src/sage/rings/polynomial/pbori/pbori.pxd b/src/sage/rings/polynomial/pbori/pbori.pxd index f9083a681a2..ae4ac1353d2 100644 --- a/src/sage/rings/polynomial/pbori/pbori.pxd +++ b/src/sage/rings/polynomial/pbori/pbori.pxd @@ -17,12 +17,12 @@ cdef class BooleanPolynomialRing(BooleanPolynomialRing_base): # it is very important to keep this cached, since otherwise the magma interface will break cdef public object __cover_ring - cdef _convert(self, rhs) noexcept + cdef _convert(self, rhs) cdef class BooleanPolynomial(MPolynomial): cdef PBPoly _pbpoly - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept + cpdef _add_(self, other) + cpdef _mul_(self, other) cdef class BooleSet: cdef BooleanPolynomialRing _ring @@ -35,7 +35,7 @@ cdef class CCuddNavigator: cdef class BooleanMonomial(MonoidElement): cdef PBMonom _pbmonom cdef BooleanPolynomialRing _ring - cpdef _mul_(self, other) noexcept + cpdef _mul_(self, other) cdef class BooleanMonomialVariableIterator: cdef object parent diff --git a/src/sage/rings/polynomial/pbori/pbori.pyx b/src/sage/rings/polynomial/pbori/pbori.pyx index fcba80851e8..6fae3b96323 100644 --- a/src/sage/rings/polynomial/pbori/pbori.pyx +++ b/src/sage/rings/polynomial/pbori/pbori.pyx @@ -607,7 +607,7 @@ cdef class BooleanPolynomialRing(BooleanPolynomialRing_base): return self._repr # Coercion - cpdef _coerce_map_from_(self, S) noexcept: + cpdef _coerce_map_from_(self, S): """ There is coercion from the base ring, from any boolean polynomial ring with compatible variable names, @@ -683,7 +683,7 @@ cdef class BooleanPolynomialRing(BooleanPolynomialRing_base): return False return self._base.has_coerce_map_from(S.base()) - cdef _convert(self, other) noexcept: + cdef _convert(self, other): r""" Canonical conversion of elements from other domains to this boolean polynomial ring. @@ -2269,7 +2269,7 @@ cdef class BooleanMonomial(MonoidElement): gens = self._parent.gens() return self._parent, (tuple(gens.index(x) for x in self.variables()),) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Compare BooleanMonomial objects. @@ -2633,7 +2633,7 @@ cdef class BooleanMonomial(MonoidElement): """ return new_BMI_from_BooleanMonomial(self) - cpdef _mul_(left, right) noexcept: + cpdef _mul_(left, right): """ Multiply this boolean monomial with another boolean monomial. @@ -2805,7 +2805,7 @@ cdef class BooleanMonomial(MonoidElement): # ### -cdef inline BooleanMonomial new_BM(parent, BooleanPolynomialRing ring) noexcept: +cdef inline BooleanMonomial new_BM(parent, BooleanPolynomialRing ring): cdef BooleanMonomial m m = BooleanMonomial.__new__(BooleanMonomial) m._parent = parent @@ -2813,13 +2813,13 @@ cdef inline BooleanMonomial new_BM(parent, BooleanPolynomialRing ring) noexcept: return m cdef inline BooleanMonomial new_BM_from_PBMonom(parent, - BooleanPolynomialRing ring, PBMonom juice) noexcept: + BooleanPolynomialRing ring, PBMonom juice): cdef BooleanMonomial m = new_BM(parent, ring) m._pbmonom = juice return m cdef inline BooleanMonomial new_BM_from_PBVar(parent, - BooleanPolynomialRing ring, PBVar juice) noexcept: + BooleanPolynomialRing ring, PBVar juice): cdef BooleanMonomial m = new_BM(parent, ring) m._pbmonom = PBMonom(juice) return m @@ -2861,7 +2861,7 @@ cdef class BooleanMonomialVariableIterator: return new_BM_from_PBVar(self.parent, self._ring, value) cdef inline BooleanMonomialVariableIterator new_BMVI_from_BooleanMonomial( - BooleanMonomial monom) noexcept: + BooleanMonomial monom): """ Construct a new iterator over the variable indices of a boolean monomial. @@ -2912,7 +2912,7 @@ cdef class BooleanMonomialIterator: return self.pbind[value] -cdef inline BooleanMonomialIterator new_BMI_from_BooleanMonomial(BooleanMonomial monom) noexcept: +cdef inline BooleanMonomialIterator new_BMI_from_BooleanMonomial(BooleanMonomial monom): """ Construct a new BooleanMonomialIterator """ @@ -3016,7 +3016,7 @@ cdef class BooleanPolynomial(MPolynomial): R = self.parent().cover_ring() return R(self)._latex_() - cpdef _add_(left, right) noexcept: + cpdef _add_(left, right): """ EXAMPLES:: @@ -3031,7 +3031,7 @@ cdef class BooleanPolynomial(MPolynomial): p._pbpoly.iadd((right)._pbpoly) return p - cpdef _sub_(left, right) noexcept: + cpdef _sub_(left, right): """ EXAMPLES:: @@ -3043,7 +3043,7 @@ cdef class BooleanPolynomial(MPolynomial): """ return left._add_(right) - cpdef _lmul_(self, Element left) noexcept: + cpdef _lmul_(self, Element left): """ EXAMPLES:: @@ -3066,7 +3066,7 @@ cdef class BooleanPolynomial(MPolynomial): else: return self._parent.zero() - cpdef _mul_(left, right) noexcept: + cpdef _mul_(left, right): """ EXAMPLES:: @@ -3081,7 +3081,7 @@ cdef class BooleanPolynomial(MPolynomial): p._pbpoly.imul((right)._pbpoly) return p - cpdef _div_(left, right) noexcept: + cpdef _div_(left, right): """ EXAMPLES:: @@ -3117,7 +3117,7 @@ cdef class BooleanPolynomial(MPolynomial): """ return self._pbpoly == right._pbpoly - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Compare left and right. @@ -4794,7 +4794,7 @@ cdef class BooleanPolynomialIterator: self.obj._parent, value) -cdef inline BooleanPolynomialIterator new_BPI_from_BooleanPolynomial(BooleanPolynomial f) noexcept: +cdef inline BooleanPolynomialIterator new_BPI_from_BooleanPolynomial(BooleanPolynomial f): """ Construct a new BooleanMonomialIterator """ @@ -5217,35 +5217,35 @@ class BooleanPolynomialIdeal(MPolynomialIdeal): ## -cdef inline BooleanPolynomial new_BP(BooleanPolynomialRing parent) noexcept: +cdef inline BooleanPolynomial new_BP(BooleanPolynomialRing parent): cdef BooleanPolynomial p p = BooleanPolynomial.__new__(BooleanPolynomial) p._parent = parent return p -cdef inline BooleanPolynomial new_BP_from_PBVar(BooleanPolynomialRing parent, PBVar juice) noexcept: +cdef inline BooleanPolynomial new_BP_from_PBVar(BooleanPolynomialRing parent, PBVar juice): cdef BooleanPolynomial p = new_BP(parent) p._pbpoly = PBBoolePolynomial(juice) return p -cdef inline BooleanPolynomial new_BP_from_PBPoly(BooleanPolynomialRing parent, PBPoly juice) noexcept: +cdef inline BooleanPolynomial new_BP_from_PBPoly(BooleanPolynomialRing parent, PBPoly juice): cdef BooleanPolynomial p = new_BP(parent) p._pbpoly = juice return p -cdef inline BooleanPolynomial new_BP_from_PBMonom(BooleanPolynomialRing parent, PBMonom juice) noexcept: +cdef inline BooleanPolynomial new_BP_from_PBMonom(BooleanPolynomialRing parent, PBMonom juice): cdef BooleanPolynomial p = new_BP(parent) p._pbpoly = PBBoolePolynomial(juice) return p -cdef inline BooleanPolynomial new_BP_from_PBSet(BooleanPolynomialRing parent, PBSet juice) noexcept: +cdef inline BooleanPolynomial new_BP_from_PBSet(BooleanPolynomialRing parent, PBSet juice): cdef BooleanPolynomial p = new_BP(parent) p._pbpoly = PBBoolePolynomial(juice) return p -cdef inline BooleanPolynomial new_BP_from_int(BooleanPolynomialRing parent, int juice) noexcept: +cdef inline BooleanPolynomial new_BP_from_int(BooleanPolynomialRing parent, int juice): cdef BooleanPolynomial p = new_BP(parent) p._pbpoly = PBBoolePolynomial(juice, parent._pbring) return p @@ -5869,7 +5869,7 @@ cdef class BooleSet: return self._pbset.sizeDouble() -cdef inline BooleSet new_BS_from_PBSet(PBSet juice, BooleanPolynomialRing ring) noexcept: +cdef inline BooleSet new_BS_from_PBSet(PBSet juice, BooleanPolynomialRing ring): """ Construct a new BooleSet """ @@ -5917,7 +5917,7 @@ cdef class BooleSetIterator: return new_BM_from_PBMonom(self._parent, self._ring, value) -cdef inline BooleSetIterator new_BSI_from_PBSetIter(BooleSet s) noexcept: +cdef inline BooleSetIterator new_BSI_from_PBSetIter(BooleSet s): """ Construct a new BooleSetIterator """ @@ -6136,7 +6136,7 @@ cdef class BooleanPolynomialVector: self._vec.push_back(p) cdef inline BooleanPolynomialVector new_BPV_from_PBPolyVector( - BooleanPolynomialRing parent, PBPolyVector juice) noexcept: + BooleanPolynomialRing parent, PBPolyVector juice): cdef BooleanPolynomialVector m m = BooleanPolynomialVector.__new__(BooleanPolynomialVector) m._vec = juice @@ -6158,7 +6158,7 @@ cdef class BooleanPolynomialVectorIterator: cdef inline BooleanPolynomialVectorIterator new_BPVI_from_PBPolyVectorIter( - BooleanPolynomialVector vec) noexcept: + BooleanPolynomialVector vec): """ Construct a new BooleanPolynomialVectorIterator """ @@ -7000,7 +7000,7 @@ cdef class GroebnerStrategy: cdef class BooleanMulAction(Action): - cpdef _act_(self, g, x) noexcept: + cpdef _act_(self, g, x): """ EXAMPLES:: @@ -7025,7 +7025,7 @@ cdef class BooleanMulAction(Action): cdef inline CCuddNavigator new_CN_from_PBNavigator(PBNavigator juice, - Py_ssize_t* pbind) noexcept: + Py_ssize_t* pbind): """ Construct a new CCuddNavigator """ @@ -7560,7 +7560,7 @@ cdef long PBRing_identifier(PBRing pbring) noexcept: return _hash -cdef object TermOrder_from_PBRing(PBRing _ring) noexcept: +cdef object TermOrder_from_PBRing(PBRing _ring): cdef int n = _ring.nVariables() pb_base_order_code = _ring.ordering().getBaseOrderCode() order_str = inv_order_dict[pb_base_order_code] @@ -7582,7 +7582,7 @@ cdef object TermOrder_from_PBRing(PBRing _ring) noexcept: return T -cdef BooleanPolynomialRing BooleanPolynomialRing_from_PBRing(PBRing _ring) noexcept: +cdef BooleanPolynomialRing BooleanPolynomialRing_from_PBRing(PBRing _ring): """ Get BooleanPolynomialRing from C++-implementation """ @@ -7899,7 +7899,7 @@ cdef class BooleConstant: return self._pbconst.hasConstantPart() -cdef object pb_block_order(n, order_str, blocks) noexcept: +cdef object pb_block_order(n, order_str, blocks): T = [TermOrder(order_str, blockend - blockstart, force=True) for (blockstart, blockend) in zip([0] + blocks, blocks + [n])] if T: @@ -7910,7 +7910,7 @@ cdef object pb_block_order(n, order_str, blocks) noexcept: return order_str -cpdef object TermOrder_from_pb_order(int n, order, blocks) noexcept: +cpdef object TermOrder_from_pb_order(int n, order, blocks): if not isinstance(order, str): if order == pbblock_dlex: order_str = pb_block_order(n, "deglex", blocks) diff --git a/src/sage/rings/polynomial/plural.pxd b/src/sage/rings/polynomial/plural.pxd index 5e3618bd90e..90b79947592 100644 --- a/src/sage/rings/polynomial/plural.pxd +++ b/src/sage/rings/polynomial/plural.pxd @@ -32,16 +32,16 @@ cdef class ExteriorAlgebra_plural(NCPolynomialRing_plural): cdef class NCPolynomial_plural(RingElement): cdef poly *_poly - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cpdef _repr_short_(self) noexcept + cpdef _add_(self, other) + cpdef _mul_(self, other) + cpdef _repr_short_(self) cdef long _hash_c(self) noexcept - cpdef is_constant(self) noexcept - cpdef dict dict(self) noexcept - cpdef dict monomial_coefficients(self, bint copy=*) noexcept + cpdef is_constant(self) + cpdef dict dict(self) + cpdef dict monomial_coefficients(self, bint copy=*) # cpdef _homogenize(self, int var) -cdef NCPolynomial_plural new_NCP(NCPolynomialRing_plural parent, poly *juice) noexcept +cdef NCPolynomial_plural new_NCP(NCPolynomialRing_plural parent, poly *juice) -cpdef MPolynomialRing_libsingular new_CRing(RingWrap rw, base_ring) noexcept -cpdef NCPolynomialRing_plural new_NRing(RingWrap rw, base_ring) noexcept +cpdef MPolynomialRing_libsingular new_CRing(RingWrap rw, base_ring) +cpdef NCPolynomialRing_plural new_NRing(RingWrap rw, base_ring) diff --git a/src/sage/rings/polynomial/plural.pyx b/src/sage/rings/polynomial/plural.pyx index 30e6aa89dc3..23dd2a11179 100644 --- a/src/sage/rings/polynomial/plural.pyx +++ b/src/sage/rings/polynomial/plural.pyx @@ -564,7 +564,7 @@ cdef class NCPolynomialRing_plural(Ring): " as noncommutative polynomial") # ??? return new_NCP(self, _p) - cpdef _coerce_map_from_(self, S) noexcept: + cpdef _coerce_map_from_(self, S): """ The only things that coerce into this ring are: @@ -1478,7 +1478,7 @@ cdef class NCPolynomial_plural(RingElement): """ return self._hash_c() - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Compare left and right. @@ -1529,7 +1529,7 @@ cdef class NCPolynomial_plural(RingElement): cdef ring *r = (left._parent)._ring return rich_to_bool(op, singular_polynomial_cmp(p, q, r)) - cpdef _add_(left, right) noexcept: + cpdef _add_(left, right): """ Adds left and right. @@ -1548,7 +1548,7 @@ cdef class NCPolynomial_plural(RingElement): (left._parent)._ring) return new_NCP((left._parent), _p) - cpdef _sub_(left, right) noexcept: + cpdef _sub_(left, right): """ Subtract left and right. @@ -1570,7 +1570,7 @@ cdef class NCPolynomial_plural(RingElement): _ring) return new_NCP((left._parent), _p) - cpdef _lmul_(self, Element left) noexcept: + cpdef _lmul_(self, Element left): """ Multiply ``self`` with a base ring element. @@ -1600,7 +1600,7 @@ cdef class NCPolynomial_plural(RingElement): singular_polynomial_rmul(&_p, self._poly, left, _ring) return new_NCP((self._parent),_p) - cpdef _mul_(left, right) noexcept: + cpdef _mul_(left, right): """ Multiply left and right. @@ -1631,7 +1631,7 @@ cdef class NCPolynomial_plural(RingElement): (left._parent)._ring) return new_NCP((left._parent),_p) - cpdef _div_(left, right) noexcept: + cpdef _div_(left, right): """ Divide left by right @@ -1813,7 +1813,7 @@ cdef class NCPolynomial_plural(RingElement): s = singular_polynomial_str(self._poly, _ring) return s - cpdef _repr_short_(self) noexcept: + cpdef _repr_short_(self): """ This is a faster but less pretty way to print polynomials. If available it uses the short SINGULAR notation. @@ -2192,7 +2192,7 @@ cdef class NCPolynomial_plural(RingElement): return (self._parent)._base._zero_element - cpdef dict dict(self) noexcept: + cpdef dict dict(self): """ Return a dictionary representing ``self``. This dictionary is in the same format as the generic MPolynomial: The dictionary @@ -2232,7 +2232,7 @@ cdef class NCPolynomial_plural(RingElement): p = pNext(p) return pd - cpdef dict monomial_coefficients(self, bint copy=True) noexcept: + cpdef dict monomial_coefficients(self, bint copy=True): """ Return a dictionary representation of ``self`` with the keys the exponent vectors and the values the corresponding coefficients. @@ -2620,7 +2620,7 @@ cdef class NCPolynomial_plural(RingElement): (self._parent)._base) return (self._parent)._base._zero_element - cpdef is_constant(self) noexcept: + cpdef is_constant(self): """ Return ``True`` if this polynomial is constant. @@ -2837,7 +2837,7 @@ cdef class NCPolynomial_plural(RingElement): ##################################################################### cdef inline NCPolynomial_plural new_NCP(NCPolynomialRing_plural parent, - poly *juice) noexcept: + poly *juice): """ Construct NCPolynomial_plural from parent and SINGULAR poly. @@ -2855,7 +2855,7 @@ cdef inline NCPolynomial_plural new_NCP(NCPolynomialRing_plural parent, return p -cpdef MPolynomialRing_libsingular new_CRing(RingWrap rw, base_ring) noexcept: +cpdef MPolynomialRing_libsingular new_CRing(RingWrap rw, base_ring): """ Construct MPolynomialRing_libsingular from ringWrap, assuming the ground field to be base_ring @@ -2925,7 +2925,7 @@ cpdef MPolynomialRing_libsingular new_CRing(RingWrap rw, base_ring) noexcept: return self -cpdef NCPolynomialRing_plural new_NRing(RingWrap rw, base_ring) noexcept: +cpdef NCPolynomialRing_plural new_NRing(RingWrap rw, base_ring): """ Construct NCPolynomialRing_plural from ringWrap, assuming the ground field to be base_ring diff --git a/src/sage/rings/polynomial/polydict.pxd b/src/sage/rings/polynomial/polydict.pxd index af56cd80364..69ddc888378 100644 --- a/src/sage/rings/polynomial/polydict.pxd +++ b/src/sage/rings/polynomial/polydict.pxd @@ -1,8 +1,8 @@ cdef class PolyDict: cdef dict __repn - cdef PolyDict _new(self, dict pdict) noexcept - cpdef remove_zeros(self, zero_test=*) noexcept + cdef PolyDict _new(self, dict pdict) + cpdef remove_zeros(self, zero_test=*) cdef class ETuple: @@ -11,7 +11,7 @@ cdef class ETuple: cdef int *_data cdef size_t get_position(self, size_t i, size_t start, size_t end) noexcept - cdef ETuple _new(self) noexcept + cdef ETuple _new(self) cdef int get_exp(self, size_t i) noexcept # need a cdef version for function pointers @@ -21,24 +21,24 @@ cdef class ETuple: cpdef int unweighted_quotient_degree(self, ETuple other) except * cpdef int weighted_quotient_degree(self, ETuple other, tuple w) except * - cpdef ETuple eadd(self, ETuple other) noexcept - cpdef ETuple esub(self, ETuple other) noexcept - cpdef ETuple emul(self, int factor) noexcept - cpdef ETuple emin(self, ETuple other) noexcept - cpdef ETuple emax(self, ETuple other) noexcept - cpdef ETuple eadd_p(self, int other, size_t pos) noexcept - cpdef ETuple eadd_scaled(self, ETuple other, int scalar) noexcept + cpdef ETuple eadd(self, ETuple other) + cpdef ETuple esub(self, ETuple other) + cpdef ETuple emul(self, int factor) + cpdef ETuple emin(self, ETuple other) + cpdef ETuple emax(self, ETuple other) + cpdef ETuple eadd_p(self, int other, size_t pos) + cpdef ETuple eadd_scaled(self, ETuple other, int scalar) cpdef int dotprod(self, ETuple other) except * - cpdef ETuple escalar_div(self, int n) noexcept - cpdef ETuple divide_by_gcd(self, ETuple other) noexcept - cpdef ETuple divide_by_var(self, size_t pos) noexcept + cpdef ETuple escalar_div(self, int n) + cpdef ETuple divide_by_gcd(self, ETuple other) + cpdef ETuple divide_by_var(self, size_t pos) cpdef bint divides(self, ETuple other) except * cpdef bint is_constant(self) noexcept cpdef bint is_multiple_of(self, int n) except * - cpdef list nonzero_positions(self, bint sort=*) noexcept - cpdef common_nonzero_positions(self, ETuple other, bint sort=*) noexcept - cpdef list nonzero_values(self, bint sort=*) noexcept - cpdef ETuple reversed(self) noexcept + cpdef list nonzero_positions(self, bint sort=*) + cpdef common_nonzero_positions(self, ETuple other, bint sort=*) + cpdef list nonzero_values(self, bint sort=*) + cpdef ETuple reversed(self) cpdef int gen_index(PolyDict x) noexcept -cpdef ETuple monomial_exponent(PolyDict p) noexcept +cpdef ETuple monomial_exponent(PolyDict p) diff --git a/src/sage/rings/polynomial/polydict.pyx b/src/sage/rings/polynomial/polydict.pyx index 0ecf35e452f..e579052df95 100644 --- a/src/sage/rings/polynomial/polydict.pyx +++ b/src/sage/rings/polynomial/polydict.pyx @@ -69,7 +69,7 @@ cpdef int gen_index(PolyDict x) noexcept: return e._data[0] -cpdef ETuple monomial_exponent(PolyDict p) noexcept: +cpdef ETuple monomial_exponent(PolyDict p): r""" Return the unique exponent of ``p`` if it is a monomial or raise a ``ValueError``. @@ -189,12 +189,12 @@ cdef class PolyDict: if remove_zero: self.remove_zeros() - cdef PolyDict _new(self, dict pdict) noexcept: + cdef PolyDict _new(self, dict pdict): cdef PolyDict ans = PolyDict.__new__(PolyDict) ans.__repn = pdict return ans - cpdef remove_zeros(self, zero_test=None) noexcept: + cpdef remove_zeros(self, zero_test=None): r""" Remove the entries with zero coefficients. @@ -1430,7 +1430,7 @@ cdef class ETuple: question (although, there is no question that this is much faster than the prior use of python dicts). """ - cdef ETuple _new(self) noexcept: + cdef ETuple _new(self): """ Quickly creates a new initialized ETuple with the same length as self. @@ -1989,7 +1989,7 @@ cdef class ETuple: ind1 += 2 return deg - cpdef ETuple eadd(self, ETuple other) noexcept: + cpdef ETuple eadd(self, ETuple other): """ Return the vector addition of ``self`` with ``other``. @@ -2039,7 +2039,7 @@ cdef class ETuple: result._nonzero += 1 return result - cpdef ETuple eadd_p(self, int other, size_t pos) noexcept: + cpdef ETuple eadd_p(self, int other, size_t pos): """ Add ``other`` to ``self`` at position ``pos``. @@ -2127,7 +2127,7 @@ cdef class ETuple: return result - cpdef ETuple eadd_scaled(self, ETuple other, int scalar) noexcept: + cpdef ETuple eadd_scaled(self, ETuple other, int scalar): """ Vector addition of ``self`` with ``scalar * other``. @@ -2166,7 +2166,7 @@ cdef class ETuple: result._nonzero += 1 return result - cpdef ETuple esub(self, ETuple other) noexcept: + cpdef ETuple esub(self, ETuple other): """ Vector subtraction of ``self`` with ``other``. @@ -2204,7 +2204,7 @@ cdef class ETuple: result._nonzero += 1 return result - cpdef ETuple emul(self, int factor) noexcept: + cpdef ETuple emul(self, int factor): """ Scalar Vector multiplication of ``self``. @@ -2228,7 +2228,7 @@ cdef class ETuple: result._data[2 * ind + 1] = self._data[2 * ind + 1] * factor return result - cpdef ETuple emax(self, ETuple other) noexcept: + cpdef ETuple emax(self, ETuple other): """ Vector of maximum of components of ``self`` and ``other``. @@ -2275,7 +2275,7 @@ cdef class ETuple: result._nonzero += 1 return result - cpdef ETuple emin(self, ETuple other) noexcept: + cpdef ETuple emin(self, ETuple other): """ Vector of minimum of components of ``self`` and ``other``. @@ -2345,7 +2345,7 @@ cdef class ETuple: result += exp1 * exp2 return result - cpdef ETuple escalar_div(self, int n) noexcept: + cpdef ETuple escalar_div(self, int n): r""" Divide each exponent by ``n``. @@ -2386,7 +2386,7 @@ cdef class ETuple: result._nonzero += 1 return result - cpdef ETuple divide_by_gcd(self, ETuple other) noexcept: + cpdef ETuple divide_by_gcd(self, ETuple other): """ Return ``self / gcd(self, other)``. @@ -2429,7 +2429,7 @@ cdef class ETuple: ind1 += 2 return result - cpdef ETuple divide_by_var(self, size_t pos) noexcept: + cpdef ETuple divide_by_var(self, size_t pos): """ Return division of ``self`` by the variable with index ``pos``. @@ -2556,7 +2556,7 @@ cdef class ETuple: return False return True - cpdef list nonzero_positions(self, bint sort=False) noexcept: + cpdef list nonzero_positions(self, bint sort=False): """ Return the positions of non-zero exponents in the tuple. @@ -2575,7 +2575,7 @@ cdef class ETuple: cdef size_t ind return [self._data[2 * ind] for ind in range(self._nonzero)] - cpdef common_nonzero_positions(self, ETuple other, bint sort=False) noexcept: + cpdef common_nonzero_positions(self, ETuple other, bint sort=False): """ Returns an optionally sorted list of non zero positions either in self or other, i.e. the only positions that need to be @@ -2598,7 +2598,7 @@ cdef class ETuple: else: return res - cpdef list nonzero_values(self, bint sort=True) noexcept: + cpdef list nonzero_values(self, bint sort=True): """ Return the non-zero values of the tuple. @@ -2620,7 +2620,7 @@ cdef class ETuple: cdef size_t ind return [self._data[2 * ind + 1] for ind in range(self._nonzero)] - cpdef ETuple reversed(self) noexcept: + cpdef ETuple reversed(self): """ Return the reversed ETuple of ``self``. diff --git a/src/sage/rings/polynomial/polynomial_compiled.pxd b/src/sage/rings/polynomial/polynomial_compiled.pxd index 3e5c9f4611f..e1b11ec1a41 100644 --- a/src/sage/rings/polynomial/polynomial_compiled.pxd +++ b/src/sage/rings/polynomial/polynomial_compiled.pxd @@ -8,17 +8,17 @@ cdef class CompiledPolynomialFunction: cdef generic_pd _dag cdef object _coeffs - cdef object _parse_structure(CompiledPolynomialFunction) noexcept - cdef generic_pd _get_gap(CompiledPolynomialFunction, BinaryTree, int) noexcept + cdef object _parse_structure(CompiledPolynomialFunction) + cdef generic_pd _get_gap(CompiledPolynomialFunction, BinaryTree, int) cdef void _fill_gaps_binary(CompiledPolynomialFunction, BinaryTree) noexcept - cdef object eval(CompiledPolynomialFunction, object) noexcept + cdef object eval(CompiledPolynomialFunction, object) cdef class generic_pd: cdef object value cdef int refs, hits cdef int label cdef int eval(self, vars, coeffs) except -2 - cdef generic_pd nodummies(generic_pd) noexcept + cdef generic_pd nodummies(generic_pd) cdef void reset(self) noexcept cdef class dummy_pd(generic_pd): diff --git a/src/sage/rings/polynomial/polynomial_compiled.pyx b/src/sage/rings/polynomial/polynomial_compiled.pyx index 1145dfae7ea..1a140067ad3 100644 --- a/src/sage/rings/polynomial/polynomial_compiled.pyx +++ b/src/sage/rings/polynomial/polynomial_compiled.pyx @@ -119,7 +119,7 @@ cdef class CompiledPolynomialFunction: def __call__(self, x): return self.eval(x) - cdef object eval(CompiledPolynomialFunction self, object x) noexcept: + cdef object eval(CompiledPolynomialFunction self, object x): cdef object temp try: pd_eval(self._dag, x, self._coeffs) #see further down @@ -130,7 +130,7 @@ cdef class CompiledPolynomialFunction: self._dag.reset() raise TypeError(msg) - cdef object _parse_structure(CompiledPolynomialFunction self) noexcept: + cdef object _parse_structure(CompiledPolynomialFunction self): """ Loop through the coefficients of the polynomial, and collect coefficient gap widths. Meanwhile, construct the evaluation @@ -169,7 +169,7 @@ cdef class CompiledPolynomialFunction: return gaps, s - cdef generic_pd _get_gap(CompiledPolynomialFunction self, BinaryTree gaps, int gap) noexcept: + cdef generic_pd _get_gap(CompiledPolynomialFunction self, BinaryTree gaps, int gap): """ Find an entry in the BinaryTree gaps, identified by the int gap. If such an entry does not exist, create it and put it in the tree. @@ -367,7 +367,7 @@ cdef class generic_pd: cdef int eval(generic_pd self, object vars, object coeffs) except -2: raise NotImplementedError - cdef generic_pd nodummies(generic_pd self) noexcept: + cdef generic_pd nodummies(generic_pd self): return self cdef void reset(generic_pd self) noexcept: @@ -381,7 +381,7 @@ cdef class dummy_pd(generic_pd): cdef void fill(dummy_pd self, generic_pd link) noexcept: self.link = link - cdef generic_pd nodummies(dummy_pd self) noexcept: + cdef generic_pd nodummies(dummy_pd self): #sorry guys, this is my stop self.link.refs = self.refs return self.link.nodummies() @@ -426,7 +426,7 @@ cdef class unary_pd(generic_pd): self.operand = operand self.operand.refs += 1 - cdef generic_pd nodummies(self) noexcept: + cdef generic_pd nodummies(self): self.operand = self.operand.nodummies() return self @@ -467,7 +467,7 @@ cdef class binary_pd(generic_pd): self.left.refs+= 1 self.right.refs+= 1 - cdef generic_pd nodummies(self) noexcept: + cdef generic_pd nodummies(self): self.left = self.left.nodummies() self.right = self.right.nodummies() return self diff --git a/src/sage/rings/polynomial/polynomial_complex_arb.pxd b/src/sage/rings/polynomial/polynomial_complex_arb.pxd index cffe352e2cf..bda5cc66008 100644 --- a/src/sage/rings/polynomial/polynomial_complex_arb.pxd +++ b/src/sage/rings/polynomial/polynomial_complex_arb.pxd @@ -3,4 +3,4 @@ from sage.rings.polynomial.polynomial_element cimport Polynomial cdef class Polynomial_complex_arb(Polynomial): cdef acb_poly_struct[1] _poly # https://github.com/cython/cython/issues/1984 - cdef Polynomial_complex_arb _new(self) noexcept + cdef Polynomial_complex_arb _new(self) diff --git a/src/sage/rings/polynomial/polynomial_complex_arb.pyx b/src/sage/rings/polynomial/polynomial_complex_arb.pyx index ed52bb01b56..da1ade2edcb 100644 --- a/src/sage/rings/polynomial/polynomial_complex_arb.pyx +++ b/src/sage/rings/polynomial/polynomial_complex_arb.pyx @@ -87,7 +87,7 @@ cdef class Polynomial_complex_arb(Polynomial): """ acb_poly_clear(self._poly) - cdef Polynomial_complex_arb _new(self) noexcept: + cdef Polynomial_complex_arb _new(self): r""" Return a new polynomial with the same parent as this one. """ @@ -231,13 +231,13 @@ cdef class Polynomial_complex_arb(Polynomial): """ return smallInteger(acb_poly_degree(self._poly)) - cdef get_unsafe(self, Py_ssize_t n) noexcept: + cdef get_unsafe(self, Py_ssize_t n): cdef ComplexBall res = ComplexBall.__new__(ComplexBall) res._parent = self._parent._base acb_poly_get_coeff_acb(res.value, self._poly, n) return res - cpdef list list(self, bint copy=True) noexcept: + cpdef list list(self, bint copy=True): r""" Return the coefficient list of this polynomial. @@ -271,7 +271,7 @@ cdef class Polynomial_complex_arb(Polynomial): # Ring and Euclidean arithmetic - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): r""" Return the sum of two polynomials. @@ -291,7 +291,7 @@ cdef class Polynomial_complex_arb(Polynomial): sig_off() return res - cpdef _neg_(self) noexcept: + cpdef _neg_(self): r""" Return the opposite of this polynomial. @@ -307,7 +307,7 @@ cdef class Polynomial_complex_arb(Polynomial): sig_off() return res - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): r""" Return the difference of two polynomials. @@ -327,7 +327,7 @@ cdef class Polynomial_complex_arb(Polynomial): sig_off() return res - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): r""" Return the product of two polynomials. @@ -348,7 +348,7 @@ cdef class Polynomial_complex_arb(Polynomial): sig_off() return res - cpdef _lmul_(self, Element a) noexcept: + cpdef _lmul_(self, Element a): r""" TESTS:: @@ -368,7 +368,7 @@ cdef class Polynomial_complex_arb(Polynomial): sig_off() return res - cpdef _rmul_(self, Element a) noexcept: + cpdef _rmul_(self, Element a): r""" TESTS:: @@ -429,7 +429,7 @@ cdef class Polynomial_complex_arb(Polynomial): # Syntactic transformations - cpdef Polynomial truncate(self, long n) noexcept: + cpdef Polynomial truncate(self, long n): r""" Return the truncation to degree `n - 1` of this polynomial. @@ -460,7 +460,7 @@ cdef class Polynomial_complex_arb(Polynomial): sig_off() return res - cdef _inplace_truncate(self, long n) noexcept: + cdef _inplace_truncate(self, long n): if n < 0: n = 0 acb_poly_truncate(self._poly, n) @@ -534,7 +534,7 @@ cdef class Polynomial_complex_arb(Polynomial): # Truncated and power series arithmetic - cpdef Polynomial _mul_trunc_(self, Polynomial other, long n) noexcept: + cpdef Polynomial _mul_trunc_(self, Polynomial other, long n): r""" Return the product of ``self`` and ``other``, truncated before degree `n`. @@ -562,7 +562,7 @@ cdef class Polynomial_complex_arb(Polynomial): sig_off() return res - cpdef Polynomial inverse_series_trunc(self, long n) noexcept: + cpdef Polynomial inverse_series_trunc(self, long n): r""" Return the power series expansion at 0 of the inverse of this polynomial, truncated before degree `n`. @@ -590,7 +590,7 @@ cdef class Polynomial_complex_arb(Polynomial): sig_off() return res - cpdef Polynomial _power_trunc(self, unsigned long expo, long n) noexcept: + cpdef Polynomial _power_trunc(self, unsigned long expo, long n): r""" Return a power of this polynomial, truncated before degree `n`. diff --git a/src/sage/rings/polynomial/polynomial_element.pxd b/src/sage/rings/polynomial/polynomial_element.pxd index 9b8bf41fa06..a8f2cf3057b 100644 --- a/src/sage/rings/polynomial/polynomial_element.pxd +++ b/src/sage/rings/polynomial/polynomial_element.pxd @@ -7,58 +7,58 @@ from sage.rings.polynomial.polynomial_compiled cimport CompiledPolynomialFunctio cdef class Polynomial(CommutativePolynomial): - cdef Polynomial _new_generic(self, list coeffs) noexcept + cdef Polynomial _new_generic(self, list coeffs) cdef char _is_gen cdef CompiledPolynomialFunction _compiled - cpdef Polynomial truncate(self, long n) noexcept - cpdef Polynomial inverse_series_trunc(self, long prec) noexcept + cpdef Polynomial truncate(self, long n) + cpdef Polynomial inverse_series_trunc(self, long prec) cdef long _hash_c(self) except -1 - cpdef constant_coefficient(self) noexcept - cpdef Polynomial _new_constant_poly(self, a, Parent P) noexcept - cpdef list list(self, bint copy=*) noexcept - cpdef _mul_generic(self, right) noexcept - cdef _square_generic(self) noexcept + cpdef constant_coefficient(self) + cpdef Polynomial _new_constant_poly(self, a, Parent P) + cpdef list list(self, bint copy=*) + cpdef _mul_generic(self, right) + cdef _square_generic(self) cpdef bint is_zero(self) except -1 cpdef bint is_one(self) except -1 cpdef bint is_term(self) except -1 - cpdef dict _mpoly_dict_recursive(self, tuple variables=*, base_ring=*) noexcept + cpdef dict _mpoly_dict_recursive(self, tuple variables=*, base_ring=*) - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cpdef _floordiv_(self, right) noexcept - cpdef Polynomial _mul_trunc_(self, Polynomial right, long n) noexcept - cpdef Polynomial _power_trunc(self, unsigned long n, long prec) noexcept - cdef Polynomial _mul_term(self, Polynomial term, bint term_on_right) noexcept + cpdef _add_(self, other) + cpdef _mul_(self, other) + cpdef _floordiv_(self, right) + cpdef Polynomial _mul_trunc_(self, Polynomial right, long n) + cpdef Polynomial _power_trunc(self, unsigned long n, long prec) + cdef Polynomial _mul_term(self, Polynomial term, bint term_on_right) # UNSAFE, only call from an inplace operator # may return a new element if not possible to modify inplace - cdef _inplace_truncate(self, long n) noexcept + cdef _inplace_truncate(self, long n) - cdef get_coeff_c(self, Py_ssize_t i) noexcept - cdef get_unsafe(self, Py_ssize_t i) noexcept + cdef get_coeff_c(self, Py_ssize_t i) + cdef get_unsafe(self, Py_ssize_t i) cpdef long number_of_terms(self) noexcept # See 23227 - cpdef _add_(self, right) noexcept - cpdef _mul_(self, right) noexcept - cpdef _floordiv_(self, right) noexcept + cpdef _add_(self, right) + cpdef _mul_(self, right) + cpdef _floordiv_(self, right) cdef public dict _cached_methods cdef class Polynomial_generic_dense(Polynomial): - cdef Polynomial_generic_dense _new_c(self, list coeffs, Parent P) noexcept + cdef Polynomial_generic_dense _new_c(self, list coeffs, Parent P) cdef list _coeffs cdef int _normalize(self) except -1 - cpdef list list(self, bint copy=*) noexcept + cpdef list list(self, bint copy=*) cdef class Polynomial_generic_dense_inexact(Polynomial_generic_dense): pass -cpdef is_Polynomial(f) noexcept -cpdef Polynomial generic_power_trunc(Polynomial p, Integer n, long prec) noexcept -cpdef list _dict_to_list(dict x, zero) noexcept +cpdef is_Polynomial(f) +cpdef Polynomial generic_power_trunc(Polynomial p, Integer n, long prec) +cpdef list _dict_to_list(dict x, zero) cpdef bint polynomial_is_variable(x) noexcept diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx index 8b58e403d3d..e9b09e8f2b7 100644 --- a/src/sage/rings/polynomial/polynomial_element.pyx +++ b/src/sage/rings/polynomial/polynomial_element.pyx @@ -134,7 +134,7 @@ from sage.categories.morphism cimport Morphism from sage.misc.superseded import deprecation_cython as deprecation, deprecated_function_alias from sage.misc.cachefunc import cached_method -cpdef is_Polynomial(f) noexcept: +cpdef is_Polynomial(f): """ Return ``True`` if ``f`` is of type univariate polynomial. @@ -244,7 +244,7 @@ cdef class Polynomial(CommutativePolynomial): CommutativeAlgebraElement.__init__(self, parent) self._is_gen = is_gen - cdef Polynomial _new_generic(self, list coeffs) noexcept: + cdef Polynomial _new_generic(self, list coeffs): r""" Quickly construct a new polynomial of the same type as ``self``, bypassing the parent's element constructor. @@ -258,7 +258,7 @@ cdef class Polynomial(CommutativePolynomial): n -= 1 return type(self)(self._parent, coeffs, check=False) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): r""" Add two polynomials. @@ -287,7 +287,7 @@ cdef class Polynomial(CommutativePolynomial): low = [x[i] + y[i] for i in range(min)] return self._new_generic(low + high) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): return self._new_generic([-x for x in self.list(copy=False)]) cpdef bint is_zero(self) except -1: @@ -370,7 +370,7 @@ cdef class Polynomial(CommutativePolynomial): return point(z, *args, **kwds) raise NotImplementedError("plotting of polynomials over %s not implemented"%R) - cpdef _lmul_(self, Element left) noexcept: + cpdef _lmul_(self, Element left): """ Multiply self on the left by a scalar. @@ -390,7 +390,7 @@ cdef class Polynomial(CommutativePolynomial): return self._parent.zero() return self._parent(left) * self - cpdef _rmul_(self, Element right) noexcept: + cpdef _rmul_(self, Element right): """ Multiply self on the right by a scalar. @@ -1011,7 +1011,7 @@ cdef class Polynomial(CommutativePolynomial): expr *= x return expr - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): r""" Compare the two polynomials self and other. @@ -1177,7 +1177,7 @@ cdef class Polynomial(CommutativePolynomial): return self.get_coeff_c(pyobject_to_long(n)) - cdef get_coeff_c(self, Py_ssize_t i) noexcept: + cdef get_coeff_c(self, Py_ssize_t i): """ Return the `i`-th coefficient of ``self``. """ @@ -1187,7 +1187,7 @@ cdef class Polynomial(CommutativePolynomial): else: return self._parent._base.zero() - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): """ Return the `i`-th coefficient of ``self``. @@ -1669,7 +1669,7 @@ cdef class Polynomial(CommutativePolynomial): else: raise ValueError("Impossible inverse modulo") - cpdef Polynomial inverse_series_trunc(self, long prec) noexcept: + cpdef Polynomial inverse_series_trunc(self, long prec): r""" Return a polynomial approximation of precision ``prec`` of the inverse series of this polynomial. @@ -1784,7 +1784,7 @@ cdef class Polynomial(CommutativePolynomial): """ raise NotImplementedError("only implemented for certain base rings") - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ EXAMPLES:: @@ -1840,7 +1840,7 @@ cdef class Polynomial(CommutativePolynomial): else: return self._mul_generic(right) - cpdef Polynomial _mul_trunc_(self, Polynomial right, long n) noexcept: + cpdef Polynomial _mul_trunc_(self, Polynomial right, long n): r""" Return the truncated multiplication of two polynomials up to ``n``. @@ -3021,7 +3021,7 @@ cdef class Polynomial(CommutativePolynomial): return self._power_trunc(mpz_get_ui(ZZn.value), prec) return generic_power_trunc(self, ZZn, pyobject_to_long(prec)) - cpdef Polynomial _power_trunc(self, unsigned long n, long prec) noexcept: + cpdef Polynomial _power_trunc(self, unsigned long n, long prec): r""" Truncated ``n``-th power of this polynomial up to precision ``prec`` @@ -3309,7 +3309,7 @@ cdef class Polynomial(CommutativePolynomial): """ raise IndexError("polynomials are immutable") - cpdef _floordiv_(self, right) noexcept: + cpdef _floordiv_(self, right): r""" Quotient of division of ``self`` by ``other``. This is denoted //. @@ -3393,7 +3393,7 @@ cdef class Polynomial(CommutativePolynomial): return (self.degree() == self.valuation() and self.leading_coefficient()._is_atomic()) - cpdef _mul_generic(self, right) noexcept: + cpdef _mul_generic(self, right): """ Compute the product of ``self`` and ``right`` using the classical quadratic algorithm. This method is the default for inexact rings. @@ -3457,7 +3457,7 @@ cdef class Polynomial(CommutativePolynomial): cdef list y = right.list(copy=False) return self._new_generic(do_schoolbook_product(x, y, -1)) - cdef _square_generic(self) noexcept: + cdef _square_generic(self): cdef list x = self.list(copy=False) cdef Py_ssize_t i, j cdef Py_ssize_t d = len(x)-1 @@ -3725,7 +3725,7 @@ cdef class Polynomial(CommutativePolynomial): @cython.boundscheck(False) @cython.wraparound(False) - cdef Polynomial _mul_term(self, Polynomial term, bint term_on_right) noexcept: + cdef Polynomial _mul_term(self, Polynomial term, bint term_on_right): """ Return the product ``self * term``, where ``term`` is a polynomial with a single term. @@ -3759,7 +3759,7 @@ cdef class Polynomial(CommutativePolynomial): """ return self._parent.base_ring() - cpdef base_extend(self, R) noexcept: + cpdef base_extend(self, R): """ Return a copy of this polynomial but with coefficients in ``R``, if there is a natural map from the coefficient ring of ``self`` to ``R``. @@ -3852,7 +3852,7 @@ cdef class Polynomial(CommutativePolynomial): else: return self._parent.change_ring(R)(self.list(copy=False)) - cpdef dict _mpoly_dict_recursive(self, tuple variables=None, base_ring=None) noexcept: + cpdef dict _mpoly_dict_recursive(self, tuple variables=None, base_ring=None): """ Return a dict of coefficient entries suitable for construction of a MPolynomial_polydict with the given variables. @@ -6020,7 +6020,7 @@ cdef class Polynomial(CommutativePolynomial): return M - cpdef constant_coefficient(self) noexcept: + cpdef constant_coefficient(self): """ Return the constant coefficient of this polynomial. @@ -6038,7 +6038,7 @@ cdef class Polynomial(CommutativePolynomial): # self.degree() >= 0 return self.get_unsafe(0) - cpdef Polynomial _new_constant_poly(self, a, Parent P) noexcept: + cpdef Polynomial _new_constant_poly(self, a, Parent P): """ Create a new constant polynomial from a in P, which MUST be an element of the base ring of P (this is not checked). @@ -6549,7 +6549,7 @@ cdef class Polynomial(CommutativePolynomial): cdef Py_ssize_t i return [i for i, c in enumerate(self.list(copy=False)) if c] - cpdef list list(self, bint copy=True) noexcept: + cpdef list list(self, bint copy=True): """ Return a new copy of the list of the underlying elements of ``self``. @@ -10204,7 +10204,7 @@ cdef class Polynomial(CommutativePolynomial): """ return self.shift(-k) - cpdef Polynomial truncate(self, long n) noexcept: + cpdef Polynomial truncate(self, long n): r""" Return the polynomial of degree `< n` which is equivalent to self modulo `x^n`. @@ -10225,7 +10225,7 @@ cdef class Polynomial(CommutativePolynomial): # We must not have check=False, since 0 must not have _coeffs = [0]. return self._parent(self[:n])#, check=False) - cdef _inplace_truncate(self, long prec) noexcept: + cdef _inplace_truncate(self, long prec): return self.truncate(prec) @cached_method @@ -11719,7 +11719,7 @@ cdef class Polynomial(CommutativePolynomial): @cython.boundscheck(False) @cython.wraparound(False) @cython.overflowcheck(False) -cdef list do_schoolbook_product(list x, list y, Py_ssize_t deg) noexcept: +cdef list do_schoolbook_product(list x, list y, Py_ssize_t deg): """ Compute the truncated multiplication of two polynomials represented by lists, using the schoolbook algorithm. @@ -11771,7 +11771,7 @@ cdef list do_schoolbook_product(list x, list y, Py_ssize_t deg) noexcept: @cython.boundscheck(False) @cython.wraparound(False) @cython.overflowcheck(False) -cdef list do_karatsuba_different_size(list left, list right, Py_ssize_t K_threshold) noexcept: +cdef list do_karatsuba_different_size(list left, list right, Py_ssize_t K_threshold): """ Multiply two polynomials of different degrees by splitting the one of largest degree in chunks that are multiplied with the other using the @@ -11853,7 +11853,7 @@ cdef list do_karatsuba_different_size(list left, list right, Py_ssize_t K_thresh @cython.boundscheck(False) @cython.wraparound(False) @cython.overflowcheck(False) -cdef list do_karatsuba(list left, list right, Py_ssize_t K_threshold,Py_ssize_t start_l, Py_ssize_t start_r,Py_ssize_t num_elts) noexcept: +cdef list do_karatsuba(list left, list right, Py_ssize_t K_threshold,Py_ssize_t start_l, Py_ssize_t start_r,Py_ssize_t num_elts): """ Core routine for Karatsuba multiplication. This function works for two polynomials of the same degree. @@ -12032,14 +12032,14 @@ cdef class Polynomial_generic_dense(Polynomial): else: self._coeffs = x - cdef Polynomial_generic_dense _new_c(self, list coeffs, Parent P) noexcept: + cdef Polynomial_generic_dense _new_c(self, list coeffs, Parent P): cdef type t = type(self) cdef Polynomial_generic_dense f = t.__new__(t) f._parent = P f._coeffs = coeffs return f - cpdef Polynomial _new_constant_poly(self, a, Parent P) noexcept: + cpdef Polynomial _new_constant_poly(self, a, Parent P): """ Create a new constant polynomial in P with value a. @@ -12111,7 +12111,7 @@ cdef class Polynomial_generic_dense(Polynomial): @cython.boundscheck(False) @cython.wraparound(False) - cdef Polynomial _mul_term(self, Polynomial term, bint term_on_right) noexcept: + cdef Polynomial _mul_term(self, Polynomial term, bint term_on_right): """ Return the product ``self * term``, where ``term`` is a polynomial with a single term. @@ -12163,7 +12163,7 @@ cdef class Polynomial_generic_dense(Polynomial): @cython.boundscheck(False) @cython.wraparound(False) - cdef get_unsafe(self, Py_ssize_t n) noexcept: + cdef get_unsafe(self, Py_ssize_t n): """ Return the `n`-th coefficient of ``self``. @@ -12260,7 +12260,7 @@ cdef class Polynomial_generic_dense(Polynomial): res._normalize() return res - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): r""" Add two polynomials. @@ -12291,7 +12291,7 @@ cdef class Polynomial_generic_dense(Polynomial): else: return self._new_c(low + high, self._parent) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): cdef Polynomial_generic_dense res cdef Py_ssize_t check=0, i, min x = (self)._coeffs @@ -12312,7 +12312,7 @@ cdef class Polynomial_generic_dense(Polynomial): else: return self._new_c(low + high, self._parent) - cpdef _rmul_(self, Element c) noexcept: + cpdef _rmul_(self, Element c): if not self._coeffs: return self if c._parent is not (self._coeffs[0])._parent: @@ -12324,7 +12324,7 @@ cdef class Polynomial_generic_dense(Polynomial): res._normalize() return res - cpdef _lmul_(self, Element c) noexcept: + cpdef _lmul_(self, Element c): if not self._coeffs: return self if c._parent is not (self._coeffs[0])._parent: @@ -12336,7 +12336,7 @@ cdef class Polynomial_generic_dense(Polynomial): res._normalize() return res - cpdef constant_coefficient(self) noexcept: + cpdef constant_coefficient(self): """ Return the constant coefficient of this polynomial. @@ -12355,7 +12355,7 @@ cdef class Polynomial_generic_dense(Polynomial): else: return self._coeffs[0] - cpdef list list(self, bint copy=True) noexcept: + cpdef list list(self, bint copy=True): """ Return a new copy of the list of the underlying elements of ``self``. @@ -12542,7 +12542,7 @@ cdef class Polynomial_generic_dense(Polynomial): return self._new_c(quo,self._parent), self._new_c(x,self._parent)._inplace_truncate(n-1) - cpdef Polynomial truncate(self, long n) noexcept: + cpdef Polynomial truncate(self, long n): r""" Return the polynomial of degree `< n` which is equivalent to self modulo `x^n`. @@ -12576,7 +12576,7 @@ cdef class Polynomial_generic_dense(Polynomial): n -= 1 return self._new_c(self._coeffs[:n], self._parent) - cdef _inplace_truncate(self, long n) noexcept: + cdef _inplace_truncate(self, long n): if n < len(self._coeffs): while n > 0 and not self._coeffs[n-1]: n -= 1 @@ -12627,7 +12627,7 @@ def universal_discriminant(n): return (1 - (n&2))*p.resultant(p.derivative())//pr1.gen(n) -cpdef Polynomial generic_power_trunc(Polynomial p, Integer n, long prec) noexcept: +cpdef Polynomial generic_power_trunc(Polynomial p, Integer n, long prec): r""" Generic truncated power algorithm @@ -12706,7 +12706,7 @@ cpdef Polynomial generic_power_trunc(Polynomial p, Integer n, long prec) noexcep return power -cpdef list _dict_to_list(dict x, zero) noexcept: +cpdef list _dict_to_list(dict x, zero): """ Convert a dict to a list. @@ -12896,7 +12896,7 @@ cdef class ConstantPolynomialSection(Map): ... TypeError: not a constant polynomial """ - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ TESTS:: @@ -13008,7 +13008,7 @@ cdef class PolynomialBaseringInjection(Morphism): self._repr_type_str = "Polynomial base injection" self._new_constant_poly_ = self._an_element._new_constant_poly - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ EXAMPLES:: @@ -13026,7 +13026,7 @@ cdef class PolynomialBaseringInjection(Morphism): _new_constant_poly_=self._new_constant_poly_) return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ EXAMPLES:: @@ -13042,7 +13042,7 @@ cdef class PolynomialBaseringInjection(Morphism): self._an_element = _slots['_an_element'] self._new_constant_poly_ = _slots['_new_constant_poly_'] - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ TESTS:: @@ -13058,7 +13058,7 @@ cdef class PolynomialBaseringInjection(Morphism): """ return self._new_constant_poly_(x, self._codomain) - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ TESTS:: diff --git a/src/sage/rings/polynomial/polynomial_gf2x.pyx b/src/sage/rings/polynomial/polynomial_gf2x.pyx index 2839b266b4a..c3bafe951ca 100644 --- a/src/sage/rings/polynomial/polynomial_gf2x.pyx +++ b/src/sage/rings/polynomial/polynomial_gf2x.pyx @@ -70,7 +70,7 @@ cdef class Polynomial_GF2X(Polynomial_template): pass Polynomial_template.__init__(self, parent, x, check, is_gen, construct) - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): """ Return the `i`-th coefficient of ``self``. diff --git a/src/sage/rings/polynomial/polynomial_integer_dense_flint.pxd b/src/sage/rings/polynomial/polynomial_integer_dense_flint.pxd index b88c2a66a76..b1b593d6a26 100644 --- a/src/sage/rings/polynomial/polynomial_integer_dense_flint.pxd +++ b/src/sage/rings/polynomial/polynomial_integer_dense_flint.pxd @@ -7,6 +7,6 @@ from sage.structure.parent cimport Parent cdef class Polynomial_integer_dense_flint(Polynomial): cdef fmpz_poly_t _poly - cdef Polynomial_integer_dense_flint _new(self) noexcept - cpdef _unsafe_mutate(self, long n, value) noexcept - cpdef Integer content(self) noexcept + cdef Polynomial_integer_dense_flint _new(self) + cpdef _unsafe_mutate(self, long n, value) + cpdef Integer content(self) diff --git a/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx b/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx index e8c014972f6..3f38f23ffdc 100644 --- a/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_integer_dense_flint.pyx @@ -109,7 +109,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): """ fmpz_poly_clear(self._poly) - cdef Polynomial_integer_dense_flint _new(self) noexcept: + cdef Polynomial_integer_dense_flint _new(self): r""" Quickly creates a new initialized Polynomial_integer_dense_flint with the correct parent and _is_gen == 0. @@ -119,7 +119,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): x._is_gen = 0 return x - cpdef Polynomial _new_constant_poly(self, a, Parent P) noexcept: + cpdef Polynomial _new_constant_poly(self, a, Parent P): r""" Quickly creates a new constant polynomial with value a in parent P @@ -474,7 +474,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): return Polynomial.__call__(self, *x, **kwds) - cpdef Integer content(self) noexcept: + cpdef Integer content(self): r""" Return the greatest common divisor of the coefficients of this polynomial. The sign is the sign of the leading coefficient. The @@ -537,7 +537,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): return Polynomial_integer_dense_flint, \ (self.parent(), self.list(), False, self.is_gen()) - cdef get_unsafe(self, Py_ssize_t n) noexcept: + cdef get_unsafe(self, Py_ssize_t n): """ Return the `n`-th coefficient of ``self``. @@ -636,7 +636,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): name = self.parent().latex_variable_names()[0] return self._repr(name=name, latex=True) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): r""" Return ``self`` plus ``right``. @@ -656,7 +656,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): return x - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): r""" Return ``self`` minus ``right``. @@ -676,7 +676,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): return x - cpdef _neg_(self) noexcept: + cpdef _neg_(self): r""" Return negative of ``self``. @@ -959,7 +959,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): return self._parent(rr), ss, tt - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): r""" Return ``self`` multiplied by ``right``. @@ -976,7 +976,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): sig_off() return x - cpdef Polynomial _mul_trunc_(self, Polynomial right, long n) noexcept: + cpdef Polynomial _mul_trunc_(self, Polynomial right, long n): r""" Truncated multiplication @@ -1007,7 +1007,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): sig_off() return x - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): r""" Return ``self`` multiplied by ``right``, where ``right`` is a scalar (integer). @@ -1025,7 +1025,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): sig_off() return x - cpdef _rmul_(self, Element right) noexcept: + cpdef _rmul_(self, Element right): r""" Return ``self`` multiplied by ``right``, where right is a scalar (integer). @@ -1165,7 +1165,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): sig_off() return res - cpdef Polynomial _power_trunc(self, unsigned long n, long prec) noexcept: + cpdef Polynomial _power_trunc(self, unsigned long n, long prec): r""" Truncated power @@ -1253,7 +1253,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): sig_off() return res - cpdef Polynomial inverse_series_trunc(self, long prec) noexcept: + cpdef Polynomial inverse_series_trunc(self, long prec): r""" Return a polynomial approximation of precision ``prec`` of the inverse series of this polynomial. @@ -1308,7 +1308,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): sig_off() return res - cpdef _unsafe_mutate(self, long n, value) noexcept: + cpdef _unsafe_mutate(self, long n, value): r""" Sets coefficient of `x^n` to value. @@ -1731,7 +1731,7 @@ cdef class Polynomial_integer_dense_flint(Polynomial): from sage.rings.polynomial.padics.polynomial_padic import _pari_padic_factorization_to_sage return _pari_padic_factorization_to_sage(G, R, self.leading_coefficient()) - cpdef list list(self, bint copy=True) noexcept: + cpdef list list(self, bint copy=True): """ Return a new copy of the list of the underlying elements of ``self``. diff --git a/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pxd b/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pxd index 982fafb8ebb..fcd907e1abe 100644 --- a/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pxd +++ b/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pxd @@ -4,4 +4,4 @@ from sage.rings.polynomial.polynomial_element cimport Polynomial cdef class Polynomial_integer_dense_ntl(Polynomial): cdef ZZX_c _poly - cdef Polynomial_integer_dense_ntl _new(self) noexcept + cdef Polynomial_integer_dense_ntl _new(self) diff --git a/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pyx b/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pyx index 6f7ffa3b5cc..6a0747d40e9 100644 --- a/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pyx +++ b/src/sage/rings/polynomial/polynomial_integer_dense_ntl.pyx @@ -73,7 +73,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): r""" A dense polynomial over the integers, implemented via NTL. """ - cdef Polynomial_integer_dense_ntl _new(self) noexcept: + cdef Polynomial_integer_dense_ntl _new(self): r""" Quickly creates a new initialized Polynomial_integer_dense_ntl with the correct parent and _is_gen == 0. @@ -338,7 +338,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): return Polynomial_integer_dense_ntl, \ (self.parent(), self.list(), False, self.is_gen()) - cdef get_unsafe(self, Py_ssize_t n) noexcept: + cdef get_unsafe(self, Py_ssize_t n): """ Return the `n`-th coefficient of ``self``. @@ -428,7 +428,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): name = self.parent().latex_variable_names()[0] return self._repr(name, latex=True) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): r""" Returns self plus right. @@ -446,7 +446,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): return x - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): r""" Return self minus right. @@ -464,7 +464,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): return x - cpdef _neg_(self) noexcept: + cpdef _neg_(self): r""" Returns negative of ``self``. @@ -680,7 +680,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): return S(rr), ss, tt - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): r""" Returns self multiplied by right. @@ -695,7 +695,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): (right)._poly) return x - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): r""" Returns self multiplied by right, where right is a scalar (integer). @@ -714,7 +714,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): ZZX_mul_ZZ(x._poly, self._poly, _right) return x - cpdef _rmul_(self, Element right) noexcept: + cpdef _rmul_(self, Element right): r""" Returns self multiplied by right, where right is a scalar (integer). @@ -1088,7 +1088,7 @@ cdef class Polynomial_integer_dense_ntl(Polynomial): from sage.rings.polynomial.padics.polynomial_padic import _pari_padic_factorization_to_sage return _pari_padic_factorization_to_sage(G, R, self.leading_coefficient()) - cpdef list list(self, bint copy=True) noexcept: + cpdef list list(self, bint copy=True): """ Return a new copy of the list of the underlying elements of ``self``. diff --git a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pxd b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pxd index f476dc782ce..6934acfee8d 100644 --- a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pxd +++ b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pxd @@ -22,14 +22,14 @@ cdef class Polynomial_dense_mod_n(Polynomial): cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): cdef zz_pX_c x cdef ntl_zz_pContext_class c - cdef Polynomial_dense_modn_ntl_zz _new(self) noexcept - cpdef _mod_(self, right) noexcept + cdef Polynomial_dense_modn_ntl_zz _new(self) + cpdef _mod_(self, right) cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): cdef ZZ_pX_c x cdef ntl_ZZ_pContext_class c - cdef Polynomial_dense_modn_ntl_ZZ _new(self) noexcept - cpdef _mod_(self, right) noexcept + cdef Polynomial_dense_modn_ntl_ZZ _new(self) + cpdef _mod_(self, right) cdef class Polynomial_dense_mod_p(Polynomial_dense_mod_n): pass diff --git a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx index c9d9ca24868..31dc850e982 100644 --- a/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx +++ b/src/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx @@ -188,7 +188,7 @@ cdef class Polynomial_dense_mod_n(Polynomial): """ return self._poly - cdef get_unsafe(self, Py_ssize_t n) noexcept: + cdef get_unsafe(self, Py_ssize_t n): """ Return the `n`-th coefficient of ``self``. @@ -220,10 +220,10 @@ cdef class Polynomial_dense_mod_n(Polynomial): return (~self)**(-n) return self.parent()(self._poly**n, construct=True) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): return self.parent()(self._poly + (right)._poly, construct=True) - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ EXAMPLES:: @@ -233,7 +233,7 @@ cdef class Polynomial_dense_mod_n(Polynomial): """ return self.parent()(self._poly * (right)._poly, construct=True) - cpdef _lmul_(self, Element c) noexcept: + cpdef _lmul_(self, Element c): try: return self.parent()(ZZ_pX([c], self.parent().modulus()) * self._poly, construct=True) except RuntimeError as msg: # should this really be a TypeError @@ -284,7 +284,7 @@ cdef class Polynomial_dense_mod_n(Polynomial): return self.parent()(self._poly.left_shift(n), construct=True) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): return self.parent()(self._poly - (right)._poly, construct=True) def __floordiv__(self, right): @@ -316,7 +316,7 @@ cdef class Polynomial_dense_mod_n(Polynomial): """ return smallInteger(max(self._poly.degree(), -1)) - cpdef list list(self, bint copy=True) noexcept: + cpdef list list(self, bint copy=True): """ Return a new copy of the list of the underlying elements of ``self``. @@ -674,7 +674,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): self.x = ntl.x self.c = ntl.c - cdef Polynomial_dense_modn_ntl_zz _new(self) noexcept: + cdef Polynomial_dense_modn_ntl_zz _new(self): cdef Polynomial_dense_modn_ntl_zz y = Polynomial_dense_modn_ntl_zz.__new__(Polynomial_dense_modn_ntl_zz) y.c = self.c y._parent = self._parent @@ -698,7 +698,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): cdef long i return [ zz_p_rep(zz_pX_GetCoeff(self.x, i)) for i from 0 <= i <= zz_pX_deg(self.x) ] - cdef get_unsafe(self, Py_ssize_t n) noexcept: + cdef get_unsafe(self, Py_ssize_t n): """ Return the `n`-th coefficient of ``self``. @@ -720,7 +720,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): self.c.restore_c() zz_pX_SetCoeff_long(self.x, n, value) - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): """ TESTS:: @@ -737,7 +737,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): """ TESTS:: @@ -754,7 +754,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef _mul_(self, _right) noexcept: + cpdef _mul_(self, _right): """ TESTS:: @@ -774,7 +774,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef Polynomial _mul_trunc_(self, Polynomial right, long n) noexcept: + cpdef Polynomial _mul_trunc_(self, Polynomial right, long n): r""" Return the product of ``self`` and ``right`` truncated to the given length `n` @@ -812,7 +812,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef _rmul_(self, Element c) noexcept: + cpdef _rmul_(self, Element c): """ TESTS:: @@ -828,7 +828,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef _lmul_(self, Element c) noexcept: + cpdef _lmul_(self, Element c): """ TESTS:: @@ -945,7 +945,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): sig_off() return q, r - cpdef _floordiv_(self, right) noexcept: + cpdef _floordiv_(self, right): """ Return the whole part of ``self``/``right``, without remainder. @@ -969,7 +969,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): sig_off() return q - cpdef _mod_(self, right) noexcept: + cpdef _mod_(self, right): """ EXAMPLES:: @@ -1176,7 +1176,7 @@ cdef class Polynomial_dense_modn_ntl_zz(Polynomial_dense_mod_n): """ return zz_pX_deg(self.x) - cpdef Polynomial truncate(self, long n) noexcept: + cpdef Polynomial truncate(self, long n): """ Return this polynomial mod `x^n`. @@ -1257,17 +1257,17 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): if self.c is not None: self.c.restore_c() - cdef Polynomial_dense_modn_ntl_ZZ _new(self) noexcept: + cdef Polynomial_dense_modn_ntl_ZZ _new(self): cdef Polynomial_dense_modn_ntl_ZZ y = Polynomial_dense_modn_ntl_ZZ.__new__(Polynomial_dense_modn_ntl_ZZ) y.c = self.c y._parent = self._parent return y - cpdef list list(self, bint copy=True) noexcept: + cpdef list list(self, bint copy=True): return [self.get_unsafe(n) for n from 0 <= n <= self.degree()] - cdef get_unsafe(self, Py_ssize_t n) noexcept: + cdef get_unsafe(self, Py_ssize_t n): """ Return the `n`-th coefficient of ``self``. @@ -1299,7 +1299,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): cdef ntl_ZZ_p val = ntl_ZZ_p(a, self.c) ZZ_pX_SetCoeff(self.x, n, val.x) - cpdef _add_(self, _right) noexcept: + cpdef _add_(self, _right): """ TESTS:: @@ -1316,7 +1316,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef _sub_(self, _right) noexcept: + cpdef _sub_(self, _right): """ TESTS:: @@ -1333,7 +1333,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef _mul_(self, _right) noexcept: + cpdef _mul_(self, _right): """ TESTS:: @@ -1353,7 +1353,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef Polynomial _mul_trunc_(self, Polynomial right, long n) noexcept: + cpdef Polynomial _mul_trunc_(self, Polynomial right, long n): """ Return the product of ``self`` and ``right`` truncated to the given length `n`, only return terms of degree less than `n`. @@ -1391,7 +1391,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef _rmul_(self, Element c) noexcept: + cpdef _rmul_(self, Element c): """ TESTS:: @@ -1408,7 +1408,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): if do_sig: sig_off() return r - cpdef _lmul_(self, Element c) noexcept: + cpdef _lmul_(self, Element c): """ TESTS:: @@ -1502,7 +1502,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): sig_off() return q, r - cpdef _floordiv_(self, right) noexcept: + cpdef _floordiv_(self, right): """ Return the whole part of ``self`` / ``right``, without remainder. @@ -1526,7 +1526,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): sig_off() return q - cpdef _mod_(self, right) noexcept: + cpdef _mod_(self, right): """ EXAMPLES:: @@ -1737,7 +1737,7 @@ cdef class Polynomial_dense_modn_ntl_ZZ(Polynomial_dense_mod_n): """ return ZZ_pX_deg(self.x) - cpdef Polynomial truncate(self, long n) noexcept: + cpdef Polynomial truncate(self, long n): """ Return this polynomial mod `x^n`. diff --git a/src/sage/rings/polynomial/polynomial_rational_flint.pxd b/src/sage/rings/polynomial/polynomial_rational_flint.pxd index dacca987830..f4644f19d04 100644 --- a/src/sage/rings/polynomial/polynomial_rational_flint.pxd +++ b/src/sage/rings/polynomial/polynomial_rational_flint.pxd @@ -13,8 +13,8 @@ from sage.rings.polynomial.polynomial_element cimport Polynomial cdef class Polynomial_rational_flint(Polynomial): cdef fmpq_poly_t _poly - cdef Polynomial_rational_flint _new(self) noexcept - cpdef _mod_(self, right) noexcept - cpdef _unsafe_mutate(self, unsigned long n, value) noexcept - cpdef Polynomial truncate(self, long n) noexcept + cdef Polynomial_rational_flint _new(self) + cpdef _mod_(self, right) + cpdef _unsafe_mutate(self, unsigned long n, value) + cpdef Polynomial truncate(self, long n) diff --git a/src/sage/rings/polynomial/polynomial_rational_flint.pyx b/src/sage/rings/polynomial/polynomial_rational_flint.pyx index 0382239cf48..c67ddf1a4c5 100644 --- a/src/sage/rings/polynomial/polynomial_rational_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_rational_flint.pyx @@ -109,7 +109,7 @@ cdef class Polynomial_rational_flint(Polynomial): # Allocation & initialisation # ########################################################################### - cdef Polynomial_rational_flint _new(self) noexcept: + cdef Polynomial_rational_flint _new(self): """ Quickly creates a new polynomial object in this class. @@ -130,7 +130,7 @@ cdef class Polynomial_rational_flint(Polynomial): res._is_gen = 0 return res - cpdef Polynomial _new_constant_poly(self, x, Parent P) noexcept: + cpdef Polynomial _new_constant_poly(self, x, Parent P): r""" Quickly creates a new constant polynomial with value x in parent P @@ -348,7 +348,7 @@ cdef class Polynomial_rational_flint(Polynomial): self._parent._singular_(singular).set_ring() # Expensive! return singular(self._singular_init_()) - cpdef list list(self, bint copy=True) noexcept: + cpdef list list(self, bint copy=True): """ Return a list with the coefficients of ``self``. @@ -392,7 +392,7 @@ cdef class Polynomial_rational_flint(Polynomial): """ return smallInteger(fmpq_poly_degree(self._poly)) - cdef get_unsafe(self, Py_ssize_t n) noexcept: + cdef get_unsafe(self, Py_ssize_t n): """ Return the `n`-th coefficient of ``self``. @@ -414,7 +414,7 @@ cdef class Polynomial_rational_flint(Polynomial): fmpq_poly_get_coeff_mpq(z.value, self._poly, n) return z - cpdef _unsafe_mutate(self, unsigned long n, value) noexcept: + cpdef _unsafe_mutate(self, unsigned long n, value): """ Sets the `n`-th coefficient of ``self`` to value. @@ -561,7 +561,7 @@ cdef class Polynomial_rational_flint(Polynomial): return Polynomial.__call__(self, *x, **kwds) - cpdef Polynomial truncate(self, long n) noexcept: + cpdef Polynomial truncate(self, long n): """ Return self truncated modulo `t^n`. @@ -848,7 +848,7 @@ cdef class Polynomial_rational_flint(Polynomial): # Arithmetic # ########################################################################### - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Return the sum of two rational polynomials. @@ -876,7 +876,7 @@ cdef class Polynomial_rational_flint(Polynomial): if do_sig: sig_off() return res - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Return the difference of two rational polynomials. @@ -904,7 +904,7 @@ cdef class Polynomial_rational_flint(Polynomial): if do_sig: sig_off() return res - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Return the difference of two rational polynomials. @@ -1058,7 +1058,7 @@ cdef class Polynomial_rational_flint(Polynomial): sig_off() return d, s, t - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Return the product of ``self`` and ``right``. @@ -1087,7 +1087,7 @@ cdef class Polynomial_rational_flint(Polynomial): if do_sig: sig_off() return res - cpdef Polynomial _mul_trunc_(self, Polynomial right, long n) noexcept: + cpdef Polynomial _mul_trunc_(self, Polynomial right, long n): r""" Truncated multiplication. @@ -1124,7 +1124,7 @@ cdef class Polynomial_rational_flint(Polynomial): if do_sig: sig_off() return res - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): r""" Return ``left * self``, where ``left`` is a rational number. @@ -1144,7 +1144,7 @@ cdef class Polynomial_rational_flint(Polynomial): if do_sig: sig_off() return res - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): r""" Return ``self * right``, where ``right`` is a rational number. @@ -1358,7 +1358,7 @@ cdef class Polynomial_rational_flint(Polynomial): sig_off() return res - cpdef Polynomial inverse_series_trunc(self, long prec) noexcept: + cpdef Polynomial inverse_series_trunc(self, long prec): r""" Return a polynomial approximation of precision ``prec`` of the inverse series of this polynomial. @@ -1406,7 +1406,7 @@ cdef class Polynomial_rational_flint(Polynomial): sig_off() return res - cpdef _mod_(self, right) noexcept: + cpdef _mod_(self, right): """ Return the remainder of ``self`` and ``right`` obtain by Euclidean division. diff --git a/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx b/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx index 00608f73403..9aae84a3143 100644 --- a/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx +++ b/src/sage/rings/polynomial/polynomial_real_mpfr_dense.pyx @@ -184,7 +184,7 @@ cdef class PolynomialRealDense(Polynomial): """ return make_PolynomialRealDense, (self._parent, self.list()) - cdef _normalize(self) noexcept: + cdef _normalize(self): """ Remove all leading 0's. """ @@ -197,7 +197,7 @@ cdef class PolynomialRealDense(Polynomial): self._coeffs = check_reallocarray(self._coeffs, i+1, sizeof(mpfr_t)) self._degree = i - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): """ Return the `i`-th coefficient of ``self``. @@ -225,7 +225,7 @@ cdef class PolynomialRealDense(Polynomial): mpfr_set(r.value, self._coeffs[i], self._base_ring.rnd) return r - cdef PolynomialRealDense _new(self, Py_ssize_t degree) noexcept: + cdef PolynomialRealDense _new(self, Py_ssize_t degree): cdef Py_ssize_t i cdef int prec = self._base_ring._prec cdef PolynomialRealDense f = PolynomialRealDense.__new__(PolynomialRealDense) @@ -257,7 +257,7 @@ cdef class PolynomialRealDense(Polynomial): """ return smallInteger(self._degree) - cpdef Polynomial truncate(self, long n) noexcept: + cpdef Polynomial truncate(self, long n): r""" Returns the polynomial of degree `< n` which is equivalent to self modulo `x^n`. @@ -310,7 +310,7 @@ cdef class PolynomialRealDense(Polynomial): return self.truncate(i+1) return self._new(-1) - cpdef shift(self, Py_ssize_t n) noexcept: + cpdef shift(self, Py_ssize_t n): r""" Returns this polynomial multiplied by the power `x^n`. If `n` is negative, terms below `x^n` will be discarded. Does not @@ -351,7 +351,7 @@ cdef class PolynomialRealDense(Polynomial): mpfr_set(f._coeffs[i], self._coeffs[i-n], self._base_ring.rnd) return f - cpdef list list(self, bint copy=True) noexcept: + cpdef list list(self, bint copy=True): """ EXAMPLES:: @@ -386,7 +386,7 @@ cdef class PolynomialRealDense(Polynomial): mpfr_neg(f._coeffs[i], self._coeffs[i], rnd) return f - cpdef _add_(left, _right) noexcept: + cpdef _add_(left, _right): """ EXAMPLES:: @@ -419,7 +419,7 @@ cdef class PolynomialRealDense(Polynomial): f._normalize() return f - cpdef _sub_(left, _right) noexcept: + cpdef _sub_(left, _right): """ EXAMPLES:: @@ -450,7 +450,7 @@ cdef class PolynomialRealDense(Polynomial): f._normalize() return f - cpdef _lmul_(self, Element c) noexcept: + cpdef _lmul_(self, Element c): """ EXAMPLES:: @@ -472,7 +472,7 @@ cdef class PolynomialRealDense(Polynomial): mpfr_mul(f._coeffs[i], self._coeffs[i], a.value, rnd) return f - cpdef _mul_(left, _right) noexcept: + cpdef _mul_(left, _right): """ Here we use the naive `O(n^2)` algorithm, as asymptotically faster algorithms such as Karatsuba can have very inaccurate results due to intermediate rounding errors. diff --git a/src/sage/rings/polynomial/polynomial_ring_homomorphism.pyx b/src/sage/rings/polynomial/polynomial_ring_homomorphism.pyx index 3be25f829c4..7e3e27dd520 100644 --- a/src/sage/rings/polynomial/polynomial_ring_homomorphism.pyx +++ b/src/sage/rings/polynomial/polynomial_ring_homomorphism.pyx @@ -36,7 +36,7 @@ cdef class PolynomialRingHomomorphism_from_base(RingHomomorphism_from_base): To: Rational Field """ - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Evaluate the homomorphism ``self`` at ``x``. @@ -65,7 +65,7 @@ cdef class PolynomialRingHomomorphism_from_base(RingHomomorphism_from_base): else: return P([f(b) for b in x]) - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ Evaluate ``self`` at ``x`` with additional (keyword) arguments. diff --git a/src/sage/rings/polynomial/polynomial_template.pxi b/src/sage/rings/polynomial/polynomial_template.pxi index 02c494c73ad..6d9621eac67 100644 --- a/src/sage/rings/polynomial/polynomial_template.pxi +++ b/src/sage/rings/polynomial/polynomial_template.pxi @@ -29,7 +29,7 @@ from sage.interfaces.singular import singular as singular_default def make_element(parent, args): return parent(*args) -cdef inline Polynomial_template element_shift(self, int n) noexcept: +cdef inline Polynomial_template element_shift(self, int n): if not isinstance(self, Polynomial_template): if n > 0: error_msg = "Cannot shift %s << %n."%(self, n) @@ -189,7 +189,7 @@ cdef class Polynomial_template(Polynomial): """ return make_element, ((self)._parent, (self.list(), False, self.is_gen())) - cpdef list list(self, bint copy=True) noexcept: + cpdef list list(self, bint copy=True): """ EXAMPLES:: @@ -224,7 +224,7 @@ cdef class Polynomial_template(Polynomial): """ celement_destruct(&self.x, (self)._cparent) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ EXAMPLES:: @@ -242,7 +242,7 @@ cdef class Polynomial_template(Polynomial): #assert(r._parent(pari(self) + pari(right)) == r) return r - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ EXAMPLES:: @@ -276,7 +276,7 @@ cdef class Polynomial_template(Polynomial): #assert(r._parent(-pari(self)) == r) return r - cpdef _lmul_(self, Element left) noexcept: + cpdef _lmul_(self, Element left): """ EXAMPLES:: @@ -322,7 +322,7 @@ cdef class Polynomial_template(Polynomial): celement_mul_scalar(&r.x, &(self).x, left, (self)._cparent) return r - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ EXAMPLES:: @@ -433,7 +433,7 @@ cdef class Polynomial_template(Polynomial): #assert(t._parent(tp) == t) return r,s,t - cpdef _floordiv_(self, right) noexcept: + cpdef _floordiv_(self, right): """ EXAMPLES:: @@ -468,7 +468,7 @@ cdef class Polynomial_template(Polynomial): celement_floordiv(&r.x, &(self).x, &(right).x, (self)._cparent) return r - cpdef _mod_(self, other) noexcept: + cpdef _mod_(self, other): """ EXAMPLES:: @@ -537,7 +537,7 @@ cdef class Polynomial_template(Polynomial): """ return not celement_is_zero(&self.x, (self)._cparent) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ EXAMPLES:: @@ -780,7 +780,7 @@ cdef class Polynomial_template(Polynomial): """ return Integer(celement_len(&self.x, (self)._cparent)-1) - cpdef Polynomial truncate(self, long n) noexcept: + cpdef Polynomial truncate(self, long n): r""" Returns this polynomial mod `x^n`. diff --git a/src/sage/rings/polynomial/polynomial_template_header.pxi b/src/sage/rings/polynomial/polynomial_template_header.pxi index ba7184f6643..64ab106f314 100644 --- a/src/sage/rings/polynomial/polynomial_template_header.pxi +++ b/src/sage/rings/polynomial/polynomial_template_header.pxi @@ -7,4 +7,4 @@ from sage.rings.polynomial.polynomial_element cimport Polynomial cdef class Polynomial_template(Polynomial): cdef celement x cdef cparent _cparent - cpdef _mod_(self, right) noexcept + cpdef _mod_(self, right) diff --git a/src/sage/rings/polynomial/polynomial_zmod_flint.pxd b/src/sage/rings/polynomial/polynomial_zmod_flint.pxd index 887f46ea6eb..c6a92f3df6c 100644 --- a/src/sage/rings/polynomial/polynomial_zmod_flint.pxd +++ b/src/sage/rings/polynomial/polynomial_zmod_flint.pxd @@ -10,8 +10,8 @@ include "polynomial_template_header.pxi" cdef cparent get_cparent(parent) except? 0 cdef class Polynomial_zmod_flint(Polynomial_template): - cdef Polynomial_template _new(self) noexcept + cdef Polynomial_template _new(self) cdef int _set_list(self, x) except -1 cdef int _set_fmpz_poly(self, fmpz_poly_t) except -1 - cpdef Polynomial _mul_trunc_opposite(self, Polynomial_zmod_flint other, length) noexcept - cpdef rational_reconstruction(self, m, n_deg=?, d_deg=?) noexcept + cpdef Polynomial _mul_trunc_opposite(self, Polynomial_zmod_flint other, length) + cpdef rational_reconstruction(self, m, n_deg=?, d_deg=?) diff --git a/src/sage/rings/polynomial/polynomial_zmod_flint.pyx b/src/sage/rings/polynomial/polynomial_zmod_flint.pyx index 352d7c7e36f..d08395dc8e8 100644 --- a/src/sage/rings/polynomial/polynomial_zmod_flint.pyx +++ b/src/sage/rings/polynomial/polynomial_zmod_flint.pyx @@ -122,7 +122,7 @@ cdef class Polynomial_zmod_flint(Polynomial_template): pass Polynomial_template.__init__(self, parent, x, check, is_gen, construct) - cdef Polynomial_template _new(self) noexcept: + cdef Polynomial_template _new(self): """ EXAMPLES:: @@ -137,7 +137,7 @@ cdef class Polynomial_zmod_flint(Polynomial_template): e._cparent = self._cparent return e - cpdef Polynomial _new_constant_poly(self, x, Parent P) noexcept: + cpdef Polynomial _new_constant_poly(self, x, Parent P): r""" Quickly creates a new constant polynomial with value x in parent P. @@ -244,7 +244,7 @@ cdef class Polynomial_zmod_flint(Polynomial_template): sig_off() return 0 - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): """ Return the `i`-th coefficient of ``self``. @@ -412,7 +412,7 @@ cdef class Polynomial_zmod_flint(Polynomial_template): else: raise IndexError("Polynomial coefficient index must be nonnegative.") - cpdef Polynomial _mul_trunc_(self, Polynomial right, long n) noexcept: + cpdef Polynomial _mul_trunc_(self, Polynomial right, long n): """ Return the product of this polynomial and other truncated to the given length `n`. @@ -445,7 +445,7 @@ cdef class Polynomial_zmod_flint(Polynomial_template): _mul_short = _mul_trunc_ - cpdef Polynomial _mul_trunc_opposite(self, Polynomial_zmod_flint other, n) noexcept: + cpdef Polynomial _mul_trunc_opposite(self, Polynomial_zmod_flint other, n): """ Return the product of this polynomial and other ignoring the least significant `n` terms of the result which may be set to anything. @@ -482,7 +482,7 @@ cdef class Polynomial_zmod_flint(Polynomial_template): _mul_short_opposite = _mul_trunc_opposite - cpdef Polynomial _power_trunc(self, unsigned long n, long prec) noexcept: + cpdef Polynomial _power_trunc(self, unsigned long n, long prec): r""" TESTS:: @@ -519,7 +519,7 @@ cdef class Polynomial_zmod_flint(Polynomial_template): nmod_poly_pow_trunc(&ans.x, &self.x, n, prec) return ans - cpdef rational_reconstruction(self, m, n_deg=0, d_deg=0) noexcept: + cpdef rational_reconstruction(self, m, n_deg=0, d_deg=0): """ Construct a rational function `n/d` such that `p*d` is equivalent to `n` modulo `m` where `p` is this polynomial. diff --git a/src/sage/rings/polynomial/polynomial_zz_pex.pyx b/src/sage/rings/polynomial/polynomial_zz_pex.pyx index 9a0384c643b..b8c9d0bcbd8 100644 --- a/src/sage/rings/polynomial/polynomial_zz_pex.pyx +++ b/src/sage/rings/polynomial/polynomial_zz_pex.pyx @@ -44,7 +44,7 @@ include "polynomial_template.pxi" from sage.libs.ntl.ntl_ZZ_pE cimport ntl_ZZ_pE -cdef inline ZZ_pE_c_to_list(ZZ_pE_c x) noexcept: +cdef inline ZZ_pE_c_to_list(ZZ_pE_c x): cdef list L = [] cdef ZZ_pX_c c_pX cdef ZZ_p_c c_p @@ -152,7 +152,7 @@ cdef class Polynomial_ZZ_pEX(Polynomial_template): Polynomial_template.__init__(self, parent, x, check, is_gen, construct) - cdef get_unsafe(self, Py_ssize_t i) noexcept: + cdef get_unsafe(self, Py_ssize_t i): r""" Return the `i`-th coefficient of ``self``. @@ -176,7 +176,7 @@ cdef class Polynomial_ZZ_pEX(Polynomial_template): cdef ZZ_pE_c c_pE = ZZ_pEX_coeff(self.x, i) return self._parent._base(ZZ_pE_c_to_list(c_pE)) - cpdef list list(self, bint copy=True) noexcept: + cpdef list list(self, bint copy=True): r""" Return the list of coefficients. @@ -198,7 +198,7 @@ cdef class Polynomial_ZZ_pEX(Polynomial_template): return [K(ZZ_pE_c_to_list(ZZ_pEX_coeff(self.x, i))) for i in range(celement_len(&self.x, (self)._cparent))] - cpdef _lmul_(self, Element left) noexcept: + cpdef _lmul_(self, Element left): r""" EXAMPLES:: @@ -410,7 +410,7 @@ cdef class Polynomial_ZZ_pEX(Polynomial_template): ZZ_pEX_MinPolyMod(r.x, ((self % other)).x, (other).x) return r - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): r""" EXAMPLES:: diff --git a/src/sage/rings/polynomial/skew_polynomial_element.pxd b/src/sage/rings/polynomial/skew_polynomial_element.pxd index d967e898909..1eb38b5b474 100644 --- a/src/sage/rings/polynomial/skew_polynomial_element.pxd +++ b/src/sage/rings/polynomial/skew_polynomial_element.pxd @@ -3,6 +3,6 @@ from sage.rings.polynomial.ore_polynomial_element cimport OrePolynomial_generic_ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense): cdef void _inplace_rmul(self, SkewPolynomial_generic_dense right) noexcept cdef void _inplace_pow(self, Py_ssize_t n) noexcept - cpdef right_power_mod(self, exp, modulus) noexcept - cpdef left_power_mod(self, exp, modulus) noexcept - cpdef operator_eval(self, eval_pt) noexcept + cpdef right_power_mod(self, exp, modulus) + cpdef left_power_mod(self, exp, modulus) + cpdef operator_eval(self, eval_pt) diff --git a/src/sage/rings/polynomial/skew_polynomial_element.pyx b/src/sage/rings/polynomial/skew_polynomial_element.pyx index b103ac37508..cf5fd9bd090 100644 --- a/src/sage/rings/polynomial/skew_polynomial_element.pyx +++ b/src/sage/rings/polynomial/skew_polynomial_element.pyx @@ -64,7 +64,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense): Generic implementation of dense skew polynomial supporting any valid base ring and twisting morphism. """ - cpdef left_power_mod(self, exp, modulus) noexcept: + cpdef left_power_mod(self, exp, modulus): r""" Return the remainder of ``self**exp`` in the left euclidean division by ``modulus``. @@ -127,7 +127,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense): _, r = r._left_quo_rem(modulus) return r - cpdef right_power_mod(self, exp, modulus) noexcept: + cpdef right_power_mod(self, exp, modulus): r""" Return the remainder of ``self**exp`` in the right euclidean division by ``modulus``. @@ -330,7 +330,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense): """ return self.operator_eval(eval_pt) - cpdef operator_eval(self, eval_pt) noexcept: + cpdef operator_eval(self, eval_pt): r""" Evaluate ``self`` at ``eval_pt`` by the operator evaluation method. @@ -461,7 +461,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense): """ return [ self(e) for e in eval_pts ] - cpdef ModuleElement _lmul_(self, Element right) noexcept: + cpdef ModuleElement _lmul_(self, Element right): r""" Return the product ``self * right``. @@ -490,7 +490,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense): self._parent, 0) return r - cpdef ModuleElement _rmul_(self, Element left) noexcept: + cpdef ModuleElement _rmul_(self, Element left): r""" Return the product ``left * self``. @@ -517,7 +517,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense): r = self._new_c([ left*x[i] for i from 0 <= i < len(x) ], self._parent, 0) return r - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): r""" Return the product ``self * right``. @@ -631,7 +631,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense): self._inplace_rmul(selfpow) n = n >> 1 - cdef _left_quo_rem(self, OrePolynomial other) noexcept: + cdef _left_quo_rem(self, OrePolynomial other): r""" Return the quotient and remainder of the left euclidean division of ``self`` by ``other`` (C implementation). @@ -660,7 +660,7 @@ cdef class SkewPolynomial_generic_dense(OrePolynomial_generic_dense): q.reverse() return (self._new_c(q, parent), self._new_c(a[:db], parent, 1)) - cdef _right_quo_rem(self, OrePolynomial other) noexcept: + cdef _right_quo_rem(self, OrePolynomial other): r""" Return the quotient and remainder of the right euclidean division of ``self`` by ``other`` (C implementation). diff --git a/src/sage/rings/polynomial/skew_polynomial_finite_field.pxd b/src/sage/rings/polynomial/skew_polynomial_finite_field.pxd index 1718554cc3a..f27cfdd6ff1 100644 --- a/src/sage/rings/polynomial/skew_polynomial_finite_field.pxd +++ b/src/sage/rings/polynomial/skew_polynomial_finite_field.pxd @@ -5,14 +5,14 @@ cdef class SkewPolynomial_finite_field_dense (SkewPolynomial_finite_order_dense) cdef dict _types cdef _factorization - cdef inline _reduced_norm_factored(self) noexcept + cdef inline _reduced_norm_factored(self) # Finding divisors - cdef SkewPolynomial_finite_field_dense _rdivisor_c(P, N) noexcept + cdef SkewPolynomial_finite_field_dense _rdivisor_c(P, N) # Finding factorizations - cdef _factor_c(self) noexcept - cdef _factor_uniform_c(self) noexcept + cdef _factor_c(self) + cdef _factor_uniform_c(self) -cdef inline SkewPolynomial_finite_field_dense mul_op(SkewPolynomial_finite_field_dense P, SkewPolynomial_finite_field_dense Q) noexcept: +cdef inline SkewPolynomial_finite_field_dense mul_op(SkewPolynomial_finite_field_dense P, SkewPolynomial_finite_field_dense Q): return Q * P diff --git a/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx b/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx index 1a176288395..b9538d07263 100644 --- a/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx +++ b/src/sage/rings/polynomial/skew_polynomial_finite_field.pyx @@ -44,7 +44,7 @@ from sage.combinat.q_analogues import q_jordan cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): - cdef inline _reduced_norm_factored(self) noexcept: + cdef inline _reduced_norm_factored(self): """ Return the reduced norm of this polynomial factorized in the center. """ @@ -213,7 +213,7 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): # Finding divisors # ---------------- - cdef SkewPolynomial_finite_field_dense _rdivisor_c(self, N) noexcept: + cdef SkewPolynomial_finite_field_dense _rdivisor_c(self, N): r""" Return a right divisor of this skew polynomial whose reduced norm is `N`. @@ -748,7 +748,7 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): # Finding factorizations # ---------------------- - cdef _factor_c(self) noexcept: + cdef _factor_c(self): r""" Compute a factorization of ``self``. @@ -819,7 +819,7 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense): factors.reverse() return Factorization(factors, sort=False, unit=unit) - cdef _factor_uniform_c(self) noexcept: + cdef _factor_uniform_c(self): r""" Compute a uniformly distributed factorization of ``self``. diff --git a/src/sage/rings/polynomial/skew_polynomial_finite_order.pxd b/src/sage/rings/polynomial/skew_polynomial_finite_order.pxd index bfaf8d04d14..438773a39ef 100644 --- a/src/sage/rings/polynomial/skew_polynomial_finite_order.pxd +++ b/src/sage/rings/polynomial/skew_polynomial_finite_order.pxd @@ -5,6 +5,6 @@ cdef class SkewPolynomial_finite_order_dense (SkewPolynomial_generic_dense): cdef _charpoly cdef _optbound - cdef _matphir_c(self) noexcept - cdef _matmul_c(self) noexcept + cdef _matphir_c(self) + cdef _matmul_c(self) diff --git a/src/sage/rings/polynomial/skew_polynomial_finite_order.pyx b/src/sage/rings/polynomial/skew_polynomial_finite_order.pyx index 4ebe50c307b..fcda4420378 100644 --- a/src/sage/rings/polynomial/skew_polynomial_finite_order.pyx +++ b/src/sage/rings/polynomial/skew_polynomial_finite_order.pyx @@ -70,7 +70,7 @@ cdef class SkewPolynomial_finite_order_dense(SkewPolynomial_generic_dense): self._charpoly = None self._optbound = None - cdef _matphir_c(self) noexcept: + cdef _matphir_c(self): r""" Return the matrix of the multiplication by `X^r` on the quotient `K[X,\sigma] / K[X,\sigma]*self`. @@ -121,7 +121,7 @@ cdef class SkewPolynomial_finite_order_dense(SkewPolynomial_generic_dense): phir.append(line) return matrix(k, phir) - cdef _matmul_c(self) noexcept: + cdef _matmul_c(self): r""" Return the matrix of the multiplication by ``self`` on `K[X,\sigma]` considered as a free module over `K[X^r]` diff --git a/src/sage/rings/polynomial/weil/weil_polynomials.pyx b/src/sage/rings/polynomial/weil/weil_polynomials.pyx index d5ebd2906ab..6a73e2748e4 100755 --- a/src/sage/rings/polynomial/weil/weil_polynomials.pyx +++ b/src/sage/rings/polynomial/weil/weil_polynomials.pyx @@ -175,7 +175,7 @@ cdef class dfs_manager: count += self.dy_data_buf[i].node_count return count - cpdef object advance_exhaust(self) noexcept: + cpdef object advance_exhaust(self): """ Advance the tree exhaustion. diff --git a/src/sage/rings/power_series_mpoly.pyx b/src/sage/rings/power_series_mpoly.pyx index 2846d563a97..714d939c30b 100644 --- a/src/sage/rings/power_series_mpoly.pyx +++ b/src/sage/rings/power_series_mpoly.pyx @@ -106,7 +106,7 @@ cdef class PowerSeries_mpoly(PowerSeries): def _mpoly(self): return self.__f - cpdef _mul_(self, right_r) noexcept: + cpdef _mul_(self, right_r): """ Return the product of two power series. """ @@ -130,7 +130,7 @@ cdef class PowerSeries_mpoly(PowerSeries): return PowerSeries_mpoly(self._parent, -self.__f, self._prec, check=False) - cpdef _add_(self, right_m) noexcept: + cpdef _add_(self, right_m): """ EXAMPLES: """ @@ -138,7 +138,7 @@ cdef class PowerSeries_mpoly(PowerSeries): return PowerSeries_mpoly(self._parent, self.__f + right.__f, self.common_prec_c(right), check=True) - cpdef _sub_(self, right_m) noexcept: + cpdef _sub_(self, right_m): """ Return difference of two power series. @@ -148,11 +148,11 @@ cdef class PowerSeries_mpoly(PowerSeries): return PowerSeries_mpoly(self._parent, self.__f - right.__f, self.common_prec_c(right), check=True) - cpdef _rmul_(self, Element c) noexcept: + cpdef _rmul_(self, Element c): return PowerSeries_mpoly(self._parent, self.__f._rmul_(c), self._prec, check=False) - cpdef _lmul_(self, Element c) noexcept: + cpdef _lmul_(self, Element c): return PowerSeries_mpoly(self._parent, self.__f._lmul_(c), self._prec, check=False) diff --git a/src/sage/rings/power_series_pari.pyx b/src/sage/rings/power_series_pari.pyx index 9e6a4d5f317..24792c94123 100644 --- a/src/sage/rings/power_series_pari.pyx +++ b/src/sage/rings/power_series_pari.pyx @@ -81,7 +81,7 @@ from sage.structure.parent cimport Parent from sage.rings.infinity import infinity -cdef PowerSeries_pari construct_from_pari(parent, pari_gen g) noexcept: +cdef PowerSeries_pari construct_from_pari(parent, pari_gen g): r""" Fast construction of power series from PARI objects of suitable type (series, polynomials, scalars and rational functions). @@ -557,7 +557,7 @@ cdef class PowerSeries_pari(PowerSeries): return self._parent.laurent_series_ring()(h) return construct_from_pari(self._parent, h) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Addition of power series. @@ -574,7 +574,7 @@ cdef class PowerSeries_pari(PowerSeries): """ return construct_from_pari(self._parent, self.g + (right).g) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtraction of power series. @@ -588,7 +588,7 @@ cdef class PowerSeries_pari(PowerSeries): """ return construct_from_pari(self._parent, self.g - (right).g) - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiplication of power series. @@ -601,7 +601,7 @@ cdef class PowerSeries_pari(PowerSeries): """ return construct_from_pari(self._parent, self.g * (right).g) - cpdef _rmul_(self, Element c) noexcept: + cpdef _rmul_(self, Element c): """ Right multiplication by a scalar. @@ -615,7 +615,7 @@ cdef class PowerSeries_pari(PowerSeries): """ return construct_from_pari(self._parent, self.g * c) - cpdef _lmul_(self, Element c) noexcept: + cpdef _lmul_(self, Element c): """ Left multiplication by a scalar. @@ -629,7 +629,7 @@ cdef class PowerSeries_pari(PowerSeries): """ return construct_from_pari(self._parent, c * self.g) - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Division of power series. diff --git a/src/sage/rings/power_series_poly.pyx b/src/sage/rings/power_series_poly.pyx index 45e1b105ab1..e1c45ff5d51 100644 --- a/src/sage/rings/power_series_poly.pyx +++ b/src/sage/rings/power_series_poly.pyx @@ -490,7 +490,7 @@ cdef class PowerSeries_poly(PowerSeries): return PowerSeries_poly(self._parent, -self.__f, self._prec, check=False) - cpdef _add_(self, right_m) noexcept: + cpdef _add_(self, right_m): """ EXAMPLES:: @@ -522,7 +522,7 @@ cdef class PowerSeries_poly(PowerSeries): return PowerSeries_poly(self._parent, self.__f + right.__f, self.common_prec_c(right), check=True) - cpdef _sub_(self, right_m) noexcept: + cpdef _sub_(self, right_m): """ Return the difference of two power series. @@ -537,7 +537,7 @@ cdef class PowerSeries_poly(PowerSeries): return PowerSeries_poly(self._parent, self.__f - right.__f, self.common_prec_c(right), check=True) - cpdef _mul_(self, right_r) noexcept: + cpdef _mul_(self, right_r): """ Return the product of two power series. @@ -553,7 +553,7 @@ cdef class PowerSeries_poly(PowerSeries): prec=prec, check=True) # check, since truncation may be needed - cpdef _rmul_(self, Element c) noexcept: + cpdef _rmul_(self, Element c): """ Multiply ``self`` on the right by a scalar. @@ -566,7 +566,7 @@ cdef class PowerSeries_poly(PowerSeries): """ return PowerSeries_poly(self._parent, self.__f * c, self._prec, check=False) - cpdef _lmul_(self, Element c) noexcept: + cpdef _lmul_(self, Element c): """ Multiply ``self`` on the left by a scalar. @@ -750,7 +750,7 @@ cdef class PowerSeries_poly(PowerSeries): else: return self.__f.truncate(prec) - cdef _inplace_truncate(self, long prec) noexcept: + cdef _inplace_truncate(self, long prec): """ Truncate ``self`` to precision ``prec`` in place. @@ -1251,7 +1251,7 @@ cdef class BaseRingFloorDivAction(Action): """ The floor division action of the base ring on a formal power series. """ - cpdef _act_(self, g, x) noexcept: + cpdef _act_(self, g, x): r""" Let ``g`` act on ``x`` under ``self``. diff --git a/src/sage/rings/power_series_ring_element.pxd b/src/sage/rings/power_series_ring_element.pxd index b8c28103131..e5c031ee147 100644 --- a/src/sage/rings/power_series_ring_element.pxd +++ b/src/sage/rings/power_series_ring_element.pxd @@ -3,9 +3,9 @@ from sage.structure.element cimport AlgebraElement, RingElement cdef class PowerSeries(AlgebraElement): cdef char _is_gen cdef _prec - cdef common_prec_c(self, PowerSeries other) noexcept + cdef common_prec_c(self, PowerSeries other) #_prec(self, RingElement right_r) # UNSAFE, only call from an inplace operator # may return a new element if not possible to modify inplace - cdef _inplace_truncate(self, long prec) noexcept + cdef _inplace_truncate(self, long prec) diff --git a/src/sage/rings/power_series_ring_element.pyx b/src/sage/rings/power_series_ring_element.pyx index f66e7b6e904..1505a49a995 100644 --- a/src/sage/rings/power_series_ring_element.pyx +++ b/src/sage/rings/power_series_ring_element.pyx @@ -254,7 +254,7 @@ cdef class PowerSeries(AlgebraElement): else: raise NotImplementedError - cpdef base_extend(self, R) noexcept: + cpdef base_extend(self, R): """ Return a copy of this power series but with coefficients in R. @@ -311,7 +311,7 @@ cdef class PowerSeries(AlgebraElement): S = self._parent.change_ring(R) return S(self) - cpdef _richcmp_(self, right, int op) noexcept: + cpdef _richcmp_(self, right, int op): r""" Comparison of self and ``right``. @@ -813,7 +813,7 @@ cdef class PowerSeries(AlgebraElement): v = [a[i] for i in range(min(prec, len(a)))] return self._parent._poly_ring()(v) - cdef _inplace_truncate(self, long prec) noexcept: + cdef _inplace_truncate(self, long prec): return self.truncate(prec) def add_bigoh(self, prec): @@ -917,7 +917,7 @@ cdef class PowerSeries(AlgebraElement): return self.prec() return min(self.prec(), f.prec()) - cdef common_prec_c(self, PowerSeries f) noexcept: + cdef common_prec_c(self, PowerSeries f): if self._prec is infinity: return f._prec elif f._prec is infinity: @@ -1048,7 +1048,7 @@ cdef class PowerSeries(AlgebraElement): v[k-n] = x return self._parent(v, self.prec()-n) - cpdef _div_(self, denom_r) noexcept: + cpdef _div_(self, denom_r): """ EXAMPLES:: diff --git a/src/sage/rings/puiseux_series_ring_element.pyx b/src/sage/rings/puiseux_series_ring_element.pyx index 33d03269302..21b1cb5b70f 100644 --- a/src/sage/rings/puiseux_series_ring_element.pyx +++ b/src/sage/rings/puiseux_series_ring_element.pyx @@ -356,7 +356,7 @@ cdef class PuiseuxSeries(AlgebraElement): n = g / n return g, m, n - cpdef _add_(self, right_m) noexcept: + cpdef _add_(self, right_m): """ Return the sum. @@ -378,7 +378,7 @@ cdef class PuiseuxSeries(AlgebraElement): l = l1 + l2 return type(self)(self._parent, l, g) - cpdef _sub_(self, right_m) noexcept: + cpdef _sub_(self, right_m): """ Return the difference. @@ -400,7 +400,7 @@ cdef class PuiseuxSeries(AlgebraElement): l = l1 - l2 return type(self)(self._parent, l, g) - cpdef _mul_(self, right_r) noexcept: + cpdef _mul_(self, right_r): """ Return the product. @@ -422,7 +422,7 @@ cdef class PuiseuxSeries(AlgebraElement): l = l1 * l2 return type(self)(self._parent, l, g) - cpdef _rmul_(self, Element c) noexcept: + cpdef _rmul_(self, Element c): """ Return the right scalar multiplication. @@ -435,7 +435,7 @@ cdef class PuiseuxSeries(AlgebraElement): """ return type(self)(self._parent, self._l._rmul_(c), self._e) - cpdef _lmul_(self, Element c) noexcept: + cpdef _lmul_(self, Element c): """ Return the left scalar multiplication. @@ -448,7 +448,7 @@ cdef class PuiseuxSeries(AlgebraElement): """ return type(self)(self._parent, self._l._lmul_(c), self._e) - cpdef _div_(self, right_r) noexcept: + cpdef _div_(self, right_r): """ Return the quotient. @@ -510,7 +510,7 @@ cdef class PuiseuxSeries(AlgebraElement): e = self._e * int(denom) return type(self)(self._parent, l, e) - cpdef _richcmp_(self, right_r, int op) noexcept: + cpdef _richcmp_(self, right_r, int op): r""" Comparison of ``self`` and ``right``. diff --git a/src/sage/rings/rational.pxd b/src/sage/rings/rational.pxd index f80ec22e9a9..f42f86515d3 100644 --- a/src/sage/rings/rational.pxd +++ b/src/sage/rings/rational.pxd @@ -3,17 +3,17 @@ from sage.libs.gmp.types cimport mpq_t cimport sage.structure.element cimport sage.rings.integer as integer -cpdef rational_power_parts(a, Rational b, factor_limit=?) noexcept +cpdef rational_power_parts(a, Rational b, factor_limit=?) cdef class Rational(sage.structure.element.FieldElement): cdef mpq_t value - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cpdef _pow_(self, other) noexcept - cdef __set_value(self, x, unsigned int base) noexcept + cpdef _add_(self, other) + cpdef _mul_(self, other) + cpdef _pow_(self, other) + cdef __set_value(self, x, unsigned int base) cdef void set_from_mpq(Rational self, mpq_t value) noexcept - cdef _lshift(self, long int exp) noexcept - cdef _rshift(self, long int exp) noexcept + cdef _lshift(self, long int exp) + cdef _rshift(self, long int exp) - cdef _val_unit(self, integer.Integer p) noexcept + cdef _val_unit(self, integer.Integer p) diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx index f7fd991b817..92fa6fd8fc3 100644 --- a/src/sage/rings/rational.pyx +++ b/src/sage/rings/rational.pyx @@ -143,7 +143,7 @@ cdef inline void set_from_Rational(Rational self, Rational other) noexcept: cdef inline void set_from_Integer(Rational self, integer.Integer other) noexcept: mpq_set_z(self.value, other.value) -cdef object Rational_mul_(Rational a, Rational b) noexcept: +cdef object Rational_mul_(Rational a, Rational b): cdef Rational x x = Rational.__new__(Rational) @@ -153,7 +153,7 @@ cdef object Rational_mul_(Rational a, Rational b) noexcept: return x -cdef object Rational_div_(Rational a, Rational b) noexcept: +cdef object Rational_div_(Rational a, Rational b): cdef Rational x x = Rational.__new__(Rational) @@ -163,7 +163,7 @@ cdef object Rational_div_(Rational a, Rational b) noexcept: return x -cdef Rational_add_(Rational self, Rational other) noexcept: +cdef Rational_add_(Rational self, Rational other): cdef Rational x x = Rational.__new__(Rational) sig_on() @@ -171,7 +171,7 @@ cdef Rational_add_(Rational self, Rational other) noexcept: sig_off() return x -cdef Rational_sub_(Rational self, Rational other) noexcept: +cdef Rational_sub_(Rational self, Rational other): cdef Rational x x = Rational.__new__(Rational) @@ -184,14 +184,14 @@ cdef Rational_sub_(Rational self, Rational other) noexcept: cdef Parent the_rational_ring = sage.rings.rational_field.Q # make sure zero/one elements are set -cdef set_zero_one_elements() noexcept: +cdef set_zero_one_elements(): global the_rational_ring the_rational_ring._zero_element = Rational(0) the_rational_ring._one_element = Rational(1) set_zero_one_elements() -cpdef Integer integer_rational_power(Integer a, Rational b) noexcept: +cpdef Integer integer_rational_power(Integer a, Rational b): """ Compute `a^b` as an integer, if it is integral, or return ``None``. @@ -273,7 +273,7 @@ cpdef Integer integer_rational_power(Integer a, Rational b) noexcept: return z -cpdef rational_power_parts(a, Rational b, factor_limit=10**5) noexcept: +cpdef rational_power_parts(a, Rational b, factor_limit=10**5): """ Compute rationals or integers `c` and `d` such that `a^b = c*d^b` with `d` small. This is used for simplifying radicals. @@ -577,7 +577,7 @@ cdef class Rational(sage.structure.element.FieldElement): raise TypeError(f"unable to convert rational {self} to an integer") - cdef __set_value(self, x, unsigned int base) noexcept: + cdef __set_value(self, x, unsigned int base): cdef int n cdef Rational temp_rational cdef integer.Integer a, b @@ -831,7 +831,7 @@ cdef class Rational(sage.structure.element.FieldElement): l = self.continued_fraction_list() return ContinuedFraction_periodic(l) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Compare two rational numbers. @@ -1812,7 +1812,7 @@ cdef class Rational(sage.structure.element.FieldElement): # TODO -- change to use cpdef? If so, must fix # code in padics, etc. Do search_src('_val_unit'). - cdef _val_unit(Rational self, integer.Integer p) noexcept: + cdef _val_unit(Rational self, integer.Integer p): """ This is called by :meth:`val_unit()`. @@ -2336,7 +2336,7 @@ cdef class Rational(sage.structure.element.FieldElement): return coercion_model.bin_op(left, right, operator.add) - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Return ``right`` plus ``self``. @@ -2388,7 +2388,7 @@ cdef class Rational(sage.structure.element.FieldElement): return coercion_model.bin_op(left, right, operator.sub) - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Return ``self`` minus ``right``. @@ -2402,7 +2402,7 @@ cdef class Rational(sage.structure.element.FieldElement): mpq_sub(x.value, self.value, (right).value) return x - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Negate ``self``. @@ -2441,7 +2441,7 @@ cdef class Rational(sage.structure.element.FieldElement): return coercion_model.bin_op(left, right, operator.mul) - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Return ``self`` times ``right``. @@ -2498,7 +2498,7 @@ cdef class Rational(sage.structure.element.FieldElement): return coercion_model.bin_op(left, right, operator.truediv) - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Return ``self`` divided by ``right``. @@ -2542,7 +2542,7 @@ cdef class Rational(sage.structure.element.FieldElement): mpq_inv(x.value, self.value) return x - cpdef _pow_(self, other) noexcept: + cpdef _pow_(self, other): """ Raise ``self`` to the rational power ``other``. @@ -2637,7 +2637,7 @@ cdef class Rational(sage.structure.element.FieldElement): from sage.symbolic.ring import SR return SR(c) * SR(d).power(n, hold=True) - cpdef _pow_int(self, n) noexcept: + cpdef _pow_int(self, n): """ Raise ``self`` to the integer power ``n``. @@ -2657,7 +2657,7 @@ cdef class Rational(sage.structure.element.FieldElement): # be particularly efficient here. return self._pow_(Rational(n)) - cdef _pow_long(self, long n) noexcept: + cdef _pow_long(self, long n): """ TESTS:: @@ -3694,7 +3694,7 @@ cdef class Rational(sage.structure.element.FieldElement): return False return a.prime_to_S_part(S) == 1 - cdef _lshift(self, long int exp) noexcept: + cdef _lshift(self, long int exp): r""" Return ``self * 2^exp``. """ @@ -3742,7 +3742,7 @@ cdef class Rational(sage.structure.element.FieldElement): return (x)._lshift(y) return coercion_model.bin_op(x, y, operator.lshift) - cdef _rshift(self, long int exp) noexcept: + cdef _rshift(self, long int exp): r""" Return ``self / 2^exp``. """ @@ -4130,7 +4130,7 @@ cdef class Z_to_Q(Morphism): import sage.categories.homset Morphism.__init__(self, sage.categories.homset.Hom(integer_ring.ZZ, rational_field.QQ)) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Return the image of the morphism on ``x``. @@ -4197,7 +4197,7 @@ cdef class Q_to_Z(Map): sage: type(ZZ.convert_map_from(QQ)) """ - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ A fast map from the rationals to the integers. @@ -4252,7 +4252,7 @@ cdef class int_to_Q(Morphism): Morphism.__init__(self, sage.categories.homset.Hom( Set_PythonType(long), rational_field.QQ)) - cpdef Element _call_(self, a) noexcept: + cpdef Element _call_(self, a): """ Return the image of the morphism on ``a``. diff --git a/src/sage/rings/real_arb.pxd b/src/sage/rings/real_arb.pxd index 263a411ee10..6743fa1c80b 100644 --- a/src/sage/rings/real_arb.pxd +++ b/src/sage/rings/real_arb.pxd @@ -9,12 +9,12 @@ cdef int arb_to_mpfi(mpfi_t target, arb_t source, const long precision) except - cdef class RealBall(RingElement): cdef arb_t value - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cpdef RealIntervalFieldElement _real_mpfi_(self, RealIntervalField_class parent) noexcept - cpdef RealBall psi(self) noexcept + cpdef _add_(self, other) + cpdef _mul_(self, other) + cpdef RealIntervalFieldElement _real_mpfi_(self, RealIntervalField_class parent) + cpdef RealBall psi(self) - cdef inline RealBall _new(self) noexcept: + cdef inline RealBall _new(self): cdef RealBall res = RealBall.__new__(RealBall) res._parent = self._parent return res diff --git a/src/sage/rings/real_arb.pyx b/src/sage/rings/real_arb.pyx index 669b154e8e8..4e989f23695 100644 --- a/src/sage/rings/real_arb.pyx +++ b/src/sage/rings/real_arb.pyx @@ -1556,7 +1556,7 @@ cdef class RealBall(RingElement): # Conversions - cpdef RealIntervalFieldElement _real_mpfi_(self, RealIntervalField_class parent) noexcept: + cpdef RealIntervalFieldElement _real_mpfi_(self, RealIntervalField_class parent): """ Return a :mod:`real interval ` containing this ball. @@ -2254,7 +2254,7 @@ cdef class RealBall(RingElement): """ return arb_is_exact(self.value) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Compare ``left`` and ``right``. @@ -2796,7 +2796,7 @@ cdef class RealBall(RingElement): if _do_sig(prec(self)): sig_off() return res - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): """ Return the sum of two balls, rounded to the ambient field's precision. @@ -2814,7 +2814,7 @@ cdef class RealBall(RingElement): if _do_sig(prec(self)): sig_off() return res - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): """ Return the difference of two balls, rounded to the ambient field's precision. @@ -2833,7 +2833,7 @@ cdef class RealBall(RingElement): if _do_sig(prec(self)): sig_off() return res - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): """ Return the product of two balls, rounded to the ambient field's precision. @@ -2852,7 +2852,7 @@ cdef class RealBall(RingElement): if _do_sig(prec(self)): sig_off() return res - cpdef _div_(self, other) noexcept: + cpdef _div_(self, other): """ Return the quotient of two balls, rounded to the ambient field's precision. @@ -3849,7 +3849,7 @@ cdef class RealBall(RingElement): if _do_sig(prec(self)): sig_off() return result - cpdef RealBall psi(self) noexcept: + cpdef RealBall psi(self): """ Compute the digamma function with argument self. diff --git a/src/sage/rings/real_double.pxd b/src/sage/rings/real_double.pxd index e2c657faec2..06d4121ef26 100644 --- a/src/sage/rings/real_double.pxd +++ b/src/sage/rings/real_double.pxd @@ -3,13 +3,13 @@ from sage.rings.ring cimport Field cimport sage.rings.abc cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): - cdef _new_c(self, double value) noexcept + cdef _new_c(self, double value) cdef class RealDoubleElement(FieldElement): cdef double _value - cdef _new_c(self, double value) noexcept - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cpdef RealDoubleElement abs(RealDoubleElement self) noexcept + cdef _new_c(self, double value) + cpdef _add_(self, other) + cpdef _mul_(self, other) + cpdef RealDoubleElement abs(RealDoubleElement self) -cdef double_repr(double x) noexcept +cdef double_repr(double x) diff --git a/src/sage/rings/real_double.pyx b/src/sage/rings/real_double.pyx index 49b836f6010..17842e7e80e 100644 --- a/src/sage/rings/real_double.pyx +++ b/src/sage/rings/real_double.pyx @@ -278,7 +278,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): from sage.rings.complex_double import CDF return CDF - cpdef _coerce_map_from_(self, S) noexcept: + cpdef _coerce_map_from_(self, S): """ Canonical coercion of ``S`` to the real double field. @@ -473,7 +473,7 @@ cdef class RealDoubleField_class(sage.rings.abc.RealDoubleField): """ return Integer(0) - cdef _new_c(self, double value) noexcept: + cdef _new_c(self, double value): cdef RealDoubleElement x x = PY_NEW(RealDoubleElement) x._value = value @@ -741,7 +741,7 @@ cdef class RealDoubleElement(FieldElement): """ return RealDoubleElement, (self._value, ) - cdef _new_c(self, double value) noexcept: + cdef _new_c(self, double value): cdef RealDoubleElement x x = PY_NEW(RealDoubleElement) x._value = value @@ -1310,7 +1310,7 @@ cdef class RealDoubleElement(FieldElement): x._value = 1.0 / self._value return x - cpdef _add_(self, right) noexcept: + cpdef _add_(self, right): """ Add two real numbers with the same parent. @@ -1323,7 +1323,7 @@ cdef class RealDoubleElement(FieldElement): x._value = self._value + (right)._value return x - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract two real numbers with the same parent. @@ -1336,7 +1336,7 @@ cdef class RealDoubleElement(FieldElement): x._value = self._value - (right)._value return x - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiply two real numbers with the same parent. @@ -1349,7 +1349,7 @@ cdef class RealDoubleElement(FieldElement): x._value = self._value * (right)._value return x - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Divide ``self`` by ``right``. @@ -1410,7 +1410,7 @@ cdef class RealDoubleElement(FieldElement): else: return self._new_c(-self._value) - cpdef RealDoubleElement abs(RealDoubleElement self) noexcept: + cpdef RealDoubleElement abs(RealDoubleElement self): """ Returns the absolute value of ``self``. @@ -1741,7 +1741,7 @@ cdef class RealDoubleElement(FieldElement): """ return bool(libc.math.isinf(self._value)) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Rich comparison of ``left`` and ``right``. @@ -1999,7 +1999,7 @@ cdef class ToRDF(Morphism): R = Set_PythonType(R) Morphism.__init__(self, Hom(R, RDF)) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Send ``x`` to the image under this map. @@ -2186,7 +2186,7 @@ else: # From here on, calling PY_NEW(RealDoubleElement) actually creates an instance of RealDoubleElement_gsl -cdef double_repr(double x) noexcept: +cdef double_repr(double x): """ Convert a double to a string with maximum precision. """ diff --git a/src/sage/rings/real_double_element_gsl.pxd b/src/sage/rings/real_double_element_gsl.pxd index 1762c5f944b..8025174d15c 100644 --- a/src/sage/rings/real_double_element_gsl.pxd +++ b/src/sage/rings/real_double_element_gsl.pxd @@ -2,6 +2,6 @@ from sage.rings.real_double cimport RealDoubleElement cdef class RealDoubleElement_gsl(RealDoubleElement): - cdef __pow_double(self, double exponent, double sign) noexcept - cpdef _pow_(self, other) noexcept - cdef _log_base(self, double log_of_base) noexcept + cdef __pow_double(self, double exponent, double sign) + cpdef _pow_(self, other) + cdef _log_base(self, double log_of_base) diff --git a/src/sage/rings/real_double_element_gsl.pyx b/src/sage/rings/real_double_element_gsl.pyx index 37d95e2c6df..9d5f2d9a93b 100644 --- a/src/sage/rings/real_double_element_gsl.pyx +++ b/src/sage/rings/real_double_element_gsl.pyx @@ -57,7 +57,7 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): else: return self ** (float(1)/n) - cdef __pow_double(self, double exponent, double sign) noexcept: + cdef __pow_double(self, double exponent, double sign): """ If ``sign == 1`` or ``self >= 0``, return ``self ^ exponent``. If ``sign == -1`` and ``self < 0``, return ``- abs(self) ^ exponent``. @@ -84,7 +84,7 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): v = -v return self._new_c(sign * gsl_sf_exp(gsl_sf_log(v) * exponent)) - cpdef _pow_(self, other) noexcept: + cpdef _pow_(self, other): """ Return ``self`` raised to the real double power ``other``. @@ -117,7 +117,7 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): """ return self.__pow_double((other)._value, 1) - cpdef _pow_int(self, n) noexcept: + cpdef _pow_int(self, n): """ Return ``self`` raised to the integer power ``n``. @@ -174,7 +174,7 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): """ return self.__pow_double(n, -1.0 if (n & 1) else 1.0) - cdef _pow_long(self, long n) noexcept: + cdef _pow_long(self, long n): """ Compute ``self`` raised to the power ``n``. @@ -214,7 +214,7 @@ cdef class RealDoubleElement_gsl(RealDoubleElement): # of n to double might change an odd number to an even number. return self.__pow_double(n, -1.0 if (n & 1) else 1.0) - cdef _log_base(self, double log_of_base) noexcept: + cdef _log_base(self, double log_of_base): if self._value == 0: from sage.rings.real_double import RDF return RDF(-1)/RDF(0) diff --git a/src/sage/rings/real_interval_absolute.pyx b/src/sage/rings/real_interval_absolute.pyx index 5b5e663a5dc..d190329872e 100644 --- a/src/sage/rings/real_interval_absolute.pyx +++ b/src/sage/rings/real_interval_absolute.pyx @@ -23,7 +23,7 @@ from sage.rings.rational_field import QQ cdef Integer zero = Integer(0) cdef Integer one = Integer(1) -cpdef inline Integer shift_floor(Integer x, long shift) noexcept: +cpdef inline Integer shift_floor(Integer x, long shift): r""" Return `x / 2^s` where `s` is the value of ``shift``, rounded towards `-\infty`. For internal use. @@ -40,7 +40,7 @@ cpdef inline Integer shift_floor(Integer x, long shift) noexcept: mpz_fdiv_q_2exp(z.value, x.value, shift) return z -cpdef inline Integer shift_ceil(Integer x, long shift) noexcept: +cpdef inline Integer shift_ceil(Integer x, long shift): r""" Return `x / 2^s` where `s` is the value of ``shift``, rounded towards `+\infty`. For internal use. @@ -161,7 +161,7 @@ cdef class RealIntervalAbsoluteField_class(Field): """ return RealIntervalAbsoluteElement(self, x) - cpdef _coerce_map_from_(self, R) noexcept: + cpdef _coerce_map_from_(self, R): """ Anything that coerces into the reals coerces into this ring. @@ -223,7 +223,7 @@ cdef class RealIntervalAbsoluteField_class(Field): return self._absprec -cdef inline shift_left(value, shift) noexcept: +cdef inline shift_left(value, shift): """ Utility function for operands that don't support the ``<<`` operator. """ @@ -319,7 +319,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): """ return RealIntervalAbsoluteElement, (self._parent, self.endpoints()) - cdef _new_c(self, Integer _mantissa, Integer _diameter) noexcept: + cdef _new_c(self, Integer _mantissa, Integer _diameter): cdef RealIntervalAbsoluteElement x x = RealIntervalAbsoluteElement.__new__(RealIntervalAbsoluteElement) x._parent = self._parent @@ -327,7 +327,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): x._diameter = _diameter return x - cpdef lower(self) noexcept: + cpdef lower(self): """ Return the lower bound of ``self``. @@ -340,7 +340,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): """ return QQ(self._mantissa) >> (self._parent)._absprec - cpdef midpoint(self) noexcept: + cpdef midpoint(self): """ Return the midpoint of ``self``. @@ -357,7 +357,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): """ return (self._mantissa + self._diameter / 2) >> (self._parent)._absprec - cpdef upper(self) noexcept: + cpdef upper(self): """ Return the upper bound of ``self``. @@ -370,7 +370,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): """ return QQ(self._mantissa + self._diameter) >> (self._parent)._absprec - cpdef absolute_diameter(self) noexcept: + cpdef absolute_diameter(self): """ Return the diameter ``self``. @@ -390,7 +390,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): diameter = absolute_diameter - cpdef endpoints(self) noexcept: + cpdef endpoints(self): """ Return the left and right endpoints of ``self``, as a tuple. @@ -612,7 +612,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): """ return self.abs() - cpdef abs(self) noexcept: + cpdef abs(self): """ Return the absolute value of ``self``. @@ -638,7 +638,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): else: return self._new_c(zero, max(-self._mantissa, self._mantissa + self._diameter)) - cpdef _add_(self, _other) noexcept: + cpdef _add_(self, _other): """ TESTS:: @@ -656,7 +656,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): cdef RealIntervalAbsoluteElement other = _other return self._new_c(self._mantissa + other._mantissa, self._diameter + other._diameter) - cpdef _sub_(self, _other) noexcept: + cpdef _sub_(self, _other): """ TESTS:: @@ -676,7 +676,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): cdef RealIntervalAbsoluteElement other = _other return self._new_c(self._mantissa - other._mantissa - other._diameter, self._diameter + other._diameter) - cpdef _mul_(self, _other) noexcept: + cpdef _mul_(self, _other): """ TESTS:: @@ -731,7 +731,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): res = -res return res - cpdef _acted_upon_(self, x, bint self_on_left) noexcept: + cpdef _acted_upon_(self, x, bint self_on_left): """ ``Absprec * relprec -> absprec`` works better than coercing both operands to absolute precision first. @@ -836,7 +836,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): res = -res return res - cpdef _div_(self, _other) noexcept: + cpdef _div_(self, _other): """ TESTS:: @@ -920,7 +920,7 @@ cdef class RealIntervalAbsoluteElement(FieldElement): """ return self.shift(-n) - cdef shift(self, long n) noexcept: + cdef shift(self, long n): if n >= 0: return self._new_c(self._mantissa << n, self._diameter << n) else: diff --git a/src/sage/rings/real_lazy.pxd b/src/sage/rings/real_lazy.pxd index 5619e492e9e..60a6580a550 100644 --- a/src/sage/rings/real_lazy.pxd +++ b/src/sage/rings/real_lazy.pxd @@ -2,15 +2,15 @@ from sage.rings.ring cimport Field from sage.structure.element cimport RingElement, ModuleElement, Element, FieldElement cdef class LazyField(Field): - cpdef interval_field(self, prec=*) noexcept + cpdef interval_field(self, prec=*) cdef class LazyFieldElement(FieldElement): - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cdef LazyFieldElement _new_wrapper(self, value) noexcept - cdef LazyFieldElement _new_binop(self, LazyFieldElement left, LazyFieldElement right, op) noexcept - cdef LazyFieldElement _new_unop(self, LazyFieldElement arg, op) noexcept - cpdef eval(self, R) noexcept + cpdef _add_(self, other) + cpdef _mul_(self, other) + cdef LazyFieldElement _new_wrapper(self, value) + cdef LazyFieldElement _new_binop(self, LazyFieldElement left, LazyFieldElement right, op) + cdef LazyFieldElement _new_unop(self, LazyFieldElement arg, op) + cpdef eval(self, R) cpdef int depth(self) noexcept cdef class LazyWrapper(LazyFieldElement): diff --git a/src/sage/rings/real_lazy.pyx b/src/sage/rings/real_lazy.pyx index ea6c7b264fb..1ba394741fa 100644 --- a/src/sage/rings/real_lazy.pyx +++ b/src/sage/rings/real_lazy.pyx @@ -63,7 +63,7 @@ cdef late_import(): cdef _QQx = None -cdef QQx() noexcept: +cdef QQx(): global _QQx if _QQx is None: _QQx = QQ['x'] @@ -134,7 +134,7 @@ cdef class LazyField(Field): else: raise AttributeError(name) - cpdef _coerce_map_from_(self, R) noexcept: + cpdef _coerce_map_from_(self, R): r""" The only things that coerce into this ring are exact rings that embed into `\RR` or `\CC` (depending on whether this field @@ -206,7 +206,7 @@ cdef class LazyField(Field): """ return CLF - cpdef interval_field(self, prec=None) noexcept: + cpdef interval_field(self, prec=None): """ Abstract method to create the corresponding interval field. @@ -541,7 +541,7 @@ cdef int get_new_prec(R, int depth) except -1: cdef class LazyFieldElement(FieldElement): - cpdef _add_(left, right) noexcept: + cpdef _add_(left, right): """ Add ``left`` with ``right``. @@ -557,7 +557,7 @@ cdef class LazyFieldElement(FieldElement): pass return left._new_binop(left, right, add) - cpdef _sub_(left, right) noexcept: + cpdef _sub_(left, right): """ Subtract ``right`` from ``left``. @@ -573,7 +573,7 @@ cdef class LazyFieldElement(FieldElement): pass return left._new_binop(left, right, sub) - cpdef _mul_(left, right) noexcept: + cpdef _mul_(left, right): """ Multiply ``left`` with ``right``. @@ -589,7 +589,7 @@ cdef class LazyFieldElement(FieldElement): pass return left._new_binop(left, right, mul) - cpdef _div_(left, right) noexcept: + cpdef _div_(left, right): """ Divide ``left`` by ``right``. @@ -653,7 +653,7 @@ cdef class LazyFieldElement(FieldElement): """ return self._new_unop(self, inv) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ If things are being wrapped, tries to compare values. That failing, it tries to compare intervals, which may return a false negative. @@ -707,13 +707,13 @@ cdef class LazyFieldElement(FieldElement): """ return hash(complex(self)) - cdef LazyFieldElement _new_wrapper(self, value) noexcept: + cdef LazyFieldElement _new_wrapper(self, value): cdef LazyWrapper e = LazyWrapper.__new__(LazyWrapper) e._parent = self._parent e._value = value return e - cdef LazyFieldElement _new_binop(self, LazyFieldElement left, LazyFieldElement right, op) noexcept: + cdef LazyFieldElement _new_binop(self, LazyFieldElement left, LazyFieldElement right, op): cdef LazyBinop e = LazyBinop.__new__(LazyBinop) e._parent = self._parent e._left = left @@ -721,7 +721,7 @@ cdef class LazyFieldElement(FieldElement): e._op = op return e - cdef LazyFieldElement _new_unop(self, LazyFieldElement arg, op) noexcept: + cdef LazyFieldElement _new_unop(self, LazyFieldElement arg, op): cdef LazyUnop e = LazyUnop.__new__(LazyUnop) e._parent = self._parent e._op = op @@ -824,7 +824,7 @@ cdef class LazyFieldElement(FieldElement): except Exception: return complex(self.eval(ComplexField(53))) - cpdef eval(self, R) noexcept: + cpdef eval(self, R): """ Abstract method for converting ``self`` into an element of ``R``. @@ -1012,7 +1012,7 @@ cdef class LazyWrapper(LazyFieldElement): """ return hash(self._value) - cpdef eval(self, R) noexcept: + cpdef eval(self, R): """ Convert ``self`` into an element of ``R``. @@ -1110,7 +1110,7 @@ cdef class LazyBinop(LazyFieldElement): cdef int right = self._right.depth() return 1 + (left if left > right else right) - cpdef eval(self, R) noexcept: + cpdef eval(self, R): """ Convert the operands to elements of ``R``, then perform the operation on them. @@ -1246,7 +1246,7 @@ cdef class LazyUnop(LazyFieldElement): """ return 1 + self._arg.depth() - cpdef eval(self, R) noexcept: + cpdef eval(self, R): """ Convert ``self`` into an element of ``R``. @@ -1325,7 +1325,7 @@ cdef class LazyNamedUnop(LazyUnop): raise TypeError("extra args must be a tuple") self._extra_args = extra_args - cpdef eval(self, R) noexcept: + cpdef eval(self, R): """ Convert ``self`` into an element of ``R``. @@ -1468,7 +1468,7 @@ cdef class LazyConstant(LazyFieldElement): self._name = name self._extra_args = extra_args - cpdef eval(self, R) noexcept: + cpdef eval(self, R): """ Convert ``self`` into an element of ``R``. @@ -1626,7 +1626,7 @@ cdef class LazyAlgebraic(LazyFieldElement): approx = (CC if prec == 0 else ComplexField(prec))(approx) self._root_approx = approx - cpdef eval(self, R) noexcept: + cpdef eval(self, R): """ Convert ``self`` into an element of ``R``. @@ -1733,7 +1733,7 @@ cdef class LazyWrapperMorphism(Morphism): from sage.categories.homset import Hom Morphism.__init__(self, Hom(domain, codomain)) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: diff --git a/src/sage/rings/real_mpfi.pxd b/src/sage/rings/real_mpfi.pxd index f9fc7a1969c..f107dbdd89a 100644 --- a/src/sage/rings/real_mpfi.pxd +++ b/src/sage/rings/real_mpfi.pxd @@ -32,7 +32,7 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField): cdef RealField_class __upper_field cdef object _multiplicative_order - cdef inline RealIntervalFieldElement _new(self) noexcept: + cdef inline RealIntervalFieldElement _new(self): """Return a new real interval with parent ``self``.""" t = self.element_class return (t.__new__(t, self)) @@ -41,9 +41,9 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField): cdef class RealIntervalFieldElement(RingElement): cdef mpfi_t value - cdef inline RealIntervalFieldElement _new(self) noexcept: + cdef inline RealIntervalFieldElement _new(self): """Return a new real interval with same parent as ``self``.""" return (self._parent)._new() - cdef RealIntervalFieldElement abs(RealIntervalFieldElement self) noexcept - cdef Rational _simplest_rational_helper(self) noexcept - cpdef _str_question_style(self, int base, int error_digits, e, bint prefer_sci) noexcept + cdef RealIntervalFieldElement abs(RealIntervalFieldElement self) + cdef Rational _simplest_rational_helper(self) + cpdef _str_question_style(self, int base, int error_digits, e, bint prefer_sci) diff --git a/src/sage/rings/real_mpfi.pyx b/src/sage/rings/real_mpfi.pyx index 2acd205af24..da282aceb3b 100644 --- a/src/sage/rings/real_mpfi.pyx +++ b/src/sage/rings/real_mpfi.pyx @@ -305,7 +305,7 @@ printing_error_digits = 0 #***************************************************************************** cdef dict RealIntervalField_cache = {} -cpdef RealIntervalField_class RealIntervalField(prec=53, sci_not=False) noexcept: +cpdef RealIntervalField_class RealIntervalField(prec=53, sci_not=False): r""" Construct a :class:`RealIntervalField_class`, with caching. @@ -756,7 +756,7 @@ cdef class RealIntervalField_class(sage.rings.abc.RealIntervalField): {'sci_not': self.scientific_notation(), 'type': 'Interval'}), sage.rings.rational_field.QQ) - cpdef _coerce_map_from_(self, S) noexcept: + cpdef _coerce_map_from_(self, S): """ Canonical coercion from ``S`` to this real interval field. @@ -1701,7 +1701,7 @@ cdef class RealIntervalFieldElement(RingElement): else: raise ValueError('Illegal interval printing style %s' % printing_style) - cpdef _str_question_style(self, int base, int error_digits, e, bint prefer_sci) noexcept: + cpdef _str_question_style(self, int base, int error_digits, e, bint prefer_sci): r""" Compute the "question-style print representation" of this value, with the given base and error_digits. See the documentation for @@ -2692,7 +2692,7 @@ cdef class RealIntervalFieldElement(RingElement): else: return Element.__rtruediv__(right, left) - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): """ Add two real intervals with the same parent. @@ -2736,7 +2736,7 @@ cdef class RealIntervalFieldElement(RingElement): mpfi_inv(x.value, self.value) return x - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract two real intervals with the same parent. @@ -2754,7 +2754,7 @@ cdef class RealIntervalFieldElement(RingElement): mpfi_sub(x.value, self.value, (right).value) return x - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiply two real intervals with the same parent. @@ -2791,7 +2791,7 @@ cdef class RealIntervalFieldElement(RingElement): return x - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Divide ``self`` by ``right``, where both are real intervals with the same parent. @@ -2818,7 +2818,7 @@ cdef class RealIntervalFieldElement(RingElement): (right).value) return x - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Return the additive "inverse" of this interval. (Technically, non-precise intervals don't have additive inverses.) @@ -2857,7 +2857,7 @@ cdef class RealIntervalFieldElement(RingElement): """ return self.abs() - cdef RealIntervalFieldElement abs(self) noexcept: + cdef RealIntervalFieldElement abs(self): """ Return the absolute value of ``self``. @@ -3656,7 +3656,7 @@ cdef class RealIntervalFieldElement(RingElement): low_open, high_open) - cdef Rational _simplest_rational_helper(self) noexcept: + cdef Rational _simplest_rational_helper(self): """ Returns the simplest rational in an interval which is either equal to or slightly larger than ``self``. We assume that both endpoints of @@ -3696,7 +3696,7 @@ cdef class RealIntervalFieldElement(RingElement): """ return mpfi_nan_p(self.value) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Implement comparisons between intervals. @@ -5189,7 +5189,7 @@ def _simplest_rational_test_helper(low, high, low_open=False, high_open=False): """ return _simplest_rational_exact(low, high, low_open, high_open) -cdef _simplest_rational_exact(Rational low, Rational high, int low_open, int high_open) noexcept: +cdef _simplest_rational_exact(Rational low, Rational high, int low_open, int high_open): """ Return the simplest rational between ``low`` and ``high``. May return ``low`` or ``high`` unless ``low_open`` or ``high_open`` (respectively) are diff --git a/src/sage/rings/real_mpfr.pxd b/src/sage/rings/real_mpfr.pxd index 6e06e5c5ea4..785d402836c 100644 --- a/src/sage/rings/real_mpfr.pxd +++ b/src/sage/rings/real_mpfr.pxd @@ -10,19 +10,19 @@ cdef class RealField_class(sage.rings.abc.RealField): cdef bint sci_not cdef mpfr_rnd_t rnd cdef object rnd_str - cdef inline RealNumber _new(self) noexcept: + cdef inline RealNumber _new(self): """Return a new real number with parent ``self``.""" return (RealNumber.__new__(RealNumber, self)) cdef class RealNumber(sage.structure.element.RingElement): cdef mpfr_t value - cdef inline RealNumber _new(self) noexcept: + cdef inline RealNumber _new(self): """Return a new real number with same parent as ``self``.""" return (RealNumber.__new__(RealNumber, self._parent)) - cpdef _add_(self, other) noexcept - cpdef _mul_(self, other) noexcept - cpdef _mod_(self, right) noexcept - cdef _set(self, x, int base) noexcept - cdef RealNumber abs(RealNumber self) noexcept + cpdef _add_(self, other) + cpdef _mul_(self, other) + cpdef _mod_(self, right) + cdef _set(self, x, int base) + cdef RealNumber abs(RealNumber self) -cpdef RealField(mpfr_prec_t prec=*, int sci_not=*, rnd=*) noexcept +cpdef RealField(mpfr_prec_t prec=*, int sci_not=*, rnd=*) diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx index 59784dc24da..1100a63e3fe 100644 --- a/src/sage/rings/real_mpfr.pyx +++ b/src/sage/rings/real_mpfr.pyx @@ -371,7 +371,7 @@ cdef double LOG_TEN_TWO_PLUS_EPSILON = 3.321928094887363 # a small overestimate cdef object RealField_cache = sage.misc.weak_dict.WeakValueDictionary() -cpdef RealField(mpfr_prec_t prec=53, int sci_not=0, rnd=MPFR_RNDN) noexcept: +cpdef RealField(mpfr_prec_t prec=53, int sci_not=0, rnd=MPFR_RNDN): """ RealField(prec, sci_not, rnd): @@ -675,7 +675,7 @@ cdef class RealField_class(sage.rings.abc.RealField): z._set(x, base) return z - cpdef _coerce_map_from_(self, S) noexcept: + cpdef _coerce_map_from_(self, S): """ Canonical coercion of x to this MPFR real field. @@ -1461,7 +1461,7 @@ cdef class RealNumber(sage.structure.element.RingElement): else: return numpy_object_interface - cdef _set(self, x, int base) noexcept: + cdef _set(self, x, int base): # This should not be called except when the number is being created. # Real Numbers are supposed to be immutable. cdef RealField_class parent @@ -2435,7 +2435,7 @@ cdef class RealNumber(sage.structure.element.RingElement): else: return Element.__rtruediv__(right, left) - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): """ Add two real numbers with the same parent. @@ -2464,7 +2464,7 @@ cdef class RealNumber(sage.structure.element.RingElement): """ return self._parent(1) / self - cpdef _sub_(self, right) noexcept: + cpdef _sub_(self, right): """ Subtract two real numbers with the same parent. @@ -2505,7 +2505,7 @@ cdef class RealNumber(sage.structure.element.RingElement): import sympy return sympy.Float(self, precision=self._parent.precision()) - cpdef _mul_(self, right) noexcept: + cpdef _mul_(self, right): """ Multiply two real numbers with the same parent. @@ -2538,7 +2538,7 @@ cdef class RealNumber(sage.structure.element.RingElement): return x - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Divide ``self`` by other, where both are real numbers with the same parent. @@ -2558,7 +2558,7 @@ cdef class RealNumber(sage.structure.element.RingElement): (right).value, (self._parent).rnd) return x - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Return the negative of ``self``. @@ -2592,7 +2592,7 @@ cdef class RealNumber(sage.structure.element.RingElement): """ return self.abs() - cdef RealNumber abs(RealNumber self) noexcept: + cdef RealNumber abs(RealNumber self): """ Return the absolute value of ``self``. @@ -2945,7 +2945,7 @@ cdef class RealNumber(sage.structure.element.RingElement): # Rounding etc ################### - cpdef _mod_(left, right) noexcept: + cpdef _mod_(left, right): """ Return the value of ``left - n*right``, rounded according to the rounding mode of the parent, where ``n`` is the integer quotient of @@ -4069,7 +4069,7 @@ cdef class RealNumber(sage.structure.element.RingElement): """ return not mpfr_zero_p(self.value) - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): """ Compare ``self`` and ``other`` according to the rich comparison operator ``op``. @@ -5879,7 +5879,7 @@ def __create__RealNumber_version0(parent, x, base=10): cdef class RRtoRR(Map): - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: @@ -5928,7 +5928,7 @@ cdef class RRtoRR(Map): return RRtoRR(self._codomain, self.domain()) cdef class ZZtoRR(Map): - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: @@ -5943,7 +5943,7 @@ cdef class ZZtoRR(Map): return y cdef class QQtoRR(Map): - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: @@ -5958,7 +5958,7 @@ cdef class QQtoRR(Map): return y cdef class double_toRR(Map): - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Takes anything that can be converted to a double. @@ -5978,7 +5978,7 @@ cdef class double_toRR(Map): return y cdef class int_toRR(Map): - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Takes Python int/long instances. diff --git a/src/sage/rings/ring_extension.pxd b/src/sage/rings/ring_extension.pxd index 99dc036da79..478bd6eef75 100644 --- a/src/sage/rings/ring_extension.pxd +++ b/src/sage/rings/ring_extension.pxd @@ -14,12 +14,12 @@ cdef class RingExtension_generic(CommutativeRing): cdef RingExtension_generic _fraction_field cdef type _fraction_field_type - cpdef is_defined_over(self, base) noexcept - cpdef CommutativeRing _check_base(self, CommutativeRing base) noexcept - cpdef _degree_over(self, CommutativeRing base) noexcept - cpdef _is_finite_over(self, CommutativeRing base) noexcept - cpdef _is_free_over(self, CommutativeRing base) noexcept - cdef Map _defining_morphism_fraction_field(self, bint extend_base) noexcept + cpdef is_defined_over(self, base) + cpdef CommutativeRing _check_base(self, CommutativeRing base) + cpdef _degree_over(self, CommutativeRing base) + cpdef _is_finite_over(self, CommutativeRing base) + cpdef _is_free_over(self, CommutativeRing base) + cdef Map _defining_morphism_fraction_field(self, bint extend_base) cdef class RingExtensionFractionField(RingExtension_generic): @@ -31,7 +31,7 @@ cdef class RingExtensionWithBasis(RingExtension_generic): cdef _basis_names cdef _basis_latex_names - cpdef _basis_over(self, CommutativeRing base) noexcept + cpdef _basis_over(self, CommutativeRing base) # cpdef _free_module(self, CommutativeRing base, bint map) diff --git a/src/sage/rings/ring_extension.pyx b/src/sage/rings/ring_extension.pyx index d412ab47e27..9c214a1ffee 100644 --- a/src/sage/rings/ring_extension.pyx +++ b/src/sage/rings/ring_extension.pyx @@ -1007,7 +1007,7 @@ cdef class RingExtension_generic(CommutativeRing): raise RuntimeError("backend is not exposed to the user; cannot print") return latex(self._backend) - cpdef _coerce_map_from_(self, other) noexcept: + cpdef _coerce_map_from_(self, other): r""" Return a coerce map from this extension to ``other`` if defined. @@ -1168,7 +1168,7 @@ cdef class RingExtension_generic(CommutativeRing): """ return self.bases()[-1] - cpdef is_defined_over(self, base) noexcept: + cpdef is_defined_over(self, base): r""" Return whether or not ``base`` is one of the bases of this extension. @@ -1216,7 +1216,7 @@ cdef class RingExtension_generic(CommutativeRing): b = (b)._base return b is base - cpdef CommutativeRing _check_base(self, CommutativeRing base) noexcept: + cpdef CommutativeRing _check_base(self, CommutativeRing base): r""" Check if ``base`` is one of the successive bases of this extension and, if it is, normalize it. @@ -1464,7 +1464,7 @@ cdef class RingExtension_generic(CommutativeRing): base = self._check_base(base) return self._degree_over(base) - cpdef _degree_over(self, CommutativeRing base) noexcept: + cpdef _degree_over(self, CommutativeRing base): r""" Return the degree of this extension over ``base``. @@ -1604,7 +1604,7 @@ cdef class RingExtension_generic(CommutativeRing): b = (b)._base raise NotImplementedError - cpdef _is_finite_over(self, CommutativeRing base) noexcept: + cpdef _is_finite_over(self, CommutativeRing base): r""" Return whether or not this extension is finite over ``base``. @@ -1667,7 +1667,7 @@ cdef class RingExtension_generic(CommutativeRing): b = (b)._base raise NotImplementedError - cpdef _is_free_over(self, CommutativeRing base) noexcept: + cpdef _is_free_over(self, CommutativeRing base): r""" Return whether or not this extension is finite over ``base``. @@ -1785,7 +1785,7 @@ cdef class RingExtension_generic(CommutativeRing): constructor = RingExtensionFractionField, {'ring': self, 'is_backend_exposed': self._is_backend_exposed} return RingExtension(ring, defining_morphism, constructors=[constructor]) - cdef Map _defining_morphism_fraction_field(self, bint extend_base) noexcept: + cdef Map _defining_morphism_fraction_field(self, bint extend_base): r""" Return the defining morphism of the fraction field of this extension. @@ -2210,7 +2210,7 @@ cdef class RingExtensionWithBasis(RingExtension_generic): b = b.base_ring() return base - cpdef _degree_over(self, CommutativeRing base) noexcept: + cpdef _degree_over(self, CommutativeRing base): r""" Return the degree of this extension over ``base``. @@ -2237,7 +2237,7 @@ cdef class RingExtensionWithBasis(RingExtension_generic): else: return len(self._basis) * self._base._degree_over(base) - cpdef _is_finite_over(self, CommutativeRing base) noexcept: + cpdef _is_finite_over(self, CommutativeRing base): r""" Return whether or not this extension is finite over ``base``. @@ -2256,7 +2256,7 @@ cdef class RingExtensionWithBasis(RingExtension_generic): return True return self._base._is_finite_over(base) - cpdef _is_free_over(self, CommutativeRing base) noexcept: + cpdef _is_free_over(self, CommutativeRing base): r""" Return whether or not this extension is free over ``base``. @@ -2317,7 +2317,7 @@ cdef class RingExtensionWithBasis(RingExtension_generic): base = self._check_base(base) return self._basis_over(base) - cpdef _basis_over(self, CommutativeRing base) noexcept: + cpdef _basis_over(self, CommutativeRing base): r""" Return a basis of this extension over ``base``. diff --git a/src/sage/rings/ring_extension_conversion.pxd b/src/sage/rings/ring_extension_conversion.pxd index 74e09e4f356..e3815a411ba 100644 --- a/src/sage/rings/ring_extension_conversion.pxd +++ b/src/sage/rings/ring_extension_conversion.pxd @@ -1,17 +1,17 @@ from sage.rings.ring_extension cimport RingExtension_generic -cpdef backend_parent(R) noexcept -cpdef from_backend_parent(R, RingExtension_generic E) noexcept +cpdef backend_parent(R) +cpdef from_backend_parent(R, RingExtension_generic E) -cpdef backend_element(x) noexcept -cpdef from_backend_element(x, RingExtension_generic E) noexcept +cpdef backend_element(x) +cpdef from_backend_element(x, RingExtension_generic E) -cdef _backend_morphism(f) noexcept -cpdef backend_morphism(f, forget=*) noexcept -cpdef from_backend_morphism(f, RingExtension_generic E) noexcept +cdef _backend_morphism(f) +cpdef backend_morphism(f, forget=*) +cpdef from_backend_morphism(f, RingExtension_generic E) -cpdef to_backend(arg) noexcept -cpdef from_backend(arg, E) noexcept +cpdef to_backend(arg) +cpdef from_backend(arg, E) diff --git a/src/sage/rings/ring_extension_conversion.pyx b/src/sage/rings/ring_extension_conversion.pyx index 597320e8af8..eeb6077cd0a 100644 --- a/src/sage/rings/ring_extension_conversion.pyx +++ b/src/sage/rings/ring_extension_conversion.pyx @@ -26,7 +26,7 @@ from sage.rings.ring_extension_morphism cimport RingExtensionBackendReverseIsomo # For parents ############# -cpdef backend_parent(R) noexcept: +cpdef backend_parent(R): r""" Return the backend parent of ``R``. @@ -49,7 +49,7 @@ cpdef backend_parent(R) noexcept: else: return R -cpdef from_backend_parent(R, RingExtension_generic E) noexcept: +cpdef from_backend_parent(R, RingExtension_generic E): r""" Try to reconstruct a ring extension (somehow related to ``E``) whose backend is ``R``. @@ -107,7 +107,7 @@ cpdef from_backend_parent(R, RingExtension_generic E) noexcept: # For elements ############## -cpdef backend_element(x) noexcept: +cpdef backend_element(x): r""" Return the backend element of ``x``. @@ -130,7 +130,7 @@ cpdef backend_element(x) noexcept: else: return x -cpdef from_backend_element(x, RingExtension_generic E) noexcept: +cpdef from_backend_element(x, RingExtension_generic E): r""" Try to reconstruct an element in a ring extension (somehow related to ``E``) whose backend is ``x``. @@ -181,7 +181,7 @@ cpdef from_backend_element(x, RingExtension_generic E) noexcept: # For morphisms ############### -cdef _backend_morphism(f) noexcept: +cdef _backend_morphism(f): r""" Return the backend morphism of ``f``. @@ -243,7 +243,7 @@ cdef _backend_morphism(f) noexcept: return ring.coerce_map_from(domain) raise NotImplementedError -cpdef backend_morphism(f, forget="all") noexcept: +cpdef backend_morphism(f, forget="all"): r""" Return the backend morphism of ``f``. @@ -299,7 +299,7 @@ cpdef backend_morphism(f, forget="all") noexcept: g = RingExtensionBackendReverseIsomorphism(f.codomain().Hom(ring)) * g return g -cpdef from_backend_morphism(f, RingExtension_generic E) noexcept: +cpdef from_backend_morphism(f, RingExtension_generic E): r""" Try to reconstruct a morphism between ring extensions (somehow related to ``E``) whose backend is ``f``. @@ -336,7 +336,7 @@ cpdef from_backend_morphism(f, RingExtension_generic E) noexcept: # Generic ######### -cpdef to_backend(arg) noexcept: +cpdef to_backend(arg): r""" Return the backend of ``arg``. @@ -392,7 +392,7 @@ cpdef to_backend(arg) noexcept: return (arg)._backend return arg -cpdef from_backend(arg, E) noexcept: +cpdef from_backend(arg, E): r""" Try to reconstruct something (somehow related to ``E``) whose backend is ``arg``. diff --git a/src/sage/rings/ring_extension_element.pxd b/src/sage/rings/ring_extension_element.pxd index 32ce1385248..6b62ad58c06 100644 --- a/src/sage/rings/ring_extension_element.pxd +++ b/src/sage/rings/ring_extension_element.pxd @@ -13,10 +13,10 @@ cdef class RingExtensionFractionFieldElement(RingExtensionElement): pass cdef class RingExtensionWithBasisElement(RingExtensionElement): - cdef _vector(self, CommutativeRing base) noexcept - cdef _matrix(self, CommutativeRing base) noexcept - cdef _trace(self, CommutativeRing base) noexcept - cdef _norm(self, CommutativeRing base) noexcept - cpdef minpoly(self, base=*, var=*) noexcept + cdef _vector(self, CommutativeRing base) + cdef _matrix(self, CommutativeRing base) + cdef _trace(self, CommutativeRing base) + cdef _norm(self, CommutativeRing base) + cpdef minpoly(self, base=*, var=*) diff --git a/src/sage/rings/ring_extension_element.pyx b/src/sage/rings/ring_extension_element.pyx index a8b2a25f335..729793d3bfa 100644 --- a/src/sage/rings/ring_extension_element.pyx +++ b/src/sage/rings/ring_extension_element.pyx @@ -358,7 +358,7 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): return parent.base()(base(self._backend)) raise NotImplementedError("cannot cast %s to the base" % self) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): r""" Compare this element with ``right`` according to the rich comparison operator ``op``. @@ -386,7 +386,7 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): """ return left._backend._richcmp_(backend_element(right), op) - cpdef _add_(self,other) noexcept: + cpdef _add_(self,other): r""" Return the sum of this element and ``other``. @@ -406,7 +406,7 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): ans._backend = self._backend + (other)._backend return ans - cpdef _neg_(self) noexcept: + cpdef _neg_(self): r""" Return the opposite of this element. @@ -426,7 +426,7 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): ans._backend = -self._backend return ans - cpdef _sub_(self,other) noexcept: + cpdef _sub_(self,other): r""" Return the difference of this element and ``other``. @@ -446,7 +446,7 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): ans._backend = self._backend - (other)._backend return ans - cpdef _mul_(self,other) noexcept: + cpdef _mul_(self,other): r""" Return the product of this element and ``other``. @@ -466,7 +466,7 @@ cdef class RingExtensionElement(CommutativeAlgebraElement): ans._backend = self._backend * (other)._backend return ans - cpdef _div_(self,other) noexcept: + cpdef _div_(self,other): r""" Return the quotient of this element by ``other``, considered as an element of the fraction field. @@ -1036,7 +1036,7 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): base = (self._parent)._check_base(base) return self._vector(base) - cdef _vector(self, CommutativeRing base) noexcept: + cdef _vector(self, CommutativeRing base): r""" Return the vector of coordinates of this element over ``base`` (in the basis output by the method :meth:`basis_over`). @@ -1201,7 +1201,7 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): raise ValueError("the extension is not finite free") return self._matrix(base) - cdef _matrix(self, CommutativeRing base) noexcept: + cdef _matrix(self, CommutativeRing base): r""" Return the matrix of the multiplication by this element (in the basis output by :meth:`basis_over`). @@ -1289,7 +1289,7 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): raise ValueError("the extension is not finite free") return self._trace(base) - cdef _trace(self, CommutativeRing base) noexcept: + cdef _trace(self, CommutativeRing base): r""" Return the trace of this element over ``base``. @@ -1382,7 +1382,7 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): raise ValueError("the extension is not finite free") return self._norm(base) - cdef _norm(self, CommutativeRing base) noexcept: + cdef _norm(self, CommutativeRing base): r""" Return the norm of this element over ``base``. @@ -1486,7 +1486,7 @@ cdef class RingExtensionWithBasisElement(RingExtensionElement): """ return self.matrix(base).charpoly(var) - cpdef minpoly(self, base=None, var='x') noexcept: + cpdef minpoly(self, base=None, var='x'): r""" Return the minimal polynomial of this element over ``base``. diff --git a/src/sage/rings/ring_extension_morphism.pxd b/src/sage/rings/ring_extension_morphism.pxd index f3d88ec3891..a02aff31a50 100644 --- a/src/sage/rings/ring_extension_morphism.pxd +++ b/src/sage/rings/ring_extension_morphism.pxd @@ -4,7 +4,7 @@ from sage.rings.morphism cimport RingMap from sage.rings.ring_extension_element cimport RingExtensionElement -cdef are_equal_morphisms(f, g) noexcept +cdef are_equal_morphisms(f, g) cdef class RingExtensionHomomorphism(RingMap): @@ -31,4 +31,4 @@ cdef class MapRelativeRingToFreeModule(Map): cdef Map _jL cdef _matrix - cdef list backend_coefficients(self, RingExtensionElement x) noexcept + cdef list backend_coefficients(self, RingExtensionElement x) diff --git a/src/sage/rings/ring_extension_morphism.pyx b/src/sage/rings/ring_extension_morphism.pyx index 4d78ee1c5d0..f861d015a35 100644 --- a/src/sage/rings/ring_extension_morphism.pyx +++ b/src/sage/rings/ring_extension_morphism.pyx @@ -29,7 +29,7 @@ from sage.rings.ring_extension_conversion cimport backend_parent, backend_elemen # I don't trust the operator == -cdef are_equal_morphisms(f, g) noexcept: +cdef are_equal_morphisms(f, g): r""" Return ``True`` if ``f`` and ``g`` coincide on the generators of the domain, ``False`` otherwise. @@ -227,7 +227,7 @@ cdef class RingExtensionHomomorphism(RingMap): """ return "Ring" - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): r""" Return the image of ``x`` under this morphism. @@ -318,7 +318,7 @@ cdef class RingExtensionHomomorphism(RingMap): base_map = base_map.extend_codomain(self.codomain()) return base_map - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): r""" Compare this element with ``other`` according to the rich comparison operator ``op``. @@ -494,7 +494,7 @@ cdef class RingExtensionHomomorphism(RingMap): else: return backend - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper function for copying and pickling. @@ -512,7 +512,7 @@ cdef class RingExtensionHomomorphism(RingMap): self._backend = _slots['_backend'] RingMap._update_slots(self, _slots) - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper function for copying and pickling. @@ -598,7 +598,7 @@ cdef class RingExtensionBackendIsomorphism(RingExtensionHomomorphism): """ return "" - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): r""" Return the image of ``x`` under this morphism. @@ -688,7 +688,7 @@ cdef class RingExtensionBackendReverseIsomorphism(RingExtensionHomomorphism): """ return "" - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): r""" Return the image of ``x`` under this morphism. @@ -771,7 +771,7 @@ cdef class MapFreeModuleToRelativeRing(Map): """ return True - cpdef Element _call_(self, v) noexcept: + cpdef Element _call_(self, v): r""" Return the image of ``x`` under this morphism. @@ -880,7 +880,7 @@ cdef class MapRelativeRingToFreeModule(Map): """ return True - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): r""" Return the image of ``x`` under this morphism. @@ -898,7 +898,7 @@ cdef class MapRelativeRingToFreeModule(Map): coeffs = self.backend_coefficients(x) return self.codomain()(coeffs) - cdef list backend_coefficients(self, RingExtensionElement x) noexcept: + cdef list backend_coefficients(self, RingExtensionElement x): r""" Return the coordinates of the image of ``x`` as elements of the backend ring. diff --git a/src/sage/rings/semirings/tropical_semiring.pyx b/src/sage/rings/semirings/tropical_semiring.pyx index 3f25fb8af98..2922298e286 100644 --- a/src/sage/rings/semirings/tropical_semiring.pyx +++ b/src/sage/rings/semirings/tropical_semiring.pyx @@ -38,7 +38,7 @@ cdef class TropicalSemiringElement(Element): """ cdef ModuleElement _val - cdef TropicalSemiringElement _new(self) noexcept: + cdef TropicalSemiringElement _new(self): """ Return a new tropical semiring element with parent ``self`. """ @@ -132,7 +132,7 @@ cdef class TropicalSemiringElement(Element): return hash(self._val) # Comparisons - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): r""" Return the standard comparison of ``left`` and ``right``. @@ -206,7 +206,7 @@ cdef class TropicalSemiringElement(Element): return rich_to_bool(op, 1) return rich_to_bool(op, 0) - cpdef _add_(left, right) noexcept: + cpdef _add_(left, right): """ Add ``left`` to ``right``. @@ -274,7 +274,7 @@ cdef class TropicalSemiringElement(Element): return self raise ArithmeticError("cannot negate any non-infinite element") - cpdef _mul_(left, right) noexcept: + cpdef _mul_(left, right): """ Multiply ``left`` and ``right``. @@ -300,7 +300,7 @@ cdef class TropicalSemiringElement(Element): x._val = self._val + rhs._val return x - cpdef _div_(left, right) noexcept: + cpdef _div_(left, right): """ Divide ``left`` by ``right``. @@ -398,7 +398,7 @@ cdef class TropicalSemiringElement(Element): from sage.rings.infinity import infinity return infinity - cpdef ModuleElement lift(self) noexcept: + cpdef ModuleElement lift(self): """ Return the value of ``self`` lifted to the base. @@ -656,7 +656,7 @@ cdef class TropicalToTropical(Map): Map from the tropical semiring to itself (possibly with different bases). Used in coercion. """ - cpdef TropicalSemiringElement _call_(self, x) noexcept: + cpdef TropicalSemiringElement _call_(self, x): """ EXAMPLES:: diff --git a/src/sage/rings/tate_algebra_element.pxd b/src/sage/rings/tate_algebra_element.pxd index 5c529825e4c..3cafe330fb0 100644 --- a/src/sage/rings/tate_algebra_element.pxd +++ b/src/sage/rings/tate_algebra_element.pxd @@ -13,18 +13,18 @@ cdef class TateAlgebraTerm(MonoidElement): cdef pAdicGenericElement _coeff cdef ETuple _exponent - cpdef _mul_(self, other) noexcept - cdef TateAlgebraTerm _floordiv_c(self, TateAlgebraTerm other) noexcept - cpdef _floordiv_(self, other) noexcept + cpdef _mul_(self, other) + cdef TateAlgebraTerm _floordiv_c(self, TateAlgebraTerm other) + cpdef _floordiv_(self, other) - cdef TateAlgebraTerm _new_c(self) noexcept + cdef TateAlgebraTerm _new_c(self) cdef long _valuation_c(self) noexcept cdef long _cmp_c(self, TateAlgebraTerm other) except? 300 - cdef Element _call_c(self, list arg) noexcept - cpdef TateAlgebraTerm monomial(self) noexcept - cpdef TateAlgebraTerm monic(self) noexcept - cdef TateAlgebraTerm _gcd_c(self, TateAlgebraTerm other) noexcept - cdef TateAlgebraTerm _lcm_c(self, TateAlgebraTerm other) noexcept + cdef Element _call_c(self, list arg) + cpdef TateAlgebraTerm monomial(self) + cpdef TateAlgebraTerm monic(self) + cdef TateAlgebraTerm _gcd_c(self, TateAlgebraTerm other) + cdef TateAlgebraTerm _lcm_c(self, TateAlgebraTerm other) cdef bint _divides_c(self, TateAlgebraTerm other, bint integral) noexcept @@ -35,15 +35,15 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): cdef list _terms_nonzero cdef bint _is_normalized - cdef _normalize(self) noexcept - cdef TateAlgebraElement _new_c(self) noexcept - cdef list _terms_c(self, bint include_zero=*) noexcept - cpdef valuation(self) noexcept - cdef TateAlgebraElement _term_mul_c(self, TateAlgebraTerm term) noexcept - cdef TateAlgebraElement _positive_lshift_c(self, n) noexcept - cdef TateAlgebraElement _lshift_c(self, n) noexcept - cpdef TateAlgebraElement monic(self) noexcept - cdef _quo_rem_c(self, list divisors, bint quo, bint rem, bint integral) noexcept - cdef _quo_rem_check(self, divisors, bint quo, bint rem) noexcept - cdef TateAlgebraElement _Spoly_c(self, TateAlgebraElement other) noexcept + cdef _normalize(self) + cdef TateAlgebraElement _new_c(self) + cdef list _terms_c(self, bint include_zero=*) + cpdef valuation(self) + cdef TateAlgebraElement _term_mul_c(self, TateAlgebraTerm term) + cdef TateAlgebraElement _positive_lshift_c(self, n) + cdef TateAlgebraElement _lshift_c(self, n) + cpdef TateAlgebraElement monic(self) + cdef _quo_rem_c(self, list divisors, bint quo, bint rem, bint integral) + cdef _quo_rem_check(self, divisors, bint quo, bint rem) + cdef TateAlgebraElement _Spoly_c(self, TateAlgebraElement other) diff --git a/src/sage/rings/tate_algebra_element.pyx b/src/sage/rings/tate_algebra_element.pyx index ddb58fcf2c8..ffd400d5159 100644 --- a/src/sage/rings/tate_algebra_element.pyx +++ b/src/sage/rings/tate_algebra_element.pyx @@ -169,7 +169,7 @@ cdef class TateAlgebraTerm(MonoidElement): """ return hash((self._coeff, self._exponent)) - cdef TateAlgebraTerm _new_c(self) noexcept: + cdef TateAlgebraTerm _new_c(self): r""" Fast creation of a Tate algebra term. @@ -312,7 +312,7 @@ cdef class TateAlgebraTerm(MonoidElement): """ return self._exponent - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): r""" Return the product of this Tate algebra term with ``other``. @@ -388,7 +388,7 @@ cdef class TateAlgebraTerm(MonoidElement): c = (ks > ko) - (ks < ko) return c - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): r""" Compare the Tate algebra term with ``other`` according to the rich comparison operator ``op``. @@ -449,7 +449,7 @@ cdef class TateAlgebraTerm(MonoidElement): c = (self)._cmp_c(other) return rich_to_bool_sgn(op, c) - cpdef TateAlgebraTerm monomial(self) noexcept: + cpdef TateAlgebraTerm monomial(self): r""" Return this term divided by its coefficient. @@ -469,7 +469,7 @@ cdef class TateAlgebraTerm(MonoidElement): ans._exponent = self._exponent return ans - cpdef TateAlgebraTerm monic(self) noexcept: + cpdef TateAlgebraTerm monic(self): r""" Return this term normalized so that it has valuation 0 and its coefficient is a power of the uniformizer. @@ -560,7 +560,7 @@ cdef class TateAlgebraTerm(MonoidElement): """ return (self._coeff).valuation_c() - self._exponent.dotprod(self._parent._log_radii) - cdef Element _call_c(self, list arg) noexcept: + cdef Element _call_c(self, list arg): """ Return this term evaluated at ``args``. @@ -728,7 +728,7 @@ cdef class TateAlgebraTerm(MonoidElement): """ return self._gcd_c(other) - cdef TateAlgebraTerm _gcd_c(self, TateAlgebraTerm other) noexcept: + cdef TateAlgebraTerm _gcd_c(self, TateAlgebraTerm other): r""" Return the greatest common divisor of this term and ``other``. @@ -798,7 +798,7 @@ cdef class TateAlgebraTerm(MonoidElement): """ return self._lcm_c(other) - cdef TateAlgebraTerm _lcm_c(self, TateAlgebraTerm other) noexcept: + cdef TateAlgebraTerm _lcm_c(self, TateAlgebraTerm other): r""" Return the least common multiple of two Tate terms. @@ -983,7 +983,7 @@ cdef class TateAlgebraTerm(MonoidElement): return False return True - cpdef _floordiv_(self, other) noexcept: + cpdef _floordiv_(self, other): r""" Return the result of the exact division of this term by ``other``. @@ -1016,7 +1016,7 @@ cdef class TateAlgebraTerm(MonoidElement): return (self)._floordiv_c(other) - cdef TateAlgebraTerm _floordiv_c(self, TateAlgebraTerm other) noexcept: + cdef TateAlgebraTerm _floordiv_c(self, TateAlgebraTerm other): r""" Return the result of the exact division of this term by ``other``. @@ -1123,7 +1123,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): if not parent.base_ring().is_field() and self.valuation() < 0: raise ValueError("this series is not in the ring of integers") - cdef TateAlgebraElement _new_c(self) noexcept: + cdef TateAlgebraElement _new_c(self): """ Fast creation of a new Tate series. @@ -1141,7 +1141,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ans._terms = ans._terms_nonzero = None return ans - cdef _normalize(self) noexcept: + cdef _normalize(self): """ Normalize this series. @@ -1282,7 +1282,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): s += "O\\left(%s^{%s} %s\\right)" % (self._parent._uniformizer_latex, self._prec, self._parent.integer_ring()._latex_()) return s - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): r""" Return the sum of this series and ``other``. @@ -1317,7 +1317,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ans._normalize() return ans - cpdef _neg_(self) noexcept: + cpdef _neg_(self): r""" Return the opposite of this series. @@ -1337,7 +1337,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ans._prec = self._prec return ans - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): r""" Return the difference of this series and ``other``. @@ -1370,7 +1370,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ans._normalize() return ans - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): r""" Return the product of this series with ``other``. @@ -1405,7 +1405,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ans._normalize() return ans - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): r""" Return the product of this series by ``right``. @@ -1794,7 +1794,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): return root - cpdef _richcmp_(self, other, int op) noexcept: + cpdef _richcmp_(self, other, int op): r""" Compare this series with ``other`` according to the rich comparison operator ``op``. @@ -1933,7 +1933,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): pass return res - cdef TateAlgebraElement _term_mul_c(self, TateAlgebraTerm term) noexcept: + cdef TateAlgebraElement _term_mul_c(self, TateAlgebraTerm term): r""" Return the product of this series by the term ``term``. @@ -1954,7 +1954,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ans._prec = self._prec + term._valuation_c() return ans - cdef TateAlgebraElement _positive_lshift_c(self, n) noexcept: + cdef TateAlgebraElement _positive_lshift_c(self, n): r""" Return the product of this series by the ``n``-th power of the uniformizer. @@ -1983,7 +1983,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): ans._prec = self._prec + n return ans - cdef TateAlgebraElement _lshift_c(self, n) noexcept: + cdef TateAlgebraElement _lshift_c(self, n): r""" Return the product of this series by the ``n``-th power of the uniformizer. @@ -2202,7 +2202,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): self._terms = None return self._terms_c() - cdef list _terms_c(self, bint include_zero=True) noexcept: + cdef list _terms_c(self, bint include_zero=True): r""" Return a list of the terms of this series sorted in descending order. @@ -2465,7 +2465,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): """ return self._prec - cpdef valuation(self) noexcept: + cpdef valuation(self): r""" Return the valuation of this series. @@ -2960,7 +2960,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): """ return self.leading_term(secure=secure).monomial() - cpdef TateAlgebraElement monic(self) noexcept: + cpdef TateAlgebraElement monic(self): r""" Return this series normalized so that it has valuation 0 and its leading coefficient is a power of the uniformizer. @@ -3181,7 +3181,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): poly = self._parent._polynomial_ring(self._poly) return poly.change_ring(Rn) - cdef _quo_rem_c(self, list divisors, bint quo, bint rem, bint integral) noexcept: + cdef _quo_rem_c(self, list divisors, bint quo, bint rem, bint integral): r""" Perform the division of this series by ``divisors``. @@ -3254,7 +3254,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): f._terms = None return quos, f - cdef _quo_rem_check(self, divisors, bint quo, bint rem) noexcept: + cdef _quo_rem_check(self, divisors, bint quo, bint rem): """ Perform the division of this series by ``divisors``. @@ -3510,7 +3510,7 @@ cdef class TateAlgebraElement(CommutativeAlgebraElement): except IndexError: raise ValueError("the S-polynomial of zero is not defined") - cdef TateAlgebraElement _Spoly_c(self, TateAlgebraElement other) noexcept: + cdef TateAlgebraElement _Spoly_c(self, TateAlgebraElement other): """ Return the S-polynomial of this series and ``other``. diff --git a/src/sage/rings/tate_algebra_ideal.pxd b/src/sage/rings/tate_algebra_ideal.pxd index d6c239b9a0c..e5581e06b8c 100644 --- a/src/sage/rings/tate_algebra_ideal.pxd +++ b/src/sage/rings/tate_algebra_ideal.pxd @@ -1,6 +1,6 @@ from sage.rings.tate_algebra_element cimport TateAlgebraTerm from sage.rings.tate_algebra_element cimport TateAlgebraElement -cdef Jpair(p1, p2) noexcept -cdef TateAlgebraElement regular_reduce(sgb, TateAlgebraTerm s, TateAlgebraElement v, stopval) noexcept -cdef TateAlgebraElement reduce(gb, TateAlgebraElement v, stopval) noexcept +cdef Jpair(p1, p2) +cdef TateAlgebraElement regular_reduce(sgb, TateAlgebraTerm s, TateAlgebraElement v, stopval) +cdef TateAlgebraElement reduce(gb, TateAlgebraElement v, stopval) diff --git a/src/sage/rings/tate_algebra_ideal.pyx b/src/sage/rings/tate_algebra_ideal.pyx index b27c98110a3..802984874b7 100644 --- a/src/sage/rings/tate_algebra_ideal.pyx +++ b/src/sage/rings/tate_algebra_ideal.pyx @@ -567,7 +567,7 @@ def groebner_basis_buchberger(I, prec, py_integral): # F5 algorithms -cdef Jpair(p1, p2) noexcept: +cdef Jpair(p1, p2): r""" Return the J-pair of ``p1`` and ``p2`` @@ -605,7 +605,7 @@ cdef Jpair(p1, p2) noexcept: return su2, t2*v2 -cdef TateAlgebraElement regular_reduce(sgb, TateAlgebraTerm s, TateAlgebraElement v, stopval) noexcept: +cdef TateAlgebraElement regular_reduce(sgb, TateAlgebraTerm s, TateAlgebraElement v, stopval): r""" Return the result of the regular reduction of the pair ``(s,v)`` by ``sgb`` @@ -689,7 +689,7 @@ cdef TateAlgebraElement regular_reduce(sgb, TateAlgebraTerm s, TateAlgebraElemen return f -cdef TateAlgebraElement reduce(gb, TateAlgebraElement v, stopval) noexcept: +cdef TateAlgebraElement reduce(gb, TateAlgebraElement v, stopval): r""" Return the result of the reduction of ``v`` by ``gb`` diff --git a/src/sage/schemes/elliptic_curves/mod_sym_num.pyx b/src/sage/schemes/elliptic_curves/mod_sym_num.pyx index daca96b9f97..a131dc8a47c 100644 --- a/src/sage/schemes/elliptic_curves/mod_sym_num.pyx +++ b/src/sage/schemes/elliptic_curves/mod_sym_num.pyx @@ -2014,7 +2014,7 @@ cdef class ModularSymbolNumerical: Integer epsQ, Integer epsQQ, llong* wQ, llong* wQQ, int T, int prec, double eps, - int use_partials=2) noexcept: + int use_partials=2): r""" This is just a helper function for _from_r_to_rr_approx. In case the integral is evaluated directly this function is called. diff --git a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx index ec1198b296e..60c132db2d1 100644 --- a/src/sage/schemes/elliptic_curves/period_lattice_region.pyx +++ b/src/sage/schemes/elliptic_curves/period_lattice_region.pyx @@ -665,7 +665,7 @@ cdef class PeriodicRegion: return sum(L, F) -cdef frame_data(data, bint full=True) noexcept: +cdef frame_data(data, bint full=True): """ Helper function for PeriodicRegion.expand() and PeriodicRegion.border(). This makes "wrapping around" work @@ -695,7 +695,7 @@ cdef frame_data(data, bint full=True) noexcept: framed[-1,:] = framed[-3,:] return framed -cdef unframe_data(framed, bint full=True) noexcept: +cdef unframe_data(framed, bint full=True): """ Helper function for PeriodicRegion.expand(). This glues the borders together using the "or" operator. diff --git a/src/sage/schemes/toric/divisor_class.pyx b/src/sage/schemes/toric/divisor_class.pyx index 3c9a9143eaf..5a92fe5b38d 100644 --- a/src/sage/schemes/toric/divisor_class.pyx +++ b/src/sage/schemes/toric/divisor_class.pyx @@ -137,7 +137,7 @@ cdef class ToricRationalDivisorClass(Vector_rational_dense): (self._parent, list(self), self._degree, not self._is_immutable)) - cpdef _act_on_(self, other, bint self_on_left) noexcept: + cpdef _act_on_(self, other, bint self_on_left): """ Act on ``other``. @@ -202,7 +202,7 @@ cdef class ToricRationalDivisorClass(Vector_rational_dense): # Now let the standard framework work... return Vector_rational_dense._act_on_(self, other, self_on_left) - cpdef _dot_product_(self, Vector right) noexcept: + cpdef _dot_product_(self, Vector right): r""" Raise a ``TypeError`` exception. diff --git a/src/sage/sets/finite_set_map_cy.pxd b/src/sage/sets/finite_set_map_cy.pxd index 998e4f58729..daa46c099e0 100644 --- a/src/sage/sets/finite_set_map_cy.pxd +++ b/src/sage/sets/finite_set_map_cy.pxd @@ -5,29 +5,29 @@ # http://www.gnu.org/licenses/ #***************************************************************************** -cpdef fibers(f, domain) noexcept +cpdef fibers(f, domain) from sage.structure.parent cimport Parent from sage.structure.list_clone cimport ClonableIntArray cdef class FiniteSetMap_MN(ClonableIntArray): - cpdef _setimage(self, int i, int j) noexcept - cpdef _getimage(self, int i) noexcept - cpdef setimage(self, i, j) noexcept - cpdef getimage(self, i) noexcept - cpdef domain(self) noexcept - cpdef codomain(self) noexcept - cpdef image_set(self) noexcept - cpdef fibers(self) noexcept - cpdef items(self) noexcept + cpdef _setimage(self, int i, int j) + cpdef _getimage(self, int i) + cpdef setimage(self, i, j) + cpdef getimage(self, i) + cpdef domain(self) + cpdef codomain(self) + cpdef image_set(self) + cpdef fibers(self) + cpdef items(self) cpdef FiniteSetMap_MN _compose_internal_(self, FiniteSetMap_MN other, - Parent resParent) noexcept - cpdef check(self) noexcept + Parent resParent) + cpdef check(self) cdef class FiniteSetMap_Set(FiniteSetMap_MN): pass -cpdef FiniteSetMap_Set FiniteSetMap_Set_from_list(cls, parent, lst) noexcept -cpdef FiniteSetMap_Set FiniteSetMap_Set_from_dict(cls, parent, d) noexcept +cpdef FiniteSetMap_Set FiniteSetMap_Set_from_list(cls, parent, lst) +cpdef FiniteSetMap_Set FiniteSetMap_Set_from_dict(cls, parent, d) cdef class FiniteSetEndoMap_N(FiniteSetMap_MN): pass cdef class FiniteSetEndoMap_Set(FiniteSetMap_Set): pass diff --git a/src/sage/sets/finite_set_map_cy.pyx b/src/sage/sets/finite_set_map_cy.pyx index 1fad423fb81..a06dc0a2bd9 100644 --- a/src/sage/sets/finite_set_map_cy.pyx +++ b/src/sage/sets/finite_set_map_cy.pyx @@ -58,7 +58,7 @@ from sage.arith.power cimport generic_power from sage.sets.set import Set_object_enumerated -cpdef fibers(f, domain) noexcept: +cpdef fibers(f, domain): r""" Returns the fibers of the function ``f`` on the finite set ``domain`` @@ -157,7 +157,7 @@ cdef class FiniteSetMap_MN(ClonableIntArray): """ return True - cpdef domain(self) noexcept: + cpdef domain(self): """ Returns the domain of ``self`` @@ -168,7 +168,7 @@ cdef class FiniteSetMap_MN(ClonableIntArray): """ return self._parent.domain() - cpdef codomain(self) noexcept: + cpdef codomain(self): """ Returns the codomain of ``self`` @@ -179,7 +179,7 @@ cdef class FiniteSetMap_MN(ClonableIntArray): """ return self._parent.codomain() - cpdef _setimage(self, int i, int j) noexcept: + cpdef _setimage(self, int i, int j): """ Set the image of ``i`` as ``j`` in ``self`` @@ -221,7 +221,7 @@ cdef class FiniteSetMap_MN(ClonableIntArray): """ self._setitem(i, j) - cpdef _getimage(self, int i) noexcept: + cpdef _getimage(self, int i): """ Returns the image of ``i`` by ``self`` @@ -239,7 +239,7 @@ cdef class FiniteSetMap_MN(ClonableIntArray): """ return self._getitem(i) - cpdef setimage(self, i, j) noexcept: + cpdef setimage(self, i, j): """ Set the image of ``i`` as ``j`` in ``self`` @@ -268,7 +268,7 @@ cdef class FiniteSetMap_MN(ClonableIntArray): """ self._setitem(int(i), int(j)) - cpdef getimage(self, i) noexcept: + cpdef getimage(self, i): """ Returns the image of ``i`` by ``self`` @@ -286,7 +286,7 @@ cdef class FiniteSetMap_MN(ClonableIntArray): """ return self._getitem(int(i)) - cpdef image_set(self) noexcept: + cpdef image_set(self): """ Returns the image set of ``self`` @@ -299,7 +299,7 @@ cdef class FiniteSetMap_MN(ClonableIntArray): """ return Set_object_enumerated(self) - cpdef fibers(self) noexcept: + cpdef fibers(self): """ Returns the fibers of ``self`` @@ -318,7 +318,7 @@ cdef class FiniteSetMap_MN(ClonableIntArray): """ return fibers(self, self.domain()) - cpdef items(self) noexcept: + cpdef items(self): """ The items of ``self`` @@ -331,7 +331,7 @@ cdef class FiniteSetMap_MN(ClonableIntArray): """ return [(i, self._getimage(i)) for i in self.domain()] - cpdef check(self) noexcept: + cpdef check(self): """ Performs checks on ``self`` @@ -362,7 +362,7 @@ cdef class FiniteSetMap_MN(ClonableIntArray): self._parent.check_element(self) cpdef FiniteSetMap_MN _compose_internal_(self, FiniteSetMap_MN other, - Parent resParent) noexcept: + Parent resParent): """ TESTS:: @@ -383,7 +383,7 @@ cdef class FiniteSetMap_MN(ClonableIntArray): return res -cpdef FiniteSetMap_Set FiniteSetMap_Set_from_list(t, parent, lst) noexcept: +cpdef FiniteSetMap_Set FiniteSetMap_Set_from_list(t, parent, lst): """ Creates a ``FiniteSetMap`` from a list @@ -406,7 +406,7 @@ cpdef FiniteSetMap_Set FiniteSetMap_Set_from_list(t, parent, lst) noexcept: super(FiniteSetMap_MN, res).__init__(parent, lst) return res -cpdef FiniteSetMap_Set FiniteSetMap_Set_from_dict(t, parent, d) noexcept: +cpdef FiniteSetMap_Set FiniteSetMap_Set_from_dict(t, parent, d): """ Creates a ``FiniteSetMap`` from a dictionary @@ -491,7 +491,7 @@ cdef class FiniteSetMap_Set(FiniteSetMap_MN): parent = self._parent return parent._unrank_codomain(self._getitem(parent._rank_domain(i))) - cpdef image_set(self) noexcept: + cpdef image_set(self): """ Returns the image set of ``self`` @@ -507,7 +507,7 @@ cdef class FiniteSetMap_Set(FiniteSetMap_MN): image_i = self._parent._unrank_codomain return Set_object_enumerated([image_i(i) for i in self]) - cpdef setimage(self, i, j) noexcept: + cpdef setimage(self, i, j): """ Set the image of ``i`` as ``j`` in ``self`` @@ -550,7 +550,7 @@ cdef class FiniteSetMap_Set(FiniteSetMap_MN): parent = self._parent return self._setitem(parent._rank_domain(i), parent._rank_codomain(j)) - cpdef getimage(self, i) noexcept: + cpdef getimage(self, i): """ Returns the image of ``i`` by ``self`` @@ -568,7 +568,7 @@ cdef class FiniteSetMap_Set(FiniteSetMap_MN): parent = self._parent return parent._unrank_codomain(self._getitem(parent._rank_domain(i))) - cpdef items(self) noexcept: + cpdef items(self): """ The items of ``self`` diff --git a/src/sage/sets/pythonclass.pxd b/src/sage/sets/pythonclass.pxd index 70c24f64d9c..4346d918386 100644 --- a/src/sage/sets/pythonclass.pxd +++ b/src/sage/sets/pythonclass.pxd @@ -5,4 +5,4 @@ cdef class Set_PythonType_class(Set_generic): cdef type _type -cpdef Set_PythonType(typ) noexcept +cpdef Set_PythonType(typ) diff --git a/src/sage/sets/pythonclass.pyx b/src/sage/sets/pythonclass.pyx index ed8c6d940c2..bfa7f3bc617 100644 --- a/src/sage/sets/pythonclass.pyx +++ b/src/sage/sets/pythonclass.pyx @@ -19,7 +19,7 @@ from sage.categories.sets_cat import Sets cdef dict _type_set_cache = {} -cpdef Set_PythonType(typ) noexcept: +cpdef Set_PythonType(typ): """ Return the (unique) Parent that represents the set of Python objects of a specified type. diff --git a/src/sage/sets/recursively_enumerated_set.pxd b/src/sage/sets/recursively_enumerated_set.pxd index 7df7e28ec28..48c8312456c 100644 --- a/src/sage/sets/recursively_enumerated_set.pxd +++ b/src/sage/sets/recursively_enumerated_set.pxd @@ -16,15 +16,15 @@ cdef class RecursivelyEnumeratedSet_generic(sage.structure.parent.Parent): cdef readonly _max_depth cdef readonly _graded_component - cpdef seeds(self) noexcept - cpdef graded_component(self, depth) noexcept + cpdef seeds(self) + cpdef graded_component(self, depth) cdef class RecursivelyEnumeratedSet_symmetric(RecursivelyEnumeratedSet_generic): - cdef set _get_next_graded_component(self, set A, set B) noexcept + cdef set _get_next_graded_component(self, set A, set B) - cpdef graded_component(self, depth) noexcept + cpdef graded_component(self, depth) cdef class RecursivelyEnumeratedSet_graded(RecursivelyEnumeratedSet_generic): - cdef set _get_next_graded_component(self, set B) noexcept + cdef set _get_next_graded_component(self, set B) - cpdef graded_component(self, depth) noexcept + cpdef graded_component(self, depth) diff --git a/src/sage/sets/recursively_enumerated_set.pyx b/src/sage/sets/recursively_enumerated_set.pyx index e25dde0485c..56bd8d16850 100644 --- a/src/sage/sets/recursively_enumerated_set.pyx +++ b/src/sage/sets/recursively_enumerated_set.pyx @@ -670,7 +670,7 @@ cdef class RecursivelyEnumeratedSet_generic(Parent): L.append("with max_depth={}".format(self._max_depth)) return " ".join(L) - cpdef seeds(self) noexcept: + cpdef seeds(self): r""" Return an iterable over the seeds of ``self``. @@ -720,7 +720,7 @@ cdef class RecursivelyEnumeratedSet_generic(Parent): raise NotImplementedError("graded_component_iterator method currently" " implemented only for graded or symmetric structure") - cpdef graded_component(self, depth) noexcept: + cpdef graded_component(self, depth): r""" Return the graded component of given depth. @@ -1149,7 +1149,7 @@ cdef class RecursivelyEnumeratedSet_symmetric(RecursivelyEnumeratedSet_generic): yield B A, B = B, self._get_next_graded_component(A, B) - cpdef graded_component(self, depth) noexcept: + cpdef graded_component(self, depth): r""" Return the graded component of given depth. @@ -1216,7 +1216,7 @@ cdef class RecursivelyEnumeratedSet_symmetric(RecursivelyEnumeratedSet_generic): self._graded_component.append(C) return self._graded_component[depth] - cdef set _get_next_graded_component(self, set A, set B) noexcept: + cdef set _get_next_graded_component(self, set A, set B): r""" Return the set of elements of depth `n+1`. @@ -1371,7 +1371,7 @@ cdef class RecursivelyEnumeratedSet_graded(RecursivelyEnumeratedSet_generic): yield B B = self._get_next_graded_component(B) - cpdef graded_component(self, depth) noexcept: + cpdef graded_component(self, depth): r""" Return the graded component of given depth. @@ -1434,7 +1434,7 @@ cdef class RecursivelyEnumeratedSet_graded(RecursivelyEnumeratedSet_generic): self._graded_component.append(C) return self._graded_component[depth] - cdef set _get_next_graded_component(self, set B) noexcept: + cdef set _get_next_graded_component(self, set B): r""" Return the set of elements of depth `n+1`. diff --git a/src/sage/stats/hmm/chmm.pyx b/src/sage/stats/hmm/chmm.pyx index 905a77ed385..f0940c5849d 100644 --- a/src/sage/stats/hmm/chmm.pyx +++ b/src/sage/stats/hmm/chmm.pyx @@ -446,7 +446,7 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): return obs, states - cdef probability_init(self) noexcept: + cdef probability_init(self): r""" Used internally to compute caching information that makes certain computations in the Baum-Welch algorithm faster. This @@ -716,7 +716,7 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): return state_sequence, mx - cdef TimeSeries _backward_scale_all(self, TimeSeries obs, TimeSeries scale) noexcept: + cdef TimeSeries _backward_scale_all(self, TimeSeries obs, TimeSeries scale): r""" This function returns the matrix beta_t(i), and is used internally as part of the Baum-Welch algorithm. @@ -756,7 +756,7 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): t -= 1 return beta - cdef _forward_scale_all(self, TimeSeries obs) noexcept: + cdef _forward_scale_all(self, TimeSeries obs): r""" Return scaled values alpha_t(i), the sequence of scalings, and the log probability. @@ -821,7 +821,7 @@ cdef class GaussianHiddenMarkovModel(HiddenMarkovModel): # Termination return alpha, scale, log_probability - cdef TimeSeries _baum_welch_xi(self, TimeSeries alpha, TimeSeries beta, TimeSeries obs) noexcept: + cdef TimeSeries _baum_welch_xi(self, TimeSeries alpha, TimeSeries beta, TimeSeries obs): r""" Used internally to compute the scaled quantity xi_t(i,j) appearing in the Baum-Welch reestimation algorithm. @@ -1292,7 +1292,7 @@ cdef class GaussianMixtureHiddenMarkovModel(GaussianHiddenMarkovModel): return G.prob(observation) cdef TimeSeries _baum_welch_mixed_gamma(self, TimeSeries alpha, TimeSeries beta, - TimeSeries obs, int j) noexcept: + TimeSeries obs, int j): r""" Let gamma_t(j,m) be the m-component (in the mixture) of the probability of being in state j at time t, given the diff --git a/src/sage/stats/hmm/distributions.pxd b/src/sage/stats/hmm/distributions.pxd index 7d613b22a64..73e4dbc6a9b 100644 --- a/src/sage/stats/hmm/distributions.pxd +++ b/src/sage/stats/hmm/distributions.pxd @@ -25,7 +25,7 @@ cdef class GaussianMixtureDistribution(Distribution): cdef double _sample(self, randstate rstate) noexcept cpdef double prob(self, double x) noexcept cpdef double prob_m(self, double x, int m) noexcept - cpdef is_fixed(self, i=?) noexcept + cpdef is_fixed(self, i=?) diff --git a/src/sage/stats/hmm/distributions.pyx b/src/sage/stats/hmm/distributions.pyx index 0a27533d74e..dd4860317e1 100644 --- a/src/sage/stats/hmm/distributions.pyx +++ b/src/sage/stats/hmm/distributions.pyx @@ -283,7 +283,7 @@ cdef class GaussianMixtureDistribution(Distribution): """ return self.c0._length - cpdef is_fixed(self, i=None) noexcept: + cpdef is_fixed(self, i=None): r""" Return whether or not this :class:`GaussianMixtureDistribution` is fixed when using Baum-Welch to update the corresponding HMM. diff --git a/src/sage/stats/hmm/hmm.pxd b/src/sage/stats/hmm/hmm.pxd index f67de100a92..1abcb95392b 100644 --- a/src/sage/stats/hmm/hmm.pxd +++ b/src/sage/stats/hmm/hmm.pxd @@ -13,5 +13,5 @@ cdef class HiddenMarkovModel: cdef int N cdef TimeSeries A, pi - cdef TimeSeries _baum_welch_gamma(self, TimeSeries alpha, TimeSeries beta) noexcept + cdef TimeSeries _baum_welch_gamma(self, TimeSeries alpha, TimeSeries beta) diff --git a/src/sage/stats/hmm/hmm.pyx b/src/sage/stats/hmm/hmm.pyx index f4a61111794..0935c9398ee 100644 --- a/src/sage/stats/hmm/hmm.pyx +++ b/src/sage/stats/hmm/hmm.pyx @@ -224,7 +224,7 @@ cdef class HiddenMarkovModel: # Some internal functions used for various general # HMM algorithms. ######################################################### - cdef TimeSeries _baum_welch_gamma(self, TimeSeries alpha, TimeSeries beta) noexcept: + cdef TimeSeries _baum_welch_gamma(self, TimeSeries alpha, TimeSeries beta): r""" Used internally to compute the scaled quantity gamma_t(j) appearing in the Baum-Welch reestimation algorithm. @@ -897,7 +897,7 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): else: return self._viterbi(obs) - cpdef _viterbi(self, IntList obs) noexcept: + cpdef _viterbi(self, IntList obs): r""" Used internally to compute the viterbi path, without rescaling. This can be useful for short sequences. @@ -977,7 +977,7 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): return state_sequence, log(mx) - cpdef _viterbi_scale(self, IntList obs) noexcept: + cpdef _viterbi_scale(self, IntList obs): r""" Used internally to compute the viterbi path with rescaling. @@ -1061,7 +1061,7 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): return state_sequence, mx - cdef TimeSeries _backward_scale_all(self, IntList obs, TimeSeries scale) noexcept: + cdef TimeSeries _backward_scale_all(self, IntList obs, TimeSeries scale): r""" Return the scaled matrix of values `\beta_t(i)` that appear in the backtracking algorithm. This function is used internally @@ -1108,7 +1108,7 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): t -= 1 return beta - cdef _forward_scale_all(self, IntList obs) noexcept: + cdef _forward_scale_all(self, IntList obs): r""" Return scaled values alpha_t(i), the sequence of scalings, and the log probability. @@ -1169,7 +1169,7 @@ cdef class DiscreteHiddenMarkovModel(HiddenMarkovModel): # Termination return alpha, scale, log_probability - cdef TimeSeries _baum_welch_xi(self, TimeSeries alpha, TimeSeries beta, IntList obs) noexcept: + cdef TimeSeries _baum_welch_xi(self, TimeSeries alpha, TimeSeries beta, IntList obs): r""" Used internally to compute the scaled quantity xi_t(i,j) appearing in the Baum-Welch reestimation algorithm. diff --git a/src/sage/stats/hmm/util.pxd b/src/sage/stats/hmm/util.pxd index 84a0e201a1b..b0d399d9aaf 100644 --- a/src/sage/stats/hmm/util.pxd +++ b/src/sage/stats/hmm/util.pxd @@ -1,7 +1,7 @@ from sage.stats.time_series cimport TimeSeries cdef class HMM_Util: - cpdef normalize_probability_TimeSeries(self, TimeSeries T, Py_ssize_t i, Py_ssize_t j) noexcept - cpdef TimeSeries initial_probs_to_TimeSeries(self, pi, bint normalize) noexcept - cpdef TimeSeries state_matrix_to_TimeSeries(self, A, int N, bint normalize) noexcept + cpdef normalize_probability_TimeSeries(self, TimeSeries T, Py_ssize_t i, Py_ssize_t j) + cpdef TimeSeries initial_probs_to_TimeSeries(self, pi, bint normalize) + cpdef TimeSeries state_matrix_to_TimeSeries(self, A, int N, bint normalize) diff --git a/src/sage/stats/hmm/util.pyx b/src/sage/stats/hmm/util.pyx index fc849742b80..553eb997364 100644 --- a/src/sage/stats/hmm/util.pyx +++ b/src/sage/stats/hmm/util.pyx @@ -22,7 +22,7 @@ cdef class HMM_Util: """ A class used in order to share cdef's methods between different files. """ - cpdef normalize_probability_TimeSeries(self, TimeSeries T, Py_ssize_t i, Py_ssize_t j) noexcept: + cpdef normalize_probability_TimeSeries(self, TimeSeries T, Py_ssize_t i, Py_ssize_t j): """ This function is used internally by the Hidden Markov Models code. @@ -86,7 +86,7 @@ cdef class HMM_Util: - cpdef TimeSeries initial_probs_to_TimeSeries(self, pi, bint normalize) noexcept: + cpdef TimeSeries initial_probs_to_TimeSeries(self, pi, bint normalize): """ This function is used internally by the __init__ methods of various Hidden Markov Models. @@ -125,7 +125,7 @@ cdef class HMM_Util: return T - cpdef TimeSeries state_matrix_to_TimeSeries(self, A, int N, bint normalize) noexcept: + cpdef TimeSeries state_matrix_to_TimeSeries(self, A, int N, bint normalize): """ This function is used internally by the ``__init__`` methods of Hidden Markov Models to make a transition matrix from ``A``. diff --git a/src/sage/stats/intlist.pyx b/src/sage/stats/intlist.pyx index ce5abfc8b7b..fccbb56e680 100644 --- a/src/sage/stats/intlist.pyx +++ b/src/sage/stats/intlist.pyx @@ -544,7 +544,7 @@ cdef class IntList: return self.time_series().plot_histogram(*args, **kwds) -cdef IntList new_int_list(Py_ssize_t length) noexcept: +cdef IntList new_int_list(Py_ssize_t length): """ Function that is used internally to quickly create a new intlist without initializing any of the allocated memory. diff --git a/src/sage/stats/time_series.pxd b/src/sage/stats/time_series.pxd index 7a044b52da9..86a9095ba75 100644 --- a/src/sage/stats/time_series.pxd +++ b/src/sage/stats/time_series.pxd @@ -1,5 +1,5 @@ cdef class TimeSeries: cdef double* _values cdef Py_ssize_t _length - cpdef rescale(self, double s) noexcept + cpdef rescale(self, double s) cpdef double sum(self) noexcept diff --git a/src/sage/stats/time_series.pyx b/src/sage/stats/time_series.pyx index ce51e65baab..d6823f85add 100644 --- a/src/sage/stats/time_series.pyx +++ b/src/sage/stats/time_series.pyx @@ -892,7 +892,7 @@ cdef class TimeSeries: t._values[i] = self._values[i*k] return t - cpdef rescale(self, double s) noexcept: + cpdef rescale(self, double s): r""" Change ``self`` by multiplying every value in the series by ``s``. @@ -2514,7 +2514,7 @@ cdef class TimeSeries: return y -cdef new_time_series(Py_ssize_t length) noexcept: +cdef new_time_series(Py_ssize_t length): r""" Return a new uninitialized time series of the given length. The entries of the time series are garbage. diff --git a/src/sage/structure/category_object.pxd b/src/sage/structure/category_object.pxd index 6bd450c4f68..83d3d4967d4 100644 --- a/src/sage/structure/category_object.pxd +++ b/src/sage/structure/category_object.pxd @@ -10,7 +10,7 @@ from sage.structure.sage_object cimport SageObject -cpdef check_default_category(default_category, category) noexcept +cpdef check_default_category(default_category, category) cdef class CategoryObject(SageObject): cdef public dict _cached_methods @@ -21,7 +21,7 @@ cdef class CategoryObject(SageObject): cdef object __weakref__ cdef long _hash_value - cdef getattr_from_category(self, name) noexcept + cdef getattr_from_category(self, name) -cpdef normalize_names(Py_ssize_t ngens, names) noexcept +cpdef normalize_names(Py_ssize_t ngens, names) cpdef bint certify_names(names) except -1 diff --git a/src/sage/structure/category_object.pyx b/src/sage/structure/category_object.pyx index 2c25ca4066d..48cee10c2bc 100644 --- a/src/sage/structure/category_object.pyx +++ b/src/sage/structure/category_object.pyx @@ -63,7 +63,7 @@ from sage.misc.cachefunc import cached_method from sage.structure.dynamic_class import DynamicMetaclass -cpdef inline check_default_category(default_category, category) noexcept: +cpdef inline check_default_category(default_category, category): ## The resulting category is guaranteed to be ## a sub-category of the default. if category is None: @@ -848,7 +848,7 @@ cdef class CategoryObject(SageObject): """ return self.getattr_from_category(name) - cdef getattr_from_category(self, name) noexcept: + cdef getattr_from_category(self, name): # Lookup a method or attribute from the category abstract classes. # See __getattr__ above for documentation. try: @@ -913,7 +913,7 @@ cdef class CategoryObject(SageObject): """ return dir_with_other_class(self, self.category().parent_class) -cpdef normalize_names(Py_ssize_t ngens, names) noexcept: +cpdef normalize_names(Py_ssize_t ngens, names): r""" Return a tuple of strings of variable names of length ngens given the input names. diff --git a/src/sage/structure/coerce.pxd b/src/sage/structure/coerce.pxd index 0ab42fe9666..71d519cf185 100644 --- a/src/sage/structure/coerce.pxd +++ b/src/sage/structure/coerce.pxd @@ -1,8 +1,8 @@ from sage.structure.parent cimport Parent from sage.structure.coerce_dict cimport TripleDict -cpdef py_scalar_parent(py_type) noexcept -cpdef py_scalar_to_element(py) noexcept +cpdef py_scalar_parent(py_type) +cpdef py_scalar_to_element(py) cpdef bint parent_is_integers(P) except -1 cpdef bint is_numpy_type(t) noexcept cpdef bint is_mpmath_type(t) noexcept @@ -17,26 +17,26 @@ cdef class CoercionModel: # This MUST be a mapping to actions. cdef readonly TripleDict _action_maps - cpdef canonical_coercion(self, x, y) noexcept - cpdef bin_op(self, x, y, op) noexcept - cpdef richcmp(self, x, y, int op) noexcept + cpdef canonical_coercion(self, x, y) + cpdef bin_op(self, x, y, op) + cpdef richcmp(self, x, y, int op) - cpdef coercion_maps(self, R, S) noexcept - cpdef discover_coercion(self, R, S) noexcept - cpdef verify_coercion_maps(self, R, S, homs, bint fix=*) noexcept - cpdef verify_action(self, action, R, S, op, bint fix=*) noexcept + cpdef coercion_maps(self, R, S) + cpdef discover_coercion(self, R, S) + cpdef verify_coercion_maps(self, R, S, homs, bint fix=*) + cpdef verify_action(self, action, R, S, op, bint fix=*) - cpdef get_action(self, R, S, op=*, r=*, s=*) noexcept - cpdef discover_action(self, R, S, op, r=*, s=*) noexcept + cpdef get_action(self, R, S, op=*, r=*, s=*) + cpdef discover_action(self, R, S, op, r=*, s=*) cdef bint _record_exceptions - cpdef _record_exception(self) noexcept + cpdef _record_exception(self) cdef readonly list _exception_stack cdef bint _exceptions_cleared cdef TripleDict _division_parents - cpdef analyse(self, xp, yp, op=*) noexcept - cpdef division_parent(self, Parent P) noexcept + cpdef analyse(self, xp, yp, op=*) + cpdef division_parent(self, Parent P) # Unique global coercion_model instance diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx index 63e84d84b94..888643314f5 100644 --- a/src/sage/structure/coerce.pyx +++ b/src/sage/structure/coerce.pyx @@ -100,7 +100,7 @@ import traceback from fractions import Fraction cdef type FractionType = Fraction -cpdef py_scalar_parent(py_type) noexcept: +cpdef py_scalar_parent(py_type): """ Returns the Sage equivalent of the given python type, if one exists. If there is no equivalent, return None. @@ -184,7 +184,7 @@ cpdef py_scalar_parent(py_type) noexcept: else: return None -cpdef py_scalar_to_element(x) noexcept: +cpdef py_scalar_to_element(x): """ Convert ``x`` to a Sage :class:`~sage.structure.element.Element` if possible. @@ -690,7 +690,7 @@ cdef class CoercionModel: self._exceptions_cleared = True self._exception_stack = [] - cpdef _record_exception(self) noexcept: + cpdef _record_exception(self): r""" Pushes the last exception that occurred onto the stack for later reference, for internal use. @@ -925,7 +925,7 @@ cdef class CoercionModel: print("Result lives in {}".format(res)) return res - cpdef analyse(self, xp, yp, op=mul) noexcept: + cpdef analyse(self, xp, yp, op=mul): """ Emulate the process of doing arithmetic between xp and yp, returning a list of steps and the parent that the result will live in. @@ -1090,7 +1090,7 @@ cdef class CoercionModel: base = parent(self.canonical_coercion(a, b)[0]) return base - cpdef division_parent(self, Parent P) noexcept: + cpdef division_parent(self, Parent P): r""" Deduces where the result of division in ``P`` lies by calculating the inverse of ``P.one()`` or ``P.an_element()``. @@ -1129,7 +1129,7 @@ cdef class CoercionModel: self._division_parents.set(P, None, None, ret) return ret - cpdef bin_op(self, x, y, op) noexcept: + cpdef bin_op(self, x, y, op): """ Execute the operation ``op`` on `x` and `y`. @@ -1277,7 +1277,7 @@ cdef class CoercionModel: # This causes so much headache. raise bin_op_exception(op, x, y) - cpdef canonical_coercion(self, x, y) noexcept: + cpdef canonical_coercion(self, x, y): r""" Given two elements `x` and `y`, with parents `S` and `R` respectively, find a common parent `Z` such that there are coercions @@ -1423,7 +1423,7 @@ cdef class CoercionModel: raise TypeError("no common canonical parent for objects with parents: '%s' and '%s'"%(xp, yp)) - cpdef coercion_maps(self, R, S) noexcept: + cpdef coercion_maps(self, R, S): r""" Give two parents `R` and `S`, return a pair of coercion maps `f: R \rightarrow Z` and `g: S \rightarrow Z` , if such a `Z` @@ -1572,7 +1572,7 @@ cdef class CoercionModel: self._coercion_maps.set(S, R, None, swap) return homs - cpdef verify_coercion_maps(self, R, S, homs, bint fix=False) noexcept: + cpdef verify_coercion_maps(self, R, S, homs, bint fix=False): """ Make sure this is a valid pair of homomorphisms from `R` and `S` to a common parent. This function is used to protect the user against buggy parents. @@ -1641,7 +1641,7 @@ cdef class CoercionModel: return R_map, S_map - cpdef discover_coercion(self, R, S) noexcept: + cpdef discover_coercion(self, R, S): """ This actually implements the finding of coercion maps as described in the :meth:`coercion_maps` method. @@ -1720,7 +1720,7 @@ cdef class CoercionModel: return None - cpdef get_action(self, R, S, op=mul, r=None, s=None) noexcept: + cpdef get_action(self, R, S, op=mul, r=None, s=None): """ Get the action of R on S or S on R associated to the operation op. @@ -1761,7 +1761,7 @@ cdef class CoercionModel: self._action_maps.set(R, S, op, action) return action - cpdef verify_action(self, action, R, S, op, bint fix=True) noexcept: + cpdef verify_action(self, action, R, S, op, bint fix=True): r""" Verify that ``action`` takes an element of R on the left and S on the right, raising an error if not. @@ -1820,7 +1820,7 @@ cdef class CoercionModel: return action - cpdef discover_action(self, R, S, op, r=None, s=None) noexcept: + cpdef discover_action(self, R, S, op, r=None, s=None): """ INPUT: @@ -1958,7 +1958,7 @@ cdef class CoercionModel: return None - cpdef richcmp(self, x, y, int op) noexcept: + cpdef richcmp(self, x, y, int op): """ Given two arbitrary objects ``x`` and ``y``, coerce them to a common parent and compare them using rich comparison operator diff --git a/src/sage/structure/coerce_actions.pyx b/src/sage/structure/coerce_actions.pyx index 7b2e16da49e..e1ff3b378e7 100644 --- a/src/sage/structure/coerce_actions.pyx +++ b/src/sage/structure/coerce_actions.pyx @@ -26,10 +26,10 @@ from sage.categories.action cimport InverseAction, PrecomposedAction from sage.arith.long cimport integer_check_long -cdef _record_exception() noexcept: +cdef _record_exception(): coercion_model._record_exception() -cdef inline an_element(R) noexcept: +cdef inline an_element(R): if isinstance(R, Parent): return R.an_element() else: @@ -118,7 +118,7 @@ cdef class ActOnAction(GenericAction): """ Class for actions defined via the _act_on_ method. """ - cpdef _act_(self, g, x) noexcept: + cpdef _act_(self, g, x): """ TESTS:: @@ -140,7 +140,7 @@ cdef class ActedUponAction(GenericAction): """ Class for actions defined via the _acted_upon_ method. """ - cpdef _act_(self, g, x) noexcept: + cpdef _act_(self, g, x): """ TESTS:: @@ -586,7 +586,7 @@ cdef class ModuleAction(Action): cdef class LeftModuleAction(ModuleAction): - cpdef _act_(self, g, a) noexcept: + cpdef _act_(self, g, a): """ A left module action is an action that takes the ring element as the first argument (the left side) and the module element as the second @@ -623,7 +623,7 @@ cdef class LeftModuleAction(ModuleAction): cdef class RightModuleAction(ModuleAction): - cpdef _act_(self, g, a) noexcept: + cpdef _act_(self, g, a): """ A right module action is an action that takes the module element as the first argument (the left side) and the ring element as the second @@ -743,7 +743,7 @@ cdef class IntegerMulAction(IntegerAction): test = m + (-m) # make sure addition and negation is allowed super().__init__(Z, M, is_left, operator.mul) - cpdef _act_(self, nn, a) noexcept: + cpdef _act_(self, nn, a): """ EXAMPLES: @@ -880,7 +880,7 @@ cdef class IntegerPowAction(IntegerAction): raise TypeError(f"no integer powering action defined on {M}") super().__init__(Z, M, False, operator.pow) - cpdef _act_(self, n, a) noexcept: + cpdef _act_(self, n, a): """ EXAMPLES: @@ -917,7 +917,7 @@ cdef class IntegerPowAction(IntegerAction): return "Integer Powering" -cdef inline fast_mul(a, n) noexcept: +cdef inline fast_mul(a, n): if n < 0: n = -n a = -a @@ -936,7 +936,7 @@ cdef inline fast_mul(a, n) noexcept: n = n >> 1 return sum -cdef inline fast_mul_long(a, long s) noexcept: +cdef inline fast_mul_long(a, long s): # It's important to change the signed s to an unsigned n, # since -LONG_MIN = LONG_MIN. See Issue #17844. cdef unsigned long n diff --git a/src/sage/structure/coerce_dict.pxd b/src/sage/structure/coerce_dict.pxd index 8542545a2f8..2f7f8d3aef4 100644 --- a/src/sage/structure/coerce_dict.pxd +++ b/src/sage/structure/coerce_dict.pxd @@ -19,7 +19,7 @@ cdef class MonoDict: cdef eraser cdef mono_cell* lookup(self, PyObject* key) noexcept - cdef get(self, k) noexcept + cdef get(self, k) cdef int set(self, k, value) except -1 cdef int resize(self) except -1 @@ -45,6 +45,6 @@ cdef class TripleDict: cdef eraser cdef triple_cell* lookup(self, PyObject* key1, PyObject* key2, PyObject* key3) noexcept - cdef get(self, k1, k2, k3) noexcept + cdef get(self, k1, k2, k3) cdef int set(self, k1, k2, k3, value) except -1 cdef int resize(self) except -1 diff --git a/src/sage/structure/coerce_dict.pyx b/src/sage/structure/coerce_dict.pyx index c2d2be34873..bdec7ec97cd 100644 --- a/src/sage/structure/coerce_dict.pyx +++ b/src/sage/structure/coerce_dict.pyx @@ -110,7 +110,7 @@ cdef class ObjectWrapper: cdef PyObject* obj -cdef inline ObjectWrapper wrap(obj) noexcept: +cdef inline ObjectWrapper wrap(obj): """ Wrap a given Python object in an :class:`ObjectWrapper`. """ @@ -126,7 +126,7 @@ cdef inline PyObject* unwrap(w) except? NULL: return (w).obj -cdef extract_mono_cell(mono_cell* cell) noexcept: +cdef extract_mono_cell(mono_cell* cell): """ Take the refcounted components from a mono_cell, put them in a tuple and return it. The mono_cell itself is marked as "freed". @@ -151,7 +151,7 @@ cdef extract_mono_cell(mono_cell* cell) noexcept: return t -cdef extract_triple_cell(triple_cell* cell) noexcept: +cdef extract_triple_cell(triple_cell* cell): # See extract_mono_cell for documentation assert valid(cell.key_id1) t = PyTuple_New(4) @@ -644,7 +644,7 @@ cdef class MonoDict: """ return self.get(k) - cdef get(self, k) noexcept: + cdef get(self, k): cdef mono_cell* cursor = self.lookup(k) if not valid(cursor.key_id): raise KeyError(k) @@ -1320,7 +1320,7 @@ cdef class TripleDict: raise KeyError(k) return self.get(k1, k2, k3) - cdef get(self, k1, k2, k3) noexcept: + cdef get(self, k1, k2, k3): cdef triple_cell* cursor = self.lookup(k1, k2, k3) if not valid(cursor.key_id1): raise KeyError((k1, k2, k3)) diff --git a/src/sage/structure/coerce_maps.pxd b/src/sage/structure/coerce_maps.pxd index e3e969d0266..0afc1a96adb 100644 --- a/src/sage/structure/coerce_maps.pxd +++ b/src/sage/structure/coerce_maps.pxd @@ -24,4 +24,4 @@ cdef class CallableConvertMap(Map): cdef _func -cdef Map CCallableConvertMap(domain, codomain, void* func, name) noexcept +cdef Map CCallableConvertMap(domain, codomain, void* func, name) diff --git a/src/sage/structure/coerce_maps.pyx b/src/sage/structure/coerce_maps.pyx index edad8231091..aabeafa6bc8 100644 --- a/src/sage/structure/coerce_maps.pyx +++ b/src/sage/structure/coerce_maps.pyx @@ -91,7 +91,7 @@ cdef class DefaultConvertMap(Map): """ return self._repr_type_str or ("Coercion" if self._is_coercion else "Conversion") - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Create an element of the codomain from a single element of the domain. @@ -110,7 +110,7 @@ cdef class DefaultConvertMap(Map): print(type(C._element_constructor), C._element_constructor) raise - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ Create an element of the codomain from an element of the domain, with extra arguments. @@ -152,7 +152,7 @@ cdef class DefaultConvertMap_unique(DefaultConvertMap): used when the element_constructor is a bound method (whose self argument is assumed to be bound to the codomain). """ - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): cdef Parent C = self._codomain try: return C._element_constructor(x) @@ -162,7 +162,7 @@ cdef class DefaultConvertMap_unique(DefaultConvertMap): print(type(C._element_constructor), C._element_constructor) raise - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): cdef Parent C = self._codomain try: if len(args) == 0: @@ -212,7 +212,7 @@ cdef class NamedConvertMap(Map): self.method_name = method_name self._repr_type_str = "Conversion via %s method" % self.method_name - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -239,7 +239,7 @@ cdef class NamedConvertMap(Map): slots['method_name'] = self.method_name return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -265,7 +265,7 @@ cdef class NamedConvertMap(Map): self.method_name = _slots['method_name'] Map._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: @@ -299,7 +299,7 @@ cdef class NamedConvertMap(Map): e = m._call_(e) return e - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ EXAMPLES:: @@ -366,7 +366,7 @@ cdef class CallableConvertMap(Map): except AttributeError: self._repr_type_str = "Conversion via %s" % self._func - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -386,7 +386,7 @@ cdef class CallableConvertMap(Map): slots['_parent_as_first_arg'] = self._parent_as_first_arg return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -405,7 +405,7 @@ cdef class CallableConvertMap(Map): self._parent_as_first_arg = _slots['_parent_as_first_arg'] Map._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ Because self._func may be anything we do a little bit of sanity checking (the return value must be an element with the correct parent). @@ -447,7 +447,7 @@ cdef class CallableConvertMap(Map): raise RuntimeError("BUG in coercion model: {} returned element with wrong parent (expected {} got {})".format(self._func, C, y._parent)) return y - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ TESTS:: @@ -485,7 +485,7 @@ cdef class CallableConvertMap(Map): cdef class CCallableConvertMap_class(Map): - cdef Element (*_func)(Parent, object) noexcept + cdef Element (*_func)(Parent, object) cdef public _name def __init__(self, domain, codomain, name): @@ -495,7 +495,7 @@ cdef class CCallableConvertMap_class(Map): self._coerce_cost = 10 self._name = name - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ TESTS:: @@ -526,7 +526,7 @@ cdef class CCallableConvertMap_class(Map): return "Conversion via c call '%s'" % self._name -cdef Map CCallableConvertMap(domain, codomain, void* func, name) noexcept: +cdef Map CCallableConvertMap(domain, codomain, void* func, name): """ Use this to create a map from domain to codomain by calling func (which must be a function pointer taking a Parent and object, and @@ -540,7 +540,7 @@ cdef Map CCallableConvertMap(domain, codomain, void* func, name) noexcept: map._func = func return map -cpdef Element _ccall_test_function(codomain, x) noexcept: +cpdef Element _ccall_test_function(codomain, x): """ For testing CCallableConvertMap_class. Returns x*x*x-x in the codomain. @@ -587,23 +587,23 @@ cdef class ListMorphism(Map): self._real_morphism = real_morphism self._repr_type_str = "List" - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): slots = Map._extra_slots(self) slots['_real_morphism'] = self._real_morphism return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): self._real_morphism = _slots['_real_morphism'] Map._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): try: x = x._data except AttributeError: x = list(x) return self._real_morphism._call_(x) - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): try: x = x._data except AttributeError: @@ -632,7 +632,7 @@ cdef class TryMap(Map): else: self._error_types = error_types - cdef dict _extra_slots(self) noexcept: + cdef dict _extra_slots(self): """ Helper for copying and pickling. @@ -655,7 +655,7 @@ cdef class TryMap(Map): slots['_error_types'] = self._error_types return slots - cdef _update_slots(self, dict _slots) noexcept: + cdef _update_slots(self, dict _slots): """ Helper for copying and pickling. @@ -677,7 +677,7 @@ cdef class TryMap(Map): self._error_types = _slots['_error_types'] Map._update_slots(self, _slots) - cpdef Element _call_(self, x) noexcept: + cpdef Element _call_(self, x): """ EXAMPLES:: @@ -696,7 +696,7 @@ cdef class TryMap(Map): except self._error_types: return self._map_b._call_(x) - cpdef Element _call_with_args(self, x, args=(), kwds={}) noexcept: + cpdef Element _call_with_args(self, x, args=(), kwds={}): """ EXAMPLES:: diff --git a/src/sage/structure/element.pxd b/src/sage/structure/element.pxd index 487a3d126a1..2d360905783 100644 --- a/src/sage/structure/element.pxd +++ b/src/sage/structure/element.pxd @@ -3,7 +3,7 @@ from sage.structure.parent cimport Parent from sage.misc.inherit_comparison cimport InheritComparisonMetaclass -cpdef inline parent(x) noexcept: +cpdef inline parent(x): """ Return the parent of the element ``x``. @@ -143,36 +143,36 @@ cpdef inline bint have_same_parent(left, right) noexcept: return HAVE_SAME_PARENT(classify_elements(left, right)) -cdef unary_op_exception(op, x) noexcept -cdef bin_op_exception(op, x, y) noexcept +cdef unary_op_exception(op, x) +cdef bin_op_exception(op, x, y) cdef class Element(SageObject): cdef Parent _parent - cpdef _richcmp_(left, right, int op) noexcept + cpdef _richcmp_(left, right, int op) cpdef int _cmp_(left, right) except -2 - cpdef base_extend(self, R) noexcept + cpdef base_extend(self, R) - cdef getattr_from_category(self, name) noexcept + cdef getattr_from_category(self, name) - cpdef _act_on_(self, x, bint self_on_left) noexcept - cpdef _acted_upon_(self, x, bint self_on_left) noexcept + cpdef _act_on_(self, x, bint self_on_left) + cpdef _acted_upon_(self, x, bint self_on_left) - cdef _add_(self, other) noexcept - cdef _sub_(self, other) noexcept - cdef _neg_(self) noexcept - cdef _add_long(self, long n) noexcept + cdef _add_(self, other) + cdef _sub_(self, other) + cdef _neg_(self) + cdef _add_long(self, long n) - cdef _mul_(self, other) noexcept - cdef _mul_long(self, long n) noexcept - cdef _matmul_(self, other) noexcept - cdef _div_(self, other) noexcept - cdef _floordiv_(self, other) noexcept - cdef _mod_(self, other) noexcept + cdef _mul_(self, other) + cdef _mul_long(self, long n) + cdef _matmul_(self, other) + cdef _div_(self, other) + cdef _floordiv_(self, other) + cdef _mod_(self, other) - cdef _pow_(self, other) noexcept - cdef _pow_int(self, n) noexcept - cdef _pow_long(self, long n) noexcept + cdef _pow_(self, other) + cdef _pow_int(self, n) + cdef _pow_long(self, long n) cdef class ElementWithCachedMethod(Element): @@ -183,14 +183,14 @@ cdef class ModuleElement(Element) # forward declaration cdef class RingElement(ModuleElement) # forward declaration cdef class ModuleElement(Element): - cpdef _add_(self, other) noexcept - cpdef _sub_(self, other) noexcept - cpdef _neg_(self) noexcept + cpdef _add_(self, other) + cpdef _sub_(self, other) + cpdef _neg_(self) # self._rmul_(x) is x * self - cpdef _lmul_(self, Element right) noexcept + cpdef _lmul_(self, Element right) # self._lmul_(x) is self * x - cpdef _rmul_(self, Element left) noexcept + cpdef _rmul_(self, Element left) cdef class ModuleElementWithMutability(ModuleElement): cdef bint _is_immutable @@ -198,18 +198,18 @@ cdef class ModuleElementWithMutability(ModuleElement): cpdef bint is_mutable(self) noexcept cdef class MonoidElement(Element): - cpdef _pow_int(self, n) noexcept + cpdef _pow_int(self, n) cdef class MultiplicativeGroupElement(MonoidElement): - cpdef _div_(self, other) noexcept + cpdef _div_(self, other) cdef class AdditiveGroupElement(ModuleElement): pass cdef class RingElement(ModuleElement): - cpdef _mul_(self, other) noexcept - cpdef _div_(self, other) noexcept - cpdef _pow_int(self, n) noexcept + cpdef _mul_(self, other) + cpdef _div_(self, other) + cpdef _pow_int(self, n) cdef class CommutativeRingElement(RingElement): pass @@ -224,11 +224,11 @@ cdef class PrincipalIdealDomainElement(DedekindDomainElement): pass cdef class EuclideanDomainElement(PrincipalIdealDomainElement): - cpdef _floordiv_(self, other) noexcept - cpdef _mod_(self, other) noexcept + cpdef _floordiv_(self, other) + cpdef _mod_(self, other) cdef class FieldElement(CommutativeRingElement): - cpdef _floordiv_(self, other) noexcept + cpdef _floordiv_(self, other) cdef class AlgebraElement(RingElement): pass @@ -248,10 +248,10 @@ cdef class Vector(ModuleElementWithMutability): # Return the dot product using the simple metric # $e_i \cdot e_j = \delta_{ij}$. The first assumes that the parents # are equal, both assume that the degrees are equal. - cpdef _dot_product_(Vector left, Vector right) noexcept - cpdef _dot_product_coerce_(Vector left, Vector right) noexcept + cpdef _dot_product_(Vector left, Vector right) + cpdef _dot_product_coerce_(Vector left, Vector right) - cpdef _pairwise_product_(Vector left, Vector right) noexcept # override, call if parents the same + cpdef _pairwise_product_(Vector left, Vector right) # override, call if parents the same cdef bint is_sparse_c(self) noexcept cdef bint is_dense_c(self) noexcept @@ -262,9 +262,9 @@ cdef class Matrix(ModuleElement): cdef Py_ssize_t _nrows cdef Py_ssize_t _ncols - cdef _vector_times_matrix_(matrix_right, Vector vector_left) noexcept # OK to override, AND call directly - cdef _matrix_times_vector_(matrix_left, Vector vector_right) noexcept # OK to override, AND call directly - cdef _matrix_times_matrix_(left, Matrix right) noexcept # OK to override, AND call directly + cdef _vector_times_matrix_(matrix_right, Vector vector_left) # OK to override, AND call directly + cdef _matrix_times_vector_(matrix_left, Vector vector_right) # OK to override, AND call directly + cdef _matrix_times_matrix_(left, Matrix right) # OK to override, AND call directly cdef bint is_sparse_c(self) noexcept cdef bint is_dense_c(self) noexcept diff --git a/src/sage/structure/element.pyx b/src/sage/structure/element.pyx index 17e8fb51690..475d1147315 100644 --- a/src/sage/structure/element.pyx +++ b/src/sage/structure/element.pyx @@ -324,7 +324,7 @@ def make_element(_class, _dict, parent): return make_element_old(_class, _dict, parent) -cdef unary_op_exception(op, x) noexcept: +cdef unary_op_exception(op, x): try: op = op.__name__ op = _coerce_op_symbols[op] @@ -334,7 +334,7 @@ cdef unary_op_exception(op, x) noexcept: return TypeError(f"unsupported operand parent for {op}: '{px}'") -cdef bin_op_exception(op, x, y) noexcept: +cdef bin_op_exception(op, x, y): try: op = op.__name__ op = _coerce_op_symbols[op] @@ -488,7 +488,7 @@ cdef class Element(SageObject): """ return self.getattr_from_category(name) - cdef getattr_from_category(self, name) noexcept: + cdef getattr_from_category(self, name): # Lookup a method or attribute from the category abstract classes. # See __getattr__ above for documentation. cdef Parent P = self._parent @@ -636,7 +636,7 @@ cdef class Element(SageObject): """ raise NotImplementedError - cpdef base_extend(self, R) noexcept: + cpdef base_extend(self, R): cdef Parent V V = self._parent.base_extend(R) return V.coerce(self) @@ -928,7 +928,7 @@ cdef class Element(SageObject): """ return self.n(prec)._mpmath_(prec=prec) - cpdef _act_on_(self, x, bint self_on_left) noexcept: + cpdef _act_on_(self, x, bint self_on_left): """ Use this method to implement ``self`` acting on ``x``. @@ -937,7 +937,7 @@ cdef class Element(SageObject): """ return None - cpdef _acted_upon_(self, x, bint self_on_left) noexcept: + cpdef _acted_upon_(self, x, bint self_on_left): """ Use this method to implement ``self`` acted on by x. @@ -1097,7 +1097,7 @@ cdef class Element(SageObject): else: return coercion_model.richcmp(self, other, op) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): r""" Basic default implementation of rich comparisons for elements with equal parents. @@ -1239,7 +1239,7 @@ cdef class Element(SageObject): # reversed addition (__radd__). return NotImplemented - cdef _add_(self, other) noexcept: + cdef _add_(self, other): """ Virtual addition method for elements with identical parents. @@ -1269,7 +1269,7 @@ cdef class Element(SageObject): else: return python_op(other) - cdef _add_long(self, long n) noexcept: + cdef _add_long(self, long n): """ Generic path for adding a C long, assumed to commute. @@ -1351,7 +1351,7 @@ cdef class Element(SageObject): except TypeError: return NotImplemented - cdef _sub_(self, other) noexcept: + cdef _sub_(self, other): """ Virtual subtraction method for elements with identical parents. @@ -1405,7 +1405,7 @@ cdef class Element(SageObject): """ return self._neg_() - cdef _neg_(self) noexcept: + cdef _neg_(self): """ Virtual unary negation method for elements. @@ -1519,7 +1519,7 @@ cdef class Element(SageObject): except TypeError: return NotImplemented - cdef _mul_(self, other) noexcept: + cdef _mul_(self, other): """ Virtual multiplication method for elements with identical parents. @@ -1549,7 +1549,7 @@ cdef class Element(SageObject): else: return python_op(other) - cdef _mul_long(self, long n) noexcept: + cdef _mul_long(self, long n): """ Generic path for multiplying by a C long, assumed to commute. @@ -1631,7 +1631,7 @@ cdef class Element(SageObject): except TypeError: return NotImplemented - cdef _matmul_(self, other) noexcept: + cdef _matmul_(self, other): """ Virtual matrix multiplication method for elements with identical parents. @@ -1734,7 +1734,7 @@ cdef class Element(SageObject): except TypeError: return NotImplemented - cdef _div_(self, other) noexcept: + cdef _div_(self, other): """ Virtual division method for elements with identical parents. This is called for Python 2 division as well as true division. @@ -1835,7 +1835,7 @@ cdef class Element(SageObject): except TypeError: return NotImplemented - cdef _floordiv_(self, other) noexcept: + cdef _floordiv_(self, other): """ Virtual floor division method for elements with identical parents. @@ -1935,7 +1935,7 @@ cdef class Element(SageObject): except TypeError: return NotImplemented - cdef _mod_(self, other) noexcept: + cdef _mod_(self, other): """ Virtual modulo method for elements with identical parents. @@ -2062,7 +2062,7 @@ cdef class Element(SageObject): except TypeError: return NotImplemented - cdef _pow_(self, other) noexcept: + cdef _pow_(self, other): """ Virtual powering method for elements with identical parents. @@ -2092,7 +2092,7 @@ cdef class Element(SageObject): else: return python_op(other) - cdef _pow_int(self, other) noexcept: + cdef _pow_int(self, other): """ Virtual powering method for powering to an integer exponent. @@ -2122,7 +2122,7 @@ cdef class Element(SageObject): else: return python_op(other) - cdef _pow_long(self, long n) noexcept: + cdef _pow_long(self, long n): """ Generic path for powering with a C long. """ @@ -2299,7 +2299,7 @@ cdef class ElementWithCachedMethod(Element): True """ - cdef getattr_from_category(self, name) noexcept: + cdef getattr_from_category(self, name): """ This getattr method ensures that cached methods and lazy attributes can be inherited from the element class of a category. @@ -2367,7 +2367,7 @@ cdef class ModuleElement(Element): """ Generic element of a module. """ - cpdef _add_(self, other) noexcept: + cpdef _add_(self, other): """ Abstract addition method @@ -2382,7 +2382,7 @@ cdef class ModuleElement(Element): """ raise NotImplementedError(f"addition not implemented for {self._parent}") - cdef _add_long(self, long n) noexcept: + cdef _add_long(self, long n): """ Generic path for adding a C long, assumed to commute. """ @@ -2390,21 +2390,21 @@ cdef class ModuleElement(Element): return self return coercion_model.bin_op(self, n, add) - cpdef _sub_(self, other) noexcept: + cpdef _sub_(self, other): """ Default implementation of subtraction using addition and negation. """ return self + (-other) - cpdef _neg_(self) noexcept: + cpdef _neg_(self): """ Default implementation of negation using multiplication with -1. """ return self._mul_long(-1) - cdef _mul_long(self, long n) noexcept: + cdef _mul_long(self, long n): """ Generic path for multiplying by a C long, assumed to commute. """ @@ -2413,7 +2413,7 @@ cdef class ModuleElement(Element): return coercion_model.bin_op(self, n, mul) # rmul -- left * self - cpdef _rmul_(self, Element left) noexcept: + cpdef _rmul_(self, Element left): """ Reversed scalar multiplication for module elements with the module element on the right and the scalar on the left. @@ -2423,7 +2423,7 @@ cdef class ModuleElement(Element): return self._lmul_(left) # lmul -- self * right - cpdef _lmul_(self, Element right) noexcept: + cpdef _lmul_(self, Element right): """ Scalar multiplication for module elements with the module element on the left and the scalar on the right. @@ -2542,7 +2542,7 @@ cdef class MonoidElement(Element): """ raise NotImplementedError - cpdef _pow_int(self, n) noexcept: + cpdef _pow_int(self, n): """ Return the (integral) power of self. """ @@ -2610,7 +2610,7 @@ cdef class MultiplicativeGroupElement(MonoidElement): """ return self.multiplicative_order() - cpdef _div_(self, right) noexcept: + cpdef _div_(self, right): """ Default implementation of division using multiplication by the inverse. @@ -2635,7 +2635,7 @@ def is_RingElement(x): cdef class RingElement(ModuleElement): - cpdef _mul_(self, other) noexcept: + cpdef _mul_(self, other): """ Abstract multiplication method @@ -2653,7 +2653,7 @@ cdef class RingElement(ModuleElement): def is_one(self): return self == self._parent.one() - cpdef _pow_int(self, n) noexcept: + cpdef _pow_int(self, n): """ Return the (integral) power of ``self``. @@ -2736,7 +2736,7 @@ cdef class RingElement(ModuleElement): l.append(x) return l - cpdef _div_(self, other) noexcept: + cpdef _div_(self, other): """ Default implementation of division using the fraction field. """ @@ -3675,13 +3675,13 @@ cdef class Vector(ModuleElementWithMutability): return (left)._dot_product_(right) return coercion_model.bin_op(left, right, mul) - cpdef _dot_product_(Vector left, Vector right) noexcept: + cpdef _dot_product_(Vector left, Vector right): return left._dot_product_coerce_(right) - cpdef _dot_product_coerce_(Vector left, Vector right) noexcept: + cpdef _dot_product_coerce_(Vector left, Vector right): raise bin_op_exception('*', left, right) - cpdef _pairwise_product_(Vector left, Vector right) noexcept: + cpdef _pairwise_product_(Vector left, Vector right): raise TypeError("unsupported operation for '%s' and '%s'"%(parent(left), parent(right))) def __truediv__(self, right): @@ -4144,13 +4144,13 @@ cdef class Matrix(ModuleElement): return right.solve_left(left) return coercion_model.bin_op(left, right, truediv) - cdef _vector_times_matrix_(matrix_right, Vector vector_left) noexcept: + cdef _vector_times_matrix_(matrix_right, Vector vector_left): raise TypeError - cdef _matrix_times_vector_(matrix_left, Vector vector_right) noexcept: + cdef _matrix_times_vector_(matrix_left, Vector vector_right): raise TypeError - cdef _matrix_times_matrix_(left, Matrix right) noexcept: + cdef _matrix_times_matrix_(left, Matrix right): raise TypeError @@ -4280,7 +4280,7 @@ cdef class EuclideanDomainElement(PrincipalIdealDomainElement): def quo_rem(self, other): raise NotImplementedError - cpdef _floordiv_(self, right) noexcept: + cpdef _floordiv_(self, right): """ Quotient of division of ``self`` by other. This is denoted //. @@ -4303,7 +4303,7 @@ cdef class EuclideanDomainElement(PrincipalIdealDomainElement): Q, _ = self.quo_rem(right) return Q - cpdef _mod_(self, other) noexcept: + cpdef _mod_(self, other): """ Remainder of division of ``self`` by other. @@ -4342,7 +4342,7 @@ def is_FieldElement(x): return isinstance(x, FieldElement) cdef class FieldElement(CommutativeRingElement): - cpdef _floordiv_(self, right) noexcept: + cpdef _floordiv_(self, right): """ Return the quotient of self and other. Since these are field elements, the floor division is exactly the same as usual division. @@ -4499,7 +4499,7 @@ cdef class InfinityElement(RingElement): # ################################################################################# -cpdef canonical_coercion(x, y) noexcept: +cpdef canonical_coercion(x, y): """ ``canonical_coercion(x,y)`` is what is called before doing an arithmetic operation between ``x`` and ``y``. It returns a pair ``(z,w)`` @@ -4518,7 +4518,7 @@ cpdef canonical_coercion(x, y) noexcept: return coercion_model.canonical_coercion(x,y) -cpdef bin_op(x, y, op) noexcept: +cpdef bin_op(x, y, op): return coercion_model.bin_op(x, y, op) diff --git a/src/sage/structure/element_wrapper.pxd b/src/sage/structure/element_wrapper.pxd index 308f4a749ce..f8689c57947 100644 --- a/src/sage/structure/element_wrapper.pxd +++ b/src/sage/structure/element_wrapper.pxd @@ -4,7 +4,7 @@ from sage.structure.element cimport Element cdef class ElementWrapper(Element): cdef public object value - cpdef _richcmp_(left, right, int op) noexcept + cpdef _richcmp_(left, right, int op) cpdef bint _lt_by_value(self, other) noexcept cdef class ElementWrapperCheckWrappedClass(ElementWrapper): diff --git a/src/sage/structure/element_wrapper.pyx b/src/sage/structure/element_wrapper.pyx index 1585401e48c..0f0c25bdd8d 100644 --- a/src/sage/structure/element_wrapper.pyx +++ b/src/sage/structure/element_wrapper.pyx @@ -293,7 +293,7 @@ cdef class ElementWrapper(Element): return left._richcmp_(right, op) return coercion_model.richcmp(left, right, op) - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Return ``True`` if ``left`` compares with ``right`` based on ``op``. diff --git a/src/sage/structure/factory.pyx b/src/sage/structure/factory.pyx index 8bd4bcd769e..75a043250c2 100644 --- a/src/sage/structure/factory.pyx +++ b/src/sage/structure/factory.pyx @@ -372,7 +372,7 @@ cdef class UniqueFactory(SageObject): version = self.get_version(sage_version) return self.get_object(version, key, kwds) - cpdef get_object(self, version, key, extra_args) noexcept: + cpdef get_object(self, version, key, extra_args): """ Returns the object corresponding to ``key``, creating it with ``extra_args`` if necessary (for example, it isn't in the cache @@ -436,7 +436,7 @@ cdef class UniqueFactory(SageObject): pass return obj - cpdef get_version(self, sage_version) noexcept: + cpdef get_version(self, sage_version): """ This is provided to allow more or less granular control over pickle versioning. Objects pickled in the same version of Sage @@ -507,7 +507,7 @@ cdef class UniqueFactory(SageObject): """ raise NotImplementedError - cpdef other_keys(self, key, obj) noexcept: + cpdef other_keys(self, key, obj): """ Sometimes during object creation, certain defaults are chosen which may result in a new (more specific) key. This allows the more specific @@ -534,7 +534,7 @@ cdef class UniqueFactory(SageObject): """ return [] - cpdef reduce_data(self, obj) noexcept: + cpdef reduce_data(self, obj): """ The results of this function can be returned from :meth:`__reduce__`. This is here so the factory internals can diff --git a/src/sage/structure/list_clone.pxd b/src/sage/structure/list_clone.pxd index e182ebf8be1..ef1d20f4bd3 100644 --- a/src/sage/structure/list_clone.pxd +++ b/src/sage/structure/list_clone.pxd @@ -21,44 +21,44 @@ cdef class ClonableElement(Element): cpdef bint _require_mutable(self) except -2 cpdef bint is_mutable(self) noexcept cpdef bint is_immutable(self) noexcept - cpdef set_immutable(self) noexcept + cpdef set_immutable(self) - cpdef _set_mutable(self) noexcept + cpdef _set_mutable(self) - cpdef ClonableElement clone(self, bint check=?) noexcept + cpdef ClonableElement clone(self, bint check=?) cdef class ClonableArray(ClonableElement): cdef list _list - cpdef list _get_list(self) noexcept - cpdef _set_list(self, list lst) noexcept - cpdef ClonableArray __copy__(self) noexcept - cpdef check(self) noexcept - cpdef object _getitem(self, int key) noexcept - cpdef _setitem(self, int key, value) noexcept + cpdef list _get_list(self) + cpdef _set_list(self, list lst) + cpdef ClonableArray __copy__(self) + cpdef check(self) + cpdef object _getitem(self, int key) + cpdef _setitem(self, int key, value) cpdef int index(self, key, start=*, stop=*) except -1 cpdef int count(self, key) except -1 cpdef long int _hash_(self) except? -1 cdef class ClonableList(ClonableArray): - cpdef append(self, el) noexcept - cpdef extend(self, it) noexcept - cpdef insert(self, int index, el) noexcept - cpdef pop(self, int index=*) noexcept - cpdef remove(self, el) noexcept + cpdef append(self, el) + cpdef extend(self, it) + cpdef insert(self, int index, el) + cpdef pop(self, int index=*) + cpdef remove(self, el) cdef class NormalizedClonableList(ClonableList): - cpdef normalize(self) noexcept + cpdef normalize(self) cdef class ClonableIntArray(ClonableElement): cdef int _len cdef int* _list - cpdef _alloc_(self, int size) noexcept - cpdef ClonableIntArray __copy__(self) noexcept - cpdef check(self) noexcept - cpdef object _getitem(self, int key) noexcept - cpdef _setitem(self, int item, value) noexcept + cpdef _alloc_(self, int size) + cpdef ClonableIntArray __copy__(self) + cpdef check(self) + cpdef object _getitem(self, int key) + cpdef _setitem(self, int item, value) cpdef int index(self, int item) except -1 cpdef long int _hash_(self) except? -1 - cpdef list list(self) noexcept + cpdef list list(self) diff --git a/src/sage/structure/list_clone.pyx b/src/sage/structure/list_clone.pyx index 9ca7be464e6..8ae709adc45 100644 --- a/src/sage/structure/list_clone.pyx +++ b/src/sage/structure/list_clone.pyx @@ -350,7 +350,7 @@ cdef class ClonableElement(Element): """ return self._is_immutable - cpdef set_immutable(self) noexcept: + cpdef set_immutable(self): """ Makes ``self`` immutable, so it can never again be changed. @@ -369,7 +369,7 @@ cdef class ClonableElement(Element): """ self._is_immutable = True - cpdef _set_mutable(self) noexcept: + cpdef _set_mutable(self): """ Makes ``self`` mutable, so it can be changed. @@ -415,7 +415,7 @@ cdef class ClonableElement(Element): self._hash = self._hash_() return self._hash - cpdef ClonableElement clone(self, bint check=True) noexcept: + cpdef ClonableElement clone(self, bint check=True): """ Return a clone that is mutable copy of ``self``. @@ -578,7 +578,7 @@ cdef class ClonableArray(ClonableElement): """ return bool(self._list) - cpdef list _get_list(self) noexcept: + cpdef list _get_list(self): """ Return the list embedded in ``self``. @@ -594,7 +594,7 @@ cdef class ClonableArray(ClonableElement): """ return self._list - cpdef _set_list(self, list lst) noexcept: + cpdef _set_list(self, list lst): """ Set the list embedded in ``self``. @@ -676,7 +676,7 @@ cdef class ClonableArray(ClonableElement): self._require_mutable() self._list[key] = value - cpdef object _getitem(self, int key) noexcept: + cpdef object _getitem(self, int key): """ Same as :meth:`__getitem__` @@ -695,7 +695,7 @@ cdef class ClonableArray(ClonableElement): """ return self._list[key] - cpdef _setitem(self, int key, value) noexcept: + cpdef _setitem(self, int key, value): """ Same as :meth:`__setitem__` @@ -822,7 +822,7 @@ cdef class ClonableArray(ClonableElement): return self._hash # See protocol in comment in sage/structure/element.pyx - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ TESTS:: @@ -845,7 +845,7 @@ cdef class ClonableArray(ClonableElement): cdef ClonableArray rgt = right return richcmp(left._list, rgt._list, op) - cpdef ClonableArray __copy__(self) noexcept: + cpdef ClonableArray __copy__(self): """ Return a copy of ``self`` @@ -889,7 +889,7 @@ cdef class ClonableArray(ClonableElement): res.__dict__ = self.__dict__.copy() return res - cpdef check(self) noexcept: + cpdef check(self): """ Check that ``self`` fulfill the invariants @@ -1006,7 +1006,7 @@ cdef class ClonableList(ClonableArray): .. SEEALSO:: :class:`~sage.structure.list_clone_demo.IncreasingList` for an example of usage. """ - cpdef append(self, el) noexcept: + cpdef append(self, el): """ Appends ``el`` to ``self`` @@ -1035,7 +1035,7 @@ cdef class ClonableList(ClonableArray): self._require_mutable() self._list.append(el) - cpdef extend(self, it) noexcept: + cpdef extend(self, it): """ Extends ``self`` by the content of the iterable ``it`` @@ -1070,7 +1070,7 @@ cdef class ClonableList(ClonableArray): self._require_mutable() self._list.extend(it) - cpdef insert(self, int index, el) noexcept: + cpdef insert(self, int index, el): """ Inserts ``el`` in ``self`` at position ``index`` @@ -1100,7 +1100,7 @@ cdef class ClonableList(ClonableArray): self._require_mutable() self._list.insert(index, el) - cpdef pop(self, int index=-1) noexcept: + cpdef pop(self, int index=-1): """ Remove ``self[index]`` from ``self`` and returns it @@ -1128,7 +1128,7 @@ cdef class ClonableList(ClonableArray): self._require_mutable() return self._list.pop(index) - cpdef remove(self, el) noexcept: + cpdef remove(self, el): """ Remove the first occurrence of ``el`` from ``self`` @@ -1285,7 +1285,7 @@ cdef class ClonableIntArray(ClonableElement): if check: self.check() - cpdef _alloc_(self, int size) noexcept: + cpdef _alloc_(self, int size): """ Allocate the array part of ``self`` for a given size @@ -1371,7 +1371,7 @@ cdef class ClonableIntArray(ClonableElement): """ return iter(self.list()) - cpdef list list(self) noexcept: + cpdef list list(self): """ Convert self into a Python list. @@ -1469,7 +1469,7 @@ cdef class ClonableIntArray(ClonableElement): else: raise IndexError("list index out of range") - cpdef object _getitem(self, int key) noexcept: + cpdef object _getitem(self, int key): """ Same as :meth:`__getitem__` @@ -1487,7 +1487,7 @@ cdef class ClonableIntArray(ClonableElement): else: raise IndexError("list index out of range") - cpdef _setitem(self, int key, value) noexcept: + cpdef _setitem(self, int key, value): """ Same as :meth:`__setitem__` @@ -1575,7 +1575,7 @@ cdef class ClonableIntArray(ClonableElement): return self._hash # See protocol in comment in sage/structure/element.pyx - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ TESTS:: @@ -1623,7 +1623,7 @@ cdef class ClonableIntArray(ClonableElement): return rich_to_bool(op, 1) return rich_to_bool(op, reslen) - cpdef ClonableIntArray __copy__(self) noexcept: + cpdef ClonableIntArray __copy__(self): """ Return a copy of ``self`` @@ -1670,7 +1670,7 @@ cdef class ClonableIntArray(ClonableElement): res.__dict__ = self.__dict__.copy() return res - cpdef check(self) noexcept: + cpdef check(self): """ Check that ``self`` fulfill the invariants @@ -1832,7 +1832,7 @@ cdef class NormalizedClonableList(ClonableList): self.normalize() return ClonableList.__exit__(self, typ, value, tracback) - cpdef normalize(self) noexcept: + cpdef normalize(self): """ Normalize ``self`` diff --git a/src/sage/structure/list_clone_demo.pyx b/src/sage/structure/list_clone_demo.pyx index fc68eee947e..0bd018f57c0 100644 --- a/src/sage/structure/list_clone_demo.pyx +++ b/src/sage/structure/list_clone_demo.pyx @@ -30,7 +30,7 @@ cdef class IncreasingArray(ClonableArray): sage: TestSuite(IncreasingArrays()([])).run() """ - cpdef check(self) noexcept: + cpdef check(self): """ Check that ``self`` is increasing. @@ -113,7 +113,7 @@ cdef class IncreasingList(ClonableList): sage: TestSuite(IncreasingLists()([])).run() """ - cpdef check(self) noexcept: + cpdef check(self): """ Check that ``self`` is increasing @@ -146,7 +146,7 @@ cdef class IncreasingIntArray(ClonableIntArray): sage: TestSuite(IncreasingIntArrays()([])).run() """ - cpdef check(self) noexcept: + cpdef check(self): """ Check that ``self`` is increasing. @@ -193,7 +193,7 @@ cdef class SortedList(NormalizedClonableList): sage: TestSuite(IncreasingIntArrays()([1,2,3])).run() sage: TestSuite(IncreasingIntArrays()([])).run() """ - cpdef normalize(self) noexcept: + cpdef normalize(self): """ Normalize ``self`` @@ -213,7 +213,7 @@ cdef class SortedList(NormalizedClonableList): self._require_mutable() self._get_list().sort() - cpdef check(self) noexcept: + cpdef check(self): """ Check that ``self`` is strictly increasing diff --git a/src/sage/structure/list_clone_timings_cy.pyx b/src/sage/structure/list_clone_timings_cy.pyx index 6237fbe09a7..46152f1e68b 100644 --- a/src/sage/structure/list_clone_timings_cy.pyx +++ b/src/sage/structure/list_clone_timings_cy.pyx @@ -14,7 +14,7 @@ from sage.structure.list_clone cimport ClonableArray ##################################################################### ###### Timings functions ###### ##################################################################### -cpdef ClonableArray cy_add1_internal(ClonableArray bla) noexcept: +cpdef ClonableArray cy_add1_internal(ClonableArray bla): """ TESTS:: @@ -34,7 +34,7 @@ cpdef ClonableArray cy_add1_internal(ClonableArray bla) noexcept: return blo -cpdef ClonableArray cy_add1_immutable(ClonableArray bla) noexcept: +cpdef ClonableArray cy_add1_immutable(ClonableArray bla): """ TESTS:: @@ -49,7 +49,7 @@ cpdef ClonableArray cy_add1_immutable(ClonableArray bla) noexcept: for i in range(len(lbla)): lbla[i] += 1 return bla.__class__(bla._parent, lbla) -cpdef ClonableArray cy_add1_mutable(ClonableArray bla) noexcept: +cpdef ClonableArray cy_add1_mutable(ClonableArray bla): """ TESTS:: @@ -68,7 +68,7 @@ cpdef ClonableArray cy_add1_mutable(ClonableArray bla) noexcept: return blo -cpdef ClonableArray cy_add1_with(ClonableArray bla) noexcept: +cpdef ClonableArray cy_add1_with(ClonableArray bla): """ TESTS:: diff --git a/src/sage/structure/mutability.pxd b/src/sage/structure/mutability.pxd index 16a474e8d2e..f5df8b89892 100644 --- a/src/sage/structure/mutability.pxd +++ b/src/sage/structure/mutability.pxd @@ -14,7 +14,7 @@ Mutability -- Pyrex Implementation cdef class Mutability: cdef public bint _is_immutable - cpdef _require_mutable(self) noexcept - cpdef _require_immutable(self) noexcept + cpdef _require_mutable(self) + cpdef _require_immutable(self) cpdef bint is_immutable(self) noexcept cpdef bint is_mutable(self) noexcept \ No newline at end of file diff --git a/src/sage/structure/mutability.pyx b/src/sage/structure/mutability.pyx index 46a04784e0c..c61fd06c3dc 100644 --- a/src/sage/structure/mutability.pyx +++ b/src/sage/structure/mutability.pyx @@ -66,7 +66,7 @@ cdef class Mutability: """ self._is_immutable = is_immutable - cpdef _require_mutable(self) noexcept: + cpdef _require_mutable(self): r""" Whenever mutability is required, this method can be called. @@ -92,7 +92,7 @@ cdef class Mutability: if self._is_immutable: raise ValueError("object is immutable; please change a copy instead") - cpdef _require_immutable(self) noexcept: + cpdef _require_immutable(self): r""" Whenever immutability is required, this method can be called. diff --git a/src/sage/structure/parent.pxd b/src/sage/structure/parent.pxd index 2a9c637af6c..1635ef8b36e 100644 --- a/src/sage/structure/parent.pxd +++ b/src/sage/structure/parent.pxd @@ -23,10 +23,10 @@ cdef class Parent(sage.structure.category_object.CategoryObject): cdef inline bint get_flag(self, int flag) noexcept: return self.flags & flag - cpdef register_coercion(self, mor) noexcept - cpdef register_action(self, action) noexcept - cpdef register_conversion(self, mor) noexcept - cpdef register_embedding(self, embedding) noexcept + cpdef register_coercion(self, mor) + cpdef register_action(self, action) + cpdef register_conversion(self, mor) + cpdef register_embedding(self, embedding) cpdef bint is_exact(self) except -2 @@ -37,33 +37,33 @@ cdef class Parent(sage.structure.category_object.CategoryObject): cpdef bint has_coerce_map_from(self, S) except -2 # returns a Morphism from S to self, or None - cpdef coerce_map_from(self, S) noexcept - cpdef _internal_coerce_map_from(self, S) noexcept - cpdef _coerce_map_from_(self, S) noexcept + cpdef coerce_map_from(self, S) + cpdef _internal_coerce_map_from(self, S) + cpdef _coerce_map_from_(self, S) # returns a Map from S to self, or None - cpdef convert_map_from(self, S) noexcept - cpdef _internal_convert_map_from(self, S) noexcept - cpdef _convert_map_from_(self, S) noexcept - cdef convert_method_map(self, S, method_name) noexcept + cpdef convert_map_from(self, S) + cpdef _internal_convert_map_from(self, S) + cpdef _convert_map_from_(self, S) + cdef convert_method_map(self, S, method_name) # returns the Action by/on self on/by S # corresponding to op and self_on_left - cpdef get_action(self, S, op=*, bint self_on_left=*, self_el=*, S_el=*) noexcept - cpdef _get_action_(self, S, op, bint self_on_left) noexcept + cpdef get_action(self, S, op=*, bint self_on_left=*, self_el=*, S_el=*) + cpdef _get_action_(self, S, op, bint self_on_left) # coerce x into self - cpdef coerce(self, x) noexcept + cpdef coerce(self, x) - cpdef an_element(self) noexcept + cpdef an_element(self) cdef public object _cache_an_element # For internal use - cpdef _generic_convert_map(self, S, category=*) noexcept - cpdef _generic_coerce_map(self, S) noexcept - cdef discover_coerce_map_from(self, S) noexcept - cdef discover_convert_map_from(self, S) noexcept - cdef discover_action(self, S, op, bint self_on_left, self_el=*, S_el=*) noexcept + cpdef _generic_convert_map(self, S, category=*) + cpdef _generic_coerce_map(self, S) + cdef discover_coerce_map_from(self, S) + cdef discover_convert_map_from(self, S) + cdef discover_action(self, S, op, bint self_on_left, self_el=*, S_el=*) # List consisting of Morphisms (from anything to self) # and Parents for which the __call__ method of self diff --git a/src/sage/structure/parent.pyx b/src/sage/structure/parent.pyx index 2e29718c66e..2b579cdc60a 100644 --- a/src/sage/structure/parent.pyx +++ b/src/sage/structure/parent.pyx @@ -128,7 +128,7 @@ from sage.structure.coerce_maps cimport (NamedConvertMap, DefaultConvertMap, from sage.structure.element cimport parent -cdef _record_exception() noexcept: +cdef _record_exception(): coercion_model._record_exception() cdef object _Integer @@ -1188,7 +1188,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): except (TypeError, ValueError, ArithmeticError): return False - cpdef coerce(self, x) noexcept: + cpdef coerce(self, x): """ Return x as an element of self, if and only if there is a canonical coercion from the parent of x to self. @@ -1604,7 +1604,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): except KeyError: pass - cpdef register_coercion(self, mor) noexcept: + cpdef register_coercion(self, mor): r""" Update the coercion model to use `mor : P \to \text{self}` to coerce from a parent ``P`` into ``self``. @@ -1664,7 +1664,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): self._registered_domains.append(D) self._coerce_from_hash.set(D, mor) - cpdef register_action(self, action) noexcept: + cpdef register_action(self, action): r""" Update the coercion model to use ``action`` to act on self. @@ -1728,7 +1728,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): raise ValueError("action must involve self") self._action_list.append(action) - cpdef register_conversion(self, mor) noexcept: + cpdef register_conversion(self, mor): r""" Update the coercion model to use `\text{mor} : P \to \text{self}` to convert from ``P`` into ``self``. @@ -1763,7 +1763,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): else: raise TypeError("conversions must be parents or maps") - cpdef register_embedding(self, embedding) noexcept: + cpdef register_embedding(self, embedding): r""" Add embedding to coercion model. @@ -1900,7 +1900,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): """ return copy(self._embedding) # It might be overkill to make a copy here - cpdef _generic_coerce_map(self, S) noexcept: + cpdef _generic_coerce_map(self, S): r""" Returns a default coercion map based on the data provided to :meth:`_populate_coercion_lists_`. @@ -1931,7 +1931,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): category = self.category()._meet_(S.category()) return self._generic_convert_map(S, category=category) - cpdef _generic_convert_map(self, S, category=None) noexcept: + cpdef _generic_convert_map(self, S, category=None): r""" Returns the default conversion map based on the data provided to :meth:`_populate_coercion_lists_`. @@ -1989,7 +1989,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): method_name = self._convert_method_name return self.convert_method_map(S, method_name) - cdef convert_method_map(self, S, method_name) noexcept: + cdef convert_method_map(self, S, method_name): # Cython implementation of _convert_method_map() cdef Parent P if isinstance(S, Parent): @@ -2090,7 +2090,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): return True return self._internal_coerce_map_from(S) is not None - cpdef _coerce_map_from_(self, S) noexcept: + cpdef _coerce_map_from_(self, S): """ Override this method to specify coercions beyond those specified in coerce_list. @@ -2107,7 +2107,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): except AttributeError: return None - cpdef coerce_map_from(self, S) noexcept: + cpdef coerce_map_from(self, S): """ Return a :class:`Map` object to coerce from ``S`` to ``self`` if one exists, or ``None`` if no such coercion exists. @@ -2145,7 +2145,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): """ return copy(self._internal_coerce_map_from(S)) - cpdef _internal_coerce_map_from(self, S) noexcept: + cpdef _internal_coerce_map_from(self, S): """ Return the :class:`Map` object to coerce from ``S`` to ``self`` that is used internally by the coercion system if one exists, or ``None`` @@ -2267,7 +2267,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): finally: _unregister_pair(self, S, "coerce") - cdef discover_coerce_map_from(self, S) noexcept: + cdef discover_coerce_map_from(self, S): """ Precedence for discovering a coercion S -> self goes as follows: @@ -2444,7 +2444,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): if connecting is not None: return (S)._embedding.post_compose(connecting) - cpdef convert_map_from(self, S) noexcept: + cpdef convert_map_from(self, S): """ This function returns a :class:`Map` from `S` to `self`, which may or may not succeed on all inputs. @@ -2470,7 +2470,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): """ return copy(self._internal_convert_map_from(S)) - cpdef _internal_convert_map_from(self, S) noexcept: + cpdef _internal_convert_map_from(self, S): """ This function returns a :class:`Map` from `S` to `self`, which may or may not succeed on all inputs. @@ -2516,7 +2516,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): mor._make_weak_references() return mor - cdef discover_convert_map_from(self, S) noexcept: + cdef discover_convert_map_from(self, S): cdef map.Map mor = self._internal_coerce_map_from(S) if mor is not None: @@ -2544,7 +2544,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): mor = self._generic_convert_map(S) return mor - cpdef _convert_map_from_(self, S) noexcept: + cpdef _convert_map_from_(self, S): """ Override this method to provide additional conversions beyond those given in convert_list. @@ -2558,7 +2558,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): """ return None - cpdef get_action(self, S, op=operator.mul, bint self_on_left=True, self_el=None, S_el=None) noexcept: + cpdef get_action(self, S, op=operator.mul, bint self_on_left=True, self_el=None, S_el=None): """ Returns an action of self on S or S on self. @@ -2594,7 +2594,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): self._action_hash.set(S, op, self_on_left, action) return action - cdef discover_action(self, S, op, bint self_on_left, self_el=None, S_el=None) noexcept: + cdef discover_action(self, S, op, bint self_on_left, self_el=None, S_el=None): """ TESTS:: @@ -2750,7 +2750,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): except TypeError: _record_exception() - cpdef _get_action_(self, S, op, bint self_on_left) noexcept: + cpdef _get_action_(self, S, op, bint self_on_left): """ Override this method to provide an action of self on S or S on self beyond what was specified in action_list. @@ -2762,7 +2762,7 @@ cdef class Parent(sage.structure.category_object.CategoryObject): # TODO: remove once all parents in Sage will inherit properly from # Sets().ParentMethods.an_element - cpdef an_element(self) noexcept: + cpdef an_element(self): r""" Returns a (preferably typical) element of this parent. diff --git a/src/sage/structure/parent_base.pyx b/src/sage/structure/parent_base.pyx index f5ecc15affa..b41175b5bff 100644 --- a/src/sage/structure/parent_base.pyx +++ b/src/sage/structure/parent_base.pyx @@ -14,7 +14,7 @@ Base class for old-style parent objects with a base ring cimport sage.structure.parent as parent from sage.structure.coerce_exceptions import CoercionException -cdef inline check_old_coerce(parent.Parent p) noexcept: +cdef inline check_old_coerce(parent.Parent p): if p._element_constructor is not None: raise RuntimeError("%s still using old coercion framework" % p) @@ -27,7 +27,7 @@ cdef class ParentWithBase(Parent_old): Parent_old.__init__(self, *args, **kwds) self._base = base - cdef _coerce_c_impl(self,x) noexcept: + cdef _coerce_c_impl(self,x): check_old_coerce(self) from sage.misc.superseded import deprecation deprecation(33497, "_coerce_c_impl is deprecated, use coerce instead") diff --git a/src/sage/structure/parent_gens.pyx b/src/sage/structure/parent_gens.pyx index 6d493e56781..3f69b9daee4 100644 --- a/src/sage/structure/parent_gens.pyx +++ b/src/sage/structure/parent_gens.pyx @@ -73,7 +73,7 @@ cimport sage.structure.parent as parent cimport sage.structure.category_object as category_object -cdef inline check_old_coerce(parent.Parent p) noexcept: +cdef inline check_old_coerce(parent.Parent p): if p._element_constructor is not None: raise RuntimeError("%s still using old coercion framework" % p) diff --git a/src/sage/structure/parent_old.pxd b/src/sage/structure/parent_old.pxd index 688ae96469a..54bb4753970 100644 --- a/src/sage/structure/parent_old.pxd +++ b/src/sage/structure/parent_old.pxd @@ -16,9 +16,9 @@ cdef class Parent(parent.Parent): # Cache for __has_coerce_map_from_c() cdef MonoDict _has_coerce_map_from - cpdef _coerce_c(self, x) noexcept - cdef _coerce_c_impl(self, x) noexcept + cpdef _coerce_c(self, x) + cdef _coerce_c_impl(self, x) - cdef __coerce_map_from_c(self, S) noexcept - cdef __coerce_map_from_c_impl(self, S) noexcept - cdef __has_coerce_map_from_c(self, S) noexcept + cdef __coerce_map_from_c(self, S) + cdef __coerce_map_from_c_impl(self, S) + cdef __has_coerce_map_from_c(self, S) diff --git a/src/sage/structure/parent_old.pyx b/src/sage/structure/parent_old.pyx index 06c84960605..7b8ce70b5a5 100644 --- a/src/sage/structure/parent_old.pyx +++ b/src/sage/structure/parent_old.pyx @@ -34,7 +34,7 @@ from sage.sets.pythonclass cimport Set_PythonType, Set_PythonType_class from cpython.object cimport * from cpython.bool cimport * -cdef inline check_old_coerce(Parent p) noexcept: +cdef inline check_old_coerce(Parent p): if p._element_constructor is not None: raise RuntimeError("%s still using old coercion framework" % p) @@ -79,7 +79,7 @@ cdef class Parent(parent.Parent): # New Coercion support functionality ########################################################## - cdef __coerce_map_from_c(self, S) noexcept: + cdef __coerce_map_from_c(self, S): """ EXAMPLES: @@ -143,7 +143,7 @@ cdef class Parent(parent.Parent): return mor - cdef __coerce_map_from_c_impl(self, S) noexcept: + cdef __coerce_map_from_c_impl(self, S): check_old_coerce(self) import sage.categories.morphism from sage.categories.map import Map @@ -183,7 +183,7 @@ cdef class Parent(parent.Parent): check_old_coerce(self) return self._coerce_c(x) - cpdef _coerce_c(self, x) noexcept: # DO NOT OVERRIDE THIS (call it) + cpdef _coerce_c(self, x): # DO NOT OVERRIDE THIS (call it) if self._element_constructor is not None: from sage.misc.superseded import deprecation deprecation(33497, "_coerce_c is deprecated, use coerce instead") @@ -200,7 +200,7 @@ cdef class Parent(parent.Parent): else: return self._coerce_c_impl(x) - cdef _coerce_c_impl(self, x) noexcept: # OVERRIDE THIS FOR CYTHON CLASSES + cdef _coerce_c_impl(self, x): # OVERRIDE THIS FOR CYTHON CLASSES """ Canonically coerce x in assuming that the parent of x is not equal to self. @@ -216,7 +216,7 @@ cdef class Parent(parent.Parent): check_old_coerce(self) return self._coerce_c_impl(x) - cdef __has_coerce_map_from_c(self, S) noexcept: + cdef __has_coerce_map_from_c(self, S): check_old_coerce(self) if self == S: return True @@ -264,7 +264,7 @@ cdef class Parent(parent.Parent): ############################################################### # Coercion Compatibility Layer ############################################################### - cpdef _coerce_map_from_(self, S) noexcept: + cpdef _coerce_map_from_(self, S): if self._element_constructor is None: return self.__coerce_map_from_c(S) else: @@ -278,7 +278,7 @@ cdef class Parent(parent.Parent): self._cache_an_element = self._an_element_impl() return self._cache_an_element - cpdef _generic_convert_map(self, S, category=None) noexcept: + cpdef _generic_convert_map(self, S, category=None): r""" Return a default conversion from ``S``. diff --git a/src/sage/structure/richcmp.pxd b/src/sage/structure/richcmp.pxd index 7db6340ec48..98bda696ec7 100644 --- a/src/sage/structure/richcmp.pxd +++ b/src/sage/structure/richcmp.pxd @@ -3,7 +3,7 @@ from cpython.object cimport (Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE, PyObject_RichCompare) -cpdef inline richcmp(x, y, int op) noexcept: +cpdef inline richcmp(x, y, int op): """ Return the result of the rich comparison of ``x`` and ``y`` with operator ``op``. @@ -50,10 +50,10 @@ cpdef inline richcmp(x, y, int op) noexcept: return PyObject_RichCompare(x, y, op) -cpdef richcmp_item(x, y, int op) noexcept +cpdef richcmp_item(x, y, int op) -cpdef inline richcmp_not_equal(x, y, int op) noexcept: +cpdef inline richcmp_not_equal(x, y, int op): """ Like ``richcmp(x, y, op)`` but assuming that `x` is not equal to `y`. diff --git a/src/sage/structure/richcmp.pyx b/src/sage/structure/richcmp.pyx index 7e1720c0e07..465f16e8274 100644 --- a/src/sage/structure/richcmp.pyx +++ b/src/sage/structure/richcmp.pyx @@ -68,7 +68,7 @@ richcmp_slotdef[Py_LE] = get_slotdef(bytes.__le__) richcmp_slotdef[Py_GE] = get_slotdef(bytes.__ge__) -cpdef richcmp_item(x, y, int op) noexcept: +cpdef richcmp_item(x, y, int op): """ This function is meant to implement lexicographic rich comparison of sequences (lists, vectors, polynomials, ...). @@ -266,7 +266,7 @@ cpdef richcmp_item(x, y, int op) noexcept: return NotImplemented -cdef slot_tp_richcompare(self, other, int op) noexcept: +cdef slot_tp_richcompare(self, other, int op): """ Function to put in the ``tp_richcompare`` slot. """ diff --git a/src/sage/symbolic/comparison_impl.pxi b/src/sage/symbolic/comparison_impl.pxi index b729babcd58..a1ef76bd778 100644 --- a/src/sage/symbolic/comparison_impl.pxi +++ b/src/sage/symbolic/comparison_impl.pxi @@ -135,7 +135,7 @@ class _print_key(): return print_order_c(self.ex, other.ex) < 0 -cpdef print_sorted(expressions) noexcept: +cpdef print_sorted(expressions): """ Sort a list in print order @@ -219,7 +219,7 @@ class _math_key(): raise ValueError('cannot compare {0} and {1}'.format(self.ex, other.ex)) -cpdef math_sorted(expressions) noexcept: +cpdef math_sorted(expressions): """ Sort a list of symbolic numbers in the "Mathematics" order @@ -409,7 +409,7 @@ class _mixed_key(): return num < 0 -cpdef mixed_sorted(expressions) noexcept: +cpdef mixed_sorted(expressions): """ Sort a list of symbolic numbers in the "Mixed" order diff --git a/src/sage/symbolic/expression.pxd b/src/sage/symbolic/expression.pxd index a212eb414c0..33e352b7f3d 100644 --- a/src/sage/symbolic/expression.pxd +++ b/src/sage/symbolic/expression.pxd @@ -1,6 +1,6 @@ -cpdef _repr_Expression(x) noexcept -cpdef _latex_Expression(x) noexcept -cpdef new_Expression(parent, x) noexcept -cpdef new_Expression_from_pyobject(parent, x, bint force=?, bint recursive=?) noexcept -cpdef new_Expression_wild(parent, unsigned int n=?) noexcept -cpdef new_Expression_symbol(parent, name=?, latex_name=?, domain=?) noexcept +cpdef _repr_Expression(x) +cpdef _latex_Expression(x) +cpdef new_Expression(parent, x) +cpdef new_Expression_from_pyobject(parent, x, bint force=?, bint recursive=?) +cpdef new_Expression_wild(parent, unsigned int n=?) +cpdef new_Expression_symbol(parent, name=?, latex_name=?, domain=?) diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index 79b03e58d06..e14674678a0 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -704,7 +704,7 @@ cdef class Expression(Expression_abc): cdef GEx _gobj - cpdef object pyobject(self) noexcept: + cpdef object pyobject(self): """ Get the underlying Python object. @@ -1577,7 +1577,7 @@ cdef class Expression(Expression_abc): return n return sage.rings.rational.Rational(n) - cpdef _eval_self(self, R) noexcept: + cpdef _eval_self(self, R): """ Evaluate this expression numerically. @@ -1638,7 +1638,7 @@ cdef class Expression(Expression_abc): else: raise TypeError("cannot evaluate symbolic expression to a numeric value") - cpdef _convert(self, kwds) noexcept: + cpdef _convert(self, kwds): """ Convert all the numeric coefficients and constants in this expression to the given ring ``R``. This results in an expression which contains @@ -2178,7 +2178,7 @@ cdef class Expression(Expression_abc): finally: sig_off() - cpdef _richcmp_(left, right, int op) noexcept: + cpdef _richcmp_(left, right, int op): """ Create a formal symbolic inequality or equality. @@ -3798,7 +3798,7 @@ cdef class Expression(Expression_abc): return False raise NotImplementedError - cdef Expression coerce_in(self, z) noexcept: + cdef Expression coerce_in(self, z): """ Quickly coerce z to be an Expression. """ @@ -3807,7 +3807,7 @@ cdef class Expression(Expression_abc): except TypeError: return self._parent.coerce(z) - cpdef _add_(left, right) noexcept: + cpdef _add_(left, right): """ Add left and right. @@ -3902,7 +3902,7 @@ cdef class Expression(Expression_abc): x = left._gobj + _right._gobj return new_Expression_from_GEx(left._parent, x) - cpdef _sub_(left, right) noexcept: + cpdef _sub_(left, right): """ EXAMPLES:: @@ -3954,7 +3954,7 @@ cdef class Expression(Expression_abc): x = left._gobj - _right._gobj return new_Expression_from_GEx(left._parent, x) - cpdef _mul_(left, right) noexcept: + cpdef _mul_(left, right): """ Multiply left and right. @@ -4120,7 +4120,7 @@ cdef class Expression(Expression_abc): x = left._gobj * _right._gobj return new_Expression_from_GEx(left._parent, x) - cpdef _div_(left, right) noexcept: + cpdef _div_(left, right): """ Divide left and right. @@ -4301,7 +4301,7 @@ cdef class Expression(Expression_abc): """ return print_order_compare_mul(left._gobj, right._gobj) - cpdef _pow_(self, other) noexcept: + cpdef _pow_(self, other): r""" Return ``self`` raised to the power ``other``. @@ -4515,7 +4515,7 @@ cdef class Expression(Expression_abc): x = g_pow(self._gobj, nexp._gobj) return new_Expression_from_GEx(self._parent, x) - cpdef _pow_int(self, other) noexcept: + cpdef _pow_int(self, other): """ TESTS:: @@ -5899,7 +5899,7 @@ cdef class Expression(Expression_abc): res = self._gobj.subs_map(smap, 0) return new_Expression_from_GEx(self._parent, res) - cpdef Expression _subs_expr(self, expr) noexcept: + cpdef Expression _subs_expr(self, expr): """ EXAMPLES:: @@ -13530,7 +13530,7 @@ cdef class Expression(Expression_abc): return S -cpdef _repr_Expression(x) noexcept: +cpdef _repr_Expression(x): r""" Return the string representation of the expression ``x``. @@ -13542,7 +13542,7 @@ cpdef _repr_Expression(x) noexcept: return ccrepr((x)._gobj) -cpdef _latex_Expression(x) noexcept: +cpdef _latex_Expression(x): r""" Return the standard LaTeX version of the expression `x`. @@ -13618,7 +13618,7 @@ def _eval_on_operands(f): cdef dict dynamic_class_cache = {} -cdef get_dynamic_class_for_function(unsigned serial) noexcept: +cdef get_dynamic_class_for_function(unsigned serial): r""" Create a dynamic class corresponding to the function with given ``serial`` that includes dynamic methods defined by the function. @@ -13713,7 +13713,7 @@ cdef get_dynamic_class_for_function(unsigned serial) noexcept: return cls -cdef Expression new_Expression_from_GEx(parent, GEx juice) noexcept: +cdef Expression new_Expression_from_GEx(parent, GEx juice): cdef type cls cdef Expression nex if is_exactly_a_function(juice): @@ -13729,7 +13729,7 @@ cdef Expression new_Expression_from_GEx(parent, GEx juice) noexcept: return nex -cpdef new_Expression(parent, x) noexcept: +cpdef new_Expression(parent, x): r""" Convert ``x`` into the symbolic expression ring ``parent``. @@ -13819,7 +13819,7 @@ cpdef new_Expression(parent, x) noexcept: return new_Expression_from_GEx(parent, exp) -cpdef new_Expression_from_pyobject(parent, x, bint force=True, bint recursive=True) noexcept: +cpdef new_Expression_from_pyobject(parent, x, bint force=True, bint recursive=True): r""" Wrap the given Python object in a symbolic expression even if it cannot be coerced to the Symbolic Ring. @@ -13890,7 +13890,7 @@ cpdef new_Expression_from_pyobject(parent, x, bint force=True, bint recursive=Tr return new_Expression_from_GEx(parent, exp) -cpdef new_Expression_wild(parent, unsigned int n=0) noexcept: +cpdef new_Expression_wild(parent, unsigned int n=0): r""" Return the n-th wild-card for pattern matching and substitution. @@ -13920,7 +13920,7 @@ cpdef new_Expression_wild(parent, unsigned int n=0) noexcept: return new_Expression_from_GEx(parent, g_wild(n)) -cpdef new_Expression_symbol(parent, name=None, latex_name=None, domain=None) noexcept: +cpdef new_Expression_symbol(parent, name=None, latex_name=None, domain=None): r""" Look up or create a symbol. @@ -14072,7 +14072,7 @@ cdef class ExpressionIterator: self._ind+=1 return new_Expression_from_GEx(self._ex._parent, ex) -cdef inline ExpressionIterator new_ExpIter_from_Expression(Expression ex) noexcept: +cdef inline ExpressionIterator new_ExpIter_from_Expression(Expression ex): """ Construct a new iterator over a symbolic expression. diff --git a/src/sage/symbolic/function.pxd b/src/sage/symbolic/function.pxd index 1987a393f86..db1ba6c5d54 100644 --- a/src/sage/symbolic/function.pxd +++ b/src/sage/symbolic/function.pxd @@ -8,21 +8,21 @@ cdef class Function(SageObject): cdef object _latex_name cdef object _conversions cdef object _evalf_params_first - cdef _is_registered(self) noexcept - cdef _register_function(self) noexcept + cdef _is_registered(self) + cdef _register_function(self) cdef class BuiltinFunction(Function): cdef object _preserved_arg - cdef _is_registered(self) noexcept + cdef _is_registered(self) cdef class GinacFunction(BuiltinFunction): cdef object _ginac_name - cdef _is_registered(self) noexcept - cdef _register_function(self) noexcept + cdef _is_registered(self) + cdef _register_function(self) cdef class SymbolicFunction(Function): # cache hash value cdef long _hash_(self) except -1 cdef bint __hinit cdef long __hcache - cdef _is_registered(self) noexcept + cdef _is_registered(self) diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx index 6f98df19964..f33b8eb47e6 100644 --- a/src/sage/symbolic/function.pyx +++ b/src/sage/symbolic/function.pyx @@ -245,14 +245,14 @@ cdef class Function(SageObject): self._register_function() register_symbol(self, self._conversions) - cdef _is_registered(self) noexcept: + cdef _is_registered(self): """ Check if this function is already registered. If it is, set `self._serial` to the right value. """ raise NotImplementedError("this is an abstract base class, it shouldn't be initialized directly") - cdef _register_function(self) noexcept: + cdef _register_function(self): """ TESTS: @@ -850,14 +850,14 @@ cdef class GinacFunction(BuiltinFunction): evalf_params_first=evalf_params_first, preserved_arg=preserved_arg, alt_name=alt_name) - cdef _is_registered(self) noexcept: + cdef _is_registered(self): # Since this is function is defined in C++, it is already in # ginac's function registry fname = self._ginac_name if self._ginac_name is not None else self._name self._serial = find_registered_function(fname, self._nargs) return bool(get_sfunction_from_serial(self._serial)) - cdef _register_function(self) noexcept: + cdef _register_function(self): # We don't need to add anything to GiNaC's function registry # However, if any custom methods were provided in the python class, # we should set the properties of the function_options object @@ -1086,7 +1086,7 @@ cdef class BuiltinFunction(Function): else: return res - cdef _is_registered(self) noexcept: + cdef _is_registered(self): """ TESTS: @@ -1204,7 +1204,7 @@ cdef class SymbolicFunction(Function): Function.__init__(self, name, nargs, latex_name, conversions, evalf_params_first) - cdef _is_registered(SymbolicFunction self) noexcept: + cdef _is_registered(SymbolicFunction self): # see if there is already a SymbolicFunction with the same state cdef long myhash = self._hash_() cdef SymbolicFunction sfunc = get_sfunction_from_hash(myhash) diff --git a/src/sage/symbolic/pynac_function_impl.pxi b/src/sage/symbolic/pynac_function_impl.pxi index cca1bb5d196..f20c8faf91a 100644 --- a/src/sage/symbolic/pynac_function_impl.pxi +++ b/src/sage/symbolic/pynac_function_impl.pxi @@ -3,7 +3,7 @@ cpdef call_registered_function(unsigned serial, list args, bint hold, bint allow_numeric_result, - result_parent) noexcept: + result_parent): r""" Call a function registered with Pynac (GiNaC). @@ -173,7 +173,7 @@ cpdef unsigned register_or_update_function(self, name, latex_name, int nargs, cdef dict sfunction_serial_dict = {} -cpdef get_sfunction_from_serial(unsigned int serial) noexcept: +cpdef get_sfunction_from_serial(unsigned int serial): """ Return an already created :class:`SymbolicFunction` given the serial. @@ -189,7 +189,7 @@ cpdef get_sfunction_from_serial(unsigned int serial) noexcept: return sfunction_serial_dict.get(serial) -cpdef get_sfunction_from_hash(long myhash) noexcept: +cpdef get_sfunction_from_hash(long myhash): """ Return an already created :class:`SymbolicFunction` given the hash. diff --git a/src/sage/symbolic/pynac_impl.pxi b/src/sage/symbolic/pynac_impl.pxi index 9d9f05c9140..f31a5498218 100644 --- a/src/sage/symbolic/pynac_impl.pxi +++ b/src/sage/symbolic/pynac_impl.pxi @@ -61,7 +61,7 @@ from sage.symbolic.function cimport Function # Symbolic function helpers ################################################################# -cdef ex_to_pyExpression(GEx juice) noexcept: +cdef ex_to_pyExpression(GEx juice): """ Convert given GiNaC::ex object to a python Expression instance. @@ -74,7 +74,7 @@ cdef ex_to_pyExpression(GEx juice) noexcept: nex._parent = SR return nex -cdef exprseq_to_PyTuple(GEx seq) noexcept: +cdef exprseq_to_PyTuple(GEx seq): """ Convert an exprseq to a Python tuple. @@ -134,7 +134,7 @@ def unpack_operands(Expression ex): return exprseq_to_PyTuple(ex._gobj) -cdef exvector_to_PyTuple(GExVector seq) noexcept: +cdef exvector_to_PyTuple(GExVector seq): """ Converts arguments list given to a function to a PyTuple. @@ -196,7 +196,7 @@ cdef GEx pyExpression_to_ex(res) except *: raise TypeError("function did not return a symbolic expression or an element that can be coerced into a symbolic expression") return (t)._gobj -cdef paramset_to_PyTuple(const_paramset_ref s) noexcept: +cdef paramset_to_PyTuple(const_paramset_ref s): """ Converts a std::multiset to a PyTuple. @@ -226,7 +226,7 @@ def paramset_from_Expression(Expression e): cdef int GINAC_FN_SERIAL = 0 -cdef set_ginac_fn_serial() noexcept: +cdef set_ginac_fn_serial(): """ Initialize the GINAC_FN_SERIAL variable to the number of functions defined by GiNaC. This allows us to prevent collisions with C++ level @@ -262,7 +262,7 @@ def get_ginac_serial(): return py_get_ginac_serial() -cdef get_fn_serial_c() noexcept: +cdef get_fn_serial_c(): """ Return overall size of Pynac function registry. """ @@ -288,7 +288,7 @@ def get_fn_serial(): return get_fn_serial_c() -cdef subs_args_to_PyTuple(const GExMap& map, unsigned options, const GExVector& seq) noexcept: +cdef subs_args_to_PyTuple(const GExMap& map, unsigned options, const GExVector& seq): """ Convert arguments from ``GiNaC::subs()`` to a PyTuple. @@ -789,12 +789,12 @@ cdef stdstring* py_dumps(o) noexcept: s = base64.b64encode(s) return string_from_pystr(s) -cdef py_loads(s) noexcept: +cdef py_loads(s): import base64 s = base64.b64decode(s) return loads(s) -cdef py_get_sfunction_from_serial(unsigned s) noexcept: +cdef py_get_sfunction_from_serial(unsigned s): """ Return the Python object associated with a serial. """ @@ -869,7 +869,7 @@ cdef int py_get_parent_char(o) except -1: # power helpers ################################################################# -cdef py_rational_power_parts(base, exp) noexcept: +cdef py_rational_power_parts(base, exp): if type(base) is not Rational: base = Rational(base) if type(exp) is not Rational: @@ -882,7 +882,7 @@ cdef py_rational_power_parts(base, exp) noexcept: ################################################################# -cdef py_binomial_int(int n, unsigned int k) noexcept: +cdef py_binomial_int(int n, unsigned int k): cdef bint sign if n < 0: n = -n + (k-1) @@ -898,7 +898,7 @@ cdef py_binomial_int(int n, unsigned int k) noexcept: else: return ans -cdef py_binomial(n, k) noexcept: +cdef py_binomial(n, k): # Keep track of the sign we should use. cdef bint sign if n < 0: @@ -949,7 +949,7 @@ def test_binomial(n, k): ################################################################# # GCD ################################################################# -cdef py_gcd(n, k) noexcept: +cdef py_gcd(n, k): if isinstance(n, Integer) and isinstance(k, Integer): if mpz_cmp_si((n).value, 1) == 0: return n @@ -969,7 +969,7 @@ cdef py_gcd(n, k) noexcept: ################################################################# # LCM ################################################################# -cdef py_lcm(n, k) noexcept: +cdef py_lcm(n, k): if isinstance(n, Integer) and isinstance(k, Integer): if mpz_cmp_si((n).value, 1) == 0: return k @@ -987,7 +987,7 @@ cdef py_lcm(n, k) noexcept: ################################################################# # Real Part ################################################################# -cdef py_real(x) noexcept: +cdef py_real(x): """ Returns the real part of x. @@ -1046,7 +1046,7 @@ def py_real_for_doctests(x): ################################################################# # Imaginary Part ################################################################# -cdef py_imag(x) noexcept: +cdef py_imag(x): """ Return the imaginary part of x. @@ -1103,7 +1103,7 @@ def py_imag_for_doctests(x): ################################################################# # Conjugate ################################################################# -cdef py_conjugate(x) noexcept: +cdef py_conjugate(x): try: return x.conjugate() except AttributeError: @@ -1250,7 +1250,7 @@ cdef bint py_is_exact(x) noexcept: return isinstance(P, SymbolicRing) or P.is_exact() -cdef py_numer(n) noexcept: +cdef py_numer(n): """ Return the numerator of the given object. This is called for typesetting coefficients. @@ -1298,7 +1298,7 @@ def py_numer_for_doctests(n): """ return py_numer(n) -cdef py_denom(n) noexcept: +cdef py_denom(n): """ Return the denominator of the given object. This is called for typesetting coefficients. @@ -1357,7 +1357,7 @@ def py_is_cinteger_for_doctest(x): """ return py_is_cinteger(x) -cdef py_float(n, PyObject* kwds) noexcept: +cdef py_float(n, PyObject* kwds): """ Evaluate pynac numeric objects numerically. @@ -1416,7 +1416,7 @@ def py_float_for_doctests(n, kwds): return py_float(n, kwds) -cdef py_RDF_from_double(double x) noexcept: +cdef py_RDF_from_double(double x): cdef RealDoubleElement r = RealDoubleElement.__new__(RealDoubleElement) r._value = x return r @@ -1424,7 +1424,7 @@ cdef py_RDF_from_double(double x) noexcept: ################################################################# # SPECIAL FUNCTIONS ################################################################# -cdef py_tgamma(x) noexcept: +cdef py_tgamma(x): """ The gamma function exported to pynac. @@ -1469,7 +1469,7 @@ def py_tgamma_for_doctests(x): """ return py_tgamma(x) -cdef py_factorial(x) noexcept: +cdef py_factorial(x): """ The factorial function exported to pynac. @@ -1510,7 +1510,7 @@ def py_factorial_py(x): """ return py_factorial(x) -cdef py_doublefactorial(x) noexcept: +cdef py_doublefactorial(x): n = Integer(x) if n < -1: raise ValueError("argument must be >= -1") @@ -1546,10 +1546,10 @@ def doublefactorial(n): return py_doublefactorial(n) -cdef py_fibonacci(n) noexcept: +cdef py_fibonacci(n): return Integer(pari(n).fibonacci()) -cdef py_step(n) noexcept: +cdef py_step(n): """ Return step function of n. """ @@ -1560,10 +1560,10 @@ cdef py_step(n) noexcept: return SR(1) return SR(Rational((1,2))) -cdef py_bernoulli(x) noexcept: +cdef py_bernoulli(x): return bernoulli(x) -cdef py_sin(x) noexcept: +cdef py_sin(x): """ TESTS:: @@ -1585,7 +1585,7 @@ cdef py_sin(x) noexcept: except (TypeError, ValueError): return CC(x).sin() -cdef py_cos(x) noexcept: +cdef py_cos(x): """ TESTS:: @@ -1607,7 +1607,7 @@ cdef py_cos(x) noexcept: except (TypeError, ValueError): return CC(x).cos() -cdef py_stieltjes(x) noexcept: +cdef py_stieltjes(x): """ Return the Stieltjes constant of the given index. @@ -1649,7 +1649,7 @@ def py_stieltjes_for_doctests(x): """ return py_stieltjes(x) -cdef py_zeta(x) noexcept: +cdef py_zeta(x): """ Return the value of the zeta function at the given value. @@ -1683,7 +1683,7 @@ def py_zeta_for_doctests(x): """ return py_zeta(x) -cdef py_exp(x) noexcept: +cdef py_exp(x): """ Return the value of the exp function at the given value. @@ -1724,7 +1724,7 @@ def py_exp_for_doctests(x): """ return py_exp(x) -cdef py_log(x) noexcept: +cdef py_log(x): """ Return the value of the log function at the given value. @@ -1793,7 +1793,7 @@ def py_log_for_doctests(x): """ return py_log(x) -cdef py_tan(x) noexcept: +cdef py_tan(x): try: return x.tan() except AttributeError: @@ -1803,28 +1803,28 @@ cdef py_tan(x) noexcept: except TypeError: return CC(x).tan() -cdef py_asin(x) noexcept: +cdef py_asin(x): try: return x.arcsin() except AttributeError: return RR(x).arcsin() -cdef py_acos(x) noexcept: +cdef py_acos(x): try: return x.arccos() except AttributeError: return RR(x).arccos() -cdef py_atan(x) noexcept: +cdef py_atan(x): try: return x.arctan() except AttributeError: return RR(x).arctan() -cdef py_atan2(x, y) noexcept: +cdef py_atan2(x, y): """ Return the value of the two argument arctan function at the given values. @@ -1909,14 +1909,14 @@ def py_atan2_for_doctests(x, y): return py_atan2(x, y) -cdef py_sinh(x) noexcept: +cdef py_sinh(x): try: return x.sinh() except AttributeError: return RR(x).sinh() -cdef py_cosh(x) noexcept: +cdef py_cosh(x): if type(x) is float: return math.cosh(PyFloat_AS_DOUBLE(x)) try: @@ -1925,14 +1925,14 @@ cdef py_cosh(x) noexcept: return RR(x).cosh() -cdef py_tanh(x) noexcept: +cdef py_tanh(x): try: return x.tanh() except AttributeError: return RR(x).tanh() -cdef py_asinh(x) noexcept: +cdef py_asinh(x): try: return x.arcsinh() except AttributeError: @@ -1943,7 +1943,7 @@ cdef py_asinh(x) noexcept: return CC(x).arcsinh() -cdef py_acosh(x) noexcept: +cdef py_acosh(x): try: return x.arccosh() except AttributeError: @@ -1954,7 +1954,7 @@ cdef py_acosh(x) noexcept: return CC(x).arccosh() -cdef py_atanh(x) noexcept: +cdef py_atanh(x): try: return x.arctanh() except AttributeError: @@ -1965,7 +1965,7 @@ cdef py_atanh(x) noexcept: return CC(x).arctanh() -cdef py_lgamma(x) noexcept: +cdef py_lgamma(x): """ Return the value of the principal branch of the log gamma function at the given value. @@ -2012,11 +2012,11 @@ def py_lgamma_for_doctests(x): return py_lgamma(x) -cdef py_isqrt(x) noexcept: +cdef py_isqrt(x): return Integer(x).isqrt() -cdef py_sqrt(x) noexcept: +cdef py_sqrt(x): try: # WORRY: What if Integer's sqrt calls symbolic one and we go in circle? return x.sqrt() @@ -2024,11 +2024,11 @@ cdef py_sqrt(x) noexcept: return math.sqrt(float(x)) -cdef py_abs(x) noexcept: +cdef py_abs(x): return abs(x) -cdef py_mod(x, n) noexcept: +cdef py_mod(x, n): """ Return x mod n. Both x and n are assumed to be integers. @@ -2076,7 +2076,7 @@ def py_mod_for_doctests(x, n): return py_mod(x, n) -cdef py_smod(a, b) noexcept: +cdef py_smod(a, b): # Modulus (in symmetric representation). # Equivalent to Maple's mods. # returns a mod b in the range [-iquo(abs(b)-1,2), iquo(abs(b),2)] @@ -2089,15 +2089,15 @@ cdef py_smod(a, b) noexcept: return c -cdef py_irem(x, n) noexcept: +cdef py_irem(x, n): return Integer(x) % Integer(n) -cdef py_iquo(x, n) noexcept: +cdef py_iquo(x, n): return Integer(x)//Integer(n) -cdef py_iquo2(x, n) noexcept: +cdef py_iquo2(x, n): x = Integer(x) n = Integer(n) try: @@ -2115,7 +2115,7 @@ cdef int py_int_length(x) except -1: return Integer(x).nbits() -cdef py_li(x, n, parent) noexcept: +cdef py_li(x, n, parent): """ Returns a numerical approximation of polylog(n, x) with precision given by the ``parent`` argument. @@ -2152,7 +2152,7 @@ def py_li_for_doctests(x, n, parent): return py_li(x, n, parent) -cdef py_psi(x) noexcept: +cdef py_psi(x): """ EXAMPLES:: @@ -2187,7 +2187,7 @@ def py_psi_for_doctests(x): """ return py_psi(x) -cdef py_psi2(n, x) noexcept: +cdef py_psi2(n, x): """ EXAMPLES:: @@ -2215,7 +2215,7 @@ def py_psi2_for_doctests(n, x): """ return py_psi2(n, x) -cdef py_li2(x) noexcept: +cdef py_li2(x): """ EXAMPLES:: @@ -2264,12 +2264,12 @@ cdef GConstant py_get_constant(const char* name) noexcept: pc = c._pynac return pc.pointer[0] -cdef py_eval_constant(unsigned serial, kwds) noexcept: +cdef py_eval_constant(unsigned serial, kwds): from sage.symbolic.constants import constants_table constant = constants_table[serial] return kwds['parent'](constant) -cdef py_eval_unsigned_infinity() noexcept: +cdef py_eval_unsigned_infinity(): """ Returns unsigned_infinity. """ @@ -2288,7 +2288,7 @@ def py_eval_unsigned_infinity_for_doctests(): """ return py_eval_unsigned_infinity() -cdef py_eval_infinity() noexcept: +cdef py_eval_infinity(): """ Returns positive infinity, i.e., oo. """ @@ -2307,7 +2307,7 @@ def py_eval_infinity_for_doctests(): """ return py_eval_infinity() -cdef py_eval_neg_infinity() noexcept: +cdef py_eval_neg_infinity(): """ Returns minus_infinity. """ @@ -2330,18 +2330,18 @@ def py_eval_neg_infinity_for_doctests(): # Constructors ################################################################## -cdef py_integer_from_long(long x) noexcept: +cdef py_integer_from_long(long x): return smallInteger(x) -cdef py_integer_from_python_obj(x) noexcept: +cdef py_integer_from_python_obj(x): return Integer(x) -cdef py_integer_from_mpz(mpz_t bigint) noexcept: +cdef py_integer_from_mpz(mpz_t bigint): cdef Integer z = PY_NEW(Integer) mpz_set(z.value, bigint) return z -cdef py_rational_from_mpq(mpq_t bigrat) noexcept: +cdef py_rational_from_mpq(mpq_t bigrat): cdef Rational rat = Rational.__new__(Rational) mpq_set(rat.value, bigrat) mpq_canonicalize(rat.value) diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx index d0f6d93186c..32a22e6f861 100644 --- a/src/sage/symbolic/ring.pyx +++ b/src/sage/symbolic/ring.pyx @@ -125,7 +125,7 @@ cdef class SymbolicRing(sage.rings.abc.SymbolicRing): """ return r'\text{SR}' - cpdef _coerce_map_from_(self, R) noexcept: + cpdef _coerce_map_from_(self, R): """ EXAMPLES:: @@ -1224,7 +1224,7 @@ cdef class NumpyToSRMorphism(Morphism): else: raise TypeError("{} is not a numpy number type".format(numpy_type)) - cpdef Element _call_(self, a) noexcept: + cpdef Element _call_(self, a): """ EXAMPLES: @@ -1271,7 +1271,7 @@ cdef class UnderscoreSageMorphism(Morphism): from sage.interfaces.sympy import sympy_init sympy_init() - cpdef Element _call_(self, a) noexcept: + cpdef Element _call_(self, a): """ EXAMPLES: diff --git a/src/sage/symbolic/substitution_map_impl.pxi b/src/sage/symbolic/substitution_map_impl.pxi index 79d8d4491cf..7d9e35cf630 100644 --- a/src/sage/symbolic/substitution_map_impl.pxi +++ b/src/sage/symbolic/substitution_map_impl.pxi @@ -24,7 +24,7 @@ cdef class SubstitutionMap(SageObject): cdef GExMap _gmapobj - cpdef Expression apply_to(self, Expression expr, unsigned options) noexcept: + cpdef Expression apply_to(self, Expression expr, unsigned options): """ Apply the substitution to a symbolic expression. @@ -51,7 +51,7 @@ cdef class SubstitutionMap(SageObject): return 'SubsMap' # GEx_to_str(&x._gobj) -cdef SubstitutionMap new_SubstitutionMap_from_GExMap(const GExMap& smap) noexcept: +cdef SubstitutionMap new_SubstitutionMap_from_GExMap(const GExMap& smap): """ Wrap a Pynac object into a Python object. @@ -75,7 +75,7 @@ cdef SubstitutionMap new_SubstitutionMap_from_GExMap(const GExMap& smap) noexcep return result -cpdef SubstitutionMap make_map(subs_dict) noexcept: +cpdef SubstitutionMap make_map(subs_dict): """ Construct a new substitution map. diff --git a/src/sage/tests/stl_vector.pyx b/src/sage/tests/stl_vector.pyx index 2a7c1bf5d05..f3b29b30dfe 100644 --- a/src/sage/tests/stl_vector.pyx +++ b/src/sage/tests/stl_vector.pyx @@ -115,7 +115,7 @@ cdef class stl_int_vector(SageObject): s += ' data[' + str(i) + '] = ' + str(self.data.at(i)) + '\n' return s.strip() - cpdef sum(self) noexcept: + cpdef sum(self): """ Add the elements. diff --git a/src/sage_setup/autogen/interpreters/specs/cdf.py b/src/sage_setup/autogen/interpreters/specs/cdf.py index e85a9fbe802..c9ea258e221 100644 --- a/src/sage_setup/autogen/interpreters/specs/cdf.py +++ b/src/sage_setup/autogen/interpreters/specs/cdf.py @@ -168,7 +168,7 @@ def __init__(self): cdef double cimag(double_complex) cdef double_complex _Complex_I - cdef inline double_complex CDE_to_dz(zz): + cdef inline double_complex CDE_to_dz(zz) noexcept: cdef ComplexDoubleElement z = (zz if isinstance(zz, ComplexDoubleElement) else CDF(zz)) return GSL_REAL(z._complex) + _Complex_I * GSL_IMAG(z._complex)