mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
merge with 0.6
This commit is contained in:
commit
cee7e4ba3b
3
CHANGES
3
CHANGES
@ -89,6 +89,9 @@ Release 1.0 (in development)
|
|||||||
Release 0.6.5 (in development)
|
Release 0.6.5 (in development)
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
|
* In autodoc, allow customizing the signature of an object where
|
||||||
|
the built-in mechanism fails.
|
||||||
|
|
||||||
* #331: Fix output for enumerated lists with start values in LaTeX.
|
* #331: Fix output for enumerated lists with start values in LaTeX.
|
||||||
|
|
||||||
* Make the ``start-after`` and ``end-before`` options to the
|
* Make the ``start-after`` and ``end-before`` options to the
|
||||||
|
@ -377,7 +377,12 @@ class Documenter(object):
|
|||||||
args = "(%s)" % self.args
|
args = "(%s)" % self.args
|
||||||
else:
|
else:
|
||||||
# try to introspect the signature
|
# try to introspect the signature
|
||||||
|
try:
|
||||||
args = self.format_args()
|
args = self.format_args()
|
||||||
|
except Exception, err:
|
||||||
|
self.directive.warn('error while formatting arguments for '
|
||||||
|
'%s: %s' % (self.fullname, err))
|
||||||
|
args = None
|
||||||
|
|
||||||
retann = self.retann
|
retann = self.retann
|
||||||
|
|
||||||
@ -663,12 +668,7 @@ class Documenter(object):
|
|||||||
self.add_line(u'', '')
|
self.add_line(u'', '')
|
||||||
|
|
||||||
# format the object's signature, if any
|
# format the object's signature, if any
|
||||||
try:
|
|
||||||
sig = self.format_signature()
|
sig = self.format_signature()
|
||||||
except Exception, err:
|
|
||||||
self.directive.warn('error while formatting signature for '
|
|
||||||
'%s: %s' % (self.fullname, err))
|
|
||||||
sig = ''
|
|
||||||
|
|
||||||
# generate the directive header and options, if applicable
|
# generate the directive header and options, if applicable
|
||||||
self.add_directive_header(sig)
|
self.add_directive_header(sig)
|
||||||
@ -868,7 +868,6 @@ class ClassDocumenter(ModuleLevelDocumenter):
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
def format_args(self):
|
def format_args(self):
|
||||||
args = None
|
|
||||||
# for classes, the relevant signature is the __init__ method's
|
# for classes, the relevant signature is the __init__ method's
|
||||||
initmeth = self.get_attr(self.object, '__init__', None)
|
initmeth = self.get_attr(self.object, '__init__', None)
|
||||||
# classes without __init__ method, default __init__ or
|
# classes without __init__ method, default __init__ or
|
||||||
|
@ -169,8 +169,9 @@ def test_format_signature():
|
|||||||
assert formatsig('method', 'H.foo', H.foo1, 'a', None) == '(a)'
|
assert formatsig('method', 'H.foo', H.foo1, 'a', None) == '(a)'
|
||||||
assert formatsig('method', 'H.foo', H.foo2, None, None) == '(b, *c)'
|
assert formatsig('method', 'H.foo', H.foo2, None, None) == '(b, *c)'
|
||||||
|
|
||||||
# test exception handling
|
# test exception handling (exception is caught and args is '')
|
||||||
raises(TypeError, formatsig, 'function', 'int', int, None, None)
|
assert formatsig('function', 'int', int, None, None) == ''
|
||||||
|
del _warnings[:]
|
||||||
|
|
||||||
# test processing by event handler
|
# test processing by event handler
|
||||||
assert formatsig('method', 'bar', H.foo1, None, None) == '42'
|
assert formatsig('method', 'bar', H.foo1, None, None) == '42'
|
||||||
|
Loading…
Reference in New Issue
Block a user