ž ©ÿfz#c@sÈdZddlZddlZddlZddlmZejejdZe dd ƒ\Z Z ddl m Z ddlmZddlZejZejr±eej7ZnGd d „d ƒZdS( uÖ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. iN(uidleConfu_ii(uAutoCompleteWindow(u HyperParsercBsÔ|EeZdZdd!gfgZejddddddd ƒZd d d „Zd d „Z d dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zd dd„Zdd„Zdd„Zd S("u AutoCompleteuedituShow Completionsu<>u extensionsu popupwaitutypeuintudefaulticCsD||_|dkrdS|j|_d|_d|_d|_dS(N(ueditwinuNoneutextuautocompletewindowu_delayed_completion_idu_delayed_completion_index(uselfueditwin((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyu__init__&s     uAutoComplete.__init__cCstj|jƒS(N(uAutoCompleteWindowutext(uself((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyu_make_autocomplete_window3su&AutoComplete._make_autocomplete_windowcCs&|jr"|jjƒd|_ndS(N(uautocompletewindowu hide_windowuNone(uselfuevent((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyu_remove_autocomplete_window6s  u(AutoComplete._remove_autocomplete_windowcCs|jdddƒdS(uqHappens when the user really wants to open a completion list, even if a function call is needed. NTF(uopen_completionsuTrueuFalse(uselfuevent((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyuforce_open_completions_event;su)AutoComplete.force_open_completions_eventcCs`|jjdƒ}|dkr7|jdddtƒn%|tkr\|jdddtƒndS(u¦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. u insert-1cu.NF(utextugetu_open_completions_lateruFalseuCOMPLETE_ATTRIBUTESuSEPSuCOMPLETE_FILES(uselfueventulastchar((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyutry_open_completions_eventAs   u'AutoComplete.try_open_completions_eventcCsht|dƒr|jrdS|jrE|jjƒrE|jjƒdS|jdddƒ}|rddSdS(u¥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) umc_stateNubreakFT(uhasattrumc_stateuautocompletewindowu is_activeucompleteuopen_completionsuFalseuTrue(uselfueventuopened((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyuautocomplete_eventNs uAutoComplete.autocomplete_eventcGs_|jjdƒ|_|jdk r:|jj|jƒn|jj|j|j|Œ|_dS(Nuinsert( utextuindexu_delayed_completion_indexu_delayed_completion_iduNoneu after_canceluafteru popupwaitu_delayed_open_completions(uselfuargs((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyu_open_completions_later^s u$AutoComplete._open_completions_latercGs9d|_|jjdƒ|jkr(dS|j|ŒdS(Nuinsert(uNoneu_delayed_completion_idutextuindexu_delayed_completion_indexuopen_completions(uselfuargs((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyu_delayed_open_completionsfs u&AutoComplete._delayed_open_completionsc Cs…|jd k r.|jj|jƒd |_nt|jdƒ}|jjddƒ}t|ƒ}}|jƒr| s„|t kr|j ƒt }x,|rÂ||ddt krÂ|d8}q—W|||…} |}x(|r||ddkr|d8}qÜW|||…} n|j ƒr| s6|t kr|j ƒt }xB|rŠ||dtks}t||dƒdkrŠ|d8}qIW|||…} |r ||ddkr |jdt|ƒ|dƒ|jƒ} | s| r| jdƒd krd Sqd } nd S|r/| r/| r/d S|j| |ƒ} | d sOd S|jƒ|_|jj| dt| ƒ|||ƒ S( uXFind 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. uinsertuinsert linestartiu'"iu.u insert-%dcu(Nuiiÿÿÿÿ(u_delayed_completion_iduNoneutextu after_cancelu HyperParserueditwinugetulenu is_in_stringuCOMPLETE_FILESu_remove_autocomplete_windowuSEPSu is_in_codeuCOMPLETE_ATTRIBUTESuID_CHARSuordu set_indexuget_expressionufindufetch_completionsu_make_autocomplete_windowuautocompletewindowu show_window( uselfu evalfuncsucompleteu userWantsWinumodeuhpucurlineuiuju comp_startu comp_whatu comp_lists((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyuopen_completionslsN  ! 7    uAutoComplete.open_completionsc Csíy|jjjjj}Wnd }YnX|rL|jdd||fiƒS|tkrK|dkrÙtj j ƒ}|j tj j ƒt d|ƒ}|jƒd|krÃtt d|ƒƒ}qHdd„|Dƒ}qÐyZ|j|ƒ}t|ƒ}|jƒd|krt|jƒ}ndd„|Dƒ}WqÐggfSYqÐXn…|tkrÐ|dkrld }nyBtjj|ƒ}tj|ƒ}|jƒd d„|Dƒ}WqÐtk rÌggfSYqÐXn|sß|}n||fSd S( uOReturn 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. uexecuget_the_completion_listuudir()u__all__cSs,g|]"}|dd…dkr|‘qS(Niu_((u.0us((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyu Äs u2AutoComplete.fetch_completions..cSs,g|]"}|dd…dkr|‘qS(Niu_((u.0us((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyu Ís u.cSs,g|]"}|dd…dkr|‘qS(Niu.((u.0us((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyu Øs N(ueditwinuflistupyshelluinterpurpccltuNoneu remotecalluCOMPLETE_ATTRIBUTESu__main__u__dict__ucopyuupdateu __builtins__uevalusortusortedu get_entityudiru__all__uCOMPLETE_FILESuosupathu expanduserulistdiruOSError( uselfuwhatumodeurpccltu namespaceubiglusmallluentityu expandedpath((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyufetch_completions§sL                uAutoComplete.fetch_completionscCs,tjjƒ}|jtjƒt||ƒS(uALookup name in a namespace spanning sys.modules and __main.dict__(usysumodulesucopyuupdateu__main__u__dict__ueval(uselfunameu namespace((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyu get_entityàsuAutoComplete.get_entityN(uShow Completionsu<>(u__name__u __module__u __qualname__umenudefsuidleConfu GetOptionu popupwaituNoneu__init__u_make_autocomplete_windowu_remove_autocomplete_windowuforce_open_completions_eventutry_open_completions_eventuautocomplete_eventu_open_completions_lateru_delayed_open_completionsuopen_completionsufetch_completionsu get_entity(u __locals__((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyu AutoCompletes      ; 9u AutoCompletei(u__doc__uosusysustringuidlelib.configHandleruidleConfu ascii_lettersudigitsuID_CHARSurangeuCOMPLETE_ATTRIBUTESuCOMPLETE_FILESuidlelibuAutoCompleteWindowuidlelib.HyperParseru HyperParseru__main__usepuSEPSualtsepu AutoComplete(((u9/opt/alt/python33/lib64/python3.3/idlelib/AutoComplete.pyus