diff --git a/src/sage/rings/polynomial/pbori/easy_polynomials.py b/src/sage/rings/polynomial/pbori/easy_polynomials.py index a5ee335b98b..270e3db06d4 100644 --- a/src/sage/rings/polynomial/pbori/easy_polynomials.py +++ b/src/sage/rings/polynomial/pbori/easy_polynomials.py @@ -6,7 +6,7 @@ def easy_linear_polynomials(p): r""" Get linear polynomials implied by given polynomial. - TESTS:: + EXAMPLES:: sage: from sage.rings.polynomial.pbori.frontend import * sage: from sage.rings.polynomial.pbori.easy_polynomials import easy_linear_polynomials diff --git a/src/sage/rings/polynomial/pbori/frontend.py b/src/sage/rings/polynomial/pbori/frontend.py index 2a0d29c2018..7314e09db63 100644 --- a/src/sage/rings/polynomial/pbori/frontend.py +++ b/src/sage/rings/polynomial/pbori/frontend.py @@ -31,7 +31,8 @@ """ -from . import * +from .PyPolyBoRi import Ring, Monomial, Polynomial +from .pbori import VariableFactory from .blocks import declare_ring as orig_declare_ring diff --git a/src/sage/rings/polynomial/pbori/gbcore.py b/src/sage/rings/polynomial/pbori/gbcore.py index 4a9d47777de..6776dbc58df 100644 --- a/src/sage/rings/polynomial/pbori/gbcore.py +++ b/src/sage/rings/polynomial/pbori/gbcore.py @@ -1,17 +1,17 @@ +from copy import copy +from itertools import chain +from inspect import getfullargspec as getargspec + from .nf import GeneratorLimitExceeded, symmGB_F2_C, symmGB_F2_python from .PyPolyBoRi import (Monomial, Polynomial, GroebnerStrategy, OrderCode, ll_red_nf_redsb) from .ll import eliminate, ll_encode -from copy import copy -from itertools import chain from .statistics import used_vars_set from .heuristics import dense_system, gauss_on_linear from .easy_polynomials import easy_linear_polynomials from .interpolate import lex_groebner_basis_for_polynomial_via_variety from .fglm import _fglm -from inspect import getfullargspec as getargspec - def get_options_from_function(f): (argnames, varargs, varopts, defaults) = getargspec(f)[:4] @@ -22,7 +22,7 @@ def filter_oldstyle_options(**options): filtered = dict() for key in options: newkey = key - for prefix in ['', 'use_', 'opt_allow_', 'opt_']: + for prefix in ['use_', 'opt_allow_', 'opt_']: newkey = newkey.replace(prefix, '') filtered[newkey] = options[key] return filtered @@ -197,13 +197,9 @@ def make_wrapper(f): return make_wrapper -def clean_polys(I): - I = list(set((Polynomial(p) for p in I if not Polynomial(p).is_zero()))) - return I - - def clean_polys_pre(I): - return (clean_polys(I), None) + wrap = (Polynomial(p) for p in I) + return (list(set(p for p in wrap if not p.is_zero())), None) def gb_with_pre_post_option(option, pre=None, @@ -259,14 +255,14 @@ def wrapper(I, **kwds): def redsb_post(I, state): - if I == []: + if not I: return [] else: return I.minimalize_and_tail_reduce() def minsb_post(I, state): - if I == []: + if not I: return [] else: return I.minimalize() diff --git a/src/sage/rings/polynomial/pbori/ll.py b/src/sage/rings/polynomial/pbori/ll.py index c9795ddd3ca..48c43220a89 100644 --- a/src/sage/rings/polynomial/pbori/ll.py +++ b/src/sage/rings/polynomial/pbori/ll.py @@ -109,15 +109,15 @@ def identity(p): else: reduction_function = ll_red_nf_redsb - def llnf(p): - return reduction_function(p, reductors) - reduced_list = [] if optimized: llnf, reduced_list = eliminate_ll_ranked(linear_leads, rest, reduction_function=reduction_function, reduce_ll_system=(not on_the_fly), prot=prot) else: + def llnf(p): + return reduction_function(p, reductors) + reduced_list = [] reductors = ll_encode(linear_leads, reduce=(not on_the_fly), prot=prot) for p in rest: p = reduction_function(p, reductors)