summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>2017-08-16 23:24:24 +0530
committerSrinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>2017-08-19 20:04:47 +0530
commit04ff790139e79c9402f44d412857a351b58e55ad (patch)
tree3130704101de679da45acf730469c512ef02b251
parentb2f841fcaa34b4bde49325917a406c4bc15a5b05 (diff)
downloadsphinx-git-04ff790139e79c9402f44d412857a351b58e55ad.tar.gz
remove unnecessary else clauses in for loop
-rw-r--r--sphinx/directives/code.py15
-rw-r--r--sphinx/environment/__init__.py5
-rw-r--r--sphinx/io.py3
3 files changed, 10 insertions, 13 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index 111f6b189..4d7e7a48d 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -311,11 +311,11 @@ class LiteralIncludeReader(object):
self.lineno_start += lineno
return lines[lineno:]
+
+ if inclusive is True:
+ raise ValueError('start-after pattern not found: %s' % start)
else:
- if inclusive is True:
- raise ValueError('start-after pattern not found: %s' % start)
- else:
- raise ValueError('start-at pattern not found: %s' % start)
+ raise ValueError('start-at pattern not found: %s' % start)
return lines
@@ -340,11 +340,10 @@ class LiteralIncludeReader(object):
return []
else:
return lines[:lineno]
+ if inclusive is True:
+ raise ValueError('end-at pattern not found: %s' % end)
else:
- if inclusive is True:
- raise ValueError('end-at pattern not found: %s' % end)
- else:
- raise ValueError('end-before pattern not found: %s' % end)
+ raise ValueError('end-before pattern not found: %s' % end)
return lines
diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py
index 53693aaf7..536aa959e 100644
--- a/sphinx/environment/__init__.py
+++ b/sphinx/environment/__init__.py
@@ -354,9 +354,8 @@ class BuildEnvironment(object):
for suffix in self.config.source_suffix:
if fnmatch.fnmatch(filename, '*' + suffix):
return filename[:-len(suffix)]
- else:
- # the file does not have docname
- return None
+ # the file does not have docname
+ return None
def doc2path(self, docname, base=True, suffix=None):
# type: (unicode, Union[bool, unicode], unicode) -> unicode
diff --git a/sphinx/io.py b/sphinx/io.py
index 8f048c7fc..8813cb3b6 100644
--- a/sphinx/io.py
+++ b/sphinx/io.py
@@ -166,8 +166,7 @@ class SphinxFileInput(FileInput):
if isinstance(parser_class, string_types):
parser_class = import_object(parser_class, 'source parser') # type: ignore # NOQA
return parser_class.supported
- else:
- return ('restructuredtext',)
+ return ('restructuredtext',)
data = FileInput.read(self)
if self.app: