Skip to content

Commit

Permalink
Merge branch '4.x' into 9657_qualname_of_mock
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Sep 26, 2021
2 parents e79efef + 232dbe4 commit 0ea135e
Show file tree
Hide file tree
Showing 143 changed files with 2,151 additions and 2,089 deletions.
12 changes: 12 additions & 0 deletions CHANGES
Expand Up @@ -7,23 +7,35 @@ Dependencies
Incompatible changes
--------------------

* #9649: ``searchindex.js``: the embedded data has changed format to allow
objects with the same name in different domains.

Deprecated
----------

Features added
--------------

* #9639: autodoc: Support asynchronous generator functions
* #9664: autodoc: ``autodoc-process-bases`` supports to inject reST snippet as a
base class

Bugs fixed
----------

* #9630: autodoc: Failed to build cross references if :confval:`primary_domain`
is not 'py'
* #9644: autodoc: Crashed on getting source info from problematic object
* #9655: autodoc: mocked object having doc comment is warned unexpectedly
* #9651: autodoc: return type field is not generated even if
:confval:`autodoc_typehints_description_target` is set to "documented" when
its info-field-list contains ``:returns:`` field
* #9657: autodoc: The base class for a subclass of mocked object is incorrect
* #9630: autosummary: Failed to build summary table if :confval:`primary_domain`
is not 'py'
* #9670: html: Fix download file with special characters
* #9649: HTML search: when objects have the same name but in different domains,
return all of them as result instead of just one.

Testing
--------
Expand Down
1 change: 1 addition & 0 deletions doc/extdev/builderapi.rst
Expand Up @@ -16,6 +16,7 @@ Builder API
.. autoattribute:: name
.. autoattribute:: format
.. autoattribute:: epilog
.. autoattribute:: allow_parallel
.. autoattribute:: supported_image_types
.. autoattribute:: supported_remote_images
.. autoattribute:: supported_data_uri_images
Expand Down
4 changes: 4 additions & 0 deletions doc/extdev/domainapi.rst
Expand Up @@ -13,6 +13,10 @@ Domain API
.. autoclass:: Index
:members:

.. module:: sphinx.directives

.. autoclass:: ObjectDescription
:members:

Python Domain
-------------
Expand Down
8 changes: 6 additions & 2 deletions doc/usage/extensions/autodoc.rst
Expand Up @@ -768,8 +768,6 @@ needed docstring processing in event :event:`autodoc-process-docstring`:

.. event:: autodoc-process-bases (app, name, obj, options, bases)

.. versionadded:: 4.1

Emitted when autodoc has read and processed a class to determine the
base-classes. *bases* is a list of classes that the event handler can
modify **in place** to change what Sphinx puts into the output. It's
Expand All @@ -781,6 +779,12 @@ needed docstring processing in event :event:`autodoc-process-docstring`:
:param options: the options given to the class directive
:param bases: the list of base classes signature. see above.

.. versionadded:: 4.1
.. versionchanged:: 4.3

``bases`` can contain a string as a base class name. It will be processed
as reST mark-up'ed text.


Skipping members
----------------
Expand Down
2 changes: 1 addition & 1 deletion sphinx/builders/__init__.py
Expand Up @@ -68,7 +68,7 @@ class Builder:
# doctree versioning method
versioning_method = 'none'
versioning_compare = False
# allow parallel write_doc() calls
#: allow parallel write_doc() calls
allow_parallel = False
# support translation
use_message_catalog = True
Expand Down
9 changes: 5 additions & 4 deletions sphinx/ext/autodoc/__init__.py
Expand Up @@ -913,10 +913,6 @@ def generate(self, more_content: Optional[StringList] = None, real_modname: str
if not self.import_object():
return

if ismock(self.object):
logger.warning(__('A mocked object is detected: %r'),
self.name, type='autodoc')

# If there is no real module defined, figure out which to use.
# The real module is used in the module analyzer to look up the module
# where the attribute documentation would actually be found in.
Expand Down Expand Up @@ -949,6 +945,11 @@ def generate(self, more_content: Optional[StringList] = None, real_modname: str
except PycodeError:
pass

docstrings: List[str] = sum(self.get_doc() or [], [])
if ismock(self.object) and not docstrings:
logger.warning(__('A mocked object is detected: %r'),
self.name, type='autodoc')

# check __module__ of object (for members not given explicitly)
if check_module:
if not self.check_module():
Expand Down
4 changes: 2 additions & 2 deletions sphinx/ext/autodoc/typehints.py
Expand Up @@ -149,14 +149,14 @@ def augment_descriptions_with_types(
elif parts[0] == 'type':
name = ' '.join(parts[1:])
has_type.add(name)
elif parts[0] == 'return':
elif parts[0] in ('return', 'returns'):
has_description.add('return')
elif parts[0] == 'rtype':
has_type.add('return')

# Add 'type' for parameters with a description but no declared type.
for name in annotations:
if name == 'return':
if name in ('return', 'returns'):
continue
if name in has_description and name not in has_type:
field = nodes.field()
Expand Down
Binary file modified sphinx/locale/ar/LC_MESSAGES/sphinx.mo
Binary file not shown.
64 changes: 32 additions & 32 deletions sphinx/locale/ar/LC_MESSAGES/sphinx.po
Expand Up @@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Sphinx\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2021-09-19 00:09+0000\n"
"POT-Creation-Date: 2021-09-26 00:10+0000\n"
"PO-Revision-Date: 2021-09-12 00:10+0000\n"
"Last-Translator: Takeshi KOMIYA <i.tkomiya@gmail.com>\n"
"Language-Team: Arabic (http://www.transifex.com/sphinx-doc/sphinx-1/language/ar/)\n"
Expand Down Expand Up @@ -2816,7 +2816,7 @@ msgstr ""
msgid "error while formatting arguments for %s: %s"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:663 sphinx/ext/autodoc/__init__.py:1682
#: sphinx/ext/autodoc/__init__.py:663 sphinx/ext/autodoc/__init__.py:1683
#, python-format
msgid "missing attribute %s in object %s"
msgstr ""
Expand All @@ -2836,76 +2836,76 @@ msgid ""
"explicit module name)"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:917
#: sphinx/ext/autodoc/__init__.py:950
#, python-format
msgid "A mocked object is detected: %r"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:968
#: sphinx/ext/autodoc/__init__.py:969
#, python-format
msgid "error while formatting signature for %s: %s"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:1018
#: sphinx/ext/autodoc/__init__.py:1019
msgid "\"::\" in automodule name doesn't make sense"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:1025
#: sphinx/ext/autodoc/__init__.py:1026
#, python-format
msgid "signature arguments or return annotation given for automodule %s"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:1038
#: sphinx/ext/autodoc/__init__.py:1039
#, python-format
msgid ""
"__all__ should be a list of strings, not %r (in module %s) -- ignoring "
"__all__"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:1104
#: sphinx/ext/autodoc/__init__.py:1105
#, python-format
msgid ""
"missing attribute mentioned in :members: option: module %s, attribute %s"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:1303 sphinx/ext/autodoc/__init__.py:1377
#: sphinx/ext/autodoc/__init__.py:2734
#: sphinx/ext/autodoc/__init__.py:1304 sphinx/ext/autodoc/__init__.py:1378
#: sphinx/ext/autodoc/__init__.py:2735
#, python-format
msgid "Failed to get a function signature for %s: %s"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:1568
#: sphinx/ext/autodoc/__init__.py:1569
#, python-format
msgid "Failed to get a constructor signature for %s: %s"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:1669
#: sphinx/ext/autodoc/__init__.py:1670
#, python-format
msgid "Bases: %s"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:1755 sphinx/ext/autodoc/__init__.py:1828
#: sphinx/ext/autodoc/__init__.py:1847
#: sphinx/ext/autodoc/__init__.py:1756 sphinx/ext/autodoc/__init__.py:1829
#: sphinx/ext/autodoc/__init__.py:1848
#, python-format
msgid "alias of %s"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:1889
#: sphinx/ext/autodoc/__init__.py:1890
#, python-format
msgid "alias of TypeVar(%s)"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:2122 sphinx/ext/autodoc/__init__.py:2216
#: sphinx/ext/autodoc/__init__.py:2123 sphinx/ext/autodoc/__init__.py:2217
#, python-format
msgid "Failed to get a method signature for %s: %s"
msgstr ""

#: sphinx/ext/autodoc/__init__.py:2348
#: sphinx/ext/autodoc/__init__.py:2349
#, python-format
msgid "Invalid __slots__ found on %s. Ignored."
msgstr ""

#: sphinx/ext/autodoc/__init__.py:2777
#: sphinx/ext/autodoc/__init__.py:2778
msgid ""
"autodoc_member_order now accepts \"alphabetical\" instead of \"alphabetic\"."
" Please update your setting."
Expand Down Expand Up @@ -3353,15 +3353,15 @@ msgstr ""
msgid "Other changes"
msgstr ""

#: sphinx/themes/basic/static/doctools.js:199 sphinx/writers/html.py:436
#: sphinx/writers/html.py:441 sphinx/writers/html5.py:387
#: sphinx/writers/html5.py:392
#: sphinx/themes/basic/static/doctools.js:199 sphinx/writers/html.py:437
#: sphinx/writers/html.py:442 sphinx/writers/html5.py:388
#: sphinx/writers/html5.py:393
msgid "Permalink to this headline"
msgstr ""

#: sphinx/themes/basic/static/doctools.js:205 sphinx/writers/html.py:131
#: sphinx/writers/html.py:140 sphinx/writers/html5.py:102
#: sphinx/writers/html5.py:111
#: sphinx/themes/basic/static/doctools.js:205 sphinx/writers/html.py:132
#: sphinx/writers/html.py:141 sphinx/writers/html5.py:103
#: sphinx/writers/html5.py:112
msgid "Permalink to this definition"
msgstr ""

Expand Down Expand Up @@ -3529,37 +3529,37 @@ msgstr ""
msgid "default role %s not found"
msgstr ""

#: sphinx/writers/html.py:329 sphinx/writers/html5.py:300
#: sphinx/writers/html.py:330 sphinx/writers/html5.py:301
#, python-format
msgid "numfig_format is not defined for %s"
msgstr ""

#: sphinx/writers/html.py:339 sphinx/writers/html5.py:310
#: sphinx/writers/html.py:340 sphinx/writers/html5.py:311
#, python-format
msgid "Any IDs not assigned for %s node"
msgstr ""

#: sphinx/writers/html.py:413 sphinx/writers/html5.py:364
#: sphinx/writers/html.py:414 sphinx/writers/html5.py:365
msgid "Permalink to this term"
msgstr ""

#: sphinx/writers/html.py:445 sphinx/writers/html5.py:396
#: sphinx/writers/html.py:446 sphinx/writers/html5.py:397
msgid "Permalink to this table"
msgstr ""

#: sphinx/writers/html.py:488 sphinx/writers/html5.py:439
#: sphinx/writers/html.py:489 sphinx/writers/html5.py:440
msgid "Permalink to this code"
msgstr ""

#: sphinx/writers/html.py:490 sphinx/writers/html5.py:441
#: sphinx/writers/html.py:491 sphinx/writers/html5.py:442
msgid "Permalink to this image"
msgstr ""

#: sphinx/writers/html.py:492 sphinx/writers/html5.py:443
#: sphinx/writers/html.py:493 sphinx/writers/html5.py:444
msgid "Permalink to this toctree"
msgstr ""

#: sphinx/writers/html.py:623 sphinx/writers/html5.py:563
#: sphinx/writers/html.py:625 sphinx/writers/html5.py:565
msgid "Could not obtain image size. :scale: option is ignored."
msgstr ""

Expand Down
Binary file modified sphinx/locale/bg/LC_MESSAGES/sphinx.mo
Binary file not shown.

0 comments on commit 0ea135e

Please sign in to comment.