#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: Simon King | Merged:
Work_issues: |
--------------------------------+-------------------------------------------
Changes (by jsrn):
* status: needs_review => needs_work
Comment:
When building the reference manual now, sage.combinat.partition_algebra
fails explosively. This is due to it defines (on the top-level, to be
included in the reference manual) functions applied using
functools.partial. This method breaks different possibilities for later
inspection; the error we see is due to Python's own inspect.getsourcelines
throwing an error when given a function returned by functools.partial.
Here is a minimal example:
{{{
sage: import functools, inspect
sage: basetwo = functools.partial(int,base=2)
sage: inspect.getsourcelines(basetwo)
<BOOM>
}}}
I don't know exactly what part of the patch caused this error to be seen
now and not earlier (looking at
http://sagemath.org/doc/reference/sage/combinat/partition_algebra.html, we
can see that before the patch, the offensive elements of the module
(e.g.SetPartitionsAk) were simply not included in the reference manual),
but it seems as though it is something that needs fixing.
It seems there are two possibilities:
1) Wrap the lines in sageinspect which causes the error and exits
gracefully, producing some best-effort documentation in such weird cases.
2) Write a wrapper/alternative version of functools.partial which properly
sets _sage_doc_ and _sage_getargspec_ etc. such that this shouldn't
happen. This might entail switching to this partial function instead of
functools.partial in other places of Sage than just partition_algebra.
1) should be easiest and perhaps is a good idea in any circumstance (owing
to the discussion earlier on whether to service everything or service only
well-formed callables). 2) should take some more effort and might be
another ticket.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9976#comment:143>
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.