(self)
return txt
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'
A description of the :class:`.Definition` object, which is heavily used
        in testing. e.g. for ``isinstance`` it returns ``def isinstance``.
A description of the : class : . Definition object which is heavily used in testing . e . g . for isinstance it returns def isinstance .
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 + ' ' + u(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('#[^\n]+\n', ' ', txt)
        # Delete multi spaces/newlines
        txt = re.sub('\s+', ' ', txt).strip()
        return txt
def description ( self ) : 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 + ' ' + u ( 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 ( '#[^\n]+\n' , ' ' , txt ) # Delete multi spaces/newlines txt = re . sub ( '\s+' , ' ' , txt ) . strip ( ) return txt