diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2018-10-10 12:39:01 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2018-10-10 12:39:01 +0200 |
commit | 94257385e9be4829dee38e5eee1ae283195ef18f (patch) | |
tree | b7c718a0161293a55c6924fea2864df9dee10e44 /astroid/protocols.py | |
parent | bc3540b765c90d3a37ac2586eb926edf1f09c6be (diff) | |
download | astroid-git-94257385e9be4829dee38e5eee1ae283195ef18f.tar.gz |
Use a generator expression for _multiply_seq_by_int
Diffstat (limited to 'astroid/protocols.py')
-rw-r--r-- | astroid/protocols.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/astroid/protocols.py b/astroid/protocols.py index 77d0ceb4..9258a368 100644 --- a/astroid/protocols.py +++ b/astroid/protocols.py @@ -148,14 +148,12 @@ nodes.Const.infer_binary_op = const_infer_binary_op def _multiply_seq_by_int(self, opnode, other, context): node = self.__class__(parent=opnode) - elts = [] - filtered_elts = (elt for elt in self.elts if elt is not util.Uninferable) - for elt in filtered_elts: - inferred = helpers.safe_infer(elt, context) - if inferred is None: - inferred = util.Uninferable - elts.append(inferred) - node.elts = elts * other.value + filtered_elts = ( + helpers.safe_infer(elt, context) or util.Uninferable + for elt in self.elts + if elt is not util.Uninferable + ) + node.elts = list(filtered_elts) * other.value return node |