+
    ^|ia1                        R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RI
H
t
 ^ RIHt ^RIHtHt ^RIHt ^RIHt ^ R	IHt ^ R
IHt ]	! 4       t^t^t]P6                  ! RRP9                  R ] 4       4      ,          4      t]P6                  ! R4      tR R ltR t R R lt!R t"RR R llt#R t$R t%R t&R t'R t(R t)R# )z\Implementations for various useful completers.

These are all loaded by default by IPython.
N)import_module)all_suffixes)time)zipimporter)expand_usercompress_user)TryNext)	arg_split)get_ipython)Listz?(?P<name>[^\W\d]\w*?)(?P<package>[/\\]__init__)?(?P<suffix>%s)$|c              #   N   "   T F  p\         P                  ! V4      x  K  	  R # 5iN)reescape).0ss   & ;/usr/lib/python3/dist-packages/IPython/core/completerlib.py	<genexpr>r   :   s      Ay!1ys   #%z.*(\.ipy|\.ipynb|\.py[w]?)$c                F    V ^8  d   QhR\         R\        \         ,          /# )   pathreturnstrr   )formats   "r   __annotate__r   D   s     % %c %d3i %    c                  aa	 V R8X  d   Rp \         P                  P                  o\         P                  P                  V 4      '       dw   . p\         P                  ! V RR7       FW  w  r#pV\        V 4      ^,           R o	S	'       d$   VP                  VV	3R lV 4       4       . VR&   KF  VP                  V4       KY  	  M- \        \        V 4      P                  P                  4       4      p. pV FB  p\        P                  V4      pV'       g   K"  VP                  VP                  R4      4       KD  	  \        \!        V4      4      #   \         d    . p Lmi ; i)	zT
Return the list containing the names of the modules available in the given
folder.
 .T)followlinksNc              3   6   <"   T F  pS! SV4      x  K  	  R # 5ir    )r   fpjoinsubdirs   & r   r   module_list.<locals>.<genexpr>X   s     ?w!U61--ws   :NNNname)osr   joinisdirwalklenextendlistr   _fileskeys	Exception	import_rematchappendgroupset)
r   filesrootdirsnondirsmodulesr$   mr%   r&   s
   &       @@r   module_listr>   D   s    rz GGLLE	ww}}T #%774T#BD#d)A+,'F?w??QW% $C	T*116689E
 GOOA1NN1776?+  G  	E	s   ,E EEc                 j   \        4       p V f   \        \        P                  4      # \	        V P
                  RR4      '       d   / pMV P
                  P                  R/ 4      p\        \        P                  4      p\        4       pRp\        P                   F  p W,          pVP%                  V4       K  	  V'       d   WP
                  R&   \        \'        V4      4      pV#   \         d    \        T4      p TP                  R4       M  \         d     Mi ; iTR	9  d   YaT&   \        4       T,
          \        8  d?   T'       g7   Rp\        R4       \        R4       \        P                  P!                  4        \        4       T,
          \"        8  d   \        R4       . u u #  ELi ; i)
z
Returns a list containing the names of all the modules available in the
folders of the pythonpath.

ip.db['rootmodules_cache'] maps sys.path entries to list of modules.
_mockFrootmodules_cache__init__Tz/
Caching the list of root modules, please wait!z@(This will only be done once - type '%rehashx' to reset cache!)
z%This is taking too long, we give up.
)r   r    )r
   r/   sysbuiltin_module_namesgetattrdbgetr   r   KeyErrorr>   remove
ValueErrorTIMEOUT_STORAGEprintstdoutflushTIMEOUT_GIVEUPr.   r7   )iprA   rootmodules
start_timestorer   r<   s          r   get_root_modulesrT   l   sl    
B	z C,,--ruugu%%EEII&92>s//0KJE	'-G$ 	7#) * %6!"s;'(K+  	!$'Gz* 9$*1$'v
"_4UHI ( )

  "v
"^3>?	 4	s=   C&&F2=DF2DF2D/F2AF21F2c                0    V ^8  d   QhR\         R\        /# )r   attrr   )r   bool)r   s   "r   r   r      s     	; 	; 	;d 	;r   c                     V'       d#    \        W4      p\        P                  ! T4      # VR,          R8H  ;'       d	    VRR R8H  '       * #   \         d     R # i ; i)F:Nr   N__N)rE   ModuleNotFoundErrorinspectismodule)modulerV   only_modulesmods   &&& r   is_importablera      s`    	&'C $$8t#99RS	T(9:: # 		s   A AAc                      \        W4      p\        P                  ! T4      #   \         d     R # \         d     R# i ; i)TF)rE   AttributeError	TypeErrorr\   r]   )r^   rV   objs   && r   is_possible_submodulerf      sC    f# C     s   # ????c                F    V ^8  d   QhR\         R\        \         ,          /# )r   r`   r   r   )r   s   "r   r   r      s     ! !C !S	 !r   c           
       a
 V P                  R4      p  \        V 4      o
R\        S
RR4      ;'       g    R9   p. p\        S
R4      '       d   T'       d	   T'       d?   TP	                  \        S
4       Uu. uF  p\        S
YA4      '       g   K  TNK  	  up4       \        S
R. 4      pT'       d   TP	                  T
3R lT 4       4       MTP	                  T4       T'       dJ   S
P                  p\        P                  P                  T4      pTe   TP	                  \        T4      4       T Uu0 uF  p\        T\        4      '       g   K  TkK  	  p	pT	P                  R4       \        T	4      #    . u # ; iu upi u upi )zF
Try to import given module and return list of potential completions.
r    rB   __file__r   __all__c              3   P   <"   T F  p\        SV4      '       g   K  Vx  K  	  R # 5ir   )rf   )r   rV   r=   s   & r   r   try_import.<locals>.<genexpr>   s     TED5J1d5S44Es   &
&)rstripr   rE   hasattrr.   dirra   ri   r)   r   dirnamer>   
isinstancer   discardr/   )r`   r_   	m_is_initcompletionsrV   m_allfile_	file_pathccompletions_setr=   s   &&        @r   
try_importrz      sH    **S/C# wq*b9??R@IKAz""LYc!f Cfd*1dA "Tf C 	D Ay"%ETETT5!

GGOOE*	 {956"-D+QAs1Cqq+ODJ'  /	C Es#   E3 5E<E<2FF3E9c                   a \        S\        4      '       d   SP                  4       oV3R lp\        4       P	                  RW R7       R# )a\  Easily create a trivial completer for a command.

Takes either a list of completions, or all completions in string (that will
be split on whitespace).

Example::

    [d:\ipython]|1> import ipy_completers
    [d:\ipython]|2> ipy_completers.quick_completer('foo', ['bar','baz'])
    [d:\ipython]|3> foo b<TAB>
    bar baz
    [d:\ipython]|3> foo ba
c                    < S# r   r#   )selfeventrt   s   &&r   do_complete$quick_completer.<locals>.do_complete   s	    r   complete_command)str_keyN)rq   r   splitr
   set_hook)cmdrt   r   s   &f r   quick_completerr      s=     +s##!'') M-kIr   c                   V P                  R4      p\        V4      pV^8X  d   V^ ,          R8X  d   R.# V^8  d   V^ ,          R9   d   V^8X  d   \        4       # V^,          P                  R4      p\        V4      ^8  d   \        4       # \        RP	                  VRR 4      R4      pV Uu. uF  pRP	                  VRR V.,           4      NK!  	  up# V^8  d%   V^ ,          R8X  d   V^,          p\        V4      # R# R# u upi )	z
Returns a list containing the completion possibilities for an import line.

The line looks like this :
'import xml.d'
'from xml.dom import'
 fromzimport r    NT>   r   import%aimport)r   r-   rT   rz   r*   )linewordsnwordsr`   completion_listels   &     r   module_completionr      s     JJsOEZF {uQx6){ zuQx#AAQ;#%%AhnnS!s8a<#%%$SXXc#2h%7>4CDObSbRD)ODD {uQx6)Ah# *{ Es   /%Dc                ,    \        VP                  4      # )z@Give completions after user has typed 'import ...' or 'from ...')r   r   r}   r~   s   &&r   module_completerr     s     UZZ((r   c                   \        VP                  RR7      p\        V4      ^8  d;   VP                  P                  R4      '       g   VR,          P	                  R4      pMRp\
        P
                  p\        P                  P                  p\        V4      w  r6p\        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       dG   V! VR,           4       Uu. uF,  pVP                  R	R
4      V! V4      '       d   R
MR,           NK.  	  p	pMV! VR,           4       Uu. uF+  q! V4      '       g   K  VP                  R	R
4      R
,           NK-  	  p
pV! VR,           4      V! VR,           4      ,           V! VR,           4      ,           V! VR,           4      ,            Uu. uF  pVP                  R	R
4      NK  	  ppW,           p	V	 Uu. uF  p\        WV4      NK  	  up# u upi u upi u upi u upi )zKComplete files that end in .py or .ipy or .ipynb for the %run command.
    F)strictr   z'"r   c              3   L   "   T F  p\         P                  V4      x  K  	  R # 5ir   )magic_run_rer4   )r   rx   s   & r   r   &magic_run_completer.<locals>.<genexpr>7  s     
0%Q<a  %s   "$T*\/z*.pyz*.ipyz*.ipynbz*.pywr   )r	   r   r-   endswithstripglobr)   r   r+   r   anyreplacer   )r}   r~   compsrelpathlglobr+   tilde_expand	tilde_valr$   matchesr:   pysps   &&           r   magic_run_completerr   !  s    ejj/EE
Q!4!4S!9!9)//%( IIEGGMME'27';$G9 s
0%
0sss
0%
000%*73;%79%7 IId3'%((3CC%7 	 9 493ER3Eaq)		$s#c))3ERwv~.ww1GGgi'()+071B+CDEDA 		$s#D 	 E * @GGw!M!95wGG9 SE Hs$   '#G.G.-G3G3-G8G=c           
     $   \        4       pVP                  pVP                  P                  R4      '       g   RVP                  9   d7   V P                  P                  RR4      pV'       d   VP                  4       # . # VP                  R8X  d   \        \        \        \        VP                  R,          4      ^,           4      4      4      pRV,           R,           p\        VP                  R,          4       UUu. uF  w  rxWgV3,          NK  	  p	pp\        V	4      ^8  d   V	# . # VP                  P                  R	4      '       dH   VP                  R,           U
u. uF)  p
R	\        P                  P                  V
4      ,           NK+  	  up
# \        V4      w  r;pVP!                  R
R4      p. p\"        P"                  ! VR,           4       Uu. uFC  p\        P                  P%                  V4      '       g   K*  VP!                  R
R4      R,           NKE  	  up F!  p
RV
9   d   \&        hVP)                  V
4       K#  	  V'       g   \        P                  P%                  V4      '       d   \+        W;V4      .# V P                  P                  R/ 4      pV Uu. uF'  qP                  VP                  4      '       g   K%  VNK)  	  ppV'       d   V# \&        hV Uu. uF  p\+        VW4      NK  	  up# u uppi u up
i u upi u upi u upi )z:Completer function for cd, which only returns directories.z-bz -b 	bookmarksN-_dhz-%0zd [%s]z--r   r   r   r   )r
   symbolr   r   rF   rG   r1   r   r-   user_ns	enumerate
startswithr)   r   basenamer   r   r   r+   r   r5   r   )r}   r~   rP   r   bkmswidth_dhfmtir   entsdr   r   foundr$   bks	bkmatchesr   s   &&                r   cd_completerr   F  si   	BllG zz4  Fejj$8ww{{;-99;I||ss3s2::e#459:;<h((1"**U2C(DE(D!u(DEt9q=K	||t$$46JJu4EF4Eqrww''***4EFF (37';$G9ood3'GE1573;1G #1GAq! (aiiS!C''1G #!8 MQ# 77==!!!'CDD ggkk+b) #B1||ELL'AQQ	B?DEu!M!\5uEEE F G# C Fs*   =K8/K>'L>L"LL Lc                "    RP                  4       # )zA completer for %reset magicz-f -s in out array dhist)r   r   s   &&r   reset_completerr   |  s    %++--r   )F)*__doc__r   r\   r)   r   rC   	importlibr   importlib.machineryr   r   	zipimportr   	completerr   r   errorr   utils._process_commonr	   IPythonr
   typingr   	_suffixesrK   rO   compiler*   r3   r   r>   rT   ra   rf   rz   r   r   r   r   r   r   r#   r   r   <module>r      s   "   	 	 
 # ,  ! 2  -   
 N	   JJ * yy Ay AAB C	 zz89%P,^	;	!!JJ.J	)"HJ4Fl.r   