11from flint.flint_base.flint_base cimport (
22 flint_mpoly,
33 flint_mpoly_context,
4- Ordering,
54 ordering_py_to_c,
65 ordering_c_to_py,
76)
@@ -17,7 +16,6 @@ from flint.types.fmpz cimport fmpz, any_as_fmpz
1716from flint.types.fmpz_mpoly cimport fmpz_mpoly
1817
1918from flint.flintlib.fmpq cimport fmpq_set, fmpq_one
20- from flint.flintlib.mpoly cimport ordering_t
2119from flint.flintlib.fmpq_mpoly cimport (
2220 fmpq_mpoly_add,
2321 fmpq_mpoly_add_fmpq,
@@ -54,7 +52,6 @@ from flint.flintlib.fmpq_mpoly cimport (
5452 fmpq_mpoly_set_coeff_fmpq_fmpz,
5553 fmpq_mpoly_set_fmpq,
5654 fmpq_mpoly_set_str_pretty,
57- fmpq_mpoly_set_term_coeff_fmpq,
5855 fmpq_mpoly_sort_terms,
5956 fmpq_mpoly_sqrt,
6057 fmpq_mpoly_sub,
@@ -163,16 +160,16 @@ cdef class fmpq_mpoly_ctx(flint_mpoly_context):
163160 fmpq_mpoly res
164161
165162 if not isinstance (d, dict ):
166- raise ValueError (" Expected a dictionary" )
163+ raise ValueError (" expected a dictionary" )
167164
168165 res = create_fmpq_mpoly(self )
169166
170167 for k, v in d.items():
171168 o = any_as_fmpq(v)
172169 if o is NotImplemented :
173- raise TypeError (f" Cannot coerce coefficient '{v}' to fmpq" )
170+ raise TypeError (f" cannot coerce coefficient '{v}' to fmpq" )
174171 elif len (k) != nvars:
175- raise ValueError (f" Expected {nvars} exponents, got {len(k)}" )
172+ raise ValueError (f" expected {nvars} exponents, got {len(k)}" )
176173
177174 exp_vec = fmpz_vec(k)
178175
@@ -212,33 +209,34 @@ cdef class fmpq_mpoly(flint_mpoly):
212209 raise TypeError (f" {ctx} is not a fmpq_mpoly_ctx or fmpz_mpoly_ctx" )
213210 elif ctx.nvars() != val.context().nvars():
214211 raise ValueError (
215- f" Provided context ('{ctx}') and provided fmpz_mpoly ('{val}') don't share the same number of variables"
212+ f" Provided context ('{ctx}') and provided fmpz_mpoly ('{val}') don't share the same number of "
213+ " variables"
216214 )
217215 init_fmpq_mpoly(self , ctx)
218216 fmpz_mpoly_set(self .val.zpoly, (< fmpz_mpoly> val).val, (< fmpz_mpoly> val).ctx.val)
219217 fmpq_one(self .val.content)
220218 fmpq_mpoly_reduce(self .val, self .ctx.val)
221219 elif isinstance (val, dict ):
222220 if ctx is None :
223- raise ValueError (" A context is required to create a fmpq_mpoly from a dict" )
221+ raise ValueError (" a context is required to create a fmpq_mpoly from a dict" )
224222 x = ctx.from_dict(val)
225223 # XXX: this copy is silly, have a ctx function that assigns an fmpz_mpoly_t
226224 init_fmpq_mpoly(self , ctx)
227225 fmpq_mpoly_set(self .val, (< fmpq_mpoly> x).val, self .ctx.val)
228226 elif isinstance (val, str ):
229227 if ctx is None :
230- raise ValueError (" Cannot parse a polynomial without context" )
228+ raise ValueError (" cannot parse a polynomial without context" )
231229 val = val.encode(" ascii" )
232230 init_fmpq_mpoly(self , ctx)
233231 if fmpq_mpoly_set_str_pretty(self .val, val, self .ctx.c_names, self .ctx.val) == - 1 :
234- raise ValueError (" Unable to parse fmpq_mpoly from string" )
232+ raise ValueError (" unable to parse fmpq_mpoly from string" )
235233 fmpq_mpoly_sort_terms(self .val, self .ctx.val)
236234 else :
237235 v = any_as_fmpq(val)
238236 if v is NotImplemented :
239237 raise TypeError (" cannot create fmpz_mpoly from type %s " % type (val))
240238 if ctx is None :
241- raise ValueError (" Need context to convert fmpz to fmpq_mpoly" )
239+ raise ValueError (" need context to convert fmpz to fmpq_mpoly" )
242240 init_fmpq_mpoly(self , ctx)
243241 fmpq_mpoly_set_fmpq(self .val, (< fmpq> v).val, self .ctx.val)
244242
@@ -280,9 +278,9 @@ cdef class fmpq_mpoly(flint_mpoly):
280278 slong nvars = self .ctx.nvars()
281279
282280 if not isinstance (x, tuple ):
283- raise TypeError (" Exponent vector index is not a tuple" )
281+ raise TypeError (" exponent vector index is not a tuple" )
284282 elif len (x) != nvars:
285- raise ValueError (" Exponent vector provided does not match number of variables" )
283+ raise ValueError (" exponent vector provided does not match number of variables" )
286284
287285 res = fmpq()
288286 exp_vec = fmpz_vec(x, double_indirect = True )
@@ -308,11 +306,11 @@ cdef class fmpq_mpoly(flint_mpoly):
308306
309307 coeff = any_as_fmpq(y)
310308 if coeff is NotImplemented :
311- raise TypeError (" Provided coefficient not coercible to fmpq" )
309+ raise TypeError (" provided coefficient not coercible to fmpq" )
312310 elif not isinstance (x, tuple ):
313- raise TypeError (" Exponent vector index is not a tuple" )
311+ raise TypeError (" exponent vector index is not a tuple" )
314312 elif len (x) != nvars:
315- raise ValueError (" Exponent vector provided does not match number of variables" )
313+ raise ValueError (" exponent vector provided does not match number of variables" )
316314
317315 exp_vec = fmpz_vec(x, double_indirect = True )
318316 fmpq_mpoly_set_coeff_fmpq_fmpz(self .val, (< fmpq> coeff).val, exp_vec.double_indirect, self .ctx.val)
@@ -530,19 +528,19 @@ cdef class fmpq_mpoly(flint_mpoly):
530528 slong nvars = self .ctx.nvars(), nargs = len (args)
531529
532530 if nargs < nvars:
533- raise ValueError("Not enough arguments provided")
531+ raise ValueError("not enough arguments provided")
534532 elif nargs > nvars:
535- raise ValueError("More arguments provided than variables")
533+ raise ValueError("more arguments provided than variables")
536534
537535 args_fmpq = tuple (any_as_fmpq(v) for v in args)
538536 for arg in args_fmpq:
539537 if arg is NotImplemented:
540- raise TypeError(f"Cannot coerce argument ('{arg}') to fmpq")
538+ raise TypeError(f"cannot coerce argument ('{arg}') to fmpq")
541539
542540 V = fmpq_vec(args_fmpq, double_indirect = True )
543541 vres = fmpq.__new__ (fmpq)
544542 if fmpq_mpoly_evaluate_all_fmpq(vres.val , self.val , V.double_indirect , self.ctx.val ) == 0:
545- raise ValueError("Unreasonably large polynomial") # pragma: no cover
543+ raise ValueError("unreasonably large polynomial") # pragma: no cover
546544 return vres
547545
548546 def monoms(self ):
@@ -676,20 +674,20 @@ cdef class fmpq_mpoly(flint_mpoly):
676674 slong i , nvars = self .ctx.nvars(), nargs = len (args)
677675
678676 if nargs < nvars:
679- raise ValueError("Not enough arguments provided")
677+ raise ValueError("not enough arguments provided")
680678 elif nargs > nvars:
681- raise ValueError("More arguments provided than variables")
679+ raise ValueError("more arguments provided than variables")
682680 elif not all(typecheck(arg , fmpq_mpoly ) for arg in args ):
683- raise TypeError (" All arguments must be fmpq_mpolys" )
681+ raise TypeError (" all arguments must be fmpq_mpolys" )
684682
685683 res_ctx = (< fmpq_mpoly> args[0 ]).ctx
686684 if not all ((< fmpq_mpoly> args[i]).ctx is res_ctx for i in range (1 , len (args))):
687- raise IncompatibleContextError(" All arguments must share the same context" )
685+ raise IncompatibleContextError(" all arguments must share the same context" )
688686
689687 C = fmpq_mpoly_vec(args, res_ctx, double_indirect = True )
690688 res = create_fmpq_mpoly(res_ctx)
691689 if fmpq_mpoly_compose_fmpq_mpoly(res.val, self .val, C.double_indirect, self .ctx.val, res_ctx.val) == 0 :
692- raise ValueError (" Unreasonably large polynomial" ) # pragma: no cover
690+ raise ValueError (" unreasonably large polynomial" ) # pragma: no cover
693691 return res
694692
695693 def context (self ):
0 commit comments