Skip to content

Commit 6b6475d

Browse files
author
Release Manager
committed
gh-35798: Replace imports from `sage.geometry...all`, update relint pattern <!-- 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 Per #35095, parts of `sage.geometry` will be shipped in sagemath- modules, sagemath-polyhedra, and sagemath-symbolics. Hence we replace imports from `sage.geometry...all`. <!-- 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". --> - Continuation of #34201 - Cherry-picked from #35095 - Part of #29705 <!-- 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. - [ ] 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: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #35798 Reported by: Matthias Köppe Reviewer(s): David Coudert
2 parents a7a70f0 + 25c193a commit 6b6475d

File tree

8 files changed

+26
-20
lines changed

8 files changed

+26
-20
lines changed

src/.relint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
namespace package. Type import_statements("SOME_IDENTIFIER") to find a more specific import,
5050
or use 'sage --fiximports' to fix automatically in the source file.
5151
# Keep in sync with SAGE_ROOT/src/sage/misc/replace_dot_all.py
52-
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|symbolic|tensor)[a-z0-9_.]*|[.]libs)[.]all\s+import'
52+
pattern: 'from\s+sage(|[.](arith|categories|combinat|crypto|databases|data_structures|dynamics|ext|game_theory|games|geometry|graphs|groups|interfaces|manifolds|matrix|matroids|misc|modules|monoids|numerical|probability|quadratic_forms|quivers|rings|sat|schemes|sets|stats|symbolic|tensor)[a-z0-9_.]*|[.]libs)[.]all\s+import'
5353
# imports from .all are allowed in all.py; also allow in some modules that need sage.all
5454
filePattern: '(.*/|)(?!(all|benchmark|dev_tools|parsing|sage_eval))[^/.]*[.](py|pyx|pxi)$'
5555

src/sage/combinat/root_system/plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ def __init__(self, space,
927927

928928
# Bounding box
929929
from sage.rings.real_mpfr import RR
930-
from sage.geometry.polyhedron.all import Polyhedron
930+
from sage.geometry.polyhedron.constructor import Polyhedron
931931
from itertools import product
932932
if bounding_box in RR:
933933
bounding_box = [[-bounding_box,bounding_box]] * self.dimension
@@ -1394,7 +1394,7 @@ def cone(self, rays=[], lines=[], color="black", thickness=1, alpha=1, wireframe
13941394
"""
13951395
if color is None:
13961396
return self.empty()
1397-
from sage.geometry.polyhedron.all import Polyhedron
1397+
from sage.geometry.polyhedron.constructor import Polyhedron
13981398
# TODO: we currently convert lines into rays, which simplify a
13991399
# bit the calculation of the intersection. But it would be
14001400
# nice to benefit from the new ``lines`` option of Polyhedra

src/sage/combinat/root_system/root_lattice_realizations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2568,7 +2568,7 @@ def plot_hedron(self, **options):
25682568
Line defined by 2 points: [(1.5, -0.5), (1.5, 0.5)]
25692569
Point set defined by 8 point(s): [(-1.5, -0.5), (-1.5, 0.5), (-0.5, -1.5), (-0.5, 1.5), (0.5, -1.5), (0.5, 1.5), (1.5, -0.5), (1.5, 0.5)]
25702570
"""
2571-
from sage.geometry.polyhedron.all import Polyhedron
2571+
from sage.geometry.polyhedron.constructor import Polyhedron
25722572
plot_options = self.plot_parse_options(**options)
25732573
if not self.cartan_type().is_finite():
25742574
raise ValueError("the Cartan type must be finite")
@@ -3092,7 +3092,7 @@ def plot_mv_polytope(self, mv_polytope, mark_endpoints=True,
30923092
sage: L.plot_mv_polytope(p) # optional - sage.geometry.polyhedron sage.plot sage.symbolic
30933093
Graphics3d Object
30943094
"""
3095-
from sage.geometry.polyhedron.all import Polyhedron
3095+
from sage.geometry.polyhedron.constructor import Polyhedron
30963096
plot_options = self.plot_parse_options(**options)
30973097

30983098
# Setup the shift for plotting

src/sage/misc/replace_dot_all.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
# Keep in sync with SAGE_ROOT/src/.relint.yml (namespace_pkg_all_import)
7373

7474
default_package_regex = (r"sage("
75-
r"|[.](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"
75+
r"|[.](arith|categories|combinat|crypto|databases|data_structures|dynamics|ext|game_theory|games|geometry|graphs|groups|interfaces|manifolds|matrix|matroids|misc|modules|monoids|numerical|probability|quadratic_forms|quivers|rings|sat|schemes|sets|stats|tensor)[a-z0-9_.]*|[.]libs"
7676
r")[.]all")
7777

7878

src/sage/numerical/interactive_simplex_method.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
6565
Since it has only two variables, we can solve it graphically::
6666
67-
sage: P.plot()
67+
sage: P.plot() # optional - sage.plot
6868
Graphics object consisting of 19 graphics primitives
6969
7070
@@ -182,7 +182,7 @@
182182
from copy import copy
183183

184184
from sage.misc.abstract_method import abstract_method
185-
from sage.geometry.all import Polyhedron
185+
from sage.geometry.polyhedron.constructor import Polyhedron
186186
from sage.matrix.special import column_matrix
187187
from sage.matrix.special import identity_matrix
188188
from sage.matrix.constructor import Matrix as matrix
@@ -1534,19 +1534,19 @@ def plot(self, *args, **kwds):
15341534
sage: b = (1000, 1500)
15351535
sage: c = (10, 5)
15361536
sage: P = InteractiveLPProblem(A, b, c, ["C", "B"], variable_type=">=")
1537-
sage: p = P.plot()
1538-
sage: p.show()
1537+
sage: p = P.plot() # optional - sage.plot
1538+
sage: p.show() # optional - sage.plot
15391539
15401540
In this case the plot works better with the following axes ranges::
15411541
1542-
sage: p = P.plot(0, 1000, 0, 1500)
1543-
sage: p.show()
1542+
sage: p = P.plot(0, 1000, 0, 1500) # optional - sage.plot
1543+
sage: p.show() # optional - sage.plot
15441544
15451545
TESTS:
15461546
15471547
We check that zero objective can be dealt with::
15481548
1549-
sage: InteractiveLPProblem(A, b, (0, 0), ["C", "B"], variable_type=">=").plot()
1549+
sage: InteractiveLPProblem(A, b, (0, 0), ["C", "B"], variable_type=">=").plot() # optional - sage.plot
15501550
Graphics object consisting of 8 graphics primitives
15511551
"""
15521552
FP = self.plot_feasible_set(*args, **kwds)
@@ -1611,13 +1611,13 @@ def plot_feasible_set(self, xmin=None, xmax=None, ymin=None, ymax=None,
16111611
sage: b = (1000, 1500)
16121612
sage: c = (10, 5)
16131613
sage: P = InteractiveLPProblem(A, b, c, ["C", "B"], variable_type=">=")
1614-
sage: p = P.plot_feasible_set()
1615-
sage: p.show()
1614+
sage: p = P.plot_feasible_set() # optional - sage.plot
1615+
sage: p.show() # optional - sage.plot
16161616
16171617
In this case the plot works better with the following axes ranges::
16181618
1619-
sage: p = P.plot_feasible_set(0, 1000, 0, 1500)
1620-
sage: p.show()
1619+
sage: p = P.plot_feasible_set(0, 1000, 0, 1500) # optional - sage.plot
1620+
sage: p.show() # optional - sage.plot
16211621
"""
16221622
if self.n() != 2:
16231623
raise ValueError("only problems with 2 variables can be plotted")

src/sage/schemes/toric/fano_variety.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@
119119

120120
import re
121121

122-
from sage.geometry.all import Cone, FaceFan, Fan, LatticePolytope
122+
from sage.geometry.cone import Cone
123+
from sage.geometry.fan import FaceFan
124+
from sage.geometry.fan import Fan
125+
from sage.geometry.lattice_polytope import LatticePolytope
123126
from sage.misc.latex import latex
124127
from sage.misc.misc_c import prod
125128
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing

src/sage/schemes/toric/library.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242

4343
from sage.matrix.constructor import Matrix as matrix
4444
from sage.matrix.special import identity_matrix
45-
from sage.geometry.all import Fan, LatticePolytope, ToricLattice
45+
from sage.geometry.fan import Fan
46+
from sage.geometry.lattice_polytope import LatticePolytope
47+
from sage.geometry.toric_lattice import ToricLattice
4648
from sage.rings.integer_ring import ZZ
4749
from sage.rings.rational_field import QQ
4850
from sage.arith.misc import GCD as gcd

src/sage/schemes/toric/morphism.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,8 @@
370370
from sage.misc.cachefunc import cached_method
371371
from sage.matrix.constructor import matrix, identity_matrix
372372
from sage.modules.free_module_element import vector
373-
from sage.geometry.all import Cone, Fan
373+
from sage.geometry.cone import Cone
374+
from sage.geometry.fan import Fan
374375

375376
from sage.schemes.generic.scheme import is_Scheme
376377
from sage.schemes.generic.morphism import (

0 commit comments

Comments
 (0)