
V]c           @   s  d  Z  d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l	 m
 Z
 d d l m Z d d l m Z d d	 l m Z d d
 l m Z d d l m Z d d l m Z m Z d d l m Z d d l m Z d   Z d   Z d   Z d e f d     YZ d e f d     YZ  d e f d     YZ! d e! f d     YZ" d e" f d     YZ# d e! f d     YZ$ d   Z% d e f d      YZ& d S(!   s   
The :mod:`jedi.api.classes` module contains the return classes of the API.
These classes are the much bigger part of the whole API, because they contain
the interesting information about completion and goto operations.
iN(   t   settings(   t   debug(   t   unite(   t   memoize_method(   t   imports(   t   compiled(   t
   ImportName(   t   FunctionExecutionContext(   t   StubModuleContext(   t   convert_namest   convert_contexts(   t
   ContextSet(   t   KeywordNamec         C   s   t  |  d d   S(   Nt   keyc         S   s   |  j  p d S(   Ni    (   i    i    (   t	   start_pos(   t   s(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   <lambda>   t    (   t   sorted(   t   names(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   _sort_names_by_start_pos   s    c         C   s]   t  | j d t   } g  | j   D] } | ^ q% } g  t |  D] } t |  |  ^ qD S(   so   
    List sub-definitions (e.g., methods in class).

    :type scope: Scope
    :rtype: list of Definition
    t   search_global(   t   nextt   get_filterst   Truet   valuesR   t
   Definition(   t	   evaluatort   contextt   filtert   nameR   t   n(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   defined_names   s    c         C   s&   g  |  D] } t  | j | j  ^ q S(   N(   R   R   R   (   t   contextst   c(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   _contexts_to_definitions(   s    t   BaseDefinitionc           B   s  e  Z i d  d 6d  d 6d  d 6d  d 6d  d 6d  d 6d d 6d	 d
 6d d 6d d 6d d 6d d 6d d 6Z e d   i d d 6j   D  Z d   Z e d    Z e	 d    Z
 e	 d    Z e	 d    Z e	 d    Z d   Z e	 d    Z e	 d     Z e e d!  Z e	 d"    Z e	 d#    Z d$   Z d%   Z e e d&  Z d'   Z e e d(  Z e	 e d)     Z d*   Z d+   Z d, d, d-  Z d.   Z d/   Z  RS(0   s   os.patht	   posixpatht
   riscospatht   ntpatht
   os2emxpatht   macpatht   genericpatht   ost   posixt   iot   _iot	   functoolst
   _functoolst   collectionst   _collectionst   sockett   _sockett   sqlite3t   _sqlite3t   builtinst   __builtin__c         c   s0   |  ]& \ } } t  | j d    | f Vq d S(   t   .N(   t   tuplet   split(   t   .0t   kt   v(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pys	   <genexpr>=   s    s   argparse.ArgumentParsers   argparse._ActionsContainerc         C   s+   | |  _  | |  _ t |  j t  |  _ d  S(   N(   t
   _evaluatort   _namet
   isinstanceR   t
   is_keyword(   t   selfR   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   __init__A   s    		c         C   s   |  j  j   S(   N(   R@   t   get_root_context(   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   _get_moduleI   s    c         C   s9   |  j    } | j   s% | j   r5 |  j    j   Sd S(   sB   Shows the file path of a module. e.g. ``/usr/lib/python2.7/os.py``N(   RF   t   is_stubt   is_compiledt
   py__file__t   None(   RC   t   module(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   module_pathP   s    c         C   s
   |  j  j S(   s   
        Name of variable/function/class/module.

        For example, for ``x = None`` it returns ``'x'``.

        :rtype: str or None
        (   R@   t   string_name(   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR   [   s    	c         C   s   |  j  j } t } | d k	 r] | j   } | d k	 r] | j d k r] | j   r] t } q] n  t |  j  t	 j
  sx | r x |  j  j   D]
 } | j SWn  |  j  j S(   s   
        The type of the definition.

        Here is an example of the value of this attribute.  Let's consider
        the following source.  As what is in ``variable`` is unambiguous
        to Jedi, :meth:`jedi.Script.goto_definitions` should return a list of
        definition for ``sys``, ``f``, ``C`` and ``x``.

        >>> from jedi._compatibility import no_unicode_pprint
        >>> from jedi import Script
        >>> source = '''
        ... import keyword
        ...
        ... class C:
        ...     pass
        ...
        ... class D:
        ...     pass
        ...
        ... x = D()
        ...
        ... def f():
        ...     pass
        ...
        ... for variable in [keyword, f, C, x]:
        ...     variable'''

        >>> script = Script(source)
        >>> defs = script.goto_definitions()

        Before showing what is in ``defs``, let's sort it by :attr:`line`
        so that it is easy to relate the result to the source code.

        >>> defs = sorted(defs, key=lambda d: d.line)
        >>> no_unicode_pprint(defs)  # doctest: +NORMALIZE_WHITESPACE
        [<Definition full_name='keyword', description='module keyword'>,
         <Definition full_name='__main__.C', description='class C'>,
         <Definition full_name='__main__.D', description='instance D'>,
         <Definition full_name='__main__.f', description='def f'>]

        Finally, here is what you can get from :attr:`type`:

        >>> defs = [str(d.type) for d in defs]  # It's unicode and in Py2 has u before it.
        >>> defs[0]
        'module'
        >>> defs[1]
        'class'
        >>> defs[2]
        'instance'
        >>> defs[3]
        'function'

        Valid values for are ``module``, ``class``, ``instance``, ``function``,
        ``param``, ``path`` and ``keyword``.

        t   import_fromN(   R@   t	   tree_namet   FalseRJ   t   get_definitiont   typet   is_definitionR   RA   R   t   SubModuleNamet   infert   api_type(   RC   RO   t   resolvet
   definitionR   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRR   f   s    :c         C   s   |  j    j j S(   s  
        The module name.

        >>> from jedi import Script
        >>> source = 'import json'
        >>> script = Script(source, path='example.py')
        >>> d = script.goto_definitions()[0]
        >>> print(d.module_name)  # doctest: +ELLIPSIS
        json
        (   RF   R   RM   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   module_name   s    c         C   sH   t  |  j   t  r2 t d   |  j   j D  St  |  j   t j  S(   s!   Whether this is a builtin module.c         s   s!   |  ] } t  | t j  Vq d  S(   N(   RA   R   t   CompiledObject(   R<   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pys	   <genexpr>   s   (   RA   RF   R   t   anyt   non_stub_context_setR   RZ   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   in_builtin_module   s    	c         C   s$   |  j  j } | d k r d S| d S(   s7   The line where the definition occurs (starting with 1).i    N(   R@   R   RJ   (   RC   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   line   s    c         C   s$   |  j  j } | d k r d S| d S(   s9   The column where the definition occurs (starting with 0).i   N(   R@   R   RJ   (   RC   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   column   s    c         C   s   t  |  j  j d | d |  S(   sS  
        Return a document string for this completion object.

        Example:

        >>> from jedi import Script
        >>> source = '''\
        ... def f(a, b=1):
        ...     "Document for function f."
        ... '''
        >>> script = Script(source, 1, len('def f'), 'example.py')
        >>> doc = script.goto_definitions()[0].docstring()
        >>> print(doc)
        f(a, b=1)
        <BLANKLINE>
        Document for function f.

        Notice that useful extra information is added to the actual
        docstring.  For function, it is call signature.  If you need
        actual docstring, use ``raw=True`` instead.

        >>> print(script.goto_definitions()[0].docstring(raw=True))
        Document for function f.

        :param fast: Don't follow imports that are only one level deep like
            ``import foo``, but follow ``from foo import bar``. This makes
            sense for speed reasons. Completing `import a` is slow if you use
            the ``foo.docstring(fast=False)`` on every object, because it
            parses all libraries starting with ``a``.
        t   fastt   raw(   t   _HelpR@   t	   docstring(   RC   Ra   R`   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRc      s    c         C   s
   |  j  j S(   s$   A textual description of the object.(   R@   RM   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   description   s    c         C   s{   |  j  j s d S|  j  j d t  } | d k r5 | St |  } y |  j | d | d <Wn t k
 rm n Xd j |  S(   s  
        Dot-separated path of this object.

        It is in the form of ``<module>[.<submodule>[...]][.<object>]``.
        It is useful when you want to look up Python manual of the
        object at hand.

        Example:

        >>> from jedi import Script
        >>> source = '''
        ... import os
        ... os.path.join'''
        >>> script = Script(source, 3, len('os.path.join'), 'example.py')
        >>> print(script.goto_definitions()[0].full_name)
        os.path.join

        Notice that it returns ``'os.path.join'`` instead of (for example)
        ``'posixpath.join'``. This is not correct, since the modules name would
        be ``<module 'posixpath' ...>```. However most users find the latter
        more practical.
        t   include_module_namesi    R9   N(	   R@   t   is_context_nameRJ   t   get_qualified_namesR   t   listt   _mappingt   KeyErrort   join(   RC   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt	   full_name   s    c         C   s#   |  j  j s t S|  j  j   j   S(   N(   R@   Rf   RP   RE   RG   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRG      s    c         K   s.   t  j d |  j   |  j |   SWd  QXd  S(   Ns   goto for %s(   R   t   increase_indent_cmR@   t   _goto_assignments(   RC   t   kwargs(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   goto_assignments&  s    c         C   s|   | o	 | s t   |  j j s# g  St |  j j   d | d | } g  | D]- } | |  j k rf |  n t |  j |  ^ qK S(   Nt
   only_stubst   prefer_stubs(   t   AssertionErrorR@   Rf   R	   t   gotoR   R?   (   RC   Rq   Rr   R   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRn   *  s    	c         K   s.   t  j d |  j   |  j |   SWd  QXd  S(   Ns   infer for %s(   R   Rm   R@   t   _infer(   RC   Ro   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRU   8  s    c         C   s   | o	 | s t   |  j j s# g  St |  j g d t } t t j d   | D  d | d | } g  | D] } | j ^ qm } g  | D]- } | |  j k r |  n t	 |  j
 |  ^ q S(   NRr   c         s   s   |  ] } | j    Vq d  S(   N(   RU   (   R<   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pys	   <genexpr>G  s    Rq   (   Rs   R@   Rf   R	   R   R
   R   t	   from_setsR   R   R?   (   RC   Rq   Rr   R   R!   R"   t   resulting_namesR   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRu   <  s    	c         C   s   xZ |  j  j   D]I } x@ | j   D]2 } g  | j d t  D] } t |  j |  ^ q< SWq W|  j d k s{ |  j d k r g  St d   d S(   s   
        Deprecated! Will raise a warning soon. Use get_signatures()[...].params.

        Raises an ``AttributeError`` if the definition is not callable.
        Otherwise returns a list of `Definition` that represents the params.
        t   resolve_starst   functiont   classs$   There are no params defined on this.N(	   R@   RU   t   get_signaturest   get_param_namesR   R   R?   RR   t   AttributeError(   RC   R   t	   signatureR   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   paramsO  s    1c         C   sZ   |  j  j s d  S|  j  j } | d  k r, d  St | t  rG | j } n  t |  j | j	  S(   N(
   R@   Rf   RJ   t   parent_contextRA   R   t   function_contextR   R?   R   (   RC   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   parentg  s    c         C   s8   d |  j  j |  j r d n d |  j p- |  j |  j f S(   Ns   <%s %sname=%r, description=%r>t   full_R   (   t	   __class__t   __name__Rl   R   Rd   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   __repr__s  s
    	i    c         C   sr   |  j  j s |  j   r d S|  j  j   j } |  j  j d d } t | | d  } d j | | | | d ! S(   sI  
        Returns the line of code where this object was defined.

        :param before: Add n lines before the current line to the output.
        :param after: Add n lines after the current line to the output.

        :return str: Returns the line(s) of code or an empty string if it's a
                     builtin.
        R   i    i   (   R@   Rf   R]   RE   t
   code_linesR   t   maxRk   (   RC   t   beforet   aftert   linest   indext   start_index(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   get_line_code{  s    
c         C   s2   g  |  j  j   j   D] } t |  j |  ^ q S(   N(   R@   RU   R{   t	   SignatureR?   (   RC   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR{     s    c         C   s   t  |  j j   j    S(   N(   R#   R@   RU   t   execute_evaluated(   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   execute  s    (!   R   t
   __module__Ri   t   dictt   itemst   _tuple_mappingRD   R   RF   t   propertyRL   R   RR   RY   R]   R^   R_   RP   R   Rc   Rd   Rl   RG   Rp   Rn   RU   Ru   R   R   R   R   R{   R   (    (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR$   ,   sP   
	H	!'						t
   Completionc           B   st   e  Z d  Z d   Z d   Z e d    Z e d    Z e e	 d  Z
 e d    Z d   Z e d    Z RS(	   s   
    `Completion` objects are returned from :meth:`api.Script.completions`. They
    provide additional information about a completion.
    c         C   s8   t  t |   j | |  | |  _ | |  _ g  |  _ d  S(   N(   t   superR   RD   t   _like_name_lengtht   _stackt   _same_name_completions(   RC   R   R   t   stackt   like_name_length(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRD     s    		c         C   s   d } t  j r' |  j d k r' d } n  |  j j d k r |  j d  k	 r g  |  j D] } | j ^ qR } d | k r d | k r | d 7} q n  |  j j } | r | |  j	 } n  | | S(   NR   Ry   t   (t   paramt   trailert   argumentt   =(
   R    t   add_bracket_after_functionRR   R@   RV   R   RJ   t   nonterminalRM   R   (   RC   t	   like_namet   appendt
   stack_nodet   nonterminalsR   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt	   _complete  s    		!c         C   s   |  j  t  S(   s  
        Return the rest of the word, e.g. completing ``isinstance``::

            isinstan# <-- Cursor is here

        would return the string 'ce'. It also adds additional stuff, depending
        on your `settings.py`.

        Assuming the following function definition::

            def foo(param=0):
                pass

        completing ``foo(par`` would give a ``Completion`` which `complete`
        would be `am=`


        (   R   R   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   complete  s    c         C   s   |  j  t  S(   s@  
        Similar to :attr:`name`, but like :attr:`name` returns also the
        symbols, for example assuming the following function definition::

            def foo(param=0):
                pass

        completing ``foo(`` would give a ``Completion`` which
        ``name_with_symbols`` would be "param=".

        (   R   RP   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   name_with_symbols  s    c         C   s7   |  j  d k r t } n  t t |   j d | d |  S(   Ni   Ra   R`   (   R   RP   R   R   Rc   (   RC   Ra   R`   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRc     s    	c         C   s   t  j j |   S(   s/   Provide a description of the completion object.(   R   Rd   t   __get__(   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRd     s    c         C   s   d t  |   j |  j j f S(   Ns   <%s: %s>(   RR   R   R@   RM   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR     s    c         C   s    t  j d t d d |  j   S(   s  
        Deprecated!

        Return the original definitions. I strongly recommend not using it for
        your completions, because it might slow down |jedi|. If you want to
        read only a few objects (<=20), it might be useful, especially to get
        the original docstrings. The basic problem of this function is that it
        follows all results. This means with 1000 completions (e.g.  numpy),
        it's just PITA-slow.
        s,   Deprecated since version 0.14.0. Use .infer.t
   stackleveli   (   t   warningst   warnt   DeprecationWarningRU   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   follow_definition  s
    (   R   R   t   __doc__RD   R   R   R   R   RP   R   Rc   Rd   R   R   R   (    (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR     s   	
		R   c           B   sh   e  Z d  Z d   Z e d    Z e d    Z e d    Z d   Z	 d   Z
 d   Z d   Z RS(	   s   
    *Definition* objects are returned from :meth:`api.Script.goto_assignments`
    or :meth:`api.Script.goto_definitions`.
    c         C   s   t  t |   j | |  d  S(   N(   R   R   RD   (   RC   R   RX   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRD     s    c         C   s   |  j  } |  j j } | d k r6 | d |  j j   S| d k sN | d k ru | d k rc d } n  | d |  j j S| j   p | } | j d t  } t	 j
 d	 d |  } t	 j
 d
 d |  j   } | S(   s  
        A description of the :class:`.Definition` object, which is heavily used
        in testing. e.g. for ``isinstance`` it returns ``def isinstance``.

        Example:

        >>> from jedi._compatibility import no_unicode_pprint
        >>> 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)
        >>> no_unicode_pprint(defs)  # doctest: +NORMALIZE_WHITESPACE
        [<Definition full_name='__main__.f', description='def f'>,
         <Definition full_name='__main__.C', description='class C'>]
        >>> str(defs[0].description)  # strip literals in python2
        'def f'
        >>> str(defs[1].description)
        'class C'

        R   t    Ry   Rz   RK   t   instancet   deft   include_prefixs	   #[^\n]+\ns   \s+(   Ry   Rz   RK   R   N(   RR   R@   RO   t	   to_stringRJ   RM   RQ   t   get_codeRP   t   ret   subt   strip(   RC   t   typRO   RX   t   txt(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRd     s    		c         C   s3   |  j  r d n
 d |  j } d |  j |  j | f S(   s1  
        In addition to the definition, also return the module.

        .. warning:: Don't use this function yet, its behaviour may change. If
            you really need it, talk to me.

        .. todo:: Add full path. This function is should return a
            `module.class.function` path.
        R   s   @%ss   %s:%s%s(   R]   R^   RY   Rd   (   RC   t   position(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   desc_with_module8  s    c            s8     j  j   } t t   f d   | D  d d   S(   sd   
        List sub-definitions (e.g., methods in class).

        :rtype: list of Definition
        c         3   s!   |  ] } t    j |  Vq d  S(   N(   R    R?   (   R<   t   d(   RC   (    s/   lib/python2.7/site-packages/jedi/api/classes.pys	   <genexpr>O  s    R   c         S   s   |  j  j p d S(   Ni    (   i    i    (   R@   R   (   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR   P  R   (   R@   RU   R   R   (   RC   t   defs(    (   RC   s/   lib/python2.7/site-packages/jedi/api/classes.pyR    F  s    c         C   s*   |  j  j d k r t S|  j  j j   Sd S(   s   
        Returns True, if defined as a name in a statement, function or class.
        Returns False, if it's a reference to such a definition.
        N(   R@   RO   RJ   R   RS   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRS   S  s    c         C   sL   |  j  j | j  j k oK |  j | j k oK |  j | j k oK |  j | j k S(   N(   R@   R   RL   R   R?   (   RC   t   other(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   __eq__]  s    c         C   s   |  j  |  S(   N(   R   (   RC   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   __ne__c  s    c         C   s%   t  |  j j |  j |  j |  j f  S(   N(   t   hashR@   R   RL   R   R?   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   __hash__f  s    (   R   R   R   RD   R   Rd   R   R   R    RS   R   R   R   (    (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR     s   	2	
		R   c           B   s/   e  Z d  Z d   Z e d    Z d   Z RS(   s   
    `Signature` objects is the return value of `Script.function_definition`.
    It knows what functions you are currently in. e.g. `isinstance(` would
    return the `isinstance` function. without `(` it would return nothing.
    c         C   s)   t  t |   j | | j  | |  _ d  S(   N(   R   R   RD   R   t
   _signature(   RC   R   R~   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRD   p  s    c         C   s2   g  |  j  j d t  D] } t |  j |  ^ q S(   s2   
        :return list of ParamDefinition:
        Rx   (   R   R|   R   t   ParamDefinitionR?   (   RC   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR   t  s    c         C   s   |  j  j   S(   N(   R   R   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR   |  s    (   R   R   R   RD   R   R   R   (    (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR   j  s   	t   CallSignaturec           B   s>   e  Z d  Z d   Z e d    Z e d    Z d   Z RS(   s   
    `CallSignature` objects is the return value of `Script.call_signatures`.
    It knows what functions you are currently in. e.g. `isinstance(` would
    return the `isinstance` function with its params. Without `(` it would
    return nothing.
    c         C   s/   t  t |   j | |  | |  _ | |  _ d  S(   N(   R   R   RD   t   _call_detailsR   (   RC   R   R~   t   call_details(    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRD     s    	c         C   s   |  j  j |  j j d t   S(   s|   
        The Param index of the current call.
        Returns None if the index cannot be found in the curent call.
        Rx   (   R   t   calculate_indexR   R|   R   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR     s    	c         C   s   |  j  j j S(   sh   
        The line/column of the bracket that is responsible for the last
        function call.
        (   R   t   bracket_leafR   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   bracket_start  s    c         C   s&   d t  |   j |  j |  j j   f S(   Ns   <%s: index=%r %s>(   RR   R   R   R   R   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR     s    (   R   R   R   RD   R   R   R   R   (    (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR     s
   	
R   c           B   s2   e  Z d    Z d   Z d   Z e d    Z RS(   c         C   s   t  |  j j    S(   s-   
        :return list of Definition:
        (   R#   R@   t   infer_default(   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR     s    c         K   s   t  |  j j |    S(   s   
        :return list of Definition:

        :param execute_annotation: If False, the values are not executed and
            you get classes instead of instances.
        (   R#   R@   t   infer_annotation(   RC   Ro   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR     s    c         C   s   |  j  j   S(   N(   R@   R   (   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR     s    c         C   s+   t  j d k  r t d   n  |  j j   S(   s   
        Returns an enum instance. Returns the same values as the builtin
        :py:attr:`inspect.Parameter.kind`.

        No support for Python < 3.4 anymore.
        i   i   s@   Python 2 is end-of-life, the new feature is not available for it(   i   i   (   t   syst   version_infot   NotImplementedErrorR@   t   get_kind(   RC   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   kind  s    (   R   R   R   R   R   R   R   (    (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyR     s   				c         C   s   d j  d   |  j   D  S(   Ns   
c         s   s   |  ] } | j    Vq d  S(   N(   R   (   R<   R~   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pys	   <genexpr>  s   (   Rk   R{   (   R   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   _format_signatures  s    Rb   c           B   s5   e  Z d  Z d   Z e d    Z e e d  Z RS(   sb   
    Temporary implementation, will be used as `Script.help() or something in
    the future.
    c         C   s   | |  _  d  S(   N(   R@   (   RC   RX   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRD     s    c         C   s?   t  |  j t  r | r i  S|  j j d k r2 i  S|  j j   S(   Nt	   statement(   RA   R@   R   RV   RU   (   RC   R`   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   _get_contexts  s
    c         C   s   d } x |  j  d |  D] } | r> | d d d d 7} n  | j   } d } |  j j r | sq t |  } n  | r | j   r x< t t | h  d t D] } | j   } | r Pq q Wq n  | r | r | | d | 7} q | | | 7} q W| S(   sa   
        The docstring ``__doc__`` for any object.

        See :attr:`doc` for example.
        R   R`   s   
t   -i   t   ignore_compileds   

(	   R   t	   py__doc__R@   Rf   R   RG   R
   R   RP   (   RC   R`   Ra   t   full_docR   t   doct   signature_textR"   (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRc     s$    "(   R   R   R   RD   R   R   R   Rc   (    (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyRb     s   	
('   R   R   R   R   t   jediR    R   t   jedi.evaluate.utilsR   t
   jedi.cacheR   t   jedi.evaluateR   R   t   jedi.evaluate.importsR   t   jedi.evaluate.contextR   t   jedi.evaluate.gradual.typeshedR   t    jedi.evaluate.gradual.conversionR	   R
   t   jedi.evaluate.base_contextR   t   jedi.api.keywordsR   R   R    R#   t   objectR$   R   R   R   R   R   R   Rb   (    (    (    s/   lib/python2.7/site-packages/jedi/api/classes.pyt   <module>   s6   			 jil&"	