summaryrefslogtreecommitdiff
path: root/sphinx/pycode/parser.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-02-18 01:53:14 +0000
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-02-18 02:16:50 +0000
commit48043906044519d01028b63b006825647d4160d8 (patch)
tree7e97c917eca9fba13379a1cd1f150750d258c23a /sphinx/pycode/parser.py
parent6c569889791c1abae6202a9c10ee4c5c8a6745ea (diff)
downloadsphinx-git-48043906044519d01028b63b006825647d4160d8.tar.gz
Resolve ``flake8-return`` errors
Diffstat (limited to 'sphinx/pycode/parser.py')
-rw-r--r--sphinx/pycode/parser.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/pycode/parser.py b/sphinx/pycode/parser.py
index cddb8bcf5..c3b17c6dd 100644
--- a/sphinx/pycode/parser.py
+++ b/sphinx/pycode/parser.py
@@ -47,7 +47,7 @@ def get_lvar_names(node: ast.AST, self: ast.arg | None = None) -> list[str]:
node_name = node.__class__.__name__
if node_name in ('Index', 'Num', 'Slice', 'Str', 'Subscript'):
raise TypeError('%r does not create new variable' % node)
- elif node_name == 'Name':
+ if node_name == 'Name':
if self is None or node.id == self_id: # type: ignore
return [node.id] # type: ignore
else:
@@ -156,7 +156,7 @@ class TokenProcessor:
tokens.append(self.current)
if self.current == condition:
break
- elif self.current == [OP, '(']:
+ if self.current == [OP, '(']:
tokens += self.fetch_until([OP, ')'])
elif self.current == [OP, '{']:
tokens += self.fetch_until([OP, '}'])
@@ -485,7 +485,7 @@ class DefinitionFinder(TokenProcessor):
token = self.fetch_token()
if token is None:
break
- elif token == COMMENT:
+ if token == COMMENT:
pass
elif token == [OP, '@'] and (self.previous is None or
self.previous.match(NEWLINE, NL, INDENT, DEDENT)):