+
    ^|i                         R t ^ RIt^ RIHt ^ RIHtHtHt ^ RIHtH	t	 ^ RI
Ht ^ RI
Ht ^ RIHt ^ RIHt ^ RIHt ^ RIt^ RIt^ RIt]! 4       tR	 R
 ltR R ltR R ltR t ! R R]4      t ! R R]4      tR# )zfprompt-toolkit utilities

Everything in this module is a private API,
not to be used outside IPython.
N)wcwidth)provisionalcompletercursor_to_position_deduplicate_completions)	Completer
Completion)Lexer)PygmentsLexer)patch_stdout)get_ipythonc                0    V ^8  d   QhR\         R\         /# )   stringreturnstr)formats   ":/usr/lib/python3/dist-packages/IPython/terminal/ptutils.py__annotate__r      s     # # #s #    c                  V P                  RR4      p V P                  RR4      p \        V 4      V8  d   V # V P                  R4      pV P                  \        P                  4      pVR,          R8X  d   VP                  4        \        V4      ^8  d;   RP                  V^ ,          V^,          R,          VR,          RR	 VR,          4      # \        V4      ^8  ds   R
\        P                  ,           R,           \        P                  ,           R
,           P                  V^ ,          V^,          R,          VR,          RR	 VR,          4      # V # )ao  
If a string is long enough, and has at least 3 dots,
replace the middle part with ellipses.

If a string naming a file is long enough, and has at least 3 slashes,
replace the middle part with ellipses.

If three consecutive dots, or two consecutive dots are encountered these are
replaced by the equivalents HORIZONTAL ELLIPSIS or TWO DOT LEADER unicode
equivalents
z...   …z..u   ‥. u   {}.{}…{}.{}:N   NNz{}u   {}…{})replacelensplitosseppopr   )r   	min_elideobject_parts
file_partss   &$  r   _elide_pointr&      s     ^^E";<F^^D!56F
6{Y<<$Lbff%J"~
<1299OOBRS!	
 	
 
Z1	rvv ==FMUUqM:a=,jnRS.A:b>
 	
 Mr   c                H    V ^8  d   QhR\         R\         R\        R\         /# )r   r   typedr#   r   )r   int)r   s   "r   r   r   E   s(       S   r   c                   \        V 4      V8  d   V # \        V4      ^,
          pV^8  d   V # V P                  V4      '       d*   \        V 4      \        V4      8  d   V R,           RWR  2# V # )zL
Elide the middle of a long string if the beginning has already been typed.
:N   Nr   N)r   
startswith)r   r(   r#   cut_how_muchs   &&$ r   _elide_typedr.   E   sp    
 6{Yu:a<LaCKU$;*4VM5J4KLLMr   c                <    V ^8  d   QhR\         R\         R\         /# )r   r   r(   r   r   )r   s   "r   r   r   T   s!     $ $3 $s $# $r   c                 0    \        \        WR 7      WR 7      # )r#   )r.   r&   )r   r(   r#   s   &&&r   _elider2   T   s    V1$ $r   c                 x    V P                  R 4      '       d#   \        V4      V8  d   W,          R 8X  d   V RR # V # )=Nr   )endswithr   )textbodyoffsets   &&&r   (_adjust_completion_text_based_on_contextr9   [   s6    }}Sc$i&0T\S5HCRyr   c                   J   a  ] tR t^bt o RtRR lt]R 4       tR tR t	Rt
V tR# )	IPythonPTCompleterz8Adaptor to provide IPython completions to prompt_toolkitNc                D    Vf   Vf   \        R4      hWn        W n        R # )Nz/Please pass shell=an InteractiveShell instance.)	TypeError_ipy_completershell)selfipy_completerr?   s   &&&r   __init__IPythonPTCompleter.__init__d   s#    =]2MNN+
r   c                j    V P                   '       d   V P                   # V P                  P                  # )N)r>   r?   r   )r@   s   &r   rA    IPythonPTCompleter.ipy_completerj   s*    &&&::'''r   c           
   #    "   VP                   P                  4       '       g   R # \        4       ;_uu_ 4        \        4       ;_uu_ 4        VP                  pVP
                  pVP                  pVP                  p\        W4V4      p V P                  W7W`P                  4       R j  xL
  R R R 4       R R R 4       R #  L  \         d[   p \        P                  ! 4       w  rp\        P                  ! YT4        R p?LT  \          d    \#        R4         R p?Lpi ; iR p?ii ; i  + '       g   i     L; i  + '       g   i     R # ; i5i)Nz"Unrecoverable Error in completions)current_linestripr
   r   r6   cursor_position_rowcursor_position_colcursor_positionr   _get_completionsrA   	Exceptionsysexc_info	tracebackprint_exceptionAttributeErrorprint)r@   documentcomplete_eventr7   
cursor_row
cursor_colrK   r8   eexc_type	exc_valueexc_tbs   &&&         r   get_completions"IPythonPTCompleter.get_completionsq   s     $$**,,
 ^^133==D!55J!55J&66O'*EF@00PbPbccc 4^^ d @@25,,./H--h6JJ% @>??@	@ 43^^^s   5ED;
=D(	C 'B>(C ,D;4
E>C  D%/D 
;D(	 DD D(	DD  D%%D(	(D83D;;E		Ec              #  B  "   \        VRR4      p\        WP                  W4      4      pV EF  pVP                  '       g   K  \        P
                  ! RVP                  4      p\        V^ ,          4      ^ 8X  d   W7P                  ,           ^ 8  dv   WP                  ^,
          ,          p	\        P
                  ! RW,           4      p
\        VR,          4      ^8X  d)   \        WP                  V,
          ^,
          R7      x  K  VP                  p\        VP                  W4      pV P                  f   ^MV P                  P                  pVP                  R8X  dj   \        VVP                  V,
          \        VR,           WP                  VP                   VR	7      VP                  VP                  ,           R
7      x  EK  \        VVP                  V,
          \        VWP                  VP                   VR	7      VP                  R
7      x  EK  	  R# 5i)zD
Private equivalent of get_completions() use only for unit_testing.
debugFNFC:    r   N)start_positionNfunctionz()r1   )rb   displaydisplay_meta)getattrr   completionsr6   unicodedata	normalizer   startr   r9   r?   r#   typer2   end	signature)r@   r7   r8   rK   ipycr_   rg   cr6   char_before
fixed_textdisplay_textadjusted_textr#   s   &&&&&         r   rL   #IPythonPTCompleter._get_completions   s     gu-.""402A666((7D
 tAw1$"WW,q0"&ww{"3K!,!6!6{1"3J tCy)Q.(GGfDTWXDXYY  66LDM #jj0djj6J6JIvv# !#$77V#3"$t+WWquu-"+
 "#!++!5	 	 !!#$77V#3"$WWquu-"+
 "#	 	W s   HH)r>   r?   )NN)__name__
__module____qualname____firstlineno____doc__rB   propertyrA   r\   rL   __static_attributes____classdictcell____classdict__s   @r   r;   r;   b   s1     B ( (@,; ;r   r;   c                   0   a  ] tR t^t o RtR tR tRtV tR# )IPythonPTLexerz+
Wrapper around PythonLexer and BashLexer.
c                   \         p\        VP                  4      V n        \        VP                  4      V n        R \        VP                  4      R\        VP                  4      R\        VP                  4      R\        VP                  4      R\        VP                  4      R\        VP                  4      R\        VP                  4      /V n        R# )HTMLhtml
javascriptjsperlrubylatexN)pygments_lexersr	   Python3Lexerpython_lexer	BashLexershell_lexer	HtmlLexerJavascriptLexer	PerlLexer	RubyLexerTexLexermagic_lexers)r@   ls   & r   rB   IPythonPTLexer.__init__   s    )!..9(5 M!++.M!++.-(9(9:- 1 12M!++.M!++.]1::.
r   c                   VP                   P                  4       pV P                  pVP                  R 4      '       g   VP                  R4      '       d   V P                  pM\VP                  R4      '       dF   V P
                  P                  4        F'  w  rEVP                  RV,           4      '       g   K%  Tp M	  VP                  V4      # )!z%%bashz%%)r6   lstripr   r,   r   r   itemslex_document)r@   rT   r6   lexermagicr   s   &&    r   r   IPythonPTLexer.lex_document   s    }}##%!!??34??8#<#<$$E__T"" --335??4%<00E 6
 !!(++r   )r   r   r   N)	ru   rv   rw   rx   ry   rB   r   r{   r|   r}   s   @r   r   r      s     
, ,r   r   )ry   rh   r   IPython.core.completerr   r   r   prompt_toolkit.completionr   r   prompt_toolkit.lexersr   r	   prompt_toolkit.patch_stdoutr
   IPython.core.getipythonr   pygments.lexerslexersr   r    rN   rP   object_completion_sentinelr&   r.   r2   r9   r;   r    r   r   <module>r      ss       < ' / 4 / * 	 
 x #L$` `F!,U !,r   