Skip to content

Commit

Permalink
Merge branch '4.x' into 9756_classmethod_not_having_func
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Oct 26, 2021
2 parents ced8895 + d8b92bb commit 096108c
Show file tree
Hide file tree
Showing 156 changed files with 1,021 additions and 990 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/transifex.yml
Expand Up @@ -15,6 +15,8 @@ jobs:
ref: 4.x
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9 # https://github.com/transifex/transifex-client/pull/330
- name: Install dependencies
run: pip install -U babel jinja2 transifex-client
- name: Extract translations from source code
Expand All @@ -33,6 +35,8 @@ jobs:
ref: 4.x
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9 # https://github.com/transifex/transifex-client/pull/330
- name: Install dependencies
run: pip install -U babel jinja2 transifex-client
- name: Extract translations from source code
Expand Down
6 changes: 6 additions & 0 deletions CHANGES
Expand Up @@ -28,6 +28,7 @@ Incompatible changes
Deprecated
----------

* ``sphinx.ext.autodoc.AttributeDocumenter._datadescriptor``
* ``sphinx.writers.html.HTMLTranslator._fieldlist_row_index``
* ``sphinx.writers.html.HTMLTranslator._table_row_index``
* ``sphinx.writers.html5.HTML5Translator._fieldlist_row_index``
Expand Down Expand Up @@ -60,13 +61,18 @@ Bugs fixed
* #9657: autodoc: The base class for a subclass of mocked object is incorrect
* #9607: autodoc: Incorrect base class detection for the subclasses of the
generic class
* #9755: autodoc: memory addresses are shown for aliases
* #9752: autodoc: Failed to detect type annotation for slots attribute
* #9756: autodoc: Crashed if classmethod does not have __func__ attribute
* #9630: autosummary: Failed to build summary table if :confval:`primary_domain`
is not 'py'
* #9670: html: Fix download file with special characters
* #9710: html: Wrong styles for even/odd rows in nested tables
* #9763: html: parameter name and its type annotation are not separated in HTML
* #9649: HTML search: when objects have the same name but in different domains,
return all of them as result instead of just one.
* #7634: intersphinx: references on the file in sub directory are broken
* #9737: LaTeX: hlist is rendered as a list containing "aggedright" text
* #9678: linkcheck: file extension was shown twice in warnings
* #9697: py domain: An index entry with parens was registered for ``py:method``
directive with ``:property:`` option
Expand Down
5 changes: 5 additions & 0 deletions doc/extdev/deprecated.rst
Expand Up @@ -22,6 +22,11 @@ The following is a list of deprecated interfaces.
- (will be) Removed
- Alternatives

* - ``sphinx.ext.autodoc.AttributeDocumenter._datadescriptor``
- 4.3
- 6.0
- N/A

* - ``sphinx.writers.html.HTMLTranslator._fieldlist_row_index``
- 4.3
- 6.0
Expand Down
6 changes: 2 additions & 4 deletions doc/usage/configuration.rst
Expand Up @@ -2637,10 +2637,8 @@ Options for the linkcheck builder
A regular expression that matches a URI.
*auth_info*
Authentication information to use for that URI. The value can be anything
that is understood by the ``requests`` library (see `requests
Authentication <requests-auth>`_ for details).

.. _requests-auth: https://requests.readthedocs.io/en/master/user/authentication/
that is understood by the ``requests`` library (see :ref:`requests
Authentication <requests:authentication>` for details).

The ``linkcheck`` builder will use the first matching ``auth_info`` value
it can find in the :confval:`linkcheck_auth` list, so values earlier in the
Expand Down
8 changes: 4 additions & 4 deletions sphinx/builders/_epub_base.py
Expand Up @@ -323,14 +323,14 @@ def footnote_spot(tree: nodes.document) -> Tuple[Element, int]:
# a) place them after the last existing footnote
# b) place them after an (empty) Footnotes rubric
# c) create an empty Footnotes rubric at the end of the document
fns = tree.traverse(nodes.footnote)
fns = list(tree.traverse(nodes.footnote))
if fns:
fn = fns[-1]
return fn.parent, fn.parent.index(fn) + 1
for node in tree.traverse(nodes.rubric):
if len(node) == 1 and node.astext() == FOOTNOTES_RUBRIC_NAME:
return node.parent, node.parent.index(node) + 1
doc = tree.traverse(nodes.document)[0]
doc = list(tree.traverse(nodes.document))[0]
rub = nodes.rubric()
rub.append(nodes.Text(FOOTNOTES_RUBRIC_NAME))
doc.append(rub)
Expand All @@ -339,10 +339,10 @@ def footnote_spot(tree: nodes.document) -> Tuple[Element, int]:
if show_urls == 'no':
return
if show_urls == 'footnote':
doc = tree.traverse(nodes.document)[0]
doc = list(tree.traverse(nodes.document))[0]
fn_spot, fn_idx = footnote_spot(tree)
nr = 1
for node in tree.traverse(nodes.reference):
for node in list(tree.traverse(nodes.reference)):
uri = node.get('refuri', '')
if (uri.startswith('http:') or uri.startswith('https:') or
uri.startswith('ftp:')) and uri not in node.astext():
Expand Down
10 changes: 5 additions & 5 deletions sphinx/builders/latex/transforms.py
Expand Up @@ -45,7 +45,7 @@ class SubstitutionDefinitionsRemover(SphinxPostTransform):
formats = ('latex',)

def run(self, **kwargs: Any) -> None:
for node in self.document.traverse(nodes.substitution_definition):
for node in list(self.document.traverse(nodes.substitution_definition)):
node.parent.remove(node)


Expand Down Expand Up @@ -81,7 +81,7 @@ def expand_show_urls(self) -> None:
if show_urls is False or show_urls == 'no':
return

for node in self.document.traverse(nodes.reference):
for node in list(self.document.traverse(nodes.reference)):
uri = node.get('refuri', '')
if uri.startswith(URI_SCHEMES):
if uri.startswith('mailto:'):
Expand Down Expand Up @@ -501,7 +501,7 @@ class BibliographyTransform(SphinxPostTransform):

def run(self, **kwargs: Any) -> None:
citations = thebibliography()
for node in self.document.traverse(nodes.citation):
for node in list(self.document.traverse(nodes.citation)):
node.parent.remove(node)
citations += node

Expand Down Expand Up @@ -602,9 +602,9 @@ class IndexInSectionTitleTransform(SphinxPostTransform):
formats = ('latex',)

def run(self, **kwargs: Any) -> None:
for node in self.document.traverse(nodes.title):
for node in list(self.document.traverse(nodes.title)):
if isinstance(node.parent, nodes.section):
for i, index in enumerate(node.traverse(addnodes.index)):
for i, index in enumerate(list(node.traverse(addnodes.index))):
# move the index node next to the section title
node.remove(index)
node.parent.insert(i + 1, index)
Expand Down
4 changes: 2 additions & 2 deletions sphinx/domains/c.py
Expand Up @@ -92,7 +92,7 @@
_string_re = re.compile(r"[LuU8]?('([^'\\]*(?:\\.[^'\\]*)*)'"
r'|"([^"\\]*(?:\\.[^"\\]*)*)")', re.S)

_simple_type_sepcifiers_re = re.compile(r"""(?x)
_simple_type_specifiers_re = re.compile(r"""(?x)
\b(
void|_Bool|bool
# Integer
Expand Down Expand Up @@ -2584,7 +2584,7 @@ def _parse_trailing_type_spec(self) -> ASTTrailingTypeSpec:
# fundamental types, https://en.cppreference.com/w/c/language/type
# and extensions
self.skip_ws()
if self.match(_simple_type_sepcifiers_re):
if self.match(_simple_type_specifiers_re):
return ASTTrailingTypeSpecFundamental(self.matched_text)

# prefixed
Expand Down
4 changes: 2 additions & 2 deletions sphinx/domains/cpp.py
Expand Up @@ -335,7 +335,7 @@
]


_simple_type_sepcifiers_re = re.compile(r"""(?x)
_simple_type_specifiers_re = re.compile(r"""(?x)
\b(
auto|void|bool
# Integer
Expand Down Expand Up @@ -5859,7 +5859,7 @@ def _parse_trailing_type_spec(self) -> ASTTrailingTypeSpec:
# fundamental types, https://en.cppreference.com/w/cpp/language/type
# and extensions
self.skip_ws()
if self.match(_simple_type_sepcifiers_re):
if self.match(_simple_type_specifiers_re):
return ASTTrailingTypeSpecFundamental(self.matched_text)

# decltype
Expand Down
2 changes: 1 addition & 1 deletion sphinx/domains/index.py
Expand Up @@ -48,7 +48,7 @@ def merge_domaindata(self, docnames: Iterable[str], otherdata: Dict) -> None:
def process_doc(self, env: BuildEnvironment, docname: str, document: Node) -> None:
"""Process a document after it is read by the environment."""
entries = self.entries.setdefault(env.docname, [])
for node in document.traverse(addnodes.index):
for node in list(document.traverse(addnodes.index)):
try:
for entry in node['entries']:
split_index_msg(entry[0], entry[1])
Expand Down
2 changes: 1 addition & 1 deletion sphinx/domains/python.py
Expand Up @@ -328,7 +328,7 @@ def make_xref(self, rolename: str, domain: str, target: str,
text = target[1:]
elif prefix == '~':
text = target.split('.')[-1]
for node in result.traverse(nodes.Text):
for node in list(result.traverse(nodes.Text)):
node.parent[node.parent.index(node)] = nodes.Text(text)
break
elif isinstance(result, pending_xref) and env.config.python_use_unqualified_type_names:
Expand Down
1 change: 1 addition & 0 deletions sphinx/environment/__init__.py
Expand Up @@ -45,6 +45,7 @@
logger = logging.getLogger(__name__)

default_settings: Dict[str, Any] = {
'auto_id_prefix': 'id',
'embed_images': False,
'embed_stylesheet': False,
'cloak_email_addresses': True,
Expand Down
4 changes: 2 additions & 2 deletions sphinx/environment/adapters/toctree.py
Expand Up @@ -193,13 +193,13 @@ def _entries_from_toctree(toctreenode: addnodes.toctree, parents: List[str],
for toplevel in children:
# nodes with length 1 don't have any children anyway
if len(toplevel) > 1:
subtrees = toplevel.traverse(addnodes.toctree)
subtrees = list(toplevel.traverse(addnodes.toctree))
if subtrees:
toplevel[1][:] = subtrees # type: ignore
else:
toplevel.pop(1)
# resolve all sub-toctrees
for subtocnode in toc.traverse(addnodes.toctree):
for subtocnode in list(toc.traverse(addnodes.toctree)):
if not (subtocnode.get('hidden', False) and
not includehidden):
i = subtocnode.parent.index(subtocnode) + 1
Expand Down
9 changes: 6 additions & 3 deletions sphinx/environment/collectors/metadata.py
Expand Up @@ -33,9 +33,12 @@ def process_doc(self, app: Sphinx, doctree: nodes.document) -> None:
Keep processing minimal -- just return what docutils says.
"""
if len(doctree) > 0 and isinstance(doctree[0], nodes.docinfo):
index = doctree.first_child_not_matching_class(nodes.PreBibliographic)
if index is None:
return
elif isinstance(doctree[index], nodes.docinfo):
md = app.env.metadata[app.env.docname]
for node in doctree[0]:
for node in doctree[index]: # type: ignore
# nodes are multiply inherited...
if isinstance(node, nodes.authors):
authors = cast(List[nodes.author], node)
Expand All @@ -58,7 +61,7 @@ def process_doc(self, app: Sphinx, doctree: nodes.document) -> None:
value = 0
md[name] = value

doctree.pop(0)
doctree.pop(index)


def setup(app: Sphinx) -> Dict[str, Any]:
Expand Down
14 changes: 11 additions & 3 deletions sphinx/ext/autodoc/__init__.py
Expand Up @@ -2329,12 +2329,11 @@ def import_object(self, raiseerror: bool = False) -> bool:

return ret

def should_suppress_directive_header(self) -> bool:
def should_suppress_value_header(self) -> bool:
if self.object is SLOTSATTR:
self._datadescriptor = True
return True
else:
return super().should_suppress_directive_header()
return super().should_suppress_value_header()

def get_doc(self, ignore: int = None) -> Optional[List[List[str]]]:
if self.object is SLOTSATTR:
Expand All @@ -2352,6 +2351,15 @@ def get_doc(self, ignore: int = None) -> Optional[List[List[str]]]:
else:
return super().get_doc(ignore) # type: ignore

@property
def _datadescriptor(self) -> bool:
warnings.warn('AttributeDocumenter._datadescriptor() is deprecated.',
RemovedInSphinx60Warning)
if self.object is SLOTSATTR:
return True
else:
return False


class RuntimeInstanceAttributeMixin(DataDocumenterMixinBase):
"""
Expand Down
2 changes: 1 addition & 1 deletion sphinx/ext/autosummary/__init__.py
Expand Up @@ -583,7 +583,7 @@ def parse(doc: List[str], settings: Any) -> nodes.document:
node = parse(doc, document.settings)
if summary.endswith(WELL_KNOWN_ABBREVIATIONS):
pass
elif not node.traverse(nodes.system_message):
elif not list(node.traverse(nodes.system_message)):
# considered as that splitting by period does not break inline markups
break

Expand Down
2 changes: 1 addition & 1 deletion sphinx/ext/linkcode.py
Expand Up @@ -39,7 +39,7 @@ def doctree_read(app: Sphinx, doctree: Node) -> None:
'js': ['object', 'fullname'],
}

for objnode in doctree.traverse(addnodes.desc):
for objnode in list(doctree.traverse(addnodes.desc)):
domain = objnode.get('domain')
uris: Set[str] = set()
for signode in objnode:
Expand Down
2 changes: 1 addition & 1 deletion sphinx/ext/todo.py
Expand Up @@ -131,7 +131,7 @@ def __init__(self, app: Sphinx, doctree: nodes.document, docname: str) -> None:

def process(self, doctree: nodes.document, docname: str) -> None:
todos: List[todo_node] = sum(self.domain.todos.values(), [])
for node in doctree.traverse(todolist):
for node in list(doctree.traverse(todolist)):
if not self.config.todo_include_todos:
node.parent.remove(node)
continue
Expand Down
4 changes: 2 additions & 2 deletions sphinx/ext/viewcode.py
Expand Up @@ -108,7 +108,7 @@ def has_tag(modname: str, fullname: str, docname: str, refname: str) -> bool:

return False

for objnode in doctree.traverse(addnodes.desc):
for objnode in list(doctree.traverse(addnodes.desc)):
if objnode.get('domain') != 'py':
continue
names: Set[str] = set()
Expand Down Expand Up @@ -191,7 +191,7 @@ def convert_viewcode_anchors(self) -> None:
node.replace_self(refnode)

def remove_viewcode_anchors(self) -> None:
for node in self.document.traverse(viewcode_anchor):
for node in list(self.document.traverse(viewcode_anchor)):
node.parent.remove(node)


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

0 comments on commit 096108c

Please sign in to comment.