code: def add_attribute_error(name_context, lookup_context, name):
      message = "AttributeError: %s has no attribute %s." % (
          lookup_context,
          name,
      )
      from jedi.evaluate.context.instance import (
          AbstractInstanceContext,
          CompiledInstanceName,
      )
  
      # Check for __getattr__/__getattribute__ existance and issue a warning
      # instead of an error, if that happens.
      typ = Error
      if isinstance(lookup_context, AbstractInstanceContext):
          slot_names = lookup_context.get_function_slot_names(
              "__getattr__"
          ) + lookup_context.get_function_slot_names("__getattribute__")
          for n in slot_names:
              # TODO do we even get here?
              if (
                  isinstance(name, CompiledInstanceName)
                  and n.parent_context.obj == object
              ):
                  typ = Warning
                  break
  
          if _check_for_setattr(lookup_context):
              typ = Warning
  
      payload = lookup_context, name
      add(name_context, "attribute-error", name, message, typ, payload)
  
imports: from parso.python import tree
  from jedi._compatibility import force_unicode
  from jedi import debug
  from jedi.evaluate.compiled import CompiledObject
  from jedi.evaluate.helpers import is_string
label_desc: Use image node_id 3 for calling a global function with example usage: add_attribute_error(name_context, lookup_context, name) without return types