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

Locally import FrozenSet node to avoid circular import

parent dea85528
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -236,12 +236,13 @@ def object_len(node, context=None):
or if multiple nodes are inferred
:rtype int: Integer length of node
"""
from astroid.objects import FrozenSet
inferred_node = safe_infer(node, context=context)
if inferred_node is None or inferred_node is util.Uninferable:
raise exceptions.InferenceError(node=node)
if inferred_node.qname() in ('builtins.str', 'builtins.bytes'):
return len(inferred_node.value)
if isinstance(inferred_node, (nodes.List, nodes.Set, nodes.Tuple, nodes.FrozenSet)):
if isinstance(inferred_node, (nodes.List, nodes.Set, nodes.Tuple, FrozenSet)):
return len(inferred_node.elts)
if isinstance(inferred_node, nodes.Dict):
return len(inferred_node.items)
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