diff options
| author | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2023-02-18 01:53:14 +0000 |
|---|---|---|
| committer | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2023-02-18 02:16:50 +0000 |
| commit | 48043906044519d01028b63b006825647d4160d8 (patch) | |
| tree | 7e97c917eca9fba13379a1cd1f150750d258c23a /sphinx/pycode | |
| parent | 6c569889791c1abae6202a9c10ee4c5c8a6745ea (diff) | |
| download | sphinx-git-48043906044519d01028b63b006825647d4160d8.tar.gz | |
Resolve ``flake8-return`` errors
Diffstat (limited to 'sphinx/pycode')
| -rw-r--r-- | sphinx/pycode/__init__.py | 2 | ||||
| -rw-r--r-- | sphinx/pycode/parser.py | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py index c899410bd..29a62e94a 100644 --- a/sphinx/pycode/__init__.py +++ b/sphinx/pycode/__init__.py @@ -140,7 +140,7 @@ class ModuleAnalyzer: def analyze(self) -> None: """Analyze the source code.""" if self._analyzed: - return None + return try: parser = Parser(self.code) 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)): |
