Replace for-yield-loop by "yield from"

This commit is contained in:
Takeshi KOMIYA 2018-12-15 20:50:46 +09:00
parent 3f90794f22
commit 2aa9e5ed3a
6 changed files with 7 additions and 13 deletions

View File

@ -418,8 +418,7 @@ class StandaloneHTMLBuilder(Builder):
buildinfo = BuildInfo.load(fp)
if self.build_info != buildinfo:
for docname in self.env.found_docs:
yield docname
yield from self.env.found_docs
return
except ValueError as exc:
logger.warning(__('Failed to read build info file: %r'), exc)

View File

@ -3845,9 +3845,8 @@ class Symbol:
yield c
if not c.identOrOp.is_anon():
continue
# TODO: change to 'yield from' when Python 2 support is dropped
for nested in c.children_recurse_anon:
yield nested
yield from c.children_recurse_anon
def get_lookup_key(self):
# type: () -> List[Tuple[ASTNestedNameElement, Any]]

View File

@ -458,8 +458,7 @@ class Documenter:
self.env.app.emit('autodoc-process-docstring',
self.objtype, self.fullname, self.object,
self.options, docstringlines)
for line in docstringlines:
yield line
yield from docstringlines
def get_sourcename(self):
# type: () -> unicode

View File

@ -667,8 +667,7 @@ def status_iterator(iterable, summary, color="darkgreen", length=0, verbosity=0,
stringify_func=display_chunk):
# type: (Iterable, unicode, str, int, int, Callable[[Any], unicode]) -> Iterable # NOQA
if length == 0:
for item in old_status_iterator(iterable, summary, color, stringify_func):
yield item
yield from old_status_iterator(iterable, summary, color, stringify_func)
return
l = 0
summary = bold(summary)

View File

@ -926,8 +926,7 @@ class LaTeXTranslator(SphinxTranslator):
if isinstance(c, addnodes.start_of_file):
continue
elif isinstance(c, nodes.Element):
for k in footnotes_under(c):
yield k
yield from footnotes_under(c)
fnotes = {} # type: Dict[unicode, List[Union[collected_footnote, bool]]]
for fn in footnotes_under(node):

View File

@ -535,8 +535,7 @@ class TexinfoTranslator(SphinxTranslator):
if isinstance(c, addnodes.start_of_file):
continue
elif isinstance(c, nodes.Element):
for k in footnotes_under(c):
yield k
yield from footnotes_under(c)
fnotes = {} # type: Dict[unicode, List[Union[collected_footnote, bool]]]
for fn in footnotes_under(node):
label = cast(nodes.label, fn[0])