Ticket #11115: trac_11115_docfix.patch

File trac_11115_docfix.patch, 25.4 KB (added by SimonKing, 9 years ago)

Fix some doc strings, and add the required blank line after embedding information for cached methods

  • sage/algebras/iwahori_hecke_algebra.py

    # HG changeset patch
    # User Simon King <simon.king@uni-jena.de>
    # Date 1319560425 -7200
    # Node ID 814cb45375fbf7319081e445a736c516f9b7ae86
    # Parent  93ca48b60ae5cd165b55e4c6be9b5d0e334d06d4
    #11115: Fix some doc strings.
    Add a blank line in the doc string of cached methods after the embedding information.
    Make correct use of cached functions in sage/algebras/steenrod/steenrod_algebra_bases.py
    
    diff --git a/sage/algebras/iwahori_hecke_algebra.py b/sage/algebras/iwahori_hecke_algebra.py
    a b  
    365365        that case, the algebra generators are also invertible and this
    366366        method returns their inverses.
    367367
    368         EXAMPLES ::
     368        EXAMPLES::
     369
    369370            sage: P.<q> = PolynomialRing(QQ)
    370371            sage: F = Frac(P)
    371372            sage: H = IwahoriHeckeAlgebraT("A2",q,base_ring=F)
  • sage/algebras/quatalg/quaternion_algebra.py

    diff --git a/sage/algebras/quatalg/quaternion_algebra.py b/sage/algebras/quatalg/quaternion_algebra.py
    a b  
    861861        r"""
    862862        Return mod `p` splitting data for this quaternion algebra at
    863863        the unramified prime `p`.  This is `2\times 2`
    864         matrices `I`, `J`, ``K`` over the finite field `\GF{p}` such that if
     864        matrices `I`, `J`, `K` over the finite field `\GF{p}` such that if
    865865        the quaternion algebra has generators `i, j, k`, then `I^2 =
    866866        i^2`, `J^2 = j^2`, `IJ=K` and `IJ=-JI`.
    867867
     
    21852185
    21862186        INPUT:
    21872187
    2188             - `p` -- prime number (see below)
     2188        - `p` -- prime number (see below)
    21892189
    2190             - `alpha` -- (default: None) element of quaternion algebra,
    2191               which can be used to parameterize the order of the
    2192               ideals `J`.  More precisely the `J`'s are the right annihilators
    2193               of `(1,0) \alpha^i` for `i=0,1,2,...,p`
     2190        - `alpha` -- (default: None) element of quaternion algebra,
     2191          which can be used to parameterize the order of the
     2192          ideals `J`.  More precisely the `J`'s are the right annihilators
     2193          of `(1,0) \alpha^i` for `i=0,1,2,...,p`
    21942194
    21952195        OUTPUT:
    21962196
    2197             - list of right ideals
     2197        - list of right ideals
    21982198
    21992199        .. note::
    22002200
  • sage/algebras/steenrod/steenrod_algebra_bases.py

    diff --git a/sage/algebras/steenrod/steenrod_algebra_bases.py b/sage/algebras/steenrod/steenrod_algebra_bases.py
    a b  
    55
    66- John H. Palmieri (2008-07-30): version 0.9
    77- John H. Palmieri (2010-06-30): version 1.0
     8- Simon King (2011-10-25): Fix the use of cached functions
    89
    910This package defines functions for computing various bases of the
    1011Steenrod algebra, and for converting between the Milnor basis and
     
    4748
    4849- :func:`steenrod_algebra_basis`.  This computes a tuple representing
    4950  basis elements for the Steenrod algebra in a given degree, at a
    50   given prime, with respect to a given basis.  Note: the work is done
    51   by the function :func:`steenrod_algebra_basis_` (note trailing
    52   underscore), while :func:`steenrod_algebra_basis` is just a version
    53   of this which automatically caches its results.
     51  given prime, with respect to a given basis. It is a cached function.
    5452
    5553- :func:`convert_to_milnor_matrix`.  This returns the change-of-basis
    56   matrix, in a given degree, from any basis to the Milnor basis.  As
    57   with the previous function, the work is actually done by
    58   :func:`convert_to_milnor_matrix_`, and then
    59   :func:`convert_to_milnor_matrix` is the cached version.
     54  matrix, in a given degree, from any basis to the Milnor basis. It is
     55  a cached function.
    6056
    6157- :func:`convert_from_milnor_matrix`.  This returns the inverse of the
    6258  previous matrix.
     
    9389
    9490In this file :file:`steenrod_algebra_bases.py`:
    9591
    96 - add appropriate lines to :func:`steenrod_algebra_basis_`.
     92- add appropriate lines to :func:`steenrod_algebra_basis`.
    9793
    9894- add a function to compute the basis in a given dimension (to be
    99   called by :func:`steenrod_algebra_basis_`).
     95  called by :func:`steenrod_algebra_basis`).
    10096
    10197- modify :func:`steenrod_basis_error_check` so it checks the new
    10298  basis.
     
    127123#  Distributed under the terms of the GNU General Public License (GPL)
    128124#*****************************************************************************
    129125
    130 from sage.misc.cachefunc import CachedFunction
     126from sage.misc.cachefunc import cached_function
    131127
    132 def convert_to_milnor_matrix_(n, basis, p=2):
     128@cached_function
     129def convert_to_milnor_matrix(n, basis, p=2):
    133130    r"""
    134131    Change-of-basis matrix, 'basis' to Milnor, in dimension
    135132    `n`, at the prime `p`.
     
    137134    INPUT:
    138135
    139136    - ``n`` - non-negative integer, the dimension
    140 
    141137    - ``basis`` - string, the basis from which to convert
    142 
    143138    - ``p`` - positive prime number (optional, default 2)
    144139
    145     OUTPUT: ``matrix`` - change-of-basis matrix, a square matrix over
    146     GF(p)
     140    OUTPUT:
     141       
     142    ``matrix`` - change-of-basis matrix, a square matrix over ``GF(p)``
    147143
    148144    .. note::
    149145
     
    203199    d = len(milnor_base)
    204200    return matrix(GF(p),d,d,rows)
    205201
    206 convert_to_milnor_matrix = CachedFunction(convert_to_milnor_matrix_)
    207 
    208202def convert_from_milnor_matrix(n, basis, p=2):
    209203    r"""
    210204    Change-of-basis matrix, Milnor to 'basis', in dimension
     
    276270    else:
    277271        return mat
    278272
    279 def steenrod_algebra_basis_(n, basis='milnor', p=2, **kwds):
     273@cached_function
     274def steenrod_algebra_basis(n, basis='milnor', p=2, **kwds):
    280275    r"""
    281276    Basis for the Steenrod algebra in degree `n`.
    282277
    283278    INPUT:
    284279
    285280    - ``n`` - non-negative integer
    286 
    287     - ``basis`` - string, which basis to use (optional, default =
    288       'milnor')
    289 
     281    - ``basis`` - string, which basis to use (optional, default = 'milnor')
    290282    - ``p`` - positive prime number (optional, default = 2)
    291 
    292283    - ``profile`` - profile function (optional, default None).  This
    293284      is just passed on to the functions :func:`milnor_basis` and
    294285      :func:`pst_basis`.
    295 
    296286    - ``truncation_type`` - truncation type, either 0 or Infinity
    297287      (optional, default Infinity if no profile function is specified,
    298288      0 otherwise).  This is just passed on to the function
    299289      :func:`milnor_basis`.
    300290
    301     OUTPUT: tuple of objects representing basis elements for the
    302     Steenrod algebra in dimension n
     291    OUTPUT:
     292       
     293    Tuple of objects representing basis elements for the Steenrod algebra
     294    in dimension n.
    303295
    304296    .. note::
    305297   
     
    404396    else:
    405397        raise ValueError, "Unknown basis: %s at the prime %s" % (basis, p)
    406398
    407 steenrod_algebra_basis = CachedFunction(steenrod_algebra_basis_)
    408 
    409399# helper functions for producing bases
    410400
    411401def restricted_partitions(n, l, no_repeats=False):
     
    11331123    """
    11341124    import sage.misc.misc as misc
    11351125
     1126    # Apparently, in this test function, we don't want to benefit from caching.
     1127    # Hence, the uncached version of steenrod_algebra_basis and of
     1128    # convert_to-milnor_matrix are used.
    11361129    if p == 2:
    11371130        bases = ('adem','woody', 'woodz', 'wall', 'arnona', 'arnonc',
    11381131                 'pst_rlex', 'pst_llex', 'pst_deg', 'pst_revz',
     
    11451138    for i in range(dim):
    11461139        if i % 5 == 0:
    11471140            misc.verbose("up to dimension %s"%i)
    1148         milnor_dim = len(steenrod_algebra_basis_(i,'milnor',p=p))
     1141        milnor_dim = len(steenrod_algebra_basis.f(i,'milnor',p=p))
    11491142        for B in bases:
    1150             # use steenrod_algebra_basis_, the uncached version
    1151             if milnor_dim != len(steenrod_algebra_basis_(i,B,p)):
     1143            if milnor_dim != len(steenrod_algebra_basis.f(i,B,p)):
    11521144                print "problem with milnor/" + B + " in dimension ", i
    1153             # use convert_to_milnor_matrix_, the uncached version
    1154             mat = convert_to_milnor_matrix_(i,B,p)
     1145            mat = convert_to_milnor_matrix.f(i,B,p)
    11551146            if mat.nrows() != 0 and not mat.is_invertible():
    11561147                print "%s invertibility problem in dim %s at p=%s" % (B, i, p)
    11571148
     
    11671158        if i % 5 == 0:
    11681159            misc.verbose("up to dimension %s"%i)
    11691160        for pro in profiles:
    1170             milnor_dim = len(steenrod_algebra_basis_(i,'milnor',p=p,profile=pro))
     1161            milnor_dim = len(steenrod_algebra_basis.f(i,'milnor',p=p,profile=pro))
    11711162            for B in bases:
    1172                 if milnor_dim != len(steenrod_algebra_basis_(i,B,p,profile=pro)):
     1163                if milnor_dim != len(steenrod_algebra_basis.f(i,B,p,profile=pro)):
    11731164                    print "problem with milnor/%s in dimension %s with profile %s"%(B, i, pro)
    11741165
    11751166    misc.verbose("done checking with profiles")
  • sage/algebras/steenrod/steenrod_algebra_mult.py

    diff --git a/sage/algebras/steenrod/steenrod_algebra_mult.py b/sage/algebras/steenrod/steenrod_algebra_mult.py
    a b  
    77  multiplication.
    88- John H. Palmieri (2010-06-30: version 1.0) multiplication of
    99  Serre-Cartan basis elements using the Adem relations.
     10  - Simon King (2011-10-25): Fix the use of cached functions.
    1011
    1112.. rubric:: Milnor multiplication, `p=2`
    1213
     
    207208#  Distributed under the terms of the GNU General Public License (GPL)
    208209#*****************************************************************************
    209210
    210 from sage.misc.cachefunc import CachedFunction
     211from sage.misc.cachefunc import cached_function
    211212
    212213# Milnor, p=2
    213214
     
    220221    - r - tuple of non-negative integers
    221222    - s - tuple of non-negative integers
    222223
    223     OUTPUT: Dictionary of terms of the form (tuple: coeff), where
     224    OUTPUT:
     225       
     226    Dictionary of terms of the form (tuple: coeff), where
    224227    'tuple' is a tuple of non-negative integers and 'coeff' is 1.
    225228
    226229    This computes Milnor matrices for the product of $\text{Sq}(r)$
     
    330333
    331334    - list - list of integers
    332335
    333     OUTPUT: None if the multinomial coefficient is 0, or sum of list
    334     if it is 1
     336    OUTPUT:
     337       
     338    None if the multinomial coefficient is 0, or sum of list if it is 1
    335339
    336340    Given the input $[n_1, n_2, n_3, ...]$, this computes the
    337341    multinomial coefficient $(n_1 + n_2 + n_3 + ...)! / (n_1! n_2!
     
    387391    - m2 - pair of tuples (f,s), same format as m1
    388392    - p - odd prime number
    389393
    390     OUTPUT: Dictionary of terms of the form (tuple: coeff), where
    391     'tuple' is a pair of tuples, as for r and s, and 'coeff' is an
    392     integer mod p.
     394    OUTPUT:
     395       
     396    Dictionary of terms of the form (tuple: coeff), where 'tuple' is
     397    a pair of tuples, as for r and s, and 'coeff' is an integer mod p.
    393398
    394399    This computes the product of the Milnor basis elements
    395400    $Q_{e_1} Q_{e_2} ... P(r_1, r_2, ...)$ and
     
    573578    - list - list of integers
    574579    - p - a prime number
    575580
    576     OUTPUT: Associated multinomial coefficient, mod p
     581    OUTPUT:
     582       
     583    Associated multinomial coefficient, mod p
    577584
    578585    Given the input $[n_1, n_2, n_3, ...]$, this computes the
    579586    multinomial coefficient $(n_1 + n_2 + n_3 + ...)! / (n_1! n_2!
     
    637644
    638645    - `n`, `k` - integers
    639646
    640     OUTPUT: `n` choose `k`, mod 2
     647    OUTPUT:
     648       
     649    `n` choose `k`, mod 2
    641650
    642651    EXAMPLES::
    643652
     
    667676    - `n`, `k` - integers
    668677    - `p` - prime number
    669678
    670     OUTPUT: `n` choose `k`, mod `p`
     679    OUTPUT:
     680       
     681    `n` choose `k`, mod `p`
    671682
    672683    EXAMPLES::
    673684
     
    681692        return 0
    682693    return multinomial_odd([n-k, k], p)
    683694
    684 def adem_(a, b, c=0, p=2):
     695@cached_function
     696def adem(a, b, c=0, p=2):
    685697    r"""
    686698    The mod `p` Adem relations
    687699   
     
    691703      to either `P^a P^b` or (if `c` present) to `P^a \beta^b P^c`
    692704    - `p` - positive prime number (optional, default 2)
    693705
    694     OUTPUT: a dictionary representing the mod `p` Adem relations
     706    OUTPUT:
     707       
     708    a dictionary representing the mod `p` Adem relations
    695709    applied to `P^a P^b` or (if `c` present) to `P^a \beta^b P^c`.
    696710
    697711    .. note::
     
    817831                    result[(0,A+B-j,1,j,0)] = coeff
    818832    return result
    819833
    820 adem = CachedFunction(adem_)
    821 
    822 def make_mono_admissible_(mono, p=2):
     834@cached_function
     835def make_mono_admissible(mono, p=2):
    823836    r"""
    824837    Given a tuple ``mono``, view it as a product of Steenrod
    825838    operations, and return a dictionary giving data equivalent to
     
    838851    - ``mono`` - a tuple of non-negative integers
    839852    - `p` - prime number, optional (default 2)
    840853
    841     OUTPUT: Dictionary of terms of the form (tuple: coeff), where
     854    OUTPUT:
     855       
     856    Dictionary of terms of the form (tuple: coeff), where
    842857    'tuple' is an admissible tuple of non-negative integers and
    843858    'coeff' is its coefficient.  This corresponds to a linear
    844859    combination of admissible monomials.  When `p` is odd, each tuple
     
    851866       \beta^{e_1} \mathcal{P}^{i_2} \beta^{e_2} \mathcal{P}^{i_2} ...
    852867       \mathcal{P}^{i_k} \beta^{e_k}
    853868
    854     ALGORITHM: Given `(i_1, i_2, i_3, ...)`, apply the Adem relations
    855     to the first pair (or triple when `p` is odd) where the sequence
    856     is inadmissible, and then apply this function recursively to each
    857     of the resulting tuples `(i_1, ..., i_{j-1}, NEW, i_{j+2}, ...)`,
    858     keeping track of the coefficients.
     869    ALGORITHM:
     870       
     871    Given `(i_1, i_2, i_3, ...)`, apply the Adem relations to the first
     872    pair (or triple when `p` is odd) where the sequence is inadmissible,
     873    and then apply this function recursively to each of the resulting
     874    tuples `(i_1, ..., i_{j-1}, NEW, i_{j+2}, ...)`, keeping track of
     875    the coefficients.
    859876
    860877    .. note::
    861878
     
    934951                else:
    935952                    ans[m] = y[x] * new[m]
    936953    return ans
    937 
    938 make_mono_admissible = CachedFunction(make_mono_admissible_)
  • sage/categories/coxeter_groups.py

    diff --git a/sage/categories/coxeter_groups.py b/sage/categories/coxeter_groups.py
    a b  
    171171            r"""
    172172            INPUT:
    173173
    174              - ``word`` - a list (or iterable) of elements of ``self.index_set()``
     174            - ``word`` - a list (or iterable) of elements of ``self.index_set()``
    175175 
    176176            Returns the group element corresponding to the given
    177177            word. Namely, if ``word`` is `[i_1,i_2,\ldots,i_k]`, then
     
    236236        def simple_reflection(self, i):
    237237            """
    238238            INPUT:
     239
    239240            - ``i`` - an element from the index set.
    240241 
    241242            Returns the simple reflection `s_i`
     
    316317        def simple_projection(self, i, side = 'right', toward_max = True):
    317318            r"""
    318319            INPUT:
    319              - ``i`` - an element of the index set of self
     320
     321            - ``i`` - an element of the index set of self
    320322
    321323            Returns the simple projection `\pi_i` (or `\overline\pi_i` if toward_max is False).
    322324             
     
    358360        def simple_projections(self, side = 'right', toward_max = True):
    359361            r"""
    360362            INPUT:
    361              - ``self`` - a Coxeter group `W`
    362              - ``side`` - 'left' or 'right' (default: 'right')
    363              - ``toward_max`` - a boolean (default: True) specifying the direction of the projection
     363
     364            - ``self`` - a Coxeter group `W`
     365            - ``side`` - 'left' or 'right' (default: 'right')
     366            - ``toward_max`` - a boolean (default: True) specifying
     367              the direction of the projection
    364368
    365369            Returns the simple projections of `W`, as a family.
    366370
     
    591595        def descents(self, side = 'right', index_set=None, positive=False):
    592596            """
    593597            INPUT:
    594              - ``index_set`` - a subset (as a list or iterable) of the nodes of the dynkin diagram;
    595                (default: all of them)
    596              - ``side`` - 'left' or 'right' (default: 'right')
    597              - ``positive`` - a boolean (default: ``False``)
     598
     599            - ``index_set`` - a subset (as a list or iterable) of the nodes of the dynkin diagram;
     600              (default: all of them)
     601            - ``side`` - 'left' or 'right' (default: 'right')
     602            - ``positive`` - a boolean (default: ``False``)
    598603
    599604            Returns the descents of self, as a list of elements of the
    600605            index_set.
     
    748753        def coset_representative(self, index_set, side = 'right'):
    749754            r"""
    750755            INPUT:
    751              - ``index_set`` - a subset (or iterable) of the nodes of the dynkin diagram
    752              - ``side`` - 'left' or 'right'
     756
     757            - ``index_set`` - a subset (or iterable) of the nodes of the dynkin diagram
     758            - ``side`` - 'left' or 'right'
    753759
    754760            Returns the unique shortest element of the coxeter group
    755761            $W$ which is in the same left (resp. right) coset as
     
    794800        def apply_simple_projection(self, i, side = 'right', toward_max = True):
    795801            r"""
    796802            INPUT:
    797              - ``i`` - an element of the index set of the Coxeter group
    798              - ``side`` - 'left' or 'right' (default: 'right')
    799              - ``toward_max`` - a boolean (default: True) specifying the direction of the projection
     803
     804            - ``i`` - an element of the index set of the Coxeter group
     805            - ``side`` - 'left' or 'right' (default: 'right')
     806            - ``toward_max`` - a boolean (default: True) specifying
     807              the direction of the projection
    800808
    801809            Returns the result of the application of the simple
    802810            projection `\pi_i` (resp. `\overline\pi_i`) on self.
     
    880888        def apply_simple_reflections(self, word, side = 'right'):
    881889            """
    882890            INPUT:
    883              - "word": A sequence of indices of Coxeter generators
    884              - "side": Indicates multiplying from left or right
     891
     892            - "word": A sequence of indices of Coxeter generators
     893            - "side": Indicates multiplying from left or right
    885894
    886895            Returns the result of the (left/right) multiplication of   
    887896            word to self.  self is not changed.
     
    10771086
    10781087            INPUT:
    10791088
    1080              - other - an element of the same Coxeter group
     1089            - other - an element of the same Coxeter group
    10811090
    10821091            OUTPUT: a boolean
    10831092
     
    11461155
    11471156            INPUT:
    11481157
    1149              - other - an element of the same Coxeter group
    1150              - side - 'left' or 'right'  (default: 'right')
     1158            - other - an element of the same Coxeter group
     1159            - side - 'left' or 'right'  (default: 'right')
    11511160
    11521161            OUTPUT: a boolean
    11531162
     
    12131222
    12141223            INPUT:
    12151224
    1216              - side - 'left' or 'right'  (default: 'right')
    1217              - positive - a boolean (default: False)
    1218              - index_set - a list of indices or None
     1225            - side - 'left' or 'right'  (default: 'right')
     1226            - positive - a boolean (default: False)
     1227            - index_set - a list of indices or None
    12191228
    12201229            OUTPUT: a list
    12211230
     
    12561265
    12571266            INPUT:
    12581267
    1259              - side - 'left' or 'right' (default: 'right')
    1260              - index_set - a list of indices or None
     1268            - side - 'left' or 'right' (default: 'right')
     1269            - index_set - a list of indices or None
    12611270
    12621271            OUTPUT: a list
    12631272
     
    12911300
    12921301            INPUT:
    12931302
    1294              - side - 'left' or 'right' (default: 'right')
    1295              - index_set - a list of indices or None
     1303            - side - 'left' or 'right' (default: 'right')
     1304            - index_set - a list of indices or None
    12961305
    12971306            OUTPUT: a list
    12981307
  • sage/categories/finite_coxeter_groups.py

    diff --git a/sage/categories/finite_coxeter_groups.py b/sage/categories/finite_coxeter_groups.py
    a b  
    106106
    107107            INPUT:
    108108           
    109              - ``index_set`` - a subset (as a list or iterable) of the nodes of the dynkin diagram;
    110               (default: all of them)
     109            - ``index_set`` - a subset (as a list or iterable) of the
     110              nodes of the dynkin diagram; (default: all of them)
    111111
    112112            Returns the longest element of ``self``, or of the
    113113            parabolic subgroup corresponding to the given index_set.
     
    176176
    177177            TODO:
    178178
    179              - Use the symmetric group in the examples (for nicer
    180                output), and print the edges for a stronger test.
    181              - The constructed poset should be lazy, in order to
    182                handle large / infinite Coxeter groups.
     179            - Use the symmetric group in the examples (for nicer
     180              output), and print the edges for a stronger test.
     181            - The constructed poset should be lazy, in order to
     182              handle large / infinite Coxeter groups.
    183183            """
    184184            from sage.combinat.posets.posets import Poset
    185185            covers = tuple([u, v] for v in self for u in v.bruhat_lower_covers() )
     
    190190            """
    191191            INPUT:
    192192
    193              - ``side`` -- "left" or "right" (default: "right")
     193            - ``side`` -- "left" or "right" (default: "right")
    194194
    195195            Returns the left (resp. right) poset for weak order.  In
    196196            this poset, `u` is smaller than `v` if some reduced word
     
    235235
    236236            TODO:
    237237
    238              - Use the symmetric group in the examples (for nicer
    239                output), and print the edges for a stronger test.
    240              - The constructed poset should be lazy, in order to
    241                handle large / infinite Coxeter groups.
     238            - Use the symmetric group in the examples (for nicer
     239              output), and print the edges for a stronger test.
     240            - The constructed poset should be lazy, in order to
     241              handle large / infinite Coxeter groups.
    242242
    243243            """
    244244            from sage.combinat.posets.posets import Poset
  • sage/categories/finite_semigroups.py

    diff --git a/sage/categories/finite_semigroups.py b/sage/categories/finite_semigroups.py
    a b  
    188188            Two elements $u$ and $v$ of a monoid are in the same $J$-class
    189189            if $u$ divides $v$ and $v$ divides $u$.
    190190
    191             OUTPUT::
     191            OUTPUT:
    192192
    193193             All the $J$-classes of self, as a list of lists.
    194194
     
    205205            r"""
    206206            Returns all the idempotents of self, grouped by J-class.
    207207
    208             OUTPUT::
     208            OUTPUT:
    209209
    210210             a list of lists.
    211211
  • sage/categories/monoids.py

    diff --git a/sage/categories/monoids.py b/sage/categories/monoids.py
    a b  
    6363            r"""
    6464            Returns the one of the monoid, that is the unique neutral element for `*`.
    6565
    66             .. note:
     66            .. note::
    6767
    6868               The default implementation is to coerce `1` into self.
    6969               It is recommended to override this method because the
    70                coercion from the integers::
     70               coercion from the integers:
    7171
    7272                - is not always meaningful (except for `1`);
    7373                - often uses ``self.one()``.
  • sage/misc/cachefunc.pyx

    diff --git a/sage/misc/cachefunc.pyx b/sage/misc/cachefunc.pyx
    a b  
    7575assignment, it can inherit a cached method from the parent class of a
    7676category (previously, the cache would have been broken)::
    7777
    78     sage: cython_code = ["from sage.all import cached_method, cached_in_parent_method, Category",
     78    sage: cython_code = ["from sage.all import cached_method, cached_in_parent_method, Category, Objects",
    7979    ... "class MyCategory(Category):",
    8080    ... "    @cached_method",
    8181    ... "    def super_categories(self):",
     
    474474                    filename = filename[len(SAGE_ROOT+'/devel/sage/'):]
    475475                elif 'site-packages/' in filename:
    476476                    filename = filename.split('site-packages/',1)[1]
    477                 file_info = "File: %s (starting at line %d)"%(filename,sourcelines[1])
     477                file_info = "File: %s (starting at line %d)\n"%(filename,sourcelines[1])
    478478                doc = file_info+(f.func_doc or '')
    479479            else:
    480480                doc = f.func_doc
  • sage/structure/dynamic_class.py

    diff --git a/sage/structure/dynamic_class.py b/sage/structure/dynamic_class.py
    a b  
    283283        True
    284284
    285285    We check that instrospection works reasonably::
     286
    286287        sage: import inspect
    287288        sage: inspect.getfile(Foo2)
    288289        '.../sage/structure/dynamic_class.pyc'
  • sage/structure/element.pyx

    diff --git a/sage/structure/element.pyx b/sage/structure/element.pyx
    a b  
    10401040        ... "cdef class MyParent(Parent):",
    10411041        ... "    Element = MyElement"]
    10421042        sage: cython('\n'.join(cython_code))
    1043         sage: cython_code = ["from sage.all import cached_method, cached_in_parent_method, Category",
     1043        sage: cython_code = ["from sage.all import cached_method, cached_in_parent_method, Category, Objects",
    10441044        ... "class MyCategory(Category):",
    10451045        ... "    @cached_method",
    10461046        ... "    def super_categories(self):",
     
    11371137            ... "from sage.structure.parent cimport Parent",
    11381138            ... "cdef class MyParent(Parent):",
    11391139            ... "    Element = MyElement",
    1140             ... "from sage.all import cached_method, lazy_attribute, Category",
     1140            ... "from sage.all import cached_method, lazy_attribute, Category, Objects",
    11411141            ... "class MyCategory(Category):",
    11421142            ... "    @cached_method",
    11431143            ... "    def super_categories(self):",