diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2017-03-12 13:56:23 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2017-03-12 13:57:05 +0200 |
commit | e93dd9919b263ff3e9782b64fe5f387acd8d1bda (patch) | |
tree | 4de176c58603da58be43514ae89022f88a6c9bf5 /astroid/inference.py | |
parent | 480e6d53210b4c160b4347cbb4987d92842a5c45 (diff) | |
download | astroid-git-e93dd9919b263ff3e9782b64fe5f387acd8d1bda.tar.gz |
Move the iteration inside the try branch, which makes the quickstart redundant
Diffstat (limited to 'astroid/inference.py')
-rw-r--r-- | astroid/inference.py | 23 |
1 files 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 |