diff options
author | Ceridwen <ceridwenv@gmail.com> | 2015-11-06 18:06:45 -0500 |
---|---|---|
committer | Ceridwen <ceridwenv@gmail.com> | 2015-11-06 18:06:45 -0500 |
commit | cc7ea53df2383cd188e2b0958b231e1eb70fc79c (patch) | |
tree | a8170ee5867f49721c3d071c322ef3815cc608b9 /astroid/scoped_nodes.py | |
parent | 67dc5fda9c487bbbe6b3ac1e98af76b63d13396e (diff) | |
download | astroid-cc7ea53df2383cd188e2b0958b231e1eb70fc79c.tar.gz |
Rename Uninferable and instatiate_class
Diffstat (limited to 'astroid/scoped_nodes.py')
-rw-r--r-- | astroid/scoped_nodes.py | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/astroid/scoped_nodes.py b/astroid/scoped_nodes.py index a994392..ab130f5 100644 --- a/astroid/scoped_nodes.py +++ b/astroid/scoped_nodes.py @@ -552,7 +552,7 @@ class DictComp(ComprehensionScope): self.generators = generators def bool_value(self): - return util.YES + return util.Uninferable class SetComp(ComprehensionScope): @@ -573,7 +573,7 @@ class SetComp(ComprehensionScope): self.generators = generators def bool_value(self): - return util.YES + return util.Uninferable class _ListComp(node_classes.NodeNG): @@ -587,7 +587,7 @@ class _ListComp(node_classes.NodeNG): self.generators = generators def bool_value(self): - return util.YES + return util.Uninferable if six.PY3: @@ -936,7 +936,7 @@ class FunctionDef(node_classes.Statement, Lambda): c.hide = True c.parent = self class_bases = [next(b.infer(context)) for b in caller.args[1:]] - c.bases = [base for base in class_bases if base != util.YES] + c.bases = [base for base in class_bases if base != util.Uninferable] c._metaclass = metaclass yield c return @@ -949,7 +949,7 @@ class FunctionDef(node_classes.Statement, Lambda): for inferred in returnnode.value.infer(context): yield inferred except exceptions.InferenceError: - yield util.YES + yield util.Uninferable def bool_value(self): return True @@ -990,7 +990,7 @@ def _is_metaclass(klass, seen=None): if isinstance(baseobj, bases.Instance): # not abstract return False - if baseobj is util.YES: + if baseobj is util.Uninferable: continue if baseobj is klass: continue @@ -1160,7 +1160,7 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, isinstance(name_node.value, six.string_types)): name = name_node.value else: - return util.YES + return util.Uninferable result = ClassDef(name, None) @@ -1170,9 +1170,9 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, result.bases = class_bases.itered() else: # There is currently no AST node that can represent an 'unknown' - # node (YES is not an AST node), therefore we simply return YES here + # node (Uninferable is not an AST node), therefore we simply return Uninferable here # although we know at least the name of the class. - return util.YES + return util.Uninferable # Get the members of the class try: @@ -1343,7 +1343,7 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, raise exceptions.AttributeInferenceError(target=self, attribute=name, context=context) - def instanciate_class(self): + def instantiate_class(self): """return Instance of ClassDef node, else return self""" return bases.Instance(self) @@ -1352,7 +1352,7 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, This method doesn't look in the instance_attrs dictionary since it's done by an Instance proxy at inference time. It - may return a YES object if the attribute has not been actually + may return a Uninferable object if the attribute has not been actually found but a __getattr__ or __getattribute__ method is defined. If *class_context* is given, then it's considered that the attribute is accessed from a class context, @@ -1442,7 +1442,7 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, try: for inferred in bases._infer_stmts(self.getattr(name, context), context, frame=self): - # yield YES object instead of descriptors when necessary + # yield Uninferable object instead of descriptors when necessary if (not isinstance(inferred, node_classes.Const) and isinstance(inferred, bases.Instance)): try: @@ -1450,13 +1450,13 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, except exceptions.AttributeInferenceError: yield inferred else: - yield util.YES + yield util.Uninferable else: yield function_to_method(inferred, self) except exceptions.AttributeInferenceError as error: if not name.startswith('__') and self.has_dynamic_getattr(context): - # class handle some dynamic attributes, return a YES object - yield util.YES + # class handle some dynamic attributes, return a Uninferable object + yield util.Uninferable else: util.reraise(exceptions.InferenceError( error.message, target=self, attribute=name, context=context)) @@ -1538,7 +1538,7 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, # Expects this from Py3k TreeRebuilder try: return next(node for node in self._metaclass.infer() - if node is not util.YES) + if node is not util.Uninferable) except (exceptions.InferenceError, StopIteration): return None if six.PY3: @@ -1561,7 +1561,7 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, inferred = next(assignment.infer()) except exceptions.InferenceError: return - if inferred is util.YES: # don't expose this + if inferred is util.Uninferable: # don't expose this return None return inferred @@ -1620,7 +1620,7 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, values = [item[0] for item in slots.items] else: values = slots.itered() - if values is util.YES: + if values is util.Uninferable: continue if not values: # Stop the iteration, because the class @@ -1630,7 +1630,7 @@ class ClassDef(mixins.FilterStmtsMixin, LocalsDictNodeNG, for elt in values: try: for inferred in elt.infer(): - if inferred is util.YES: + if inferred is util.Uninferable: continue if (not isinstance(inferred, node_classes.Const) or not isinstance(inferred.value, |