Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meta-PR: Replace imports from sage.*.all for namespace packages #35110

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
53ede8c
sage.rings.finite_rings: Deprecate is_FiniteField, is_PrimeFiniteField
mkoeppe Dec 5, 2022
8d4d8e5
sage.rings.finite_rings: Make it a namespace package
mkoeppe Dec 5, 2022
6ce26bc
src/sage/rings/finite_rings/finite_field_constructor.py: Restore re-e…
mkoeppe Dec 5, 2022
98a5484
src/sage/rings/finite_rings/hom_finite_field.pyx: Import ABC as Finit…
mkoeppe Dec 5, 2022
2e6b5ef
sage.rings.finite_rings: Deprecate is_FiniteFieldElent
mkoeppe Dec 5, 2022
3be7c97
Fixups
mkoeppe Dec 6, 2022
97a363e
Fixups
mkoeppe Dec 6, 2022
0c01403
Fixup: Elements of finite fields are not instances of FieldElement
mkoeppe Dec 6, 2022
9f4d1c4
src/sage/crypto/mq/rijndael_gf.py: Fix imports
mkoeppe Dec 6, 2022
9ebadcf
Merge tag '9.8.beta6' into t/32664/add_sage_rings_abc_finitefield__de…
mkoeppe Jan 7, 2023
bdf2f33
sage -fiximports src/sage/algebras src/sage/combinat src/sage/matroids
alexchandler100 Jan 29, 2023
301a0d1
sage -fiximports src/sage/{topology,homology}
alexchandler100 Jan 29, 2023
21148e5
sage -fiximports src/sage/{functions,interfaces,symbolic}
alexchandler100 Jan 29, 2023
1e88c12
sage -fiximports src/sage/{finance,interacts,libs,numerical,statistic…
alexchandler100 Jan 30, 2023
572896d
src/sage/{numerical,tests}: Manual fixes to imports
alexchandler100 Jan 30, 2023
965dfc6
sage -fiximports src/sage/stats
alexchandler100 Jan 30, 2023
21b94ba
src/sage/libs/giac/auto-methods.pxi: Back out whitespace changes in t…
mkoeppe Jan 30, 2023
bd50b49
git grep -l -E ' (Q as QQ|Z as ZZ)' | xargs sed -i.bak 's/ Q as QQ/ Q…
mkoeppe Jan 30, 2023
8e77597
sage.{algebras,combinat}: Consolidate imports from the same module
mkoeppe Jan 30, 2023
2870ffb
src/sage/interfaces/sage0.py: Hide a legitimate .all import from relint
mkoeppe Jan 30, 2023
70e5c66
sage.{functions,interfaces,symbolic}: Consolidate imports from the sa…
mkoeppe Jan 30, 2023
7305a7c
git grep -l -E ' (Q as QQ|Z as ZZ)' | xargs sed -i.bak 's/ Q as QQ/ Q…
mkoeppe Jan 30, 2023
f8bf304
Merge tag '9.8' into t/34946/sage__algebras_combinat_matroids___repla…
mkoeppe Feb 12, 2023
7bb289c
Merge tag '10.0.beta0' into t/34946/sage__algebras_combinat_matroids_…
mkoeppe Feb 13, 2023
effc538
Merge tag '10.0.beta0' into t/34953/sage__topology_homology___replace…
mkoeppe Feb 13, 2023
43c759d
Merge tag '10.0.beta0' into t/34954/sage__functions_interfaces_symbol…
mkoeppe Feb 13, 2023
572f4fb
Merge tag '10.0.beta0' into t/34957/sage__finance_interacts_libs_nume…
mkoeppe Feb 13, 2023
accafd8
Merge branch 'develop' into t/34957/sage__finance_interacts_libs_nume…
mkoeppe Feb 13, 2023
a8b4557
Merge branch 'develop' into t/34954/sage__functions_interfaces_symbol…
mkoeppe Feb 13, 2023
30bc1c6
Merge remote-tracking branch 'upstream/develop' into t/32664/add_sage…
mkoeppe Feb 13, 2023
254431c
Merge branch 'develop' into t/34946/sage__algebras_combinat_matroids_…
mkoeppe Feb 14, 2023
9e0baab
Update src/sage/stats/distributions/discrete_gaussian_polynomial.py
mkoeppe Feb 14, 2023
69d9a49
git grep -l -E ' (Q as QQ|Z as ZZ)' | xargs sed -i.bak 's/ Q as QQ/ Q…
mkoeppe Feb 14, 2023
3be20ec
Merge remote-tracking branch 'upstream/develop' into t/34946/sage__al…
mkoeppe Feb 14, 2023
ed1ee83
src/sage/combinat/necklace.py: Add missing import
mkoeppe Feb 14, 2023
10d2e1c
git grep -l 'GCD as gcd' src/sage/{algebras,combinat,matroids} | xarg…
mkoeppe Feb 14, 2023
29ad54e
Replace relative imports by absolute imports because pytest
mkoeppe Feb 16, 2023
ef98cb5
Replace relative imports by absolute imports because pytest
mkoeppe Feb 16, 2023
8c2d315
src/sage/matroids/linear_matroid.pyx: Remove unused imports, sort imp…
mkoeppe Feb 18, 2023
7265733
Merge branch 'develop' into t/32664/add_sage_rings_abc_finitefield__d…
mkoeppe Feb 19, 2023
b4639a2
Merge branch 'develop' into t/34954/sage__functions_interfaces_symbol…
mkoeppe Feb 19, 2023
3d1ad55
Merge branch 'develop' into t/34957/sage__finance_interacts_libs_nume…
mkoeppe Feb 19, 2023
40a7d57
src/sage/rings/finite_rings: Update doctest output (trac->github)
mkoeppe Feb 21, 2023
912e4c5
Merge remote-tracking branch 'upstream/develop' into t/34946/sage__al…
mkoeppe Feb 24, 2023
d68c2af
Merge branch 'develop' into t/34957/sage__finance_interacts_libs_nume…
mkoeppe Feb 24, 2023
c4204ec
Merge branch 'develop' into t/34954/sage__functions_interfaces_symbol…
mkoeppe Feb 24, 2023
12b4440
Merge tag '10.0.beta3' into t/32664/add_sage_rings_abc_finitefield__d…
mkoeppe Mar 3, 2023
cf42096
Merge branch 'develop' into t/34954/sage__functions_interfaces_symbol…
mkoeppe Mar 3, 2023
17f83a5
Merge branch 'develop' into t/34957/sage__finance_interacts_libs_nume…
mkoeppe Mar 3, 2023
c94bb06
sage -fiximports src/sage/{coding,groups}
alexchandler100 Jan 29, 2023
b4ec50e
git grep -l -E ' (Q as QQ|Z as ZZ)' | xargs sed -i.bak 's/ Q as QQ/ Q…
mkoeppe Jan 30, 2023
f1861a9
sage.{coding,groups}: Consolidate imports from the same module
mkoeppe Jan 30, 2023
34b9b18
src/sage/coding/delsarte_bounds.py: Remove useless import in doctest
mkoeppe Jan 30, 2023
62436f9
git grep -l 'GCD as gcd' src/sage/{coding,groups} | xargs sed -i.bak …
mkoeppe Feb 14, 2023
cec7c2f
Replace relative imports by absolute imports because pytest
mkoeppe Feb 16, 2023
2459849
Merge tag '10.0.beta4' into t/32664/add_sage_rings_abc_finitefield__d…
mkoeppe Mar 13, 2023
d591aec
sage -fiximports src/sage/{arith,crypto,databases,dynamics,lfunctions…
alexchandler100 Jan 29, 2023
9435a7e
git grep -l -E ' (Q as QQ|Z as ZZ)' | xargs sed -i.bak 's/ Q as QQ/ Q…
mkoeppe Jan 30, 2023
3d51e7b
src/sage/databases/findstat.py: Hide a legitimate .all import from re…
mkoeppe Jan 30, 2023
350979e
sage.{crypto,databases,dynamics,lfunctions,quadratic_forms}: Consolid…
mkoeppe Jan 30, 2023
f210dce
src/sage/quadratic_forms/ternary_qf.py: Fix import syntax
mkoeppe Feb 13, 2023
feb6525
src/sage/crypto/public_key/blum_goldwasser.py: Fix up relative imports
mkoeppe Feb 13, 2023
6e96393
Replace relative imports by absolute imports because pytest
mkoeppe Feb 14, 2023
4571804
Fix up syntax
mkoeppe Feb 14, 2023
9721de1
git grep -l 'GCD as gcd' src/sage/{arith,crypto,databases,dynamics,lf…
mkoeppe Feb 14, 2023
f9f6542
git grep -l 'XGCD as xgcd' src/sage/{arith,crypto,databases,dynamics,…
mkoeppe Feb 14, 2023
e2eb4af
Merge branch 't/34946/sage__algebras_combinat_matroids___replace_impo…
mkoeppe Mar 13, 2023
a8d742d
Merge branch 't/34948/sage__coding_groups___replace_imports_from_sage…
mkoeppe Mar 13, 2023
2dc34c4
Merge branch 't/34953/sage__topology_homology___replace_imports_from_…
mkoeppe Mar 13, 2023
93237d5
Merge branch 't/34954/sage__functions_interfaces_symbolic___replace_i…
mkoeppe Mar 13, 2023
436eaf3
Merge branch 't/34955/sage__arith_crypto_databases_dynamics_lfunction…
mkoeppe Mar 13, 2023
3f33cb3
Merge branch 't/34957/sage__finance_interacts_libs_numerical_statisti…
mkoeppe Mar 13, 2023
247bad9
src/.relint.yml (namespace_pkg_all_import): Skip all.py, upgrade from…
mkoeppe Jan 30, 2023
d2be519
src/.relint.yml: Allow .all imports in some modules
mkoeppe Jan 30, 2023
e62066f
src/sage/rings/padics/padic_template_element.pxi: Restore import lost…
mkoeppe Mar 13, 2023
a9d9420
Merge branch 't/32664/add_sage_rings_abc_finitefield__deprecate_is_fi…
mkoeppe Mar 13, 2023
545c2d1
Merge branch 't/34955/sage__arith_crypto_databases_dynamics_lfunction…
mkoeppe Mar 13, 2023
34586ac
src/sage/rings/polynomial/integer_valued_polynomials.py: Replace .all…
mkoeppe Mar 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/.relint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@
Hint: namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import,
Hint: or use 'sage --fiximports' to fix automatically in the source file.
# Keep in sync with SAGE_ROOT/src/sage/misc/replace_dot_all.py
pattern: 'from\s+sage(|[.](arith|categories|combinat|ext|graphs(|[.]decompositions)|interfaces|libs|matrix|misc|numerical(|[.]backends)|rings|sets))[.]all\s+import'
filePattern: '.*[.](py|pyx|pxi)$'
error: false # Make this a warning instead of an error for now
pattern: 'from\s+sage(|[.](arith|categories|combinat|ext|graphs(|[.]decompositions)|interfaces|libs|matrix|misc|numerical(|[.]backends)|rings(|[.]finite_rings)|sets))[.]all\s+import'
# imports from .all are allowed in all.py; also allow in some modules that need sage.all
filePattern: '(.*/|)(?!(all|benchmark|dev_tools|parsing|sage_eval))[^/.]*[.](py|pyx|pxi)$'
2 changes: 1 addition & 1 deletion src/sage/algebras/affine_nil_temperley_lieb.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Distributed under the terms of the GNU General Public License (GPL)
# https://www.gnu.org/licenses/
# ****************************************************************************
from sage.categories.all import AlgebrasWithBasis
from sage.categories.algebras_with_basis import AlgebrasWithBasis
from sage.combinat.root_system.cartan_type import CartanType
from sage.combinat.root_system.weyl_group import WeylGroup
from sage.rings.ring import Ring
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/cluster_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@

from copy import copy

from sage.arith.all import binomial
from sage.arith.misc import binomial
from sage.categories.homset import Hom
from sage.categories.morphism import SetMorphism
from sage.categories.rings import Rings
Expand Down
4 changes: 2 additions & 2 deletions src/sage/algebras/free_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@

from sage.structure.factory import UniqueFactory
from sage.misc.cachefunc import cached_method
from sage.all import PolynomialRing
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.ring import Algebra
from sage.categories.algebras_with_basis import AlgebrasWithBasis
from sage.combinat.free_module import CombinatorialFreeModule
Expand Down Expand Up @@ -282,7 +282,7 @@ def create_key(self, base_ring, arg1=None, arg2=None,
PolRing = PolynomialRing(base_ring, *args, **kwds)
if degrees is None:
return (PolRing,)
from sage.all import TermOrder
from sage.rings.polynomial.term_order import TermOrder
T = TermOrder(PolRing.term_order(), PolRing.ngens() + 1)
varnames = list(PolRing.variable_names())
newname = 'x'
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/free_algebra_quotient.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def hamilton_quatalg(R):
"""
n = 3
from sage.algebras.free_algebra import FreeAlgebra
from sage.matrix.all import MatrixSpace
from sage.matrix.matrix_space import MatrixSpace
A = FreeAlgebra(R, n, 'i')
F = A.monoid()
i, j, k = F.gens()
Expand Down
4 changes: 2 additions & 2 deletions src/sage/algebras/group_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
# http://www.gnu.org/licenses/
#*****************************************************************************

from sage.rings.all import IntegerRing
from sage.categories.all import Rings
from sage.rings.integer_ring import IntegerRing
from sage.categories.rings import Rings
from sage.categories.magmas import Magmas
from sage.categories.additive_magmas import AdditiveMagmas
from sage.categories.sets_cat import Sets
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/hecke_algebras/ariki_koike_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def dimension(self):
sage: LT.dimension()
29160
"""
from sage.arith.all import factorial
from sage.arith.misc import factorial
return self._r**self._n * factorial(self._n)

def some_elements(self):
Expand Down
6 changes: 4 additions & 2 deletions src/sage/algebras/iwahori_hecke_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@
from sage.structure.parent import Parent
from sage.structure.unique_representation import UniqueRepresentation
from sage.categories.realizations import Realizations, Category_realization_of_parent
from sage.categories.all import AlgebrasWithBasis, FiniteDimensionalAlgebrasWithBasis, CoxeterGroups
from sage.categories.algebras_with_basis import AlgebrasWithBasis
from sage.categories.finite_dimensional_algebras_with_basis import FiniteDimensionalAlgebrasWithBasis
from sage.categories.coxeter_groups import CoxeterGroups
from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing
from sage.arith.all import is_square
from sage.arith.misc import is_square
from sage.combinat.root_system.coxeter_group import CoxeterGroup
from sage.sets.family import Family
from sage.combinat.free_module import CombinatorialFreeModule
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/lie_algebras/bch.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from sage.arith.misc import bernoulli
from sage.categories.lie_algebras import LieAlgebras
from sage.combinat.integer_vector import IntegerListsLex
from sage.arith.all import factorial
from sage.arith.misc import factorial
from sage.rings.rational_field import QQ
from sage.structure.element import canonical_coercion

Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/lie_algebras/free_lie_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def graded_dimension(self, k):
"""
if k == 0:
return 0
from sage.arith.all import moebius
from sage.arith.misc import moebius
s = len(self.lie_algebra_generators())
k = ZZ(k) # Make sure we have something that is in ZZ
return sum(moebius(d) * s**(k // d) for d in k.divisors()) // k
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************
from sage.arith.all import factorial
from sage.arith.misc import factorial
from sage.misc.misc_c import prod
from sage.misc.repr import repr_lincomb
from sage.misc.latex import latex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.arith.all import binomial
from sage.arith.misc import binomial
from sage.sets.family import Family
from .lie_conformal_algebra_element import LCAStructureCoefficientsElement
from sage.categories.lie_conformal_algebras import LieConformalAlgebras
Expand Down
11 changes: 8 additions & 3 deletions src/sage/algebras/quatalg/quaternion_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.arith.all import (hilbert_conductor_inverse, hilbert_conductor,
factor, gcd, kronecker_symbol, valuation)
from sage.rings.all import RR, Integer
from sage.arith.misc import (hilbert_conductor_inverse,
hilbert_conductor,
factor,
gcd,
kronecker as kronecker_symbol,
valuation)
from sage.rings.real_mpfr import RR
from sage.rings.integer import Integer
from sage.rings.integer_ring import ZZ
from sage.rings.rational import Rational
from sage.rings.finite_rings.finite_field_constructor import GF
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/schur_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from sage.combinat.sf.sf import SymmetricFunctions
from sage.combinat.symmetric_group_algebra import SymmetricGroupAlgebra
from sage.combinat.tableau import SemistandardTableaux
from sage.arith.all import binomial
from sage.arith.misc import binomial
from sage.matrix.constructor import Matrix
from sage.misc.cachefunc import cached_method
from sage.misc.flatten import flatten
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/shuffle_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ def expansion_on_basis(self, w):
sage: S.expansion_on_basis(Word('abab'))
2*B[aabb] + B[abab]
"""
from sage.arith.all import factorial
from sage.arith.misc import factorial
if not w:
return self._alg.one()
if len(w) == 1:
Expand Down
6 changes: 4 additions & 2 deletions src/sage/algebras/steenrod/steenrod_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,9 @@
from sage.combinat.free_module import CombinatorialFreeModule
from sage.misc.lazy_attribute import lazy_attribute
from sage.misc.cachefunc import cached_method
from sage.categories.all import ModulesWithBasis, tensor, Hom
from sage.categories.modules_with_basis import ModulesWithBasis
from sage.categories.tensor import tensor
from sage.categories.homset import Hom

######################################################
# the main class
Expand Down Expand Up @@ -584,7 +586,7 @@ def __init__(self, p=2, basis='milnor', **kwds):
sage: A1 == SteenrodAlgebra(2, profile=[2,1], basis='pst')
False
"""
from sage.arith.all import is_prime
from sage.arith.misc import is_prime
from sage.categories.super_hopf_algebras_with_basis import SuperHopfAlgebrasWithBasis
from sage.categories.infinite_enumerated_sets import InfiniteEnumeratedSets
from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
Expand Down
5 changes: 3 additions & 2 deletions src/sage/algebras/steenrod/steenrod_algebra_mult.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,9 @@ def multinomial_odd(list,p):
sage: multinomial_odd([1,2,4], 107)
105
"""
from sage.rings.all import GF, Integer
from sage.arith.all import binomial
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.rings.integer import Integer
from sage.arith.misc import binomial
n = sum(list)
answer = 1
F = GF(p)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/arith/multi_modular.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ from cysignals.memory cimport check_allocarray, check_reallocarray, sig_free

from sage.libs.gmp.mpz cimport *
from sage.rings.integer cimport Integer, smallInteger
from sage.arith.all import random_prime
from sage.arith.misc import random_prime
from types import GeneratorType
from sage.ext.stdsage cimport PY_NEW
from cpython.object cimport PyObject_RichCompare
Expand Down
4 changes: 3 additions & 1 deletion src/sage/arith/numerical_approx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Generic numerical approximation function
from sage.structure.parent cimport Parent
from sage.structure.element cimport parent
cdef Parent CDF
from sage.rings.all import RealField, ComplexField, CDF
from sage.rings.real_mpfr import RealField
from sage.rings.complex_mpfr import ComplexField
from sage.rings.complex_double import CDF


def numerical_approx_generic(x, prec):
Expand Down
4 changes: 2 additions & 2 deletions src/sage/coding/bch_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
from sage.modules.free_module_element import vector
from sage.misc.misc_c import prod
from sage.categories.fields import Fields
from sage.arith.all import gcd
from sage.rings.all import Zmod
from sage.arith.misc import gcd
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as Zmod

from .cyclic_code import CyclicCode
from .grs_code import GeneralizedReedSolomonCode
Expand Down
2 changes: 1 addition & 1 deletion src/sage/coding/binary_code.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4103,7 +4103,7 @@ cdef class BinaryCodeClassifier:
m = BinaryCode(matrix(ZZ, rs))

m_aut_gp_gens, m_labeling, m_size, m_base = self._aut_gp_and_can_label(m)
from sage.arith.all import factorial
from sage.arith.misc import factorial
if True: # size*factorial(n-B.ncols) == m_size:

if len(m_aut_gp_gens) == 0:
Expand Down
9 changes: 6 additions & 3 deletions src/sage/coding/code_bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,14 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.arith.misc import binomial, is_prime_power
from sage.libs.gap.libgap import libgap
from sage.rings.all import QQ, RR, ZZ, RDF
from sage.arith.misc import is_prime_power
from sage.arith.all import binomial
from sage.misc.functional import sqrt, log
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.real_double import RDF
from sage.rings.real_mpfr import RR

from .delsarte_bounds import (delsarte_bound_hamming_space,
delsarte_bound_additive_hamming_space)
from sage.features.gap import GapPackage
Expand Down
15 changes: 6 additions & 9 deletions src/sage/coding/code_constructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,17 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.misc.misc_c import prod
from sage.arith.all import quadratic_residues, gcd

from sage.structure.sequence import Sequence, Sequence_generic

from sage.matrix.matrix_space import MatrixSpace
from sage.arith.misc import gcd, quadratic_residues
from sage.matrix.constructor import matrix
from sage.matrix.matrix_space import MatrixSpace
from sage.matrix.special import random_matrix

from sage.misc.misc_c import prod
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.rings.finite_rings.integer_mod import Mod
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.integer import Integer
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.structure.sequence import Sequence, Sequence_generic

from .linear_code import LinearCode

Expand Down Expand Up @@ -753,7 +750,7 @@ def ToricCode(P,F):

- David Joyner (07-2006)
"""
from sage.combinat.all import Tuples
from sage.combinat.tuple import Tuples
mset = [x for x in F if x != 0]
d = len(P[0])
pts = Tuples(mset, d).list()
Expand Down
4 changes: 2 additions & 2 deletions src/sage/coding/cyclic_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
from copy import copy
from sage.rings.integer import Integer
from sage.categories.homset import Hom
from sage.arith.all import gcd
from sage.arith.misc import gcd
from sage.modules.free_module_element import vector
from sage.matrix.constructor import matrix
from sage.misc.cachefunc import cached_method
from sage.rings.all import Zmod
from sage.rings.finite_rings.integer_mod_ring import IntegerModRing as Zmod


def find_generator_polynomial(code, check=True):
Expand Down
7 changes: 3 additions & 4 deletions src/sage/coding/delsarte_bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def krawtchouk(n, q, l, x, check=True):
...
TypeError: no conversion of this rational to integer
"""
from sage.arith.all import binomial
from sage.arith.misc import binomial
from sage.arith.srange import srange
# Use the expression in equation (55) of MacWilliams & Sloane, pg 151
# We write jth term = some_factor * (j-1)th term
Expand Down Expand Up @@ -171,7 +171,7 @@ def eberlein(n, w, k, u, check=True):
TypeError: either m or x-m must be an integer

"""
from sage.arith.all import binomial
from sage.arith.misc import binomial
from sage.arith.srange import srange

if 2*w > n:
Expand Down Expand Up @@ -275,7 +275,7 @@ def _delsarte_cwc_LP_building(n, d, w, solver, isinteger):

"""
from sage.numerical.mip import MixedIntegerLinearProgram
from sage.arith.all import binomial
from sage.arith.misc import binomial

p = MixedIntegerLinearProgram(maximization=True, solver=solver)
A = p.new_variable(integer=isinteger, nonnegative=True)
Expand Down Expand Up @@ -602,7 +602,6 @@ def _delsarte_Q_LP_building(q, d, solver, isinteger):
EXAMPLES::

sage: from sage.coding.delsarte_bounds import _delsarte_Q_LP_building
sage: from sage.all import *
sage: q = Matrix([[codes.bounds.krawtchouk(6,2,i,j) for j in range(7)] for i in range(7)])
sage: _, p = _delsarte_Q_LP_building(q, 2, "PPL", False)
sage: p.show()
Expand Down
6 changes: 5 additions & 1 deletion src/sage/coding/information_set_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
# http://www.gnu.org/licenses/
#******************************************************************************

from sage.all import ZZ, Integer, vector, SageObject, binomial
from sage.rings.integer_ring import ZZ
from sage.rings.integer import Integer
from sage.modules.free_module_element import free_module_element as vector
from sage.structure.sage_object import SageObject
from sage.functions.other import binomial
from .decoder import Decoder


Expand Down
35 changes: 18 additions & 17 deletions src/sage/coding/linear_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,32 +205,33 @@ class should inherit from this class. Also ``AbstractLinearCode`` should never
import os
import subprocess

from io import StringIO
from copy import copy
from io import StringIO

from sage.cpython.string import bytes_to_str
from sage.arith.misc import binomial, GCD
from sage.categories.cartesian_product import cartesian_product
from sage.categories.fields import Fields
from sage.coding.decoder import Decoder
from sage.coding.encoder import Encoder
from sage.coding.linear_code_no_metric import AbstractLinearCodeNoMetric
from sage.combinat.subset import Subsets
from sage.cpython.string import bytes_to_str
from sage.features.gap import GapPackage
from sage.groups.all import SymmetricGroup
from sage.groups.perm_gps.permgroup import PermutationGroup
from sage.interfaces.gap import gap
from sage.matrix.matrix_space import MatrixSpace
from sage.misc.cachefunc import cached_method
from sage.misc.functional import is_even
from sage.misc.misc_c import prod
from sage.misc.randstate import current_randstate
from sage.modules.free_module import VectorSpace
from sage.modules.free_module_element import vector
from sage.arith.all import GCD, binomial
from sage.groups.all import SymmetricGroup
from sage.groups.perm_gps.permgroup import PermutationGroup
from sage.rings.rational_field import QQ
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.rings.integer import Integer
from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.integer import Integer
from sage.rings.finite_rings.finite_field_constructor import FiniteField as GF
from sage.misc.misc_c import prod
from sage.misc.functional import is_even
from sage.misc.cachefunc import cached_method
from sage.misc.randstate import current_randstate
from sage.combinat.subset import Subsets
from sage.features.gap import GapPackage
from sage.coding.linear_code_no_metric import AbstractLinearCodeNoMetric
from .encoder import Encoder
from .decoder import Decoder
from sage.rings.rational_field import QQ

# *****************************************************************************
# coding theory functions
Expand Down
Loading