Ñò
§ÚêLc
@ så d Z d d k Z d d k Z d d k Z d d k l Z e i e i e i d Z e i e i d Z
e d d ƒ \ Z Z
d d k l Z d d k l Z d d k Z e i Z e i o e e i 7Z n d
d
d „ ƒ YZ d S( sÖ AutoComplete.py - An IDLE extension for automatically completing names.
This extension can complete either attribute names of file names. It can pop
a window with all available names, for the user to select from.
iÿÿÿÿN( t idleConfs ._~#$:-t _i i ( t AutoCompleteWindow( t HyperParsert AutoCompletec B s§ e Z d d g f g Z e i d d d d d d d ƒZ d d
„ Z d „ Z d d „ Z d
„ Z
d „ Z d „ Z d „ Z
d „ Z d d „ Z d „ Z d „ Z RS( t edits Show Completionss <>t
extensionsR t popupwaitt typet intt defaulti c C sF | | _ | d j o d S| i | _ d | _ d | _ d | _ d S( N( t editwint Nonet textt autocompletewindowt _delayed_completion_idt _delayed_completion_index( t selfR ( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyt __init__) s
c C s t i | i ƒ S( N( R R
( R ( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyt _make_autocomplete_window6 s c C s( | i o | i i ƒ d | _ n d S( N( R t hide_windowR ( R t event( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyt _remove_autocomplete_window9 s
c C s | i t t t ƒ d S( sq Happens when the user really wants to open a completion list, even
if a function call is needed.
N( t open_completionst Truet False( R R ( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyt force_open_completions_event> s c C sd | i i d ƒ } | d j o | i t t t t ƒ n( | t j o | i t t t t ƒ n d S( s¦ Happens when it would be nice to open a completion list, but not
really necessary, for example after an dot, so function
calls won't be made.
s insert-1ct .N( R
t gett _open_completions_laterR t COMPLETE_ATTRIBUTESt SEPSt COMPLETE_FILES( R R t lastchar( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyt try_open_completions_eventD s
c C sp t | d ƒ o | i o d S| i o" | i i ƒ o | i i ƒ d S| i t t t ƒ } | o d Sd S( s¥ Happens when the user wants to complete his word, and if necessary,
open a completion list after that (if there is more than one
completion)
t mc_stateNt break( t hasattrR# R t is_activet completeR R R ( R R t opened( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyt autocomplete_eventQ s
c G sa | i i d ƒ | _ | i d j o | i i | i ƒ n | i i | i | i | Œ | _ d S( Nt insert( R
t indexR R R t after_cancelt afterR t _delayed_open_completions( R t args( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyR a s
c G s; d | _ | i i d ƒ | i j o d S| i | Œ d S( NR* ( R R R
R+ R R ( R R/ ( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyR. i s c C s… | i d j o | i i | i ƒ d | _ n t | i d ƒ } | i i d d ƒ } t | ƒ } } | i ƒ o© | p
| t j o” | i
ƒ t } x+ | o# | | d t j o | d 8} qœ W| | | !} | } x/ | o' | | d t t j o | d 8} qÝ W| | | !}
nò | i
ƒ oà | p
| t j oË | i
ƒ t } x+ | o# | | d t j o | d 8} qRW| | | !} | oo | | d d j oZ | i d t | ƒ | d ƒ | i ƒ }
|
p | o |
i d ƒ d j o d Sqd }
n d S| o |
o
| o d S| i |
| ƒ } | d
p d S| i ƒ | _ | i i | d t | ƒ | | | ƒ t S( sX Find the completions and create the AutoCompleteWindow.
Return True if successful (no syntax error or so found).
if complete is True, then if there's nothing to complete and no
start of completion, won't open completions and return False.
If mode is given, will open a completion list only in this mode.
R* s insert linestarti R s
insert-%dct (iÿÿÿÿNt i ( R R R
R, R R R t lent is_in_stringR R t FILENAME_CHARSR t
is_in_codeR t ID_CHARSt set_indext get_expressiont findt fetch_completionsR R t show_windowR ( R t evalfuncsR' t userWantsWint modet hpt curlinet it jt
comp_startt comp_whatt
comp_lists( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyR o sZ
"
"
c
C sg y | i i i i i } Wn
d } n X| o | i d d | | f h ƒ S| t j oD| d j oŸ t i i
ƒ } | i t i i ƒ t
d | ƒ } | i ƒ d | j o t
d | ƒ } | i ƒ qšg } | D]" } | d d j o | | q× q× ~ } qHyƒ | i | ƒ } t | ƒ } | i ƒ d | j o | i } | i ƒ n7 g }
| D]" } | d d j o |
| q]q]~
} WqHg g f SXn« | t j o | d j o
d } n ye t i i | ƒ } t i | ƒ } | i ƒ g } | D]" } | d d j o | | qûqû~ } WqHt j
o g g f SXn | p
| } n | | f Sd S(
sO Return a pair of lists of completions for something. The first list
is a sublist of the second. Both are sorted.
If there is a Python subprocess, get the comp. list there. Otherwise,
either fetch_completions() is running in the subprocess itself or it
was called in an IDLE EditorWindow before any script had been run.
The subprocess environment is that of the most recently run script. If
two unrelated modules are being edited some calltips in the current
module may be inoperative if the module was not the last to run.
t exect get_the_completion_listR1 s dir()t __all__i R R N( R t flistt pyshellt interpt rpccltR t
remotecallR t __main__t __dict__t copyt updatet __builtins__t evalt sortt
get_entityt dirRH R t ost patht
expandusert listdirt OSError(
R t whatR> RL t namespacet biglt smalllt _[1]t st entityt _[2]t expandedpatht _[3]( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyR: ¦ sP
:
:
:
c C s, t i i ƒ } | i t i ƒ t | | ƒ S( sA Lookup name in a namespace spanning sys.modules and __main.dict__( t syst modulesRP RQ RN RO RS ( R t nameR] ( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyRU á s ( s Show Completionss <>N( t __name__t
__module__t menudefsR t GetOptionR R R R R R R" R) R R. R R: RU ( ( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyR s
7 ;i ( ( t __doc__RW Rf t stringt idlelib.configHandlerR t
ascii_letterst digitst curdirR4 R6 t rangeR R t idlelibR t idlelib.HyperParserR RN t sepR t altsepR ( ( ( s, /usr/lib64/python2.6/idlelib/AutoComplete.pyt s