Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 48ad149

Browse files
author
Matthias Koeppe
committed
Merge #34163
2 parents 1c7f79a + c79ff66 commit 48ad149

13 files changed

+74
-74
lines changed

src/sage/interfaces/ecm.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ def recommended_B1(self, factor_digits):
336336
r'(?P<primality>.*) cofactor (?P<cofactor>\d+) has [\s]*(?P<digits>\d+) digits')
337337

338338
def _parse_output(self, n, out):
339-
"""
340-
Parse the ECM output
339+
r"""
340+
Parse the ECM output.
341341
342342
INPUT:
343343
@@ -348,10 +348,9 @@ def _parse_output(self, n, out):
348348
OUTPUT:
349349
350350
List of pairs ``(integer, bool)`` consisting of factors of the
351-
ECM input and whether they are deemed to be probable
352-
prime. Note that ECM is not a good primality test, and there
353-
is a sizeable probability that the "probable prime" is
354-
actually composite.
351+
ECM input and whether they are deemed to be probable prime.
352+
Note that ECM is not a good primality test, and there is a
353+
sizeable probability that the "probable prime" is actually composite.
355354
356355
EXAMPLES::
357356

src/sage/interfaces/frobby.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def _parse_4ti2_matrix(self, string):
361361
A list of rows of the matrix, where each row is represented as
362362
a list of integers.
363363
364-
EXAMPLES::
364+
EXAMPLES:
365365
366366
The format is straight-forward, as this example shows. ::
367367

src/sage/interfaces/giac.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -903,8 +903,6 @@ def _richcmp_(self, other, op):
903903
sage: a == 5
904904
True
905905
906-
::
907-
908906
sage: c = giac(3)
909907
sage: a == c
910908
False
@@ -915,8 +913,6 @@ def _richcmp_(self, other, op):
915913
sage: c <= a
916914
True
917915
918-
::
919-
920916
TESTS::
921917
922918
sage: x = var('x')
@@ -1065,10 +1061,11 @@ def _sage_(self, locals=None):
10651061
10661062
This method works successfully when Giac returns a result
10671063
or list of results that consist only of:
1064+
10681065
- numbers, i.e. integers, floats, complex numbers;
10691066
- functions and named constants also present in Sage, where:
10701067
- Sage knows how to translate the function or constant's name
1071-
from Giac's naming scheme through the ``symbol_table``, or
1068+
from Giac's naming scheme through the ``symbol_table``, or
10721069
- you provide a translation dictionary ``locals``.
10731070
10741071
New conversions can be added using Pynac's ``register_symbol``.

src/sage/interfaces/interface.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,16 @@ def execute(self, *args, **kwds):
248248
return self.eval(*args, **kwds)
249249

250250
def __call__(self, x, name=None):
251-
252251
r"""
253-
Create a new object in self from x.
252+
Create a new object in ``self`` from ``x``.
253+
254+
The object ``X`` returned can be used like any Sage object, and
255+
wraps an object in ``self``. The standard arithmetic operators
256+
work. Moreover if ``foo`` is a function then::
257+
258+
``X.foo(y,z,...)``
254259
255-
The object X returned can be used like any Sage object, and
256-
wraps an object in self. The standard arithmetic operators
257-
work. Moreover if foo is a function then
258-
X.foo(y,z,...)
259-
calls foo(X, y, z, ...) and returns the corresponding object.
260+
calls ``foo(X, y, z, ...)`` and returns the corresponding object.
260261
261262
EXAMPLES::
262263
@@ -446,7 +447,7 @@ def _relation_symbols(self):
446447

447448
def _exponent_symbol(self):
448449
"""
449-
Return the symbol used to denote *10^ in floats, e.g 'e' in 1.5e6
450+
Return the symbol used to denote ``*10^`` in floats, e.g 'e' in 1.5e6
450451
451452
EXAMPLES::
452453

src/sage/interfaces/jmoldata.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@
3131
import sys
3232
from pathlib import Path
3333

34+
3435
class JmolData(SageObject):
3536
r"""
36-
.. todo::
37+
.. TODO::
3738
38-
Create an animated image file (GIF) if spin is on and put data
39-
extracted from a file into a variable/string/structure to return
39+
Create an animated image file (GIF) if spin is on and put data
40+
extracted from a file into a variable/string/structure to return
4041
"""
4142
def __init__(self):
4243
"""

src/sage/interfaces/magma.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2627,7 +2627,7 @@ def __bool__(self):
26272627
sage: bool(magma(0)) # optional - magma
26282628
False
26292629
2630-
TESTS::
2630+
TESTS:
26312631
26322632
Verify that :trac:`32602` is fixed::
26332633

src/sage/interfaces/mathematica.py

+14-11
Original file line numberDiff line numberDiff line change
@@ -414,14 +414,14 @@ def _un_camel(name):
414414
415415
EXAMPLES::
416416
417-
sage: sage.interfaces.mathematica._un_camel('CamelCase')
418-
'camel_case'
419-
sage: sage.interfaces.mathematica._un_camel('EllipticE')
420-
'elliptic_e'
421-
sage: sage.interfaces.mathematica._un_camel('FindRoot')
422-
'find_root'
423-
sage: sage.interfaces.mathematica._un_camel('GCD')
424-
'gcd'
417+
sage: sage.interfaces.mathematica._un_camel('CamelCase')
418+
'camel_case'
419+
sage: sage.interfaces.mathematica._un_camel('EllipticE')
420+
'elliptic_e'
421+
sage: sage.interfaces.mathematica._un_camel('FindRoot')
422+
'find_root'
423+
sage: sage.interfaces.mathematica._un_camel('GCD')
424+
'gcd'
425425
"""
426426
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
427427
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
@@ -725,17 +725,20 @@ def _sage_(self, locals={}):
725725
726726
This method works successfully when Mathematica returns a result
727727
or list of results that consist only of:
728+
728729
- numbers, i.e. integers, floats, complex numbers;
729730
- functions and named constants also present in Sage, where:
730731
- Sage knows how to translate the function or constant's name
731-
from Mathematica's naming scheme, or
732+
from Mathematica's naming scheme, or
732733
- you provide a translation dictionary `locals`, or
733734
- the Sage name for the function or constant is simply the
734-
Mathematica name in lower case;
735-
- symbolic variables whose names don't pathologically overlap with
735+
Mathematica name in lower case;
736+
737+
- symbolic variables whose names do not pathologically overlap with
736738
objects already defined in Sage.
737739
738740
This method will not work when Mathematica's output includes:
741+
739742
- strings;
740743
- functions unknown to Sage that are not specified in `locals`;
741744
- Mathematica functions with different parameters/parameter order to

src/sage/interfaces/mathics.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -979,17 +979,20 @@ def _sage_(self, locals={}):
979979
980980
This method works successfully when Mathics returns a result
981981
or list of results that consist only of:
982+
982983
- numbers, i.e. integers, floats, complex numbers;
983984
- functions and named constants also present in Sage, where:
984985
- Sage knows how to translate the function or constant's name
985-
from Mathics's naming scheme, or
986+
from Mathics's naming scheme, or
986987
- you provide a translation dictionary `locals`, or
987988
- the Sage name for the function or constant is simply the
988-
Mathics name in lower case;
989-
- symbolic variables whose names don't pathologically overlap with
989+
Mathics name in lower case;
990+
991+
- symbolic variables whose names do not pathologically overlap with
990992
objects already defined in Sage.
991993
992994
This method will not work when Mathics's output includes:
995+
993996
- strings;
994997
- functions unknown to Sage;
995998
- Mathics functions with different parameters/parameter order to

src/sage/interfaces/mupad.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -157,22 +157,20 @@ def __reduce__(self):
157157
return reduce_load_mupad, tuple([])
158158

159159
def _read_in_file_command(self, filename):
160-
"""
160+
r"""
161161
EXAMPLES::
162162
163163
sage: mupad._read_in_file_command('test')
164164
'read("test")'
165165
166166
sage: filename = tmp_filename()
167-
sage: f = open(filename, 'w')
168-
sage: _ = f.write('x := 2;\n')
169-
sage: f.close()
167+
sage: with open(filename, 'w') as f:
168+
....: _ = f.write('x := 2;\n')
170169
sage: mupad.read(filename) # optional - MuPAD
171170
sage: mupad.get('x').strip() # optional - mupad
172171
'2'
173-
174172
"""
175-
return 'read("%s")'%filename
173+
return 'read("%s")' % filename
176174

177175
def _quit_string(self):
178176
"""

src/sage/interfaces/phc.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -482,19 +482,17 @@ def _output_from_command_list(self, command_list, polys, verbose=False):
482482
return output_filename
483483

484484
def _input_file(self, polys):
485-
"""
485+
r"""
486486
This is used internally to implement the PHC interface.
487487
488488
INPUT:
489489
490490
- polys -- a list of polynomials in a Sage polynomial ring
491-
over a field that embeds into the complex
492-
numbers.
491+
over a field that embeds into the complex numbers
493492
494493
OUTPUT:
495494
496-
- a PHC input file (as a text string) that describes these -
497-
polynomials.
495+
a PHC input file (as a text string) that describes these polynomials
498496
499497
EXAMPLES::
500498

src/sage/interfaces/polymake.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def _equality_symbol(self):
449449
return "=="
450450

451451
def _read_in_file_command(self, filename):
452-
"""
452+
r"""
453453
TESTS::
454454
455455
sage: polymake._read_in_file_command('foobar')
@@ -466,7 +466,6 @@ def _read_in_file_command(self, filename):
466466
sage: L = polymake([42] * 84) # optional - polymake
467467
sage: len(L) # optional - polymake
468468
84
469-
470469
"""
471470
return 'eval read_file "{}";\n'.format(filename)
472471

src/sage/interfaces/qepcad.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -628,14 +628,16 @@ def _qepcad_atoms(formula):
628628
629629
- `formula` (string) - a quantifier-free formula.
630630
631-
.. note:: this function is pis-aller used for doctesting, not a complete
632-
parser, which should be written in a further ticket.
631+
.. NOTE::
632+
633+
This function is pis-aller used for doctesting, not a complete
634+
parser, which should be written in a further ticket.
633635
634636
EXAMPLES::
635637
636-
sage: from sage.interfaces.qepcad import _qepcad_atoms
637-
sage: _qepcad_atoms('y^5 + 4 y + 8 >= 0 /\\ y <= 0 /\\ [ y = 0 \\/ y^5 + 4 y + 8 = 0 ]')
638-
{'y <= 0', 'y = 0', 'y^5 + 4 y + 8 = 0', 'y^5 + 4 y + 8 >= 0'}
638+
sage: from sage.interfaces.qepcad import _qepcad_atoms
639+
sage: _qepcad_atoms('y^5 + 4 y + 8 >= 0 /\\ y <= 0 /\\ [ y = 0 \\/ y^5 + 4 y + 8 = 0 ]')
640+
{'y <= 0', 'y = 0', 'y^5 + 4 y + 8 = 0', 'y^5 + 4 y + 8 >= 0'}
639641
"""
640642
return set(i.strip() for i in flatten([i.split('\\/') for i in formula.replace('[','').replace(']','').split('/\\')]))
641643

src/sage/interfaces/r.py

+17-18
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,12 @@ def _setup_r_to_sage_converter():
297297
Set up a the converter used to convert from rpy2's
298298
representation of R objects to the one sage expects.
299299
300-
EXAMPLES::
301-
302-
Test
300+
EXAMPLES:
303301
304-
Simple numeric values are represented as vectors in R. So `1` would actually
305-
be an array of length 1. We convert all vectors of length 1 to simple values,
306-
whether or not they "originally" were simple values or not:
302+
Simple numeric values are represented as vectors in R. So `1`
303+
would actually be an array of length 1. We convert all vectors of
304+
length 1 to simple values, whether or not they "originally" were
305+
simple values or not::
307306
308307
sage: r([42]).sage() # optional - rpy2
309308
42
@@ -314,27 +313,27 @@ def _setup_r_to_sage_converter():
314313
sage: r('c("foo")').sage() # optional - rpy2
315314
'foo'
316315
317-
Arrays of length greater than one are treated normally:
316+
Arrays of length greater than one are treated normally::
318317
319318
sage: r([42, 43]).sage() # optional - rpy2
320319
[42, 43]
321320
322321
We also convert all numeric values to integers if that is possible without
323-
loss of precision:
322+
loss of precision::
324323
325324
sage: type(r([1.0]).sage()) == int # optional - rpy2
326325
True
327326
328327
sage: r([1.0, 42.5]).sage() # optional - rpy2
329328
[1, 42.5]
330329
331-
Matrices are converted to sage matrices:
330+
Matrices are converted to sage matrices::
332331
333332
sage: r('matrix(c(2,4,3,1,5,7), nrow=2, ncol=3)').sage() # optional - rpy2
334333
[2 3 5]
335334
[4 1 7]
336335
337-
More complex r structures are represented by dictionaries:
336+
More complex r structures are represented by dictionaries::
338337
339338
sage: r.summary(1).sage() # optional - rpy2
340339
{'DATA': [1, 1, 1, 1, 1, 1],
@@ -345,7 +344,7 @@ def _setup_r_to_sage_converter():
345344
{'DATA': {'width': 60}, '_Names': 'width'}
346345
347346
The conversion can handle "not a number", infintiy, imaginary values and
348-
missing values:
347+
missing values::
349348
350349
sage: r(-17).sqrt().sage() # optional - rpy2
351350
nan
@@ -356,8 +355,7 @@ def _setup_r_to_sage_converter():
356355
sage: inf = r('Inf'); inf.sage() # optional - rpy2
357356
inf
358357
359-
360-
Character Vectors are represented by regular python arrays:
358+
Character Vectors are represented by regular python arrays::
361359
362360
sage: labs = r.paste('c("X","Y")', '1:10', sep='""'); labs.sage() # optional - rpy2
363361
['X1', 'Y2', 'X3', 'Y4', 'X5', 'Y6', 'X7', 'Y8', 'X9', 'Y10']
@@ -503,9 +501,9 @@ def _lazy_init(self):
503501
the blas implementation that is used.
504502
For details, see https://bitbucket.org/rpy2/rpy2/issues/491.
505503
506-
TESTS::
504+
TESTS:
507505
508-
Initialization happens on eval:
506+
Initialization happens on eval::
509507
510508
sage: my_r = R() # optional - rpy2
511509
sage: my_r._initialized # optional - rpy2
@@ -1391,6 +1389,7 @@ def __getitem__(self, s):
13911389
INPUT:
13921390
13931391
- s -- a string
1392+
13941393
OUTPUT: RFunction -- the R function that in R has name s
13951394
13961395
EXAMPLES::
@@ -2061,13 +2060,14 @@ def r_version():
20612060
"""
20622061
return r.version()
20632062

2063+
20642064
class HelpExpression(str):
20652065
"""
20662066
Used to improve printing of output of r.help.
20672067
"""
20682068
def __repr__(self):
2069-
"""
2070-
Return string representation of self.
2069+
r"""
2070+
Return string representation of ``self``.
20712071
20722072
OUTPUT: string
20732073
@@ -2082,4 +2082,3 @@ def __repr__(self):
20822082
R!
20832083
"""
20842084
return str(self)
2085-

0 commit comments

Comments
 (0)