#9976: Decorated functions/methods have generic signature in documentation
--------------------------------+-------------------------------------------
Reporter: jsrn | Owner: mvngu
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):
Replying to [comment:39 SimonKing]:
> Replying to [comment:37 jsrn]:
> > No, the TypeError is around the try which is after the logic possibly
calling the builtin_argspec-thing: It first checks for a _sage_getarspec-
attribute, then it checks if it is a builtin (in which case it uses the
builtin_argspec), and if both fail, it tries to use inspect.getargspec
(after your patch, sageinspect.sage_getargspec). Now, inspect.getargspec
may throw a TypeError if the argument is class and this is then handled
separately. But you already do than in sageinspec.sage_getarspec, right?
>
> Sounds correct.
>
> Well, I'll try.
On the other hand, if you see what is done after the "`except TypeError`",
you'll find that something remains to do: Remove the argument "self" that
sage_getargspec would return when being called on a class or class
instance:
{{{
sage: from sage.misc.sageinspect import sage_getargspec
sage: sage_getargspec(QQ)
(['self', 'x', '*args', '**kwds'], None, None, (0,))
sage: sage_getargspec(QQ.__class__)
(['self', 'x', '*args', '**kwds'], None, None, (0,))
}}}
So, I guess a better plan is to explicitly test (using `inspect.isclass`
and whether we want the first argument to be stripped:
{{{
sage: import inspect
sage: inspect.isclass(QQ.__class__)
True
sage: sage.misc.sageinspect.isclassinstance(QQ)
True
}}}
This is what I will replace the "`except TypeError`" with.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9976#comment:40>
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.