Ticket #14249: trac14249-fix_doc.patch

File trac14249-fix_doc.patch, 3.7 KB (added by SimonKing, 10 years ago)

Fixes according to Travis' remarks

  • sage/structure/coerce_actions.pyx

    # HG changeset patch
    # User Simon King <simon.king@uni-jena.de>
    # Date 1369144471 -7200
    # Node ID 12b2b39a39cdc741520e270f7546815db71684ba
    # Parent  d972add21785a473d6144c850fafff39caf69fe9
    #14249: Fix some doc formatting, and use Python 3 style errors
    
    diff --git a/sage/structure/coerce_actions.pyx b/sage/structure/coerce_actions.pyx
    a b  
    174174    This test checks that the issue in :trac:`7718` has been fixed::
    175175
    176176        sage: class MyParent(Parent):
    177         ...    def an_element(self):
    178         ...        pass
    179         ...
     177        ....:     def an_element(self):
     178        ....:         pass
     179        ....:
    180180        sage: A = MyParent()
    181181        sage: detect_element_action(A, ZZ, True)
    182182        Traceback (most recent call last):
     
    189189    else:
    190190        x = X_el
    191191    if x is None:
    192         raise RuntimeError, "an_element() for %s returned None" % X
     192        raise RuntimeError("an_element() for %s returned None" % X)
    193193    if Y_el is None or (parent_c(Y_el) is not Y):
    194194        y = an_element(Y)
    195195    else:
    196196        y = Y_el
    197197    if y is None:
    198198        if isinstance(Y, Parent):
    199             raise RuntimeError, "an_element() for %s returned None" % Y
     199            raise RuntimeError("an_element() for %s returned None" % Y)
    200200        else:
    201201            return # don't know how to make elements of this type...
    202202    if isinstance(x, ModuleElement) and isinstance(y, RingElement):
     
    329329        if g is None:
    330330            g = G.an_element()
    331331        if parent_c(g) is not G:
    332             raise CoercionException,"The parent of %s is not %s but %s"%(g,G,parent_c(g))
     332            raise CoercionException("The parent of %s is not %s but %s"%(g,G,parent_c(g)))
    333333        if a is None:
    334334            a = S.an_element()
    335335        if parent_c(a) is not S:
    336             raise CoercionException,"The parent of %s is not %s but %s"%(a,S,parent_c(a))
     336            raise CoercionException("The parent of %s is not %s but %s"%(a,S,parent_c(a)))
    337337        if not isinstance(g, RingElement) or not isinstance(a, ModuleElement):
    338             raise CoercionException, "Not a ring element acting on a module element."
     338            raise CoercionException("Not a ring element acting on a module element.")
    339339        res = self.act(g, a)
    340340        if parent_c(res) is not the_set:
    341341            # In particular we will raise an error if res is None
    342             raise CoercionException, "Result is None or has wrong parent."
     342            raise CoercionException("Result is None or has wrong parent.")
    343343           
    344344
    345345    def _repr_name_(self):
  • sage/structure/parent.pyx

    diff --git a/sage/structure/parent.pyx b/sage/structure/parent.pyx
    a b  
    6464
    6565    sage: from sage.structure.element import RingElement
    6666    sage: class MyElement(RingElement):
    67     ...     def __init__(self, x,y, parent = None):
    68     ...         RingElement.__init__(self, parent)
    69     ...     def _mul_(self, other):
    70     ...         return self
    71     ...     def _rmul_(self, other):
    72     ...         return self
    73     ...     def _lmul_(self, other):
    74     ...         return self
     67    ....:      def __init__(self, x,y, parent = None):
     68    ....:          RingElement.__init__(self, parent)
     69    ....:      def _mul_(self, other):
     70    ....:          return self
     71    ....:      def _rmul_(self, other):
     72    ....:          return self
     73    ....:      def _lmul_(self, other):
     74    ....:          return self
    7575    sage: class MyParent(Parent):
    76     ...     Element = MyElement
    77 
    78 Now, we define
     76    ....:      Element = MyElement
     77
     78Now, we define ::
    7979
    8080    sage: P = MyParent(base=ZZ, category=Rings())
    8181    sage: a = P(1,2)