code: def getattr_static(obj, attr):
      """Retrieve attributes without triggering dynamic lookup via the
      descriptor protocol,  __getattr__ or __getattribute__.
  
      Note: this function may not be able to retrieve all attributes
      that getattr can fetch (like dynamically created attributes)
      and may find attributes that getattr can't (like descriptors
      that raise AttributeError). It can also return descriptor objects
      instead of instance members in some cases. See the
      documentation for details.
      """
      instance_result = _sentinel
      if not _is_type(obj):
          klass = type(obj)
          dict_attr = _shadowed_dict(klass)
          if (
              dict_attr is _sentinel
              or type(dict_attr) is types.MemberDescriptorType
          ):
              instance_result = _check_instance(obj, attr)
          else:
              raise CannotEval
      else:
          klass = obj
  
      klass_result = _check_class(klass, attr)
  
      if (
          instance_result is not _sentinel
          and klass_result is not _sentinel
      ):
          if (
              _check_class(type(klass_result), "__get__")
              is not _sentinel
              and _check_class(type(klass_result), "__set__")
              is not _sentinel
          ):
              return _resolve_descriptor(klass_result, obj, klass)
  
      if instance_result is not _sentinel:
          return instance_result
      if klass_result is not _sentinel:
          get = _check_class(type(klass_result), "__get__")
          if get is _sentinel:
              return klass_result
          else:
              if obj is klass:
                  instance = None
              else:
                  instance = obj
              return _resolve_descriptor(klass_result, instance, klass)
  
      if obj is klass:
          # for types we check the metaclass too
          for entry in _static_getmro(type(klass)):
              if _shadowed_dict(type(entry)) is _sentinel:
                  try:
                      result = entry.__dict__[attr]
                      get = _check_class(type(result), "__get__")
                      if get is not _sentinel:
                          raise CannotEval
                      return result
                  except KeyError:
                      pass
      raise CannotEval
  
file_path: catboost/contrib/python/pure-eval/pure_eval/my_getattr_static.py
imports: import types
  from pure_eval.utils import of_type, CannotEval
label_desc: Use image node_id 6 for calling a global function with example usage: getattr_static(obj, attr) and returns: instance_result, _resolve_descriptor, klass_result, _resolve_descriptor, result