summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryce Guinta <bryce.paul.guinta@gmail.com>2018-03-11 01:19:38 -0700
committerBryce Guinta <bryce.paul.guinta@gmail.com>2018-03-11 01:25:12 -0700
commitdea855281856debe9bddc9b5ceae02884683edcf (patch)
treeebe3ebb8ea6e0cad34fa9ae9d0163b4c5ae92cd4
parentfbcf8a03ed6f9160c2780c6627fe76b66f4ad0c5 (diff)
downloadastroid-git-dea855281856debe9bddc9b5ceae02884683edcf.tar.gz
Revert "Move FrozenSet to node_classes so it is accessible"
This reverts commit 06273cd07d4b3701998df7b2c656d1b029bdee8e.
-rw-r--r--astroid/brain/brain_builtin_inference.py10
-rw-r--r--astroid/node_classes.py15
-rw-r--r--astroid/nodes.py2
-rw-r--r--astroid/objects.py15
-rw-r--r--astroid/tests/unittest_inference.py3
-rw-r--r--astroid/tests/unittest_objects.py2
6 files changed, 24 insertions, 23 deletions
diff --git a/astroid/brain/brain_builtin_inference.py b/astroid/brain/brain_builtin_inference.py
index b4174765..ae3ed1ee 100644
--- a/astroid/brain/brain_builtin_inference.py
+++ b/astroid/brain/brain_builtin_inference.py
@@ -186,7 +186,7 @@ def _infer_builtin(node, context,
infer_tuple = partial(
_infer_builtin,
klass=nodes.Tuple,
- iterables=(nodes.List, nodes.Set, nodes.FrozenSet,
+ iterables=(nodes.List, nodes.Set, objects.FrozenSet,
objects.DictItems, objects.DictKeys,
objects.DictValues),
build_elts=tuple)
@@ -194,7 +194,7 @@ infer_tuple = partial(
infer_list = partial(
_infer_builtin,
klass=nodes.List,
- iterables=(nodes.Tuple, nodes.Set, nodes.FrozenSet,
+ iterables=(nodes.Tuple, nodes.Set, objects.FrozenSet,
objects.DictItems, objects.DictKeys,
objects.DictValues),
build_elts=list)
@@ -202,14 +202,14 @@ infer_list = partial(
infer_set = partial(
_infer_builtin,
klass=nodes.Set,
- iterables=(nodes.List, nodes.Tuple, nodes.FrozenSet,
+ iterables=(nodes.List, nodes.Tuple, objects.FrozenSet,
objects.DictKeys),
build_elts=set)
infer_frozenset = partial(
_infer_builtin,
- klass=nodes.FrozenSet,
- iterables=(nodes.List, nodes.Tuple, nodes.Set, nodes.FrozenSet,
+ klass=objects.FrozenSet,
+ iterables=(nodes.List, nodes.Tuple, nodes.Set, objects.FrozenSet,
objects.DictKeys),
build_elts=frozenset)
diff --git a/astroid/node_classes.py b/astroid/node_classes.py
index 2f5fca9c..fba9e495 100644
--- a/astroid/node_classes.py
+++ b/astroid/node_classes.py
@@ -2837,21 +2837,6 @@ class ExceptHandler(mixins.AssignTypeMixin, Statement):
return False
-class FrozenSet(_BaseContainer):
- """class representing a FrozenSet composite node"""
-
- def pytype(self):
- return '%s.frozenset' % BUILTINS
-
- def _infer(self, context=None):
- yield self
-
- @decorators.cachedproperty
- def _proxied(self): # pylint: disable=method-hidden
- builtins = MANAGER.astroid_cache[BUILTINS]
- return builtins.getattr('frozenset')[0]
-
-
class Exec(Statement):
"""Class representing the ``exec`` statement.
diff --git a/astroid/nodes.py b/astroid/nodes.py
index 00e1a345..f9399a56 100644
--- a/astroid/nodes.py
+++ b/astroid/nodes.py
@@ -20,7 +20,7 @@ from astroid.node_classes import (
AssignName, AugAssign, Repr, BinOp, BoolOp, Break, Call, Compare,
Comprehension, Const, Continue, Decorators, DelAttr, DelName, Delete,
Dict, Expr, Ellipsis, EmptyNode, ExceptHandler, Exec, ExtSlice, For,
- FrozenSet, ImportFrom, Attribute, Global, If, IfExp, Import, Index, Keyword,
+ ImportFrom, Attribute, Global, If, IfExp, Import, Index, Keyword,
List, Name, Nonlocal, Pass, Print, Raise, Return, Set, Slice, Starred, Subscript,
TryExcept, TryFinally, Tuple, UnaryOp, While, With, Yield, YieldFrom,
const_factory,
diff --git a/astroid/objects.py b/astroid/objects.py
index f669b9a8..7a873449 100644
--- a/astroid/objects.py
+++ b/astroid/objects.py
@@ -29,6 +29,21 @@ BUILTINS = six.moves.builtins.__name__
objectmodel = util.lazy_import('interpreter.objectmodel')
+class FrozenSet(node_classes._BaseContainer):
+ """class representing a FrozenSet composite node"""
+
+ def pytype(self):
+ return '%s.frozenset' % BUILTINS
+
+ def _infer(self, context=None):
+ yield self
+
+ @decorators.cachedproperty
+ def _proxied(self): # pylint: disable=method-hidden
+ builtins = MANAGER.astroid_cache[BUILTINS]
+ return builtins.getattr('frozenset')[0]
+
+
class Super(node_classes.NodeNG):
"""Proxy class over a super call.
diff --git a/astroid/tests/unittest_inference.py b/astroid/tests/unittest_inference.py
index e8b074bd..6508b3fe 100644
--- a/astroid/tests/unittest_inference.py
+++ b/astroid/tests/unittest_inference.py
@@ -26,6 +26,7 @@ from astroid import arguments
from astroid import decorators as decoratorsmod
from astroid import exceptions
from astroid import helpers
+from astroid import objects
from astroid import test_utils
from astroid import util
from astroid.tests import resources
@@ -88,7 +89,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
assertInferTuple = partialmethod(_assertInferElts, nodes.Tuple)
assertInferList = partialmethod(_assertInferElts, nodes.List)
assertInferSet = partialmethod(_assertInferElts, nodes.Set)
- assertInferFrozenSet = partialmethod(_assertInferElts, nodes.FrozenSet)
+ assertInferFrozenSet = partialmethod(_assertInferElts, objects.FrozenSet)
CODE = '''
class C(object):
diff --git a/astroid/tests/unittest_objects.py b/astroid/tests/unittest_objects.py
index 92e2c4c2..0dba8dea 100644
--- a/astroid/tests/unittest_objects.py
+++ b/astroid/tests/unittest_objects.py
@@ -21,7 +21,7 @@ class ObjectsTest(unittest.TestCase):
frozenset({1: 2, 2: 3}) #@
""")
inferred = next(node.infer())
- self.assertIsInstance(inferred, nodes.FrozenSet)
+ self.assertIsInstance(inferred, objects.FrozenSet)
self.assertEqual(inferred.pytype(), "%s.frozenset" % bases.BUILTINS)