diff --git a/doc/usage/extensions/example_google.py b/doc/usage/extensions/example_google.py index e4f65ec03..05183af12 100644 --- a/doc/usage/extensions/example_google.py +++ b/doc/usage/extensions/example_google.py @@ -111,7 +111,7 @@ def module_level_function(param1, param2=None, *args, **kwargs): { 'param1': param1, - 'param2': param2 + 'param2': param2, } Raises: diff --git a/doc/usage/extensions/example_numpy.py b/doc/usage/extensions/example_numpy.py index 662cabae1..3bfc4dfcb 100644 --- a/doc/usage/extensions/example_numpy.py +++ b/doc/usage/extensions/example_numpy.py @@ -141,7 +141,7 @@ def module_level_function(param1, param2=None, *args, **kwargs): { 'param1': param1, - 'param2': param2 + 'param2': param2, } Raises diff --git a/sphinx/application.py b/sphinx/application.py index 2b80e1ab8..4c2e7c544 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -995,10 +995,11 @@ class Sphinx: .. code-block:: python - class math(docutils.nodes.Element): pass + class math(docutils.nodes.Element): ... def visit_math_html(self, node): self.body.append(self.starttag(node, 'math')) + def depart_math_html(self, node): self.body.append('') @@ -1089,7 +1090,7 @@ class Sphinx: } def run(self): - ... + pass def setup(app): app.add_directive('my-directive', MyDirective) @@ -1347,8 +1348,9 @@ class Sphinx: to them using custom roles instead of generic ones (like :rst:role:`ref`). Example call:: - app.add_crossref_type('topic', 'topic', 'single: %s', - docutils.nodes.emphasis) + app.add_crossref_type( + 'topic', 'topic', 'single: %s', docutils.nodes.emphasis + ) Example usage:: @@ -1458,7 +1460,7 @@ class Sphinx: app.add_js_file('example.js') # => - app.add_js_file('example.js', loading_method="async") + app.add_js_file('example.js', loading_method='async') # => app.add_js_file(None, body="var myVariable = 'foo';") diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index 2ec2aae73..605b9a9c0 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -197,6 +197,7 @@ def cut_lines( Use like this (e.g. in the ``setup()`` function of :file:`conf.py`):: from sphinx.ext.autodoc import cut_lines + app.connect('autodoc-process-docstring', cut_lines(4, what={'module'})) This can (and should) be used in place of :confval:`automodule_skip_lines`. diff --git a/sphinx/pycode/parser.py b/sphinx/pycode/parser.py index 3ff98bf79..34d30200f 100644 --- a/sphinx/pycode/parser.py +++ b/sphinx/pycode/parser.py @@ -43,7 +43,7 @@ def get_lvar_names(node: ast.AST, self: ast.arg | None = None) -> list[str]: This raises `TypeError` if the assignment does not create new variable:: ary[0] = 'foo' - dic["bar"] = 'baz' + dic['bar'] = 'baz' # => TypeError """ if self: