Skip to content

Commit 48a4551

Browse files
author
Release Manager
committed
gh-36067: `sage.{cpython,data_structures,databases,ext,parallel,structure}`: Update `# needs` <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- 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". --> - 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. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [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: #36067 Reported by: Matthias Köppe Reviewer(s): David Coudert
2 parents 3dd31ba + 00f24ed commit 48a4551

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2067
-1655
lines changed

src/sage/cpython/cython_metaclass.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ In Python, this would be ``meta.__init__(cls, name, bases, dict)``.
6161
6262
EXAMPLES::
6363
64-
sage: cython( # optional - sage.misc.cython
64+
sage: cython( # needs sage.misc.cython
6565
....: '''
6666
....: cimport sage.cpython.cython_metaclass
6767
....: cdef class MyCustomType():
@@ -76,9 +76,9 @@ EXAMPLES::
7676
....: ''')
7777
Calling MyMetaclass.__init__(<class '...MyCustomType'>, None, None, None)
7878
Calling MyMetaclass.__init__(<class '...MyDerivedType'>, None, None, None)
79-
sage: MyCustomType.__class__ # optional - sage.misc.cython
79+
sage: MyCustomType.__class__ # needs sage.misc.cython
8080
<class '...MyMetaclass'>
81-
sage: class MyPythonType(MyDerivedType): # optional - sage.misc.cython
81+
sage: class MyPythonType(MyDerivedType): # needs sage.misc.cython
8282
....: pass
8383
Calling MyMetaclass.__init__(<class '...MyPythonType'>, 'MyPythonType', (<class '...MyDerivedType'>,), {...})
8484
@@ -99,7 +99,7 @@ TESTS:
9999
Check that a proper exception is raised if ``__getmetaclass__``
100100
returns a non-type::
101101
102-
sage: cython( # optional - sage.misc.cython
102+
sage: cython( # needs sage.misc.cython
103103
....: '''
104104
....: cimport sage.cpython.cython_metaclass
105105
....: cdef class MyCustomType():

src/sage/cpython/debug.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def getattr_debug(obj, name, default=_no_default):
101101
found '__doc__' in dict of <class 'list'>
102102
got ... 'str'>)
103103
returning ... 'str'>)
104-
sage: _ = getattr_debug(gp(1), "log")
104+
sage: _ = getattr_debug(gp(1), "log") # needs sage.libs.pari
105105
getattr_debug(obj=1, name='log'):
106106
type(obj) = <class 'sage.interfaces.gp.GpElement'>
107107
object has __dict__ slot (<class 'dict'>)

src/sage/cpython/getattr.pyx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ cdef class AttributeErrorMessage:
5555
...
5656
AttributeError: 'sage.rings.integer.Integer' object has no attribute 'bla'
5757
sage: x = polygen(ZZ, 'x')
58-
sage: QQ[x].gen().bla # optional - sage.libs.flint
58+
sage: QQ[x].gen().bla # needs sage.libs.flint
5959
Traceback (most recent call last):
6060
...
6161
AttributeError: 'sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint' object has no attribute 'bla'
@@ -407,20 +407,21 @@ def dir_with_other_class(self, *cls):
407407
408408
Check that objects without dicts are well handled::
409409
410-
sage: cython("cdef class A:\n cdef public int a") # optional - sage.misc.cython
411-
sage: cython("cdef class B:\n cdef public int b") # optional - sage.misc.cython
412-
sage: x = A() # optional - sage.misc.cython
413-
sage: x.a = 1 # optional - sage.misc.cython
414-
sage: hasattr(x,'__dict__') # optional - sage.misc.cython
410+
sage: # needs sage.misc.cython
411+
sage: cython("cdef class A:\n cdef public int a")
412+
sage: cython("cdef class B:\n cdef public int b")
413+
sage: x = A()
414+
sage: x.a = 1
415+
sage: hasattr(x,'__dict__')
415416
False
416-
sage: dir_with_other_class(x, B) # optional - sage.misc.cython
417+
sage: dir_with_other_class(x, B)
417418
[..., 'a', 'b']
418419
419420
TESTS:
420421
421422
Check that :trac:`13043` is fixed::
422423
423-
sage: len(dir(RIF))==len(set(dir(RIF)))
424+
sage: len(dir(RIF))==len(set(dir(RIF))) # needs sage.rings.real_interval_field
424425
True
425426
"""
426427
ret = set()

src/sage/cpython/string.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TESTS:
66
77
Check that this can be used outside of Sage (see :trac:`25549`)::
88
9-
sage: cython( # optional - sage.misc.cython
9+
sage: cython( # needs sage.misc.cython
1010
....: '''
1111
....: from sage.cpython.string cimport char_to_str
1212
....: print(char_to_str("hello world!"))

src/sage/cpython/wrapperdescr.pxd

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,26 @@ cdef inline wrapperbase* get_slotdef(wrapper_descriptor slotwrapper) except NULL
3939
4040
TESTS::
4141
42-
sage: cython( # optional - sage.misc.cython
42+
sage: # needs sage.misc.cython
43+
sage: cython(
4344
....: '''
4445
....: from sage.cpython.wrapperdescr cimport get_slotdef
4546
....: from cpython.long cimport PyLong_FromVoidPtr
4647
....: def py_get_slotdef(slotwrapper):
4748
....: return PyLong_FromVoidPtr(get_slotdef(slotwrapper))
4849
....: ''')
49-
sage: py_get_slotdef(object.__init__) # random # optional - sage.misc.cython
50+
sage: py_get_slotdef(object.__init__) # random
5051
140016903442416
51-
sage: py_get_slotdef(bytes.__lt__) # random # optional - sage.misc.cython
52+
sage: py_get_slotdef(bytes.__lt__) # random
5253
140016903441800
53-
sage: py_get_slotdef(bytes.__lt__) == py_get_slotdef(Integer.__lt__) # optional - sage.misc.cython
54+
sage: py_get_slotdef(bytes.__lt__) == py_get_slotdef(Integer.__lt__)
5455
True
55-
sage: py_get_slotdef(bytes.__lt__) == py_get_slotdef(bytes.__gt__) # optional - sage.misc.cython
56+
sage: py_get_slotdef(bytes.__lt__) == py_get_slotdef(bytes.__gt__)
5657
False
5758
sage: class X():
5859
....: def __eq__(self, other):
5960
....: return False
60-
sage: py_get_slotdef(X.__eq__) # optional - sage.misc.cython
61+
sage: py_get_slotdef(X.__eq__)
6162
Traceback (most recent call last):
6263
...
6364
TypeError: Cannot convert ... to wrapper_descriptor

src/sage/cpython/wrapperdescr.pyx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ def wrapperdescr_call(slotwrapper, self, *args, **kwds):
6868
54
6969
sage: wrapperdescr_call(Element.__mul__, 7/5, 9)
7070
63/5
71-
sage: from sage.numerical.mip import MixedIntegerLinearProgram
72-
sage: wrapperdescr_call(type.__call__, MixedIntegerLinearProgram, maximization=False)
71+
sage: from sage.numerical.mip import MixedIntegerLinearProgram # needs sage.numerical.mip
72+
sage: wrapperdescr_call(type.__call__, # needs sage.numerical.mip
73+
....: MixedIntegerLinearProgram, maximization=False)
7374
Mixed Integer Program (no objective, 0 variables, 0 constraints)
7475
7576
TESTS::

src/sage/data_structures/bitset.pyx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,27 +204,28 @@ cdef class FrozenBitset:
204204
the number of elements currently in the bitset, while the capacity
205205
is the number of elements that the bitset can hold. ::
206206
207-
sage: p = primes_first_n(10); p
207+
sage: p = primes_first_n(10); p # needs sage.libs.pari
208208
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
209-
sage: tuple(p)
209+
sage: tuple(p) # needs sage.libs.pari
210210
(2, 3, 5, 7, 11, 13, 17, 19, 23, 29)
211-
sage: F = FrozenBitset(p); F; FrozenBitset(tuple(p))
211+
sage: F = FrozenBitset(p); F; FrozenBitset(tuple(p)) # needs sage.libs.pari
212212
001101010001010001010001000001
213213
001101010001010001010001000001
214214
215215
Recover the primes from the bitset::
216216
217-
sage: for b in F:
217+
sage: for b in F: # needs sage.libs.pari
218218
....: print(b)
219219
2
220220
3
221221
...
222222
29
223-
sage: list(F)
223+
sage: list(F) # needs sage.libs.pari
224224
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
225225
226226
Query the bitset::
227227
228+
sage: # needs sage.libs.pari
228229
sage: len(F)
229230
10
230231
sage: len(list(F))
@@ -2067,7 +2068,7 @@ def test_bitset(py_a, py_b, long n):
20672068
20682069
Large enough to span multiple limbs. We don't explicitly check the number of limbs below because it will be different in the 32 bit versus 64 bit cases::
20692070
2070-
sage: test_bitset('111001'*25, RealField(151)(pi).str(2)[2:], 69)
2071+
sage: test_bitset('111001'*25, RealField(151)(pi).str(2)[2:], 69) # needs sage.symbolic
20712072
a 111001111001111001111001111001111001111001111001111001111001111001111001111001111001111001111001111001111001111001111001111001111001111001111001111001
20722073
list a [0, 1, 2, 5, 6, 7, 8, 11, 12, 13, 14, 17, 18, 19, 20, 23, 24, 25, 26, 29, 30, 31, 32, 35, 36, 37, 38, 41, 42, 43, 44, 47, 48, 49, 50, 53, 54, 55, 56, 59, 60, 61, 62, 65, 66, 67, 68, 71, 72, 73, 74, 77, 78, 79, 80, 83, 84, 85, 86, 89, 90, 91, 92, 95, 96, 97, 98, 101, 102, 103, 104, 107, 108, 109, 110, 113, 114, 115, 116, 119, 120, 121, 122, 125, 126, 127, 128, 131, 132, 133, 134, 137, 138, 139, 140, 143, 144, 145, 146, 149]
20732074
a.size 150

src/sage/data_structures/blas_dict.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ cpdef dict sum_of_terms(index_coeff_pairs):
398398
{'a': 1, 'b': 3}
399399
sage: blas.sum_of_terms([('a', 5), ('b', 3), ('a', -5)])
400400
{'b': 3}
401-
sage: blas.sum_of_terms([('a', 5), ('b', GF(2).one()), ('a', -5), ('b', GF(2).one())])
401+
sage: blas.sum_of_terms([('a', 5), ('b', GF(2).one()),
402+
....: ('a', -5), ('b', GF(2).one())])
402403
{}
403404
"""
404405
cdef dict result = {}

src/sage/data_structures/stream.py

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,7 @@ class Stream_dirichlet_invert(Stream_unary):
16691669
sage: g = Stream_dirichlet_invert(f, True)
16701670
sage: [g[i] for i in range(10)]
16711671
[0, 1, -1, -1, 0, -1, 1, -1, 0, 0]
1672-
sage: [moebius(i) for i in range(10)]
1672+
sage: [moebius(i) for i in range(10)] # needs sage.libs.pari
16731673
[0, 1, -1, -1, 0, -1, 1, -1, 0, 0]
16741674
"""
16751675
def __init__(self, series, is_sparse):
@@ -1897,6 +1897,7 @@ class Stream_plethysm(Stream_binary):
18971897
18981898
EXAMPLES::
18991899
1900+
sage: # needs sage.modules
19001901
sage: from sage.data_structures.stream import Stream_function, Stream_plethysm
19011902
sage: s = SymmetricFunctions(QQ).s()
19021903
sage: p = SymmetricFunctions(QQ).p()
@@ -1920,6 +1921,7 @@ class Stream_plethysm(Stream_binary):
19201921
This class also handles the plethysm of an exact stream with a
19211922
stream of order `0`::
19221923
1924+
sage: # needs sage.modules
19231925
sage: from sage.data_structures.stream import Stream_exact
19241926
sage: f = Stream_exact([s[1]], order=1)
19251927
sage: g = Stream_function(lambda n: s[n], True, 0)
@@ -1931,6 +1933,7 @@ class Stream_plethysm(Stream_binary):
19311933
19321934
Check corner cases::
19331935
1936+
sage: # needs sage.modules
19341937
sage: f0 = Stream_exact([p([])])
19351938
sage: f1 = Stream_exact([p[1]], order=1)
19361939
sage: f2 = Stream_exact([p[2]], order=2 )
@@ -1944,21 +1947,24 @@ class Stream_plethysm(Stream_binary):
19441947
19451948
Check that degree one elements are treated in the correct way::
19461949
1950+
sage: # needs sage.modules
19471951
sage: R.<a1,a2,a11,b1,b21,b111> = QQ[]; p = SymmetricFunctions(R).p()
19481952
sage: f_s = a1*p[1] + a2*p[2] + a11*p[1,1]
19491953
sage: g_s = b1*p[1] + b21*p[2,1] + b111*p[1,1,1]
19501954
sage: r_s = f_s(g_s)
1951-
sage: f = Stream_exact([f_s.restrict_degree(k) for k in range(f_s.degree()+1)])
1952-
sage: g = Stream_exact([g_s.restrict_degree(k) for k in range(g_s.degree()+1)])
1955+
sage: f = Stream_exact([f_s.restrict_degree(k)
1956+
....: for k in range(f_s.degree()+1)])
1957+
sage: g = Stream_exact([g_s.restrict_degree(k)
1958+
....: for k in range(g_s.degree()+1)])
19531959
sage: r = Stream_plethysm(f, g, True, p)
19541960
sage: r_s == sum(r[n] for n in range(2*(r_s.degree()+1)))
19551961
True
19561962
1957-
sage: r_s - f_s(g_s, include=[])
1963+
sage: r_s - f_s(g_s, include=[]) # needs sage.modules
19581964
(a2*b1^2-a2*b1)*p[2] + (a2*b111^2-a2*b111)*p[2, 2, 2] + (a2*b21^2-a2*b21)*p[4, 2]
19591965
1960-
sage: r2 = Stream_plethysm(f, g, True, p, include=[])
1961-
sage: r_s - sum(r2[n] for n in range(2*(r_s.degree()+1)))
1966+
sage: r2 = Stream_plethysm(f, g, True, p, include=[]) # needs sage.modules
1967+
sage: r_s - sum(r2[n] for n in range(2*(r_s.degree()+1))) # needs sage.modules
19621968
(a2*b1^2-a2*b1)*p[2] + (a2*b111^2-a2*b111)*p[2, 2, 2] + (a2*b21^2-a2*b21)*p[4, 2]
19631969
19641970
"""
@@ -1968,6 +1974,7 @@ def __init__(self, f, g, is_sparse, p, ring=None, include=None, exclude=None):
19681974
19691975
TESTS::
19701976
1977+
sage: # needs sage.modules
19711978
sage: from sage.data_structures.stream import Stream_function, Stream_plethysm
19721979
sage: s = SymmetricFunctions(QQ).s()
19731980
sage: p = SymmetricFunctions(QQ).p()
@@ -2009,6 +2016,7 @@ def _approximate_order(self):
20092016
20102017
EXAMPLES::
20112018
2019+
sage: # needs sage.modules
20122020
sage: from sage.data_structures.stream import Stream_function, Stream_plethysm
20132021
sage: p = SymmetricFunctions(QQ).p()
20142022
sage: f = Stream_function(lambda n: p[n], True, 1)
@@ -2035,6 +2043,7 @@ def get_coefficient(self, n):
20352043
20362044
EXAMPLES::
20372045
2046+
sage: # needs sage.modules
20382047
sage: from sage.data_structures.stream import Stream_function, Stream_plethysm
20392048
sage: s = SymmetricFunctions(QQ).s()
20402049
sage: p = SymmetricFunctions(QQ).p()
@@ -2074,6 +2083,7 @@ def compute_product(self, n, la):
20742083
20752084
EXAMPLES::
20762085
2086+
sage: # needs sage.modules
20772087
sage: from sage.data_structures.stream import Stream_plethysm, Stream_exact, Stream_function, Stream_zero
20782088
sage: s = SymmetricFunctions(QQ).s()
20792089
sage: p = SymmetricFunctions(QQ).p()
@@ -2086,21 +2096,26 @@ def compute_product(self, n, la):
20862096
sage: A == p[2, 1](s[2] + s[3]).homogeneous_component(7)
20872097
True
20882098
2099+
sage: # needs sage.modules
20892100
sage: p2 = tensor([p, p])
20902101
sage: f = Stream_exact([1]) # irrelevant for this test
2091-
sage: g = Stream_function(lambda n: sum(tensor([p[k], p[n-k]]) for k in range(n+1)), True, 1)
2102+
sage: g = Stream_function(lambda n: sum(tensor([p[k], p[n-k]])
2103+
....: for k in range(n+1)), True, 1)
20922104
sage: h = Stream_plethysm(f, g, True, p2)
20932105
sage: A = h.compute_product(7, Partition([2, 1]))
20942106
sage: B = p[2, 1](sum(g[n] for n in range(7)))
2095-
sage: B = p2.element_class(p2, {m: c for m, c in B if sum(mu.size() for mu in m) == 7})
2107+
sage: B = p2.element_class(p2, {m: c for m, c in B
2108+
....: if sum(mu.size() for mu in m) == 7})
20962109
sage: A == B
20972110
True
20982111
2112+
sage: # needs sage.modules
20992113
sage: f = Stream_exact([1]) # irrelevant for this test
21002114
sage: g = Stream_function(lambda n: s[n], True, 0)
21012115
sage: h = Stream_plethysm(f, g, True, p)
21022116
sage: B = p[2, 2, 1](sum(p(s[i]) for i in range(7)))
2103-
sage: all(h.compute_product(k, Partition([2, 2, 1])) == B.restrict_degree(k) for k in range(7))
2117+
sage: all(h.compute_product(k, Partition([2, 2, 1]))
2118+
....: == B.restrict_degree(k) for k in range(7))
21042119
True
21052120
"""
21062121
# This is the approximate order of the result
@@ -2134,6 +2149,7 @@ def stretched_power_restrict_degree(self, i, m, d):
21342149
21352150
EXAMPLES::
21362151
2152+
sage: # needs sage.modules
21372153
sage: from sage.data_structures.stream import Stream_plethysm, Stream_exact, Stream_function, Stream_zero
21382154
sage: s = SymmetricFunctions(QQ).s()
21392155
sage: p = SymmetricFunctions(QQ).p()
@@ -2144,14 +2160,17 @@ def stretched_power_restrict_degree(self, i, m, d):
21442160
sage: A == p[2,2,2](s[2] + s[3]).homogeneous_component(12)
21452161
True
21462162
2163+
sage: # needs sage.modules
21472164
sage: p2 = tensor([p, p])
21482165
sage: f = Stream_exact([1]) # irrelevant for this test
2149-
sage: g = Stream_function(lambda n: sum(tensor([p[k], p[n-k]]) for k in range(n+1)), True, 1)
2166+
sage: g = Stream_function(lambda n: sum(tensor([p[k], p[n-k]])
2167+
....: for k in range(n+1)), True, 1)
21502168
sage: h = Stream_plethysm(f, g, True, p2)
21512169
sage: A = h.stretched_power_restrict_degree(2, 3, 6)
2152-
sage: B = p[2,2,2](sum(g[n] for n in range(7))) # long time
2153-
sage: B = p2.element_class(p2, {m: c for m, c in B if sum(mu.size() for mu in m) == 12}) # long time
2154-
sage: A == B # long time
2170+
sage: B = p[2,2,2](sum(g[n] for n in range(7))) # long time
2171+
sage: B = p2.element_class(p2, {m: c for m, c in B # long time
2172+
....: if sum(mu.size() for mu in m) == 12})
2173+
sage: A == B # long time
21552174
True
21562175
"""
21572176
while len(self._powers) < m:
@@ -2298,6 +2317,7 @@ class Stream_rmul(Stream_scalar):
22982317
22992318
EXAMPLES::
23002319
2320+
sage: # needs sage.modules
23012321
sage: from sage.data_structures.stream import (Stream_rmul, Stream_function)
23022322
sage: W = algebras.DifferentialWeyl(QQ, names=('x',))
23032323
sage: x, dx = W.gens()
@@ -2339,6 +2359,7 @@ class Stream_lmul(Stream_scalar):
23392359
23402360
EXAMPLES::
23412361
2362+
sage: # needs sage.modules
23422363
sage: from sage.data_structures.stream import (Stream_lmul, Stream_function)
23432364
sage: W = algebras.DifferentialWeyl(QQ, names=('x',))
23442365
sage: x, dx = W.gens()

src/sage/databases/cremona.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def cremona_letter_code(n):
217217
Traceback (most recent call last):
218218
...
219219
ValueError: Cremona letter codes are only defined for non-negative integers
220-
sage: cremona_letter_code(x)
220+
sage: cremona_letter_code(x) # needs sage.symbolic
221221
Traceback (most recent call last):
222222
...
223223
ValueError: Cremona letter codes are only defined for non-negative integers

0 commit comments

Comments
 (0)