108108 }
109109)
110110
111- DICT_TYPES = (
112- astroid .objects .DictValues ,
113- astroid .objects .DictKeys ,
114- astroid .objects .DictItems ,
115- astroid .nodes .node_classes .Dict ,
116- )
117-
118111
119112class VariableVisitConsumerAction (Enum ):
120113 """Reported by _check_consumer() and its sub-methods to determine the
@@ -166,7 +159,7 @@ def _get_unpacking_extra_info(node: nodes.Assign, inferred: InferenceResult) ->
166159 and unbalanced-tuple/dict-unpacking errors.
167160 """
168161 more = ""
169- if isinstance (inferred , DICT_TYPES ):
162+ if isinstance (inferred , utils . DICT_TYPES ):
170163 if isinstance (node , nodes .Assign ):
171164 more = node .value .as_string ()
172165 elif isinstance (node , nodes .For ):
@@ -1249,7 +1242,7 @@ def visit_for(self, node: nodes.For) -> None:
12491242 targets = node .target .elts
12501243
12511244 inferred = utils .safe_infer (node .iter )
1252- if not isinstance (inferred , DICT_TYPES ):
1245+ if not isinstance (inferred , utils . DICT_TYPES ):
12531246 return
12541247
12551248 values = self ._nodes_to_unpack (inferred )
@@ -2886,7 +2879,7 @@ def _check_unpacking(
28862879 @staticmethod
28872880 def _nodes_to_unpack (node : nodes .NodeNG ) -> list [nodes .NodeNG ] | None :
28882881 """Return the list of values of the `Assign` node."""
2889- if isinstance (node , (nodes .Tuple , nodes .List ) + DICT_TYPES ):
2882+ if isinstance (node , (nodes .Tuple , nodes .List ) + utils . DICT_TYPES ):
28902883 return node .itered () # type: ignore[no-any-return]
28912884 if isinstance (node , astroid .Instance ) and any (
28922885 ancestor .qname () == "typing.NamedTuple" for ancestor in node .ancestors ()
@@ -2912,7 +2905,7 @@ def _report_unbalanced_unpacking(
29122905
29132906 symbol = (
29142907 "unbalanced-dict-unpacking"
2915- if isinstance (inferred , DICT_TYPES )
2908+ if isinstance (inferred , utils . DICT_TYPES )
29162909 else "unbalanced-tuple-unpacking"
29172910 )
29182911 self .add_message (symbol , node = node , args = args , confidence = INFERENCE )
0 commit comments