
    Æeig                     N   d dl Z d dlZd dlZd dlmZmZmZmZmZm	Z	m
Z
mZmZmZ d dlmZ d dlmZ 	 	 	 	 ddZd ZddZ	 	 	 	 ddZdd	Zd
 Zd Z G d d      ZeZ G d de      Zd dZd Zd Z G d d      Z G d d      Z  G d d      Z! G d de      Z" G d d      Z#y)!    N)
builtinsevaluate
exceptionslibutilspynames
pynamesdef	pyobjectspyobjectsdefpyscopesworder)	fixsyntax)functionutilsc                 n    |t        j                  dt        d       t        | |||||      } |       S )am  Return python code completions as a list of `CodeAssistProposal`

    `resource` is a `rope.base.resources.Resource` object.  If
    provided, relative imports are handled.

    `maxfixes` is the maximum number of errors to fix if the code has
    errors in it.

    If `later_locals` is `False` names defined in this scope and after
    this line is ignored.

    z'Codeassist no longer supports templates   
stacklevel)resourcemaxfixeslater_locals)warningswarnDeprecationWarning_PythonCodeAssist)projectsource_codeoffsetr   	templatesr   r   assists           9/usr/lib/python3/dist-packages/rope/contrib/codeassist.pycode_assistr       sF    * 57IVW	
 !F 8O    c                 \    t        j                  | d      }|j                  |      \  }}}|S )aN  Return the offset in which the completion should be inserted

    Usually code assist proposals should be inserted like::

        completion = proposal.name
        result = (source_code[:starting_offset] +
                  completion + source_code[offset:])

    Where starting_offset is the offset returned by this function.

    Tr   Worderget_splitted_primary_beforer   r   word_finder
expressionstartingstarting_offsets         r   r*   r*   9   s6     --T2K,7,S,S-)J/ r!   c                     t        j                  | |||      }|j                  |      }|y|j                         }t	               j                  |      S )zGet the pydocN)r   	FixSyntax	pyname_at
get_objectPyDocExtractorget_doc)r   r   r   r   r   fixerpynamepyobjects           r   r0   r0   L   sP    hIE__V$F~  "H##H--r!   c                     t        j                  | |||      }|j                  |      }|y|j                         }	t	               j                  |	||      S )ay  Get the calltip of a function

    The format of the returned string is
    ``module_name.holding_scope_names.function_name(arguments)``.  For
    classes `__init__()` and for normal objects `__call__()` function
    is used.

    Note that the offset is on the function itself *not* after the its
    open parenthesis.  (Actually it used to be the other way but it
    was easily confused when string literals were involved.  So I
    decided it is better for it not to try to be too clever when it
    cannot be clever enough).  You can use a simple search like::

        offset = source_code.rindex('(', 0, offset) - 1

    to handle simple situations.

    If `ignore_unknown` is `True`, `None` is returned for functions
    without source-code like builtins and extensions.

    If `remove_self` is `True`, the first parameter whose name is self
    will be removed for methods.
    N)r   r,   r-   r.   r/   get_calltip)
r   r   r   r   r   ignore_unknownremove_selfr1   r2   r3   s
             r   r5   r5   V   sW    @ hIE__V$F~  "H''.+NNr!   c                     t        j                  | |||      }|j                  |      }|5|j                         \  }}| |j	                         j                         |fS y)aS  Return the definition location of the python name at `offset`

    Return a (`rope.base.resources.Resource`, lineno) tuple.  If no
    `resource` is given and the definition is inside the same module,
    the first element of the returned tuple would be `None`.  If the
    location cannot be determined ``(None, None)`` is returned.

    NN)r   r,   r-   get_definition_location
get_moduleget_resource)	r   r   r   r   r   r1   r2   modulelinenos	            r   r:   r:   ~   sf     hIE__V$F779$$&335v==r!   c                      dd l }t        j                  dt        d        |j                  j
                  j                  | i |S )Nr   z4Use `rope.contrib.findit.find_occurrences()` insteadr   r   )rope.contrib.finditr   r   r   contribfinditfind_occurrences)argskwdsropes      r   rC   rC      s>    MM>
 04<<//>>>r!   c                 V   | j                  |      }t        j                  ||      }|j                         \  }}|sy|j	                         j                  |      }g }t        |t        j                        r(t        j                  |j                         |      dfg}nAt        |t        j                        r't        j                  |j                         |      dfg}|j                  rt        |t        j                        rd}	nt        |t        j                         rd}	nd}	|j#                  |j$                  j'                         |	f       |j                  }|j                  r|j#                  |j                         j(                  df       |j+                          |S )a  Get the canonical path to an object.

    Given the offset of the object, this returns a list of
    (name, name_type) tuples representing the canonical path to the
    object. For example, the 'x' in the following code:

        class Foo(object):
            def bar(self):
                class Qux(object):
                    def mux(self, x):
                        pass

    we will return:

        [('Foo', 'CLASS'), ('bar', 'FUNCTION'), ('Qux', 'CLASS'),
         ('mux', 'FUNCTION'), ('x', 'PARAMETER')]

    `resource` is a `rope.base.resources.Resource` object.

    `offset` is the offset of the pyname you want the path to.

    N	PARAMETERVARIABLEFUNCTIONCLASSMODULE)get_pymoduler   eval_locationr:   	get_scopeget_inner_scope_for_line
isinstancer   ParameterNamer   get_name_atr<   AssignedNameparentr   FunctionScope
ClassScopeappendr3   get_name	real_pathreverse)
r   r   r   pymodr2   defmodr>   scopenames
scope_types
             r   get_canonical_pathra      s^   0   *E##E62F 335NFF77?E E&*223$$U%7%7%96BKPQ	FJ33	4$$U%7%7%96BJOP ,,eX334#Jx223 JJenn--/<= ,, 
LL&%%'118<=	MMOLr!   c                   `    e Zd ZdZddZd Zd Zed        Zed        Z	d Z
d	 Zed
        Zy)CompletionProposala  A completion proposal

    The `scope` instance variable shows where proposed name came from
    and can be 'global', 'local', 'builtin', 'attribute', 'keyword',
    'imported', 'parameter_keyword'.

    The `type` instance variable shows the approximate type of the
    proposed object and can be 'instance', 'class', 'function', 'module',
    and `None`.

    All possible relations between proposal's `scope` and `type` are shown
    in the table below (different scopes in rows and types in columns):

                      | instance | class | function | module | None
                local |    +     |   +   |    +     |   +    |
               global |    +     |   +   |    +     |   +    |
              builtin |    +     |   +   |    +     |        |
            attribute |    +     |   +   |    +     |   +    |
             imported |    +     |   +   |    +     |   +    |
              keyword |          |       |          |        |  +
    parameter_keyword |          |       |          |        |  +

    Nc                 L    || _         || _        | j                  |      | _        y N)namer2   
_get_scoper^   )selfrf   r^   r2   s       r   __init__zCompletionProposal.__init__   s     	__U+
r!   c                 T    | j                    d| j                   d| j                   dS )Nz (, ))rf   r^   typerh   s    r   __str__zCompletionProposal.__str__   s'    ))Btzzl"TYYKq99r!   c                     t        |       S re   )strrn   s    r   __repr__zCompletionProposal.__repr__   s    4yr!   c                    | j                   }t        |t        j                        r|j	                         }t        |t        j
                        r;|j                         }t        |t        j                        r|j                         S yy)ztThe names of the parameters the function takes.

        Returns None if this completion is not a function.
        N)
r2   rQ   r   ImportedName_get_imported_pynameDefinedNamer.   r	   AbstractFunctionget_param_namesrh   r2   r3   s      r   
parameterszCompletionProposal.parameters   ss     fg223002Ffg112((*H(I$>$>?//11 @ 3r!   c                 r   | j                   }t        |t        j                        r||j	                         }t        |t        j
                        ryt        |t        j                        ryt        |t        j                        st        |t        j                        ryyt        |t        j                        ryt        |t        j                        st        |t        j                        rF|j	                         }t        |t        j                        ryt        |t        j                        ryy)Nfunctionclassinstancer=   )r2   rQ   r   BuiltinNamer.   BuiltinFunctionBuiltinClassBuiltinObjectr   ImportedModulert   rv   r	   rw   AbstractClassry   s      r   rm   zCompletionProposal.type  s    fh223((*H(H$<$<=!Hh&;&;<Hh&<&<=(..B "   6 67 4 45G'':
 ((*H(I$>$>?!(I$;$;<r!   c                     t        | j                  t        j                        ryt        | j                  t        j
                        s$t        | j                  t        j                        ry|S )Nbuiltinimported)rQ   r2   r   r   r   r   rt   )rh   r^   s     r   rg   zCompletionProposal._get_scope  sM    dkk8#7#78dkk7#9#9:jKK--?
 r!   c                     | j                   sy| j                   j                         }t        |d      sy| j                   j                         j                         S )zYGet the proposed object's docstring.

        Returns None if it can not be get.
        Nr0   )r2   r.   hasattrr0   rh   r3   s     r   r0   zCompletionProposal.get_doc'  sI    
 {{;;))+x+{{%%'//11r!   c                 D    t        j                  d       | j                  S )NzAthe proposal's `kind` property is deprecated, use `scope` instead)r   r   r^   rn   s    r   kindzCompletionProposal.kind3  s    R	
 zzr!   re   )__name__
__module____qualname____doc__ri   ro   rr   propertyrz   rm   rg   r0   r    r!   r   rc   rc      s\    0,
: 2 2  0
2  r!   rc   c                   (     e Zd ZdZ fdZd Z xZS )NamedParamProposalzA parameter keyword completion proposal

    Holds reference to ``_function`` -- the function which
    parameter ``name`` belongs to. This allows to determine
    default value for this parameter.
    c                 L    || _         d|z  }t        | 	  |d       || _        y )Nz%s=parameter_keyword)argnamesuperri   	_function)rh   rf   r|   	__class__s      r   ri   zNamedParamProposal.__init__G  s*    t|23!r!   c                     t         j                  j                  | j                        }|j                  D ]  \  }}| j
                  |k(  s|c S  y)zGet a string representation of a param's default value.

        Returns None if there is no default value for this param.
        N)r   DefinitionInforeadr   args_with_defaultsr   )rh   definfoargdefaults       r   get_defaultzNamedParamProposal.get_defaultM  sM    
  ..33DNNC#66 	LC||s"	 r!   )r   r   r   r   ri   r   __classcell__r   s   @r   r   r   ?  s    "	r!   r   c                 <    t        | ||      }|j                         S )a  Sort a list of proposals

    Return a sorted list of the given `CodeAssistProposal`.

    `scopepref` can be a list of proposal scopes.  Defaults to
    ``['parameter_keyword', 'local', 'global', 'imported',
    'attribute', 'builtin', 'keyword']``.

    `typepref` can be a list of proposal types.  Defaults to
    ``['class', 'function', 'instance', 'module', None]``.
    (`None` stands for completions with no type like keywords.)
    )_ProposalSorterget_sorted_proposal_list)	proposals	scopepreftypeprefsorters       r   sorted_proposalsr   Y  s!     Y	8<F**,,r!   c                 p    t        j                  | d      }|j                  |      \  }}}|r|dz   |z   S |S )z!Return the expression to completeT.r#   r&   s         r   starting_expressionr   j  sF    --T2K,7,S,S-)J/ C(**Or!   c                  >    t        j                  dt        d       i S )Nz"default_templates() is deprecated.r   r   )r   r   r   r   r!   r   default_templatesr   u  s    MM,.@Q Ir!   c                   l    e Zd Z	 ddZej
                  Zd Zd Zd Z	d Z
ddZd Zd	 Zd
 Zd Zd Zy)r   Nc                     || _         || _        || _        || _        || _        t        j                  |d      | _        | j                  j                  |      \  | _	        | _
        | _        y )NT)r   coder   r   r   r   r$   r'   r%   r(   r)   r   )rh   r   r   r   r   r   r   s          r   ri   z_PythonCodeAssist.__init__}  se     	  (!==d;
 88@		
OMKr!   c                     |dz
  }|dk\  r@||   j                         s||   dv r&|dz  }|dk\  r||   j                         r||   dv r&|dz   S )N   r   _)isalnum)rh   r   r   current_offsets       r   _find_starting_offsetz'_PythonCodeAssist._find_starting_offset  sp    !!'//1[5PTW5WaN !'//1[5PTW5W !!r!   c                 v    | j                   D cg c]  }|j                  |      rt        |d      ! c}S c c}w )Nkeyword)keywords
startswithrc   )rh   r)   kws      r   _matching_keywordsz$_PythonCodeAssist._matching_keywords  s;     mm
}}X& r9-
 	
 
s   $6c                 d   | j                   t        | j                        kD  rg S t        | j	                         j                               }| j                  j                         dk(  rG| j                  j                         dk7  r*|j                  | j                  | j                               |S )N )r   lenr   list_code_completionsvaluesr(   stripr)   extendr   )rh   completionss     r   __call__z_PythonCodeAssist.__call__  s    ;;TYY'I4113::<=??  "b(T]]-@-@-Bb-Ht66t}}EFr!   c                 n   i }t        j                  || j                        }||j                         }d}t	        |t
        j                  t
        j                  f      rd}|j                         j                         D ]1  \  }}|j                  | j                        s"t        |||      ||<   3 |S )N	attributer   )r   eval_strr(   r.   rQ   r
   PyModule	PyPackageget_attributesitemsr   r)   rc   )	rh   module_scopeholding_scoperesultfound_pynameelementcompl_scoperf   r2   s	            r   _dotted_completionsz%_PythonCodeAssist._dotted_completions  s    ((H#"--/G%K'L$9$9<;Q;Q#RS( ' 6 6 8 > > @ Qf??4==1#5dK#PF4LQ r!   c                    |j                   | j                  |j                   |       ||j                         }n|j                         }|j	                         D ]j  \  }}|j                  | j                        s"d}|j                         dk(  rd}| | j                  s| j                  |||      r[t        |||      ||<   l y )NlocalModuleglobal)rU   _undotted_completionsget_propagated_names	get_namesr   r   r)   get_kindr   _is_defined_afterrc   )rh   r^   r   r>   r_   rf   r2   r   s           r   r   z'_PythonCodeAssist._undotted_completions  s    <<#&&u||V<>..0EOO%E!KKM 
	QLD&t}}-%>>#x/"*KN((11%H#5dK#PF4L
	Qr!   c                     | j                   j                  | j                        }|i S | j                  ||      }i }|D ]2  }|j	                  | j
                        st        |d||         ||<   4 |S )Nr   )r^   r2   )r'   get_from_moduler   _find_moduler   r)   rc   )rh   pymodulemodule_namer   rf   s        r   _from_import_completionsz*_PythonCodeAssist._from_import_completions  s}    &&66t{{CI$$X{; 	Dt}}-1$ t	
 r!   c                     d}||   dk(  r|dz  }||   dk(  rt        j                  |||d  |      }|j                         S )Nr   r   r   )r   r   r.   )rh   r   r   dotsr2   s        r   r   z_PythonCodeAssist._find_module  sV    $3&AID $3&''+de2DdK  ""r!   c                     |j                         }|G|d   A|d   |j                  j                         k(  r ||d   cxk  r|j                         k  ry y y y y y )Nr   r   T)r:   r3   r;   get_end)rh   r^   r2   r>   locations        r   r   z#_PythonCodeAssist._is_defined_after  sd    113HQK$;u~~88::hqk<U]]_< = ; %<r!   c                 H   | j                   j                  dd| j                        dz   }t        j                  | j
                  | j                   | j                  | j                        }|j                         }|j                         }|j                  }|j                  d      }i }t        j                  ||      }t        j                  ||dz
           }	|j                  ||	      }
| j                  j!                  | j                        r| j#                  |      S | j$                  j'                         dk7  r#|j)                  | j+                  ||
             |S |j)                  | j-                  |j.                  |
             | j1                  |
||       |S )N
r   r   r   )r>   )r   countr   r   r,   r   r   r   rM   rO   r   split_logical_start_get_line_indentsrP   r'   is_a_name_after_from_importr   r(   r   updater   _keyword_parametersr3   r   )rh   r>   r1   r   r   r   linesr   startindentsinner_scopes              r   r   z#_PythonCodeAssist._code_completions  s\   q$++6:##LL$))T]]DMM
 %%'))+##

4 ((7--eEAI.>?";;E7K77D00::??  "b(MM$22<MN  MM$22<3H3H+VW&&{F6&Jr!   c                 "   | j                   }|dk(  ri S t        j                  | j                  d      }|j	                  |dz
        r+|j                  |dz
        }|j                  |dz
        }	 t        j                  ||      }||j                         }t        |t        j                        rnIt        |t        j                        rd|v r|d   j                         }nd|v r|d   j                         }t        |t        j                        r\g }	|	j!                  |j#                  d             i }
|	D ]0  }|j%                  | j&                        st)        ||      |
|dz   <   2 |
S i S # t        j                  $ r i cY S w xY w)	Nr   Tr   ri   r   F)special_args=)r   r   r$   r   is_on_function_call_keywordfind_parens_start_from_insideget_primary_atr   r   r   BadIdentifierErrorr.   rQ   r	   rw   r   r   rx   r   r)   r   )rh   r   r^   r   r'   function_parensprimaryfunction_pynamer3   param_namesr   rf   s               r   r   z%_PythonCodeAssist._keyword_parameters  s   Q;ImmDIIt4226A:>)GGQR
SO!0011DEG"*"3"3E7"C **557h	(B(BCx)@)@A"h.'
3>>@H8+'
3>>@Hh	(B(BC"$K&&x'?'?U'?'STF + T??4==91CD(1SF4#:.T "M	+ 00 	s   2E6 6FF)Nr   Tre   )r   r   r   ri   r   kwlistr   r   r   r   r   r   r   r   r   r   r   r   r!   r   r   r   |  sI    TXA ~~H"
Q&#,r!   r   c                   $    e Zd ZdZddZd Zd Zy)r   z$Sort a list of code assist proposalsNc                     || _         |g d}|| _        |g d}t        |      D ci c]  \  }}||
 c}}| _        y c c}}w )N)r   r   r   r   r   r   r   )r}   r|   r~   r=   N)r   r   	enumeratetyperank)rh   code_assist_proposalsr   r   indexrm   s         r   ri   z_ProposalSorter.__init__  sL    .I #HH8A(8KLuLLs   A c                 ~   i }| j                   D ]-  }|j                  |j                  g       j                  |       / g }| j                  D ]h  }|j                  |g       }|D cg c]  }|j                  | j                  v r| }}|j                  | j                         |j                  |       j |S c c}w )z%Return a list of `CodeAssistProposal`)key)r   
setdefaultr^   rX   r   getrm   r	  sort_proposal_keyr   )rh   r   proposalr   r^   scope_proposalss         r   r   z(_ProposalSorter.get_sorted_proposal_list.  s    	 	FH  4;;HE	F^^ 	+E'mmE26O !0==DMM1 O 
   T%7%7 8MM/*	+ s   &!B:c                     d }| j                   j                  |j                  d       ||j                        |j                  fS )Nc                 &    t        d | D              S )Nc              3   ,   K   | ]  }|d k(  s	d  yw)r   r   Nr   ).0cs     r   	<genexpr>zJ_ProposalSorter._proposal_key.<locals>._underline_count.<locals>.<genexpr>A  s     3Q!s(q3s   
)sum)rf   s    r   _underline_countz7_ProposalSorter._proposal_key.<locals>._underline_count@  s    3$333r!   d   )r	  r  rm   rf   )rh   	proposal1r  s      r   r  z_ProposalSorter._proposal_key?  s>    	4 MMinnc2Y^^,NN
 	
r!   r9   )r   r   r   r   ri   r   r  r   r!   r   r   r     s    .M""
r!   r   c                   b     e Zd Zd ZddZ fdZd Zd Zd Zd Z	ddZ
dd	Zd
 ZddZ xZS )r/   c                 "   t        |t        j                        r| j                  |      S t        |t        j                        r| j                  |      S t        |t        j                        r| j                  |j                               S y re   )	rQ   r	   rw   _get_function_docstringr   _get_class_docstringAbstractModule_trim_docstringr0   r   s     r   r0   zPyDocExtractor.get_docP  sq    h	 : :;//99)"9"9:,,X66)":":;''(8(8(:;;r!   c                    	 t        |t        j                        r|d   j                         }t        |t        j                        s|d   j                         }|rt        |t        j                        sy t        |t        j                        rJ| j                  |d      }|r3| j                  |      r"|j                  dd      j                  dd      S |S y # t
        j                  $ r Y y w xY w)	Nri   r   T)
add_modulez(self)z()z(self, ()rQ   r	   r   r.   rw   r   AttributeNotFoundError
PyFunction_get_function_signature
_is_methodreplace)rh   r3   r6   r7   r   s        r   r5   zPyDocExtractor.get_calltipY  s    	(I$;$;<#J/::<h	(B(BC#J/::< *Xy7K7K"Lh	 : :;11(t1LFtx8~~h5==iMMM	 <	 00 		s   AC C43C4c                     fd}| j                  |j                         d      } ||      }||z  }d|v rD|d   j                         }t        |t        j
                        r|d| j                  |      z   z  }|S )Nc                     | j                         }| j                         D cg c]  }|j                          }}dj                  |      }d| d| dS c c}w )Nrk   zclass r&  z):

)rY   get_superclassesjoin)pyclass
class_namer   superssuper_classesr   s        r   _get_class_headerz>PyDocExtractor._get_class_docstring.<locals>._get_class_headerj  s]     ))+J4;4L4L4NO5enn&OFO IIf-MJ<qv>> Ps   Ar   ri   

)r#  r0   r.   rQ   r	   rw   _get_single_function_docstring)rh   r0  r4  contentsdocinitr   s         r   r!  z#PyDocExtractor._get_class_docstringi  s    	? ''(91=(x :&113D$	 : :;v C CD III
r!   c                    |g}| j                  |      r9|j                  | j                  |j                  |j	                                      dj                  |D cg c]  }| j                  |       c}      S c c}w )Nr5  )r*  r   _get_super_methodsrU   rY   r/  r6  )rh   
pyfunction	functionsr|   s       r   r   z&PyDocExtractor._get_function_docstring|  sq    L	??:&''
(9(9:;N;N;PQ {{KTUxT00:U
 	
Us   A<c                     t        |t        j                        xr$ t        |j                  t        j                        S re   )rQ   r	   r(  rU   PyClass)rh   r<  s     r   r*  zPyDocExtractor._is_method  s5    *i&:&:; 

y00A
 	
r!   c                 v    | j                  |      }| j                  |j                         d      }|dz   |z   S )Nr   )r   z:

)r)  r#  r0   )rh   r<  	signaturedocss       r   r6  z-PyDocExtractor._get_single_function_docstring  s@    00<	##J$6$6$8!#D7"T))r!   c                     g }|j                         D ]e  }||v r>||   j                         }t        |t        j                        r|j                  |       |j                  | j                  ||             g |S re   )r.  r.   rQ   r	   rw   rX   r   r;  )rh   r0  rf   r   super_classr|   s         r   r;  z!PyDocExtractor._get_super_methods  sx    "335 	FK{"&t,779h	(B(BCMM(+MM$11+tDE	F r!   c                 >   | j                  ||      }t        |t        j                        r2t        j
                  j                  |      }||j                         z   S dj                  ||j                         z   dj                  |j                                     S )Nz{}({})rk   )	_locationrQ   r	   r(  r   r   r   	to_stringformatrY   r/  rx   )rh   r<  r%  r   infos        r   r)  z&PyDocExtractor._get_function_signature  s    >>*j9j)"6"67 //44Z@Ddnn...??:..00		*4467 r!   c                    g }|j                   }|rst        |t        j                        sY|j	                  |j                                |j	                  d       |j                   }|rt        |t        j                        sY|rxt        |t        j                        r!|j                  d| j                  |             t        |t        j                        r#|j                  d|j                         dz          dj                  |      S )Nr   r   r   )rU   rQ   r	   r"  rX   rY   r(  insert_get_moduler   BuiltinModuler/  )rh   r3   r%  r   rU   s        r   rF  zPyDocExtractor._location  s    Z	0H0HIOOFOO-.OOC ]]F Z	0H0HI (I$8$894#3#3H#=>&("8"896??#4s#:;wwx  r!   c                 |    |j                         }|*|j                         }|t        j                  |      dz   S y)Nr   r   )r;   r<   r   modname)rh   r<  r=   r   s       r   rL  zPyDocExtractor._get_module  sC    &&(**,H#''1C77r!   c                 :   |sy|j                         j                         }t        j                  }|dd D ]6  }|j	                         }|st        |t        |      t        |      z
        }8 |d   j                         g}|t        j                  k  r,|dd D ]$  }|j                  ||d j                                & |r|d   s|j                          |r|d   s|r|d   s|j                  d       |r|d   sdj                  fd|D              S )zThe sample code from :PEP:`257`r   r   Nr   r   c              3   .   K   | ]  }d z  |z     yw) Nr   )r  liner   s     r   r  z1PyDocExtractor._trim_docstring.<locals>.<genexpr>  s     B$w-Bs   )
expandtabs
splitlinessysmaxsizelstripminr   r   rX   rstrippopr/  )rh   	docstringr   r   indentrT  strippedtrimmeds     `     r   r#  zPyDocExtractor._trim_docstring  s    $$&113!"I 	@D{{}HVSYX%>?	@
 8>>#$CKKab	 7tFG}33567 gbkKKM gbkgajKKN gaj yyB'BBBr!   )FF)F)r   )r   r   r   r0   r5   r!  r   r*  r6  r;  r)  rF  rL  r#  r   r   s   @r   r/   r/   O  s;     &


*
	!Cr!   r/   c                        e Zd Z fdZ xZS )TemplateProposalc                 l    t        j                  dt        d       t        |   |d       || _        y )NzTemplateProposal is deprecated.r   r   template)r   r   r   r   ri   rd  )rh   rf   rd  r   s      r   ri   zTemplateProposal.__init__  s/    -/Aa	
 	z* r!   )r   r   r   ri   r   r   s   @r   rb  rb    s    ! !r!   rb  c                   $    e Zd Zd Zd Zd Zd Zy)Templatec                 J    || _         t        j                  dt        d       y )NzTemplate is deprecated.r   r   )rd  r   r   r   )rh   rd  s     r   ri   zTemplate.__init__  s     /1CPQRr!   c                     g S re   r   rn   s    r   	variableszTemplate.variables  s    	r!   c                     | j                   S re   )rd  rh   mappings     r   
substitutezTemplate.substitute  s    }}r!   c                 ,    t        | j                        S re   )r   rd  rk  s     r   get_cursor_locationzTemplate.get_cursor_location  s    4==!!r!   N)r   r   r   ri   ri  rm  ro  r   r!   r   rf  rf    s    S"r!   rf  )NNr   T)Nr   )Nr   FFr9   )$r   rW  r   	rope.baser   r   r   r   r   r   r	   r
   r   r   rope.contribr   rope.refactorr   r    r*   r0   r5   r:   rC   ra   rc   CodeAssistProposalr   r   r   r   r   r   r/   rb  rf  r   r!   r   <module>rt     s     
    # ' !H&. %OP$?5pe eR ( + 4-"[ [|-
 -
jDC DCT!) !" "r!   