summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Drozd <nicholasdrozd@gmail.com>2018-07-26 11:55:16 -0500
committerBryce Guinta <bryce.guinta@protonmail.com>2018-07-30 21:40:09 -0600
commit2894a1a392ba564ad05ce695cfc35b11340049fc (patch)
treec55e4813cdeac8f86190b2e8740bf1dd357580ed
parenta48aa1ea5c47b82f6adbb1fecff90c4ab68cd19d (diff)
downloadastroid-git-2894a1a392ba564ad05ce695cfc35b11340049fc.tar.gz
Cut obsolete "explicit StopIteration" comments
The explicit StopIterations were themselves were cut in ceeee097.
-rw-r--r--astroid/decorators.py6
-rw-r--r--astroid/inference.py10
-rw-r--r--astroid/node_classes.py4
-rw-r--r--astroid/protocols.py8
4 files changed, 0 insertions, 28 deletions
diff --git a/astroid/decorators.py b/astroid/decorators.py
index 975e4ef2..ef5a7a8e 100644
--- a/astroid/decorators.py
+++ b/astroid/decorators.py
@@ -99,8 +99,6 @@ def path_wrapper(func):
yield res
yielded.add(ares)
except StopIteration as error:
- # Explicit StopIteration to return error information, see
- # comment in raise_if_nothing_inferred.
if error.args:
return error.args[0]
return None
@@ -120,10 +118,6 @@ def yes_if_nothing_inferred(func, instance, args, kwargs):
@wrapt.decorator
def raise_if_nothing_inferred(func, instance, args, kwargs):
- """All generators wrapped with raise_if_nothing_inferred *must*
- explicitly raise StopIteration with information to create an
- appropriate structured InferenceError.
- """
inferred = False
try:
generator = func(*args, **kwargs)
diff --git a/astroid/inference.py b/astroid/inference.py
index 16095a2c..ec3a370e 100644
--- a/astroid/inference.py
+++ b/astroid/inference.py
@@ -221,8 +221,6 @@ def infer_call(self, context=None):
except exceptions.InferenceError:
## XXX log error ?
continue
- # Explicit StopIteration to return error information, see comment
- # in raise_if_nothing_inferred.
return dict(node=self, context=context)
nodes.Call._infer = infer_call
@@ -321,8 +319,6 @@ def infer_attribute(self, context=None):
except AttributeError:
# XXX method / function
context.boundnode = None
- # Explicit StopIteration to return error information, see comment
- # in raise_if_nothing_inferred.
return dict(node=self, context=context)
nodes.Attribute._infer = decorators.path_wrapper(infer_attribute)
nodes.AssignAttr.infer_lhs = infer_attribute # # won't work with a path wrapper
@@ -404,8 +400,6 @@ def infer_subscript(self, context=None):
return None
yield from assigned.infer(context)
- # Explicit StopIteration to return error information, see comment
- # in raise_if_nothing_inferred.
return dict(node=self, context=context)
nodes.Subscript._infer = decorators.path_wrapper(infer_subscript)
@@ -462,8 +456,6 @@ def _infer_boolop(self, context=None):
else:
yield value
- # Explicit StopIteration to return error information, see comment
- # in raise_if_nothing_inferred.
return dict(node=self, context=context)
nodes.BoolOp._infer = _infer_boolop
@@ -542,8 +534,6 @@ def infer_unaryop(self, context=None):
"""Infer what an UnaryOp should return when evaluated."""
yield from _filter_operation_errors(self, _infer_unaryop, context,
util.BadUnaryOperationMessage)
- # Explicit StopIteration to return error information, see comment
- # in raise_if_nothing_inferred.
return dict(node=self, context=context)
nodes.UnaryOp._infer_unaryop = _infer_unaryop
diff --git a/astroid/node_classes.py b/astroid/node_classes.py
index 405e5971..9e1a0754 100644
--- a/astroid/node_classes.py
+++ b/astroid/node_classes.py
@@ -58,15 +58,11 @@ def unpack_infer(stmt, context=None):
yield elt
continue
yield from unpack_infer(elt, context)
- # Explicit StopIteration to return error information, see comment
- # in raise_if_nothing_inferred.
return dict(node=stmt, context=context)
# if inferred is a final node, return it and stop
inferred = next(stmt.infer(context))
if inferred is stmt:
yield inferred
- # Explicit StopIteration to return error information, see comment
- # in raise_if_nothing_inferred.
return dict(node=stmt, context=context)
# else, infer recursively, except Uninferable object that should be returned as is
for inferred in stmt.infer(context):
diff --git a/astroid/protocols.py b/astroid/protocols.py
index 933c5840..0397595d 100644
--- a/astroid/protocols.py
+++ b/astroid/protocols.py
@@ -263,8 +263,6 @@ def for_assigned_stmts(self, node=None, context=None, asspath=None):
yield from lst.elts
else:
yield from _resolve_looppart(self.iter.infer(context), asspath, context)
- # Explicit StopIteration to return error information, see comment
- # in raise_if_nothing_inferred.
return dict(node=self, unknown=node,
assign_path=asspath, context=context)
@@ -362,8 +360,6 @@ def assign_assigned_stmts(self, node=None, context=None, asspath=None):
return None
yield from _resolve_asspart(self.value.infer(context), asspath, context)
- # Explicit StopIteration to return error information, see comment
- # in raise_if_nothing_inferred.
return dict(node=self, unknown=node,
assign_path=asspath, context=context)
@@ -427,8 +423,6 @@ def excepthandler_assigned_stmts(self, node=None, context=None, asspath=None):
assigned = objects.ExceptionInstance(assigned)
yield assigned
- # Explicit StopIteration to return error information, see comment
- # in raise_if_nothing_inferred.
return dict(node=self, unknown=node,
assign_path=asspath, context=context)
@@ -543,8 +537,6 @@ def with_assigned_stmts(self, node=None, context=None, asspath=None):
'in {node!r}.', node=self, targets=node,
assign_path=asspath, context=context) from exc
yield obj
- # Explicit StopIteration to return error information, see comment
- # in raise_if_nothing_inferred.
return dict(node=self, unknown=node,
assign_path=asspath, context=context)