Fix flake8 5.0.0 reported formatting errors

This commit is contained in:
daniel.eades
2022-08-01 17:05:25 +01:00
committed by Jean-François B
parent cdde699188
commit 964fcb2e07
5 changed files with 20 additions and 11 deletions

View File

@@ -121,7 +121,7 @@ class RecipeDomain(Domain):
def get_objects(self): def get_objects(self):
for obj in self.data['recipes']: for obj in self.data['recipes']:
yield(obj) yield obj
def resolve_xref(self, env, fromdocname, builder, typ, target, node, def resolve_xref(self, env, fromdocname, builder, typ, target, node,
contnode): contnode):

View File

@@ -248,8 +248,10 @@ class GoogleDocstring:
def _consume_indented_block(self, indent: int = 1) -> List[str]: def _consume_indented_block(self, indent: int = 1) -> List[str]:
lines = [] lines = []
line = self._lines.get(0) line = self._lines.get(0)
while(not self._is_section_break() and while (
(not line or self._is_indented(line, indent))): not self._is_section_break() and
(not line or self._is_indented(line, indent))
):
lines.append(self._lines.next()) lines.append(self._lines.next())
line = self._lines.get(0) line = self._lines.get(0)
return lines return lines

View File

@@ -72,7 +72,8 @@ Inventory = Dict[str, Dict[str, InventoryItem]]
def get_type_hints( def get_type_hints(
obj: Any, globalns: Optional[Dict[str, Any]] = None, localns: Optional[Dict] = None obj: Any, globalns: Optional[Dict[str, Any]] = None, localns: Optional[Dict] = None
) -> Dict[str, Any]: ) -> 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 This is a simple wrapper of `typing.get_type_hints()` that does not raise an error on
runtime. runtime.

View File

@@ -1519,7 +1519,7 @@ def test_latex_labels(app, status, warning):
def test_latex_figure_in_admonition(app, status, warning): def test_latex_figure_in_admonition(app, status, warning):
app.builder.build_all() app.builder.build_all()
result = (app.outdir / 'python.tex').read_text(encoding='utf8') 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(): def test_default_latex_documents():

View File

@@ -95,8 +95,10 @@ class SetupTest(TestCase):
for name in Config._config_values: for name in Config._config_values:
has_config = False has_config = False
for method_name, args, _kwargs in app.method_calls: for method_name, args, _kwargs in app.method_calls:
if(method_name == 'add_config_value' and if (
args[0] == name): method_name == 'add_config_value' and
args[0] == name
):
has_config = True has_config = True
if not has_config: if not has_config:
self.fail('Config value was not added to app %s' % name) self.fail('Config value was not added to app %s' % name)
@@ -105,11 +107,15 @@ class SetupTest(TestCase):
has_skip_member = False has_skip_member = False
for method_name, args, _kwargs in app.method_calls: for method_name, args, _kwargs in app.method_calls:
if method_name == 'connect': if method_name == 'connect':
if(args[0] == 'autodoc-process-docstring' and if (
args[1] == _process_docstring): args[0] == 'autodoc-process-docstring' and
args[1] == _process_docstring
):
has_process_docstring = True has_process_docstring = True
elif(args[0] == 'autodoc-skip-member' and elif (
args[1] == _skip_member): args[0] == 'autodoc-skip-member' and
args[1] == _skip_member
):
has_skip_member = True has_skip_member = True
if not has_process_docstring: if not has_process_docstring:
self.fail('autodoc-process-docstring never connected') self.fail('autodoc-process-docstring never connected')