Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-François B <2589111+jfbu@users.noreply.github.com>2022-08-01 22:05:08 +0300
committerGitHub <noreply@github.com>2022-08-01 22:05:08 +0300
commit50904866b73f898e570cfc27097999d582fb0d02 (patch)
treea3950ec7304f537c53a1b383f360ab32b100247c
parentcdde69918812b079a92325345478ac3d1afaf7c2 (diff)
parent964fcb2e07fc4995e3057fd66944a41e63d0fe61 (diff)
Merge pull request #10741 from danieleades/fix-formatting
fix formatting
-rw-r--r--doc/development/tutorials/examples/recipe.py2
-rw-r--r--sphinx/ext/napoleon/docstring.py6
-rw-r--r--sphinx/util/typing.py3
-rw-r--r--tests/test_build_latex.py2
-rw-r--r--tests/test_ext_napoleon.py18
5 files changed, 20 insertions, 11 deletions
diff --git a/doc/development/tutorials/examples/recipe.py b/doc/development/tutorials/examples/recipe.py
index 7af8af90d..f917f15c9 100644
--- a/doc/development/tutorials/examples/recipe.py
+++ b/doc/development/tutorials/examples/recipe.py
@@ -121,7 +121,7 @@ class RecipeDomain(Domain):
def get_objects(self):
for obj in self.data['recipes']:
- yield(obj)
+ yield obj
def resolve_xref(self, env, fromdocname, builder, typ, target, node,
contnode):
diff --git a/sphinx/ext/napoleon/docstring.py b/sphinx/ext/napoleon/docstring.py
index e79ddcebc..cb0083a8f 100644
--- a/sphinx/ext/napoleon/docstring.py
+++ b/sphinx/ext/napoleon/docstring.py
@@ -248,8 +248,10 @@ class GoogleDocstring:
def _consume_indented_block(self, indent: int = 1) -> List[str]:
lines = []
line = self._lines.get(0)
- while(not self._is_section_break() and
- (not line or self._is_indented(line, indent))):
+ while (
+ not self._is_section_break() and
+ (not line or self._is_indented(line, indent))
+ ):
lines.append(self._lines.next())
line = self._lines.get(0)
return lines
diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py
index eed7a7b95..518ea8771 100644
--- a/sphinx/util/typing.py
+++ b/sphinx/util/typing.py
@@ -72,7 +72,8 @@ Inventory = Dict[str, Dict[str, InventoryItem]]
def get_type_hints(
obj: Any, globalns: Optional[Dict[str, Any]] = None, localns: Optional[Dict] = None
) -> Dict[str, Any]:
- """Return a dictionary containing type hints for a function, method, module or class object.
+ """Return a dictionary containing type hints for a function, method, module or class
+ object.
This is a simple wrapper of `typing.get_type_hints()` that does not raise an error on
runtime.
diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py
index 3728b3da7..8f7a2e85a 100644
--- a/tests/test_build_latex.py
+++ b/tests/test_build_latex.py
@@ -1519,7 +1519,7 @@ def test_latex_labels(app, status, warning):
def test_latex_figure_in_admonition(app, status, warning):
app.builder.build_all()
result = (app.outdir / 'python.tex').read_text(encoding='utf8')
- assert(r'\begin{figure}[H]' in result)
+ assert r'\begin{figure}[H]' in result
def test_default_latex_documents():
diff --git a/tests/test_ext_napoleon.py b/tests/test_ext_napoleon.py
index a1b98996f..171893ce1 100644
--- a/tests/test_ext_napoleon.py
+++ b/tests/test_ext_napoleon.py
@@ -95,8 +95,10 @@ class SetupTest(TestCase):
for name in Config._config_values:
has_config = False
for method_name, args, _kwargs in app.method_calls:
- if(method_name == 'add_config_value' and
- args[0] == name):
+ if (
+ method_name == 'add_config_value' and
+ args[0] == name
+ ):
has_config = True
if not has_config:
self.fail('Config value was not added to app %s' % name)
@@ -105,11 +107,15 @@ class SetupTest(TestCase):
has_skip_member = False
for method_name, args, _kwargs in app.method_calls:
if method_name == 'connect':
- if(args[0] == 'autodoc-process-docstring' and
- args[1] == _process_docstring):
+ if (
+ args[0] == 'autodoc-process-docstring' and
+ args[1] == _process_docstring
+ ):
has_process_docstring = True
- elif(args[0] == 'autodoc-skip-member' and
- args[1] == _skip_member):
+ elif (
+ args[0] == 'autodoc-skip-member' and
+ args[1] == _skip_member
+ ):
has_skip_member = True
if not has_process_docstring:
self.fail('autodoc-process-docstring never connected')