Skip to content

Commit e0c51e5

Browse files
author
Release Manager
committed
gh-35919: `sage.matroids`: Update `# needs`, modularization fixes for imports <!-- 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 <!-- Describe your changes here in detail. --> - Many `# optional` are removed because small prime finite fields no longer need to be marked `# optional/needs sage.rings.finite_rings` since #35847 - Other `# optional` are replaced by codeblock-scoped `# needs` tags - Remaining `# optional` with standard features are replaced by `# needs` - Some import fixes needed for separate testing of **sagemath-modules** or **sagemath-graphs**[modules] from #35095 <!-- 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". --> This is: - done with the help of `sage -fixdoctests` from #35749 - Part of: #29705 - Cherry-picked from: #35095 <!-- 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: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #35919 Reported by: Matthias Köppe Reviewer(s): David Coudert, Matthias Köppe
2 parents b22ee1e + 007f6ae commit e0c51e5

16 files changed

+1516
-1468
lines changed

src/sage/matroids/advanced.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,6 @@
5959
from . import lean_matrix
6060
from .extension import LinearSubclasses, MatroidExtensions
6161
from .union_matroid import MatroidUnion, MatroidSum, PartitionMatroid
62-
from .graphic_matroid import GraphicMatroid
62+
63+
from sage.misc.lazy_import import lazy_import
64+
lazy_import('sage.matroids.graphic_matroid', 'GraphicMatroid')

src/sage/matroids/basis_exchange_matroid.pyx

+95-95
Large diffs are not rendered by default.

src/sage/matroids/basis_matroid.pyx

+66-66
Large diffs are not rendered by default.

src/sage/matroids/catalog.py

+129-129
Large diffs are not rendered by default.

src/sage/matroids/circuit_closures_matroid.pyx

+21-21
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ AUTHORS:
5050
TESTS::
5151
5252
sage: from sage.matroids.advanced import *
53-
sage: M = CircuitClosuresMatroid(matroids.named_matroids.Fano()) # optional - sage.rings.finite_rings
54-
sage: TestSuite(M).run() # optional - sage.rings.finite_rings
53+
sage: M = CircuitClosuresMatroid(matroids.named_matroids.Fano())
54+
sage: TestSuite(M).run()
5555
5656
Methods
5757
=======
@@ -117,8 +117,8 @@ cdef class CircuitClosuresMatroid(Matroid):
117117
EXAMPLES::
118118
119119
sage: from sage.matroids.advanced import *
120-
sage: M = CircuitClosuresMatroid(matroids.named_matroids.Fano()) # optional - sage.rings.finite_rings
121-
sage: M # optional - sage.rings.finite_rings
120+
sage: M = CircuitClosuresMatroid(matroids.named_matroids.Fano())
121+
sage: M
122122
Matroid of rank 3 on 7 elements with circuit-closures
123123
{2: {{'a', 'b', 'f'}, {'a', 'c', 'e'}, {'a', 'd', 'g'},
124124
{'b', 'c', 'd'}, {'b', 'e', 'g'}, {'c', 'f', 'g'},
@@ -127,7 +127,7 @@ cdef class CircuitClosuresMatroid(Matroid):
127127
....: circuit_closures={3: ['edfg', 'acdg', 'bcfg', 'cefh',
128128
....: 'afgh', 'abce', 'abdf', 'begh', 'bcdh', 'adeh'],
129129
....: 4: ['abcdefgh']})
130-
sage: M.equals(matroids.named_matroids.P8()) # optional - sage.rings.finite_rings
130+
sage: M.equals(matroids.named_matroids.P8())
131131
True
132132
"""
133133

@@ -140,8 +140,8 @@ cdef class CircuitClosuresMatroid(Matroid):
140140
EXAMPLES::
141141
142142
sage: from sage.matroids.advanced import *
143-
sage: M = CircuitClosuresMatroid(matroids.named_matroids.Fano()) # optional - sage.rings.finite_rings
144-
sage: M # optional - sage.rings.finite_rings
143+
sage: M = CircuitClosuresMatroid(matroids.named_matroids.Fano())
144+
sage: M
145145
Matroid of rank 3 on 7 elements with circuit-closures
146146
{2: {{'a', 'b', 'f'}, {'a', 'c', 'e'}, {'a', 'd', 'g'},
147147
{'b', 'c', 'd'}, {'b', 'e', 'g'}, {'c', 'f', 'g'},
@@ -152,7 +152,7 @@ cdef class CircuitClosuresMatroid(Matroid):
152152
....: circuit_closures={3: ['edfg', 'acdg', 'bcfg', 'cefh',
153153
....: 'afgh', 'abce', 'abdf', 'begh', 'bcdh', 'adeh'],
154154
....: 4: ['abcdefgh']})
155-
sage: M.equals(matroids.named_matroids.P8()) # optional - sage.rings.finite_rings
155+
sage: M.equals(matroids.named_matroids.P8())
156156
True
157157
"""
158158
if M is not None:
@@ -348,17 +348,17 @@ cdef class CircuitClosuresMatroid(Matroid):
348348
EXAMPLES::
349349
350350
sage: from sage.matroids.advanced import *
351-
sage: M = CircuitClosuresMatroid(matroids.named_matroids.Fano()) # optional - sage.rings.finite_rings
352-
sage: CC = M.circuit_closures() # optional - sage.rings.finite_rings
353-
sage: len(CC[2]) # optional - sage.rings.finite_rings
351+
sage: M = CircuitClosuresMatroid(matroids.named_matroids.Fano())
352+
sage: CC = M.circuit_closures()
353+
sage: len(CC[2])
354354
7
355-
sage: len(CC[3]) # optional - sage.rings.finite_rings
355+
sage: len(CC[3])
356356
1
357-
sage: len(CC[1]) # optional - sage.rings.finite_rings
357+
sage: len(CC[1])
358358
Traceback (most recent call last):
359359
...
360360
KeyError: 1
361-
sage: [sorted(X) for X in CC[3]] # optional - sage.rings.finite_rings
361+
sage: [sorted(X) for X in CC[3]]
362362
[['a', 'b', 'c', 'd', 'e', 'f', 'g']]
363363
"""
364364
return self._circuit_closures
@@ -387,16 +387,16 @@ cdef class CircuitClosuresMatroid(Matroid):
387387
388388
sage: from sage.matroids.advanced import *
389389
sage: M1 = CircuitClosuresMatroid(matroids.Wheel(3))
390-
sage: M2 = matroids.CompleteGraphic(4) # optional - sage.graphs
391-
sage: M1._is_isomorphic(M2) # optional - sage.graphs
390+
sage: M2 = matroids.CompleteGraphic(4) # needs sage.graphs
391+
sage: M1._is_isomorphic(M2) # needs sage.graphs
392392
True
393-
sage: M1._is_isomorphic(M2, certificate=True) # optional - sage.graphs
393+
sage: M1._is_isomorphic(M2, certificate=True) # needs sage.graphs
394394
(True, {0: 0, 1: 1, 2: 2, 3: 3, 4: 5, 5: 4})
395-
sage: M1 = CircuitClosuresMatroid(matroids.named_matroids.Fano()) # optional - sage.rings.finite_rings
396-
sage: M2 = matroids.named_matroids.NonFano() # optional - sage.rings.finite_rings
397-
sage: M1._is_isomorphic(M2) # optional - sage.rings.finite_rings
395+
sage: M1 = CircuitClosuresMatroid(matroids.named_matroids.Fano())
396+
sage: M2 = matroids.named_matroids.NonFano()
397+
sage: M1._is_isomorphic(M2)
398398
False
399-
sage: M1._is_isomorphic(M2, certificate=True) # optional - sage.rings.finite_rings
399+
sage: M1._is_isomorphic(M2, certificate=True)
400400
(False, None)
401401
402402

0 commit comments

Comments
 (0)