#9976: Decorated functions/methods have generic signature in documentation
--------------------------------+-------------------------------------------
Reporter: jsrn | Owner: jsrn
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-4.7
Component: documentation | Keywords: sphinx, documentation, cython
inspection
Author: jsrn, Simon King | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
--------------------------------+-------------------------------------------
Comment(by SimonKing):
What about using the following little function:
{{{
def grep_parentheses(s):
out = []
single_quote = False
double_quote = False
level = 0
for c in s:
if level>0:
out.append(c)
if c=='(' and not single_quote and not double_quote:
level += 1
elif c=='"':
double_quote = not double_quote
elif c=="'":
single_quote = not single_quote
elif c==')' and not single_quote and not double_quote:
if level == 1:
return '('+''.join(out)
level -= 1
raise SyntaxError, "The given string does not contain balanced
parentheses"
}}}
Wouldn't it correctly find the first pair of parentheses? And isn't the
first pair of parentheses in the definition of a function exacty what we
need?
For the exampe from my previous post, one gets:
{{{
sage: code = 'def foo(a="):", b=4):\n return'
sage: grep_parentheses(code)
'(a="):", b=4)'
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9976#comment:98>
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.