#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):
I replaced the regular expression by the function that I sketched in my
post above.
Here is an example that still fails:
{{{
sage: cython_code = [
... 'cdef class MyClass:',
... ' def _sage_src_(self):',
... ' return "def foo(x, a=\\\')\\\"\\\', b={(2+1):\\\'bar\\\'}):
return\\n"',
... ' def __call__(self, m,n): return "something"']
sage: cython('\n'.join(cython_code))
sage: O = MyClass()
sage: print O._sage_src_()
def foo(x, a=')"', b={(2+1):'bar'}): return
}}}
When we use the "fake" source code to create a Python function, we can
correctly analyse its arguments:
{{{
sage: def foo(x, a=')"', b={(2+1):'bar'}): return
...
sage: sage.misc.sageinspect.sage_getargspec(foo)
ArgSpec(args=['x', 'a', 'b'], varargs=None, keywords=None, defaults=(')"',
{3: 'bar'}))
}}}
However, the analysis using `_sage_getargspec_from_ast` fails:
{{{
sage: sage.misc.sageinspect._sage_getargspec_from_ast(O._sage_src_())
ArgSpec(args=['x', 'a', 'b'], varargs=None, keywords=None, defaults=(')"',
{None: 'bar'}))
}}}
This is why I believe that there is a bug in `_sage_getargspec_from_ast`.
The question is: Shall we start to debug it thoroughly, or shall we be
happy that (with the patch that I am going to submit and in which I
replace the regular expression by the parentheses finder) it will become
less buggy.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9976#comment:103>
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.