From e93dd9919b263ff3e9782b64fe5f387acd8d1bda Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Sun, 12 Mar 2017 13:56:23 +0200 Subject: Move the iteration inside the try branch, which makes the quickstart redundant --- astroid/inference.py | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/astroid/inference.py b/astroid/inference.py index b7602ba0..8867e211 100644 --- a/astroid/inference.py +++ b/astroid/inference.py @@ -611,22 +611,6 @@ def _get_aug_flow(left, left_type, aug_opnode, right, right_type, return methods -def quickstart(func): - """ - Run a generator enough to get the first value, and then buffer that value. - This will raise any exceptions that happen during the generator startup - when func is called, rather than when it is used. - """ - @functools.wraps(func) - def wrapper(*args, **kwargs): - result_generator = func(*args, **kwargs) - first_value = next(result_generator) - - return itertools.chain([first_value], result_generator) - return wrapper - - -@quickstart def _infer_binary_operation(left, right, binary_opnode, context, flow_factory): """Infer a binary operation between a left operand and a right operand @@ -700,12 +684,11 @@ def _infer_binop(self, context): return try: - results = _infer_binary_operation(lhs, rhs, self, context, _get_binop_flow) + for result in _infer_binary_operation(lhs, rhs, self, + context, _get_binop_flow): + yield result except exceptions._NonDeducibleTypeHierarchy: yield util.Uninferable - else: - for result in results: - yield result @decorators.yes_if_nothing_inferred -- cgit v1.2.1