#9976: Decorated functions/methods have generic signature in documentation
--------------------------------+-------------------------------------------
   Reporter:  jsrn              |       Owner:  jsrn                            
        
       Type:  enhancement       |      Status:  needs_review                    
        
   Priority:  major             |   Milestone:  sage-4.7                        
        
  Component:  documentation     |    Keywords:  sphinx, documentation, cython 
inspection
     Author:  jsrn, Simon King  |    Upstream:  N/A                             
        
   Reviewer:                    |      Merged:                                  
        
Work_issues:                    |  
--------------------------------+-------------------------------------------
Changes (by SimonKing):

  * status:  needs_work => needs_review


Comment:

 The new patch version improves parsing of arguments a lot.

 It provides a function
 `sage.misc.sageinspect._grep_first_pair_of_parentheses`, that is used to
 find the first matching pair of parentheses without being fooled by
 parentheses inside string variables. In other words, it finds the sub-
 string of a function definition that provides its arguments.

 Then, it also extends the capabilities of the `SageArgSpecVisitor`. This
 is a parser for the argspec of a function. It used to be able to parse
 dicts, lists and tuples. It is now also able to parse binary and boolean
 and unitary operations, and comparisons. Hence, if those type of things
 appear in the default arguments of a function, `SageArgSpecVisitor` will
 find them.

 This is relevant for Cython code. From the doctests:
 {{{
 sage: cython('def foo(x, a=\')"\', b={not (2+1==3):\'bar\'}): return')
 sage: print sage.misc.sageinspect.sage_getsource(foo)
 def foo(x, a=')"', b={not (2+1==3):'bar'}): return
 sage: sage.misc.sageinspect.sage_getargspec(foo)
 ArgSpec(args=['x', 'a', 'b'], varargs=None, keywords=None, defaults=(')"',
 {False: 'bar'}))
 }}}

 Both lines would simply fail with an error, without the patch. With the
 old patch, the last line would give a wrong answer.

 I did not rebuild the documentation and I did not run long tests, yet. But
 I think it can be reviewed now.

 For the patchbot:

 Apply trac_9976_decorated_generic_sigs_alternative.patch
 9976-inspection_of_cython.patch 9976_doc_fixes.patch

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9976#comment:108>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to