1515from typing import TYPE_CHECKING , Any , Union
1616
1717import astroid
18- from astroid import bases , nodes
18+ from astroid import bases , nodes , util
1919from astroid .nodes import LocalsDictNodeNG
2020from astroid .typing import SuccessfulInferenceResult
2121
@@ -459,7 +459,7 @@ def _is_attribute_property(name: str, klass: nodes.ClassDef) -> bool:
459459 return False
460460 property_name = "builtins.property"
461461 for attr in attributes :
462- if attr is astroid . Uninferable :
462+ if isinstance ( attr , util . UninferableBase ) :
463463 continue
464464 try :
465465 inferred = next (attr .infer ())
@@ -1453,7 +1453,7 @@ def _check_slots(self, node: nodes.ClassDef) -> None:
14531453
14541454 for slots in node .ilookup ("__slots__" ):
14551455 # check if __slots__ is a valid type
1456- if slots is astroid . Uninferable :
1456+ if isinstance ( slots , util . UninferableBase ) :
14571457 continue
14581458 if not is_iterable (slots ) and not is_comprehension (slots ):
14591459 self .add_message ("invalid-slots" , node = node )
@@ -1471,7 +1471,7 @@ def _check_slots(self, node: nodes.ClassDef) -> None:
14711471 values = [item [0 ] for item in slots .items ]
14721472 else :
14731473 values = slots .itered ()
1474- if values is astroid . Uninferable :
1474+ if isinstance ( values , util . UninferableBase ) :
14751475 continue
14761476 for elt in values :
14771477 try :
@@ -1518,7 +1518,7 @@ def _check_slots_elt(
15181518 self , elt : SuccessfulInferenceResult , node : nodes .ClassDef
15191519 ) -> None :
15201520 for inferred in elt .infer ():
1521- if inferred is astroid . Uninferable :
1521+ if isinstance ( inferred , util . UninferableBase ) :
15221522 continue
15231523 if not isinstance (inferred , nodes .Const ) or not isinstance (
15241524 inferred .value , str
@@ -1623,8 +1623,7 @@ def _check_invalid_class_object(self, node: nodes.AssignAttr) -> None:
16231623 else :
16241624 inferred = safe_infer (node .parent .value )
16251625 if (
1626- isinstance (inferred , nodes .ClassDef )
1627- or inferred is astroid .Uninferable
1626+ isinstance (inferred , (nodes .ClassDef , util .UninferableBase ))
16281627 or inferred is None
16291628 ):
16301629 # If is uninferable, we allow it to prevent false positives
@@ -2133,7 +2132,7 @@ def _check_init(self, node: nodes.FunctionDef, klass_node: nodes.ClassDef) -> No
21332132 # pylint: disable = too-many-try-statements
21342133 try :
21352134 for klass in expr .expr .infer ():
2136- if klass is astroid . Uninferable :
2135+ if isinstance ( klass , util . UninferableBase ) :
21372136 continue
21382137 # The inferred klass can be super(), which was
21392138 # assigned to a variable and the `__init__`
0 commit comments