summaryrefslogtreecommitdiff
path: root/astroid/builder.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2018-05-31 12:55:00 +0800
committerClaudiu Popa <pcmanticore@gmail.com>2018-05-31 12:56:28 +0800
commit5fd5aa81483e709cb5c464c7d4bb37c8c39f2afa (patch)
treecfd45af86bbc534168146c0cd5847dc3f63cc275 /astroid/builder.py
parentc62742e32213e1da979bb5e7f3d1cec55fbb5d99 (diff)
downloadastroid-git-5fd5aa81483e709cb5c464c7d4bb37c8c39f2afa.tar.gz
Replace some for statements with yield from
Diffstat (limited to 'astroid/builder.py')
-rw-r--r--astroid/builder.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/astroid/builder.py b/astroid/builder.py
index 968aa410..979d3fcc 100644
--- a/astroid/builder.py
+++ b/astroid/builder.py
@@ -17,7 +17,6 @@ import os
import sys
import textwrap
-
from astroid._ast import _parse
from astroid import bases
from astroid import exceptions
@@ -313,8 +312,7 @@ def _extract_expressions(node):
yield real_expr
else:
for child in node.get_children():
- for result in _extract_expressions(child):
- yield result
+ yield from _extract_expressions(child)
def _find_statement_by_line(node, line):
@@ -420,8 +418,7 @@ def extract_node(code, module_name=''):
tree = parse(code, module_name=module_name)
extracted = []
if requested_lines:
- for line in requested_lines:
- extracted.append(_find_statement_by_line(tree, line))
+ extracted = [_find_statement_by_line(tree, line) for line in requested_lines]
# Modifies the tree.
extracted.extend(_extract_expressions(tree))