Skip to content
Snippets Groups Projects
Commit dea85528 authored by Bryce Guinta's avatar Bryce Guinta
Browse files

Revert "Move FrozenSet to node_classes so it is accessible"

This reverts commit 06273cd07d4b3701998df7b2c656d1b029bdee8e.
parent fbcf8a03
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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)
Loading
Loading
@@ -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)
Loading
Loading
@@ -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)
 
Loading
Loading
Loading
Loading
@@ -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.
 
Loading
Loading
Loading
Loading
@@ -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,
Loading
Loading
Loading
Loading
@@ -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.
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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):
Loading
Loading
Loading
Loading
@@ -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)
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment