@@ -423,15 +423,18 @@ cpdef bint is_numpy_type(t):
423423    EXAMPLES:: 
424424
425425        sage: from sage.structure.coerce import is_numpy_type 
426-         sage: import numpy                                                              # needs numpy 
427-         sage: is_numpy_type(numpy.int16)                                                # needs numpy 
426+ 
427+         sage: # needs numpy 
428+         sage: import numpy 
429+         sage: is_numpy_type(numpy.int16) 
428430        True 
429-         sage: is_numpy_type(numpy.floating)                                             # needs numpy  
431+         sage: is_numpy_type(numpy.floating) 
430432        True 
431-         sage: is_numpy_type(numpy.ndarray)                                              # needs numpy  
433+         sage: is_numpy_type(numpy.ndarray) 
432434        True 
433-         sage: is_numpy_type(numpy.matrix)                                               # needs numpy  
435+         sage: is_numpy_type(numpy.matrix) 
434436        True 
437+ 
435438        sage: is_numpy_type(int) 
436439        False 
437440        sage: is_numpy_type(Integer) 
@@ -923,20 +926,23 @@ cdef class CoercionModel:
923926    cpdef analyse(self , xp, yp, op = mul):
924927        """ 
925928        Emulate the process of doing arithmetic between xp and yp, returning 
926-         a list of steps and the parent that the result will live in. The 
927-         ``explain`` function is easier to use, but if one wants access to 
929+         a list of steps and the parent that the result will live in. 
930+ 
931+         The :meth:`explain` method is easier to use, but if one wants access to 
928932        the actual morphism and action objects (rather than their string 
929-         representations) then this is the function to use. 
933+         representations),  then this is the function to use. 
930934
931935        EXAMPLES:: 
932936
933937            sage: cm = sage.structure.element.get_coercion_model() 
934938            sage: GF7 = GF(7) 
935939            sage: steps, res = cm.analyse(GF7, ZZ) 
936940            sage: steps 
937-             ['Coercion on right operand via', Natural morphism: 
941+             ['Coercion on right operand via', 
942+              Natural morphism: 
938943              From: Integer Ring 
939-               To:   Finite Field of size 7, 'Arithmetic performed after coercions.'] 
944+               To:   Finite Field of size 7, 
945+              'Arithmetic performed after coercions.'] 
940946            sage: res 
941947            Finite Field of size 7 
942948            sage: f = steps[1]; type(f) 
@@ -1016,9 +1022,10 @@ cdef class CoercionModel:
10161022
10171023    def  common_parent (self , *args ):
10181024        """ 
1019-         Computes a common parent for all the inputs. It's essentially 
1020-         an `n`-ary canonical coercion except it can operate on parents 
1021-         rather than just elements. 
1025+         Compute a common parent for all the inputs. 
1026+ 
1027+         It's essentially an `n`-ary canonical coercion except it can 
1028+         operate on parents rather than just elements. 
10221029
10231030        INPUT: 
10241031
@@ -1027,7 +1034,7 @@ cdef class CoercionModel:
10271034        OUTPUT: 
10281035
10291036        A :class:`Parent` into which each input should coerce, or raises a 
1030-         `` TypeError` ` if no such :class:`Parent` can be found. 
1037+         :class:` TypeError` if no such :class:`Parent` can be found. 
10311038
10321039        EXAMPLES:: 
10331040
@@ -1122,23 +1129,25 @@ cdef class CoercionModel:
11221129
11231130    cpdef bin_op(self , x, y, op):
11241131        """ 
1125-         Execute the operation op on x and y. It first looks for an action 
1126-         corresponding to op, and failing that, it tries to coerces x and y 
1127-         into a common parent and calls op on them. 
1132+         Execute the operation ``op`` on `x` and `y`. 
1133+ 
1134+         It first looks for an action 
1135+         corresponding to ``op``, and failing that, it tries to coerce `x` and `y` 
1136+         into a common parent and calls ``op`` on them. 
11281137
1129-         If it cannot make sense of the operation, a TypeError is raised. 
1138+         If it cannot make sense of the operation, a :class:` TypeError`  is raised. 
11301139
11311140        INPUT: 
11321141
1133-         - ``x``   - the left operand 
1142+         - ``x`` - - the left operand 
11341143
1135-         - ``y``   - the right operand 
1144+         - ``y`` - - the right operand 
11361145
1137-         - ``op`` - a python function taking 2 arguments 
1146+         - ``op`` --  a python function taking 2 arguments 
11381147
11391148          .. NOTE:: 
11401149
1141-              op  is often an arithmetic operation, but need not be so. 
1150+              ``op``  is often an arithmetic operation, but need not be so. 
11421151
11431152        EXAMPLES:: 
11441153
@@ -1268,26 +1277,28 @@ cdef class CoercionModel:
12681277
12691278    cpdef canonical_coercion(self , x, y):
12701279        r """ 
1271-         Given two elements x  and y , with parents S  and R  respectively, 
1272-         find a common parent Z  such that there are coercions 
1273-         `f: S \m  apsto  Z` and `g: R \m  apsto  Z` and return `f( x) , g( y) ` 
1280+         Given two elements `x`  and `y` , with parents `S`  and `R`  respectively, 
1281+         find a common parent `Z`  such that there are coercions 
1282+         `f: S \t  o  Z` and `g: R \t  o  Z` and return `f( x) , g( y) `,  
12741283        which will have the same parent.  
12751284
1276-         Raises a type error if no such Z  can be found.  
1285+         Raises a type error if no such `Z`  can be found.  
12771286
12781287        EXAMPLES:: 
12791288
12801289            sage: cm = sage. structure. element. get_coercion_model( )  
12811290            sage: cm. canonical_coercion( mod( 2, 10) , 17)  
12821291            ( 2, 7)  
1283-             sage: x, y = cm. canonical_coercion( 1/2, matrix( ZZ, 2, 2, range( 4)))          # needs sage. modules 
1284-             sage: x                                                                     # needs sage. modules 
1292+ 
1293+             sage: # needs sage. modules 
1294+             sage: x, y = cm. canonical_coercion( 1/2, matrix( ZZ, 2, 2, range( 4)))  
1295+             sage: x 
12851296            [1/2   0 ] 
12861297            [  0 1/2 ] 
1287-             sage: y                                                                     # needs sage . modules  
1298+             sage: y 
12881299            [0 1 ] 
12891300            [2 3 ] 
1290-             sage: parent( x)  is parent( y)                                                 # needs sage . modules  
1301+             sage: parent( x)  is parent( y)  
12911302            True 
12921303
12931304        There is some support for non-Sage datatypes as well:: 
@@ -1296,7 +1307,6 @@ cdef class CoercionModel:
12961307            sage: type( x) , type( y)  
12971308            ( <class 'sage. rings. integer. Integer'>, <class 'sage. rings. integer. Integer'>)  
12981309
1299- 
13001310            sage: x, y = cm. canonical_coercion( int( 5) , complex( 3))  
13011311            sage: type( x) , type( y)  
13021312            ( <class 'complex'>, <class 'complex'>)  
@@ -1411,7 +1421,6 @@ cdef class CoercionModel:
14111421
14121422        raise  TypeError (" no common canonical parent for objects with parents: '%s ' and '%s '" % (xp, yp))
14131423
1414- 
14151424    cpdef coercion_maps(self , R, S):
14161425        r """ 
14171426        Give two parents `R` and `S`, return a pair of coercion maps 
@@ -1471,12 +1480,14 @@ cdef class CoercionModel:
14711480            False 
14721481            sage: cm = sage. structure. element. get_coercion_model( )  
14731482            sage: cm. coercion_maps( V, W)  
1474-             ( None, ( map internal to coercion system -- copy before use)  
1483+             ( None, 
1484+              ( map internal to coercion system -- copy before use)  
14751485             Coercion map: 
14761486               From: Vector space of dimension 3 over Rational Field 
14771487               To:   Vector space of dimension 3 over Rational Field)  
14781488            sage: cm. coercion_maps( W, V)  
1479-             ( None, ( map internal to coercion system -- copy before use)  
1489+             ( None, 
1490+              ( map internal to coercion system -- copy before use)  
14801491             Coercion map: 
14811492               From: Vector space of dimension 3 over Rational Field 
14821493               To:   Vector space of dimension 3 over Rational Field)  
@@ -1495,15 +1506,15 @@ cdef class CoercionModel:
14951506            sage: # needs sage. libs. pari 
14961507            sage: import gc 
14971508            sage: T = type( GF( 2))  
1498-             sage: gc. collect( )  # random 
1509+             sage: gc. collect( )   #  random 
14991510            852 
15001511            sage: N0 = len( list( o for o in gc. get_objects( )  if type( o)  is T))  
15011512            sage: L = [ZZ(1) + GF(p)(1) for p in prime_range(2, 50) ] 
15021513            sage: N1 = len( list( o for o in gc. get_objects( )  if type( o)  is T))  
15031514            sage: N1 > N0 
15041515            True 
15051516            sage: del L 
1506-             sage: gc. collect( )  # random 
1517+             sage: gc. collect( )   #  random 
15071518            3939 
15081519            sage: N2 = len( list( o for o in gc. get_objects( )  if type( o)  is T))  
15091520            sage: N2 - N0 
@@ -1561,7 +1572,7 @@ cdef class CoercionModel:
15611572
15621573    cpdef verify_coercion_maps(self , R, S, homs, bint fix = False ):
15631574        """ 
1564-         Make sure this is a valid pair of homomorphisms from R  and S  to a common parent. 
1575+         Make sure this is a valid pair of homomorphisms from `R`  and `S`  to a common parent. 
15651576        This function is used to protect the user against buggy parents. 
15661577
15671578        EXAMPLES:: 
@@ -1631,7 +1642,7 @@ cdef class CoercionModel:
16311642    cpdef discover_coercion(self , R, S):
16321643        """ 
16331644        This actually implements the finding of coercion maps as described in 
1634-         the `` coercion_maps` ` method. 
1645+         the :meth:` coercion_maps` method. 
16351646
16361647        EXAMPLES:: 
16371648
@@ -1811,15 +1822,15 @@ cdef class CoercionModel:
18111822        """ 
18121823        INPUT: 
18131824
1814-         - ``R`` - the left Parent (or type) 
1815-         - ``S`` - the right Parent (or type) 
1816-         - ``op`` - the operand, typically an element of the operator module 
1817-         - ``r`` - (optional) element of R  
1818-         - ``s`` - (optional) element of S . 
1825+         - ``R`` --  the left :class:` Parent`  (or type) 
1826+         - ``S`` --  the right :class:` Parent`  (or type) 
1827+         - ``op`` --  the operand, typically an element of the :mod:` operator`  module 
1828+         - ``r`` --  (optional) element of `R`  
1829+         - ``s`` --  (optional) element of `S` . 
18191830
18201831        OUTPUT: 
18211832
1822-         - An action A  such that s op r  is given by A(s,r). 
1833+         - An action `A`  such that `s` ``op`` `r`  is given by ` A(s,r)` . 
18231834
18241835        The steps taken are illustrated below. 
18251836
@@ -1833,13 +1844,14 @@ cdef class CoercionModel:
18331844            True 
18341845            sage: cm = sage.structure.element.get_coercion_model() 
18351846
1836-         If R  or S  is a Parent, ask it for an action by/on R :: 
1847+         If `R`  or `S`  is a :class:` Parent` , ask it for an action by/on `R` :: 
18371848
18381849            sage: cm.discover_action(ZZ, P, operator.mul) 
18391850            Left scalar multiplication by Integer Ring on 
18401851             Univariate Polynomial Ring in x over Integer Ring 
18411852
1842-         If R or S a type, recursively call get_action with the Sage versions of R and/or S:: 
1853+         If `R` or `S` a type, recursively call :meth:`get_action` 
1854+         with the Sage versions of `R` and/or `S`:: 
18431855
18441856            sage: cm.discover_action(P, int, operator.mul) 
18451857            Right scalar multiplication by Integer Ring on 
@@ -1848,7 +1860,7 @@ cdef class CoercionModel:
18481860              From: Set of Python objects of class 'int' 
18491861              To:   Integer Ring 
18501862
1851-         If op  is division, look for action on right by inverse:: 
1863+         If ``op``  is division, look for action on `` right``  by inverse:: 
18521864
18531865            sage: cm.discover_action(P, ZZ, operator.truediv) 
18541866            Right inverse action by Rational Field on 
0 commit comments