mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
remove unnecessary else clauses in for loop
This commit is contained in:
@@ -311,11 +311,11 @@ class LiteralIncludeReader(object):
|
|||||||
self.lineno_start += lineno
|
self.lineno_start += lineno
|
||||||
|
|
||||||
return lines[lineno:]
|
return lines[lineno:]
|
||||||
|
|
||||||
|
if inclusive is True:
|
||||||
|
raise ValueError('start-after pattern not found: %s' % start)
|
||||||
else:
|
else:
|
||||||
if inclusive is True:
|
raise ValueError('start-at pattern not found: %s' % start)
|
||||||
raise ValueError('start-after pattern not found: %s' % start)
|
|
||||||
else:
|
|
||||||
raise ValueError('start-at pattern not found: %s' % start)
|
|
||||||
|
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
@@ -340,11 +340,10 @@ class LiteralIncludeReader(object):
|
|||||||
return []
|
return []
|
||||||
else:
|
else:
|
||||||
return lines[:lineno]
|
return lines[:lineno]
|
||||||
|
if inclusive is True:
|
||||||
|
raise ValueError('end-at pattern not found: %s' % end)
|
||||||
else:
|
else:
|
||||||
if inclusive is True:
|
raise ValueError('end-before pattern not found: %s' % end)
|
||||||
raise ValueError('end-at pattern not found: %s' % end)
|
|
||||||
else:
|
|
||||||
raise ValueError('end-before pattern not found: %s' % end)
|
|
||||||
|
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
|
|||||||
@@ -354,9 +354,8 @@ class BuildEnvironment(object):
|
|||||||
for suffix in self.config.source_suffix:
|
for suffix in self.config.source_suffix:
|
||||||
if fnmatch.fnmatch(filename, '*' + suffix):
|
if fnmatch.fnmatch(filename, '*' + suffix):
|
||||||
return filename[:-len(suffix)]
|
return filename[:-len(suffix)]
|
||||||
else:
|
# the file does not have docname
|
||||||
# the file does not have docname
|
return None
|
||||||
return None
|
|
||||||
|
|
||||||
def doc2path(self, docname, base=True, suffix=None):
|
def doc2path(self, docname, base=True, suffix=None):
|
||||||
# type: (unicode, Union[bool, unicode], unicode) -> unicode
|
# type: (unicode, Union[bool, unicode], unicode) -> unicode
|
||||||
|
|||||||
@@ -166,8 +166,7 @@ class SphinxFileInput(FileInput):
|
|||||||
if isinstance(parser_class, string_types):
|
if isinstance(parser_class, string_types):
|
||||||
parser_class = import_object(parser_class, 'source parser') # type: ignore # NOQA
|
parser_class = import_object(parser_class, 'source parser') # type: ignore # NOQA
|
||||||
return parser_class.supported
|
return parser_class.supported
|
||||||
else:
|
return ('restructuredtext',)
|
||||||
return ('restructuredtext',)
|
|
||||||
|
|
||||||
data = FileInput.read(self)
|
data = FileInput.read(self)
|
||||||
if self.app:
|
if self.app:
|
||||||
|
|||||||
Reference in New Issue
Block a user