Skip to content

Commit

Permalink
gh-35372: Replace more .all imports
Browse files Browse the repository at this point in the history
    
<!-- Please provide a concise, informative and self-explanatory title.
-->
<!-- Don't put issue numbers in the title. Put it in the Description
below. -->
<!-- For example, instead of "Fixes #12345", use "Add a new method to
multiply two integers" -->

### 📚 Description

This is a follow-up on:
- #35110

As preparation for #35322, which is changing more packages to implicit
namespace packages, we remove `.all` imports from these packages
throughout the Sage library.

This is part of:
- #29705

<!-- Describe your changes here in detail. -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x
]`. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->
- Depends on #35418
- Depends on #35358
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: #35372
Reported by: Matthias Köppe
Reviewer(s): Gonzalo Tornaría
  • Loading branch information
Release Manager committed Apr 4, 2023
2 parents f091c75 + 4ac23e6 commit 519b62c
Show file tree
Hide file tree
Showing 63 changed files with 99 additions and 628 deletions.
16 changes: 8 additions & 8 deletions src/.relint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
- name: 'python3: Python3 incompatible code'
hint: |
# ifilter, imap, izip # __metaclass__
Hint: # update raise statements # except Exception, var
Hint: # six is no longer allowed
# update raise statements # except Exception, var
# six is no longer allowed
pattern: '(import.*[, ]ifilter|import.*[, ]imap|import.*[, ]izip|^\s*raise\s*[A-Za-z]*Error\s*,|__metaclass__|except\s*[A-Za-z]\s*,|import six|from six import)'
filePattern: .*[.](py|pyx|rst)

Expand All @@ -20,9 +20,9 @@
- name: 'blocks: wrong syntax for blocks (INPUT, OUTPUT, EXAMPLES, NOTE, etc.)'
hint: |
# the correct syntax is .. SEEALSO::
Hint: # TESTS and EXAMPLES should be plural, NOTE singular
Hint: # no :: after INPUT, OUTPUT, REFERENCE blocks
Hint: # no " :" at the end of lines
# TESTS and EXAMPLES should be plural, NOTE singular
# no :: after INPUT, OUTPUT, REFERENCE blocks
# no " :" at the end of lines
pattern: '(\.\.SEE|SEE ALSO|SEEALSO:($|[^:])|^\s*TEST:|^\s*EXAMPLE:|^\s*NOTES:|^\s*[A-Z]*PUT::|^\s*REFERENCES?::$)'

- name: 'trac_links: bad trac link'
Expand All @@ -46,10 +46,10 @@
- name: 'namespace_pkg_all_import: import from .all of a namespace package'
hint: |
Sage library code should not import from sage.PAC.KAGE.all when sage.PAC.KAGE is an implicit
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.
namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import,
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(|[.]finite_rings)|sets))[.]all\s+import'
pattern: 'from\s+sage(|[.](arith|categories|combinat|crypto|databases|data_structures|dynamics|ext|game_theory|games|graphs|groups|interfaces|manifolds|matrix|matroids|misc|modules|monoids|numerical|probability|quadratic_forms|quivers|rings|sat|schemes|sets|stats|tensor)[a-z0-9_.]*|[.]libs)[.]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)$'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ AUTHOR:
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.groups.perm_gps.all import CyclicPermutationGroup
from sage.groups.perm_gps.permgroup_named import CyclicPermutationGroup
from sage.libs.singular.function import lib, singular_function
from sage.misc.repr import repr_lincomb
from sage.rings.polynomial.multi_polynomial_ideal import MPolynomialIdeal
Expand Down
2 changes: 1 addition & 1 deletion src/sage/algebras/letterplace/free_algebra_letterplace.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ cdef class FreeAlgebra_letterplace(Algebra):
ngens = self.__ngens
degbound = self._degbound
cdef list G = [C(x._poly) for x in g]
from sage.groups.perm_gps.all import CyclicPermutationGroup
from sage.groups.perm_gps.permgroup_named import CyclicPermutationGroup
CG = CyclicPermutationGroup(C.ngens())
for y in G:
out.extend([y] + [y * CG[ngens * (n + 1)]
Expand Down
3 changes: 2 additions & 1 deletion src/sage/categories/finite_complex_reflection_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,8 @@ def noncrossing_partition_lattice(self, c=None, L=None,
sage: sorted( w.reduced_word() for w in W.noncrossing_partition_lattice(W.from_reduced_word([2])) ) # optional - gap3
[[], [2]]
"""
from sage.combinat.posets.all import Poset, LatticePoset
from sage.combinat.posets.posets import Poset
from sage.combinat.posets.lattices import LatticePoset

R = self.reflections()
if L is None:
Expand Down
2 changes: 1 addition & 1 deletion src/sage/coding/ag_code_decoders.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ AUTHORS:
cimport cython

from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.function_field.all import FunctionField
from sage.rings.function_field.constructor import FunctionField

from sage.modules.free_module_element import vector
from sage.matrix.constructor import matrix
Expand Down
2 changes: 1 addition & 1 deletion src/sage/coding/linear_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class should inherit from this class. Also ``AbstractLinearCode`` should never
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_named import SymmetricGroup
from sage.groups.perm_gps.permgroup import PermutationGroup
from sage.interfaces.gap import gap
from sage.matrix.matrix_space import MatrixSpace
Expand Down
Loading

0 comments on commit 519b62c

Please sign in to comment.