class_docstr: *Definition* objects are returned from :meth:`api.Script.goto_assignments`
  or :meth:`api.Script.goto_definitions`.
class_docstr_tok: ["*","Definition","*","objects","are","returned","from",":","meth",":","`","api.Script.goto_assignments","`","or",":","meth",":","`","api.Script.goto_definitions","`","."]
docstr: A description of the :class:`.Definition` object, which is heavily used
  in testing. e.g. for ``isinstance`` it returns ``def isinstance``.
  
  Example:
  
  >>> from jedi import Script
  >>> source = '''
  ... def f():
  ...     pass
  ...
  ... class C:
  ...     pass
  ...
  ... variable = f if random.choice([0,1]) else C'''
  >>> script = Script(source, column=3)  # line is maximum by default
  >>> defs = script.goto_definitions()
  >>> defs = sorted(defs, key=lambda d: d.line)
  >>> defs
  [<Definition def f>, <Definition class C>]
  >>> str(defs[0].description)  # strip literals in python2
  'def f'
  >>> str(defs[1].description)
  'class C'
docstr_tok: ["A","description","of","the",":","class",":","`",".Definition","`","object",",","which","is","heavily","used","in","testing",".","e.g",".","for","``","isinstance","``","it","returns","``","def","isinstance","``",".","Example",":",">",">",">","from","jedi","import","Script",">",">",">","source","=","``","'","...","def","f","(",")",":","...","pass","...","...","class","C",":","...","pass","...","...","variable","=","f","if","random.choice","(","[","0,1","]",")","else","C","''","'",">",">",">","script","=","Script","(","source",",","column=3",")","#","line","is","maximum","by","default",">",">",">","defs","=","script.goto_definitions","(",")",">",">",">","defs","=","sorted","(","defs",",","key=lambda","d",":","d.line",")",">",">",">","defs","[","<","Definition","def","f",">",",","<","Definition","class","C",">","]",">",">",">","str","(","defs","[","0","]",".description",")","#","strip","literals","in","python2","'def","f'",">",">",">","str","(","defs","[","1","]",".description",")","'class","C","'"]
code: def description(self):
      """
      A description of the :class:`.Definition` object, which is heavily used
      in testing. e.g. for ``isinstance`` it returns ``def isinstance``.
  
      Example:
  
      >>> from jedi import Script
      >>> source = '''
      ... def f():
      ...     pass
      ...
      ... class C:
      ...     pass
      ...
      ... variable = f if random.choice([0,1]) else C'''
      >>> script = Script(source, column=3)  # line is maximum by default
      >>> defs = script.goto_definitions()
      >>> defs = sorted(defs, key=lambda d: d.line)
      >>> defs
      [<Definition def f>, <Definition class C>]
      >>> str(defs[0].description)  # strip literals in python2
      'def f'
      >>> str(defs[1].description)
      'class C'
  
      """
      typ = self.type
      tree_name = self._name.tree_name
      if (
          typ in ("function", "class", "module", "instance")
          or tree_name is None
      ):
          if typ == "function":
              # For the description we want a short and a pythonic way.
              typ = "def"
          return typ + " " + self._name.string_name
      elif typ == "param":
          code = search_ancestor(tree_name, "param").get_code(
              include_prefix=False, include_comma=False
          )
          return typ + " " + code
  
      definition = tree_name.get_definition() or tree_name
      # Remove the prefix, because that's not what we want for get_code
      # here.
      txt = definition.get_code(include_prefix=False)
      # Delete comments:
      txt = re.sub(r"#[^\n]+\n", " ", txt)
      # Delete multi spaces/newlines
      txt = re.sub(r"\s+", " ", txt).strip()
      return txt
  
imports: import re
  from parso.python.tree import search_ancestor
  from jedi import settings
  from jedi.evaluate.utils import ignored, unite
  from jedi.cache import memoize_method
  from jedi.evaluate import imports
  from jedi.evaluate import compiled
  from jedi.evaluate.imports import ImportName
  from jedi.evaluate.context import instance
  from jedi.evaluate.context import ClassContext, FunctionExecutionContext
  from jedi.api.keywords import KeywordName
label_desc: Use image node_id 2 for calling the Definition obj's underlying member method code with example usage: obj.description() and returns: txt, unknown, unknown