PyType (@Nullable PyReferenceExpression ref, TypeEvalContext context) { if (ref != null) { PyExpression qualifier = ref.getQualifier(); if (qualifier != null) { String attr_name = ref.getReferencedName(); if (PyNames.__CLASS__.equals(attr_name)) { PyType qualifierType = context.getType(qualifier); if (qualifierType instanceof PyClassType) { return new PyClassTypeImpl(((PyClassType)qualifierType).getPyClass(), true); // always as class, never instance } } else if (PyNames.DUNDER_DICT.equals(attr_name)) { PyType qualifierType = context.getType(qualifier); if (qualifierType instanceof PyClassType && ((PyClassType)qualifierType).isDefinition()) { return PyBuiltinCache.getInstance(ref).getDictType(); } } } } return null; }