mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '2.0'
This commit is contained in:
commit
47cd262b3e
2
CHANGES
2
CHANGES
@ -76,6 +76,8 @@ Bugs fixed
|
||||
* #6486: UnboundLocalError is raised if broken extension installed
|
||||
* #6567: autodoc: :confval:`autodoc_inherit_docstrings` does not effect to
|
||||
``__init__()`` and ``__new__()``
|
||||
* #6574: autodoc: :confval:`autodoc_member_order` does not refer order of
|
||||
imports when ``'bysource'`` order
|
||||
* #6498: autosummary: crashed with wrong autosummary_generate setting
|
||||
* #6507: autosummary: crashes without no autosummary_generate setting
|
||||
* #6511: LaTeX: autonumbered list can not be customized in LaTeX
|
||||
|
@ -50,7 +50,7 @@ are built:
|
||||
``preview-latex-style`` on Ubuntu xenial). Therefore, the default for this
|
||||
option is ``False`` but it is strongly recommended to set it to ``True``.
|
||||
|
||||
.. versionchanged:: 2.1
|
||||
.. versionchanged:: 2.2
|
||||
|
||||
This option can be used with the ``'svg'`` :confval:`imgmath_image_format`.
|
||||
|
||||
|
@ -104,7 +104,7 @@ def read_svg_depth(filename: str) -> int:
|
||||
return None
|
||||
|
||||
|
||||
def write_svg_depth(filename: str, depth:int) -> None:
|
||||
def write_svg_depth(filename: str, depth: int) -> None:
|
||||
"""Write the depth to SVG file as a comment at end of file
|
||||
"""
|
||||
with open(filename, 'a') as f:
|
||||
|
@ -270,6 +270,22 @@ class VariableCommentPicker(ast.NodeVisitor):
|
||||
super().visit(node)
|
||||
self.previous = node
|
||||
|
||||
def visit_Import(self, node: ast.Import) -> None:
|
||||
"""Handles Import node and record it to definition orders."""
|
||||
for name in node.names:
|
||||
if name.asname:
|
||||
self.add_entry(name.asname)
|
||||
else:
|
||||
self.add_entry(name.name)
|
||||
|
||||
def visit_ImportFrom(self, node: ast.Import) -> None:
|
||||
"""Handles Import node and record it to definition orders."""
|
||||
for name in node.names:
|
||||
if name.asname:
|
||||
self.add_entry(name.asname)
|
||||
else:
|
||||
self.add_entry(name.name)
|
||||
|
||||
def visit_Assign(self, node: ast.Assign) -> None:
|
||||
"""Handles Assign node and pick up a variable comment."""
|
||||
try:
|
||||
|
@ -344,6 +344,22 @@ def test_async_function_and_method():
|
||||
'Foo.method': ('def', 6, 7)}
|
||||
|
||||
|
||||
def test_imports():
|
||||
source = ('import sys\n'
|
||||
'from os import environment, path\n'
|
||||
'\n'
|
||||
'import sphinx as Sphinx\n'
|
||||
'from sphinx.application import Sphinx as App\n')
|
||||
parser = Parser(source)
|
||||
parser.parse()
|
||||
assert parser.definitions == {}
|
||||
assert parser.deforders == {'sys': 0,
|
||||
'environment': 1,
|
||||
'path': 2,
|
||||
'Sphinx': 3,
|
||||
'App': 4}
|
||||
|
||||
|
||||
def test_formfeed_char():
|
||||
source = ('class Foo:\n'
|
||||
'\f\n'
|
||||
|
Loading…
Reference in New Issue
Block a user