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/directives/code.py | |
parent | 6c569889791c1abae6202a9c10ee4c5c8a6745ea (diff) | |
download | sphinx-git-48043906044519d01028b63b006825647d4160d8.tar.gz |
Resolve ``flake8-return`` errors
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r-- | sphinx/directives/code.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index db8d7de71..c2e97a5ae 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -80,7 +80,7 @@ def container_wrapper( if isinstance(parsed[0], nodes.system_message): msg = __('Invalid caption: %s' % parsed[0].astext()) raise ValueError(msg) - elif isinstance(parsed[0], nodes.Element): + if isinstance(parsed[0], nodes.Element): caption_node = nodes.caption(parsed[0].rawsource, '', *parsed[0].children) caption_node.source = literal_node.source @@ -88,8 +88,7 @@ def container_wrapper( container_node += caption_node container_node += literal_node return container_node - else: - raise RuntimeError # never reached + raise RuntimeError # never reached class CodeBlock(SphinxDirective): @@ -259,12 +258,11 @@ class LiteralIncludeReader: if pyobject not in tags: raise ValueError(__('Object named %r not found in include file %r') % (pyobject, self.filename)) - else: - start = tags[pyobject][1] - end = tags[pyobject][2] - lines = lines[start - 1:end] - if 'lineno-match' in self.options: - self.lineno_start = start + start = tags[pyobject][1] + end = tags[pyobject][2] + lines = lines[start - 1:end] + if 'lineno-match' in self.options: + self.lineno_start = start return lines |