Skip to content

Commit

Permalink
Merge pull request sphinx-doc#10741 from danieleades/fix-formatting
Browse files Browse the repository at this point in the history
fix formatting
  • Loading branch information
jfbu authored Aug 1, 2022
2 parents cdde699 + 964fcb2 commit 5090486
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion doc/development/tutorials/examples/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def get_full_qualified_name(self, node):

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):
Expand Down
6 changes: 4 additions & 2 deletions sphinx/ext/napoleon/docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,10 @@ def lines(self) -> List[str]:
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
Expand Down
3 changes: 2 additions & 1 deletion sphinx/util/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def is_invalid_builtin_class(obj: Any) -> bool:
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.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_build_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
18 changes: 12 additions & 6 deletions tests/test_ext_napoleon.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ def test_add_config_values(self):
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)
Expand All @@ -105,11 +107,15 @@ def test_add_config_values(self):
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')
Expand Down

0 comments on commit 5090486

Please sign in to comment.