Merge branch '3.1.x' into 3.x

This commit is contained in:
Takeshi KOMIYA
2020-07-05 16:14:17 +09:00
5 changed files with 31 additions and 30 deletions

View File

@@ -45,6 +45,9 @@ Dependencies
Incompatible changes
--------------------
* #7650: autodoc: the signature of base function will be shown for decorated
functions, not a signature of decorator
Deprecated
----------
@@ -61,9 +64,12 @@ Bugs fixed
is 'description'
* #7812: autodoc: crashed if the target name matches to both an attribute and
module that are same name
* #7650: autodoc: function signature becomes ``(*args, **kwargs)`` if the
function is decorated by generic decorator
* #7812: autosummary: generates broken stub files if the target code contains
an attribute and module that are same name
* #7806: viewcode: Failed to resolve viewcode references on 3rd party builders
* #7838: html theme: List items have extra vertical space
Testing
--------

View File

@@ -1157,10 +1157,7 @@ class FunctionDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # typ
try:
self.env.app.emit('autodoc-before-process-signature', self.object, False)
if inspect.is_singledispatch_function(self.object):
sig = inspect.signature(self.object, follow_wrapped=True)
else:
sig = inspect.signature(self.object)
sig = inspect.signature(self.object, follow_wrapped=True)
args = stringify_signature(sig, **kwargs)
except TypeError as exc:
logger.warning(__("Failed to get a function signature for %s: %s"),
@@ -1740,13 +1737,8 @@ class MethodDocumenter(DocstringSignatureMixin, ClassLevelDocumenter): # type:
sig = inspect.signature(self.object, bound_method=False)
else:
self.env.app.emit('autodoc-before-process-signature', self.object, True)
meth = self.parent.__dict__.get(self.objpath[-1], None)
if meth and inspect.is_singledispatch_method(meth):
sig = inspect.signature(self.object, bound_method=True,
follow_wrapped=True)
else:
sig = inspect.signature(self.object, bound_method=True)
sig = inspect.signature(self.object, bound_method=True,
follow_wrapped=True)
args = stringify_signature(sig, **kwargs)
except TypeError as exc:
logger.warning(__("Failed to get a method signature for %s: %s"),

View File

@@ -513,28 +513,31 @@ ol.upperroman {
list-style: upper-roman;
}
ol > li:first-child > :first-child,
ul > li:first-child > :first-child {
:not(li) > ol > li:first-child > :first-child,
:not(li) > ul > li:first-child > :first-child {
margin-top: 0px;
}
ol ol > li:first-child > :first-child,
ol ul > li:first-child > :first-child,
ul ol > li:first-child > :first-child,
ul ul > li:first-child > :first-child {
margin-top: revert;
}
ol > li:last-child > :last-child,
ul > li:last-child > :last-child {
:not(li) > ol > li:last-child > :last-child,
:not(li) > ul > li:last-child > :last-child {
margin-bottom: 0px;
}
ol ol > li:last-child > :last-child,
ol ul > li:last-child > :last-child,
ul ol > li:last-child > :last-child,
ul ul > li:last-child > :last-child {
margin-bottom: revert;
ol.simple ol p,
ol.simple ul p,
ul.simple ol p,
ul.simple ul p {
margin-top: 0;
}
ol.simple > li:not(:first-child) > p,
ul.simple > li:not(:first-child) > p {
margin-top: 0;
}
ol.simple p,
ul.simple p {
margin-bottom: 0;
}
dl.footnote > dt,

View File

@@ -1267,7 +1267,7 @@ def test_automethod_for_decorated(app):
actual = do_autodoc(app, 'method', 'target.decorator.Bar.meth')
assert list(actual) == [
'',
'.. py:method:: Bar.meth()',
'.. py:method:: Bar.meth(name=None, age=None)',
' :module: target.decorator',
'',
]
@@ -1432,7 +1432,7 @@ def test_coroutine(app):
actual = do_autodoc(app, 'function', 'target.coroutine.sync_func')
assert list(actual) == [
'',
'.. py:function:: sync_func(*args, **kwargs)',
'.. py:function:: sync_func()',
' :module: target.coroutine',
'',
]

View File

@@ -98,7 +98,7 @@ def test_decorated(app):
actual = do_autodoc(app, 'function', 'target.decorator.foo')
assert list(actual) == [
'',
'.. py:function:: foo()',
'.. py:function:: foo(name=None, age=None)',
' :module: target.decorator',
'',
]