remove unnecessary else clauses in for loop

This commit is contained in:
Srinivas Reddy Thatiparthy 2017-08-16 23:24:24 +05:30
parent b2f841fcaa
commit 04ff790139
3 changed files with 10 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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: