1- """Complete either attribute names or file names.
1+ # Complete either attribute names or file names.
2+
3+ # Either on demand or after a user-selected delay after a key character,
4+ # pop up a list of candidates.
25
3- Either on demand or after a user-selected delay after a key character,
4- pop up a list of candidates.
5- """
66import __main__
77import keyword
88import os
@@ -93,18 +93,17 @@ def try_open_completions_event(self, event=None):
9393 self .popupwait , self ._delayed_open_completions , args )
9494
9595 def _delayed_open_completions (self , args ):
96- " Call open_completions if index unchanged."
96+ # Call open_completions if index unchanged.
9797 self ._delayed_completion_id = None
9898 if self .text .index ("insert" ) == self ._delayed_completion_index :
9999 self .open_completions (args )
100100
101101 def open_completions (self , args ):
102- """Find the completions and create the AutoCompleteWindow.
103- Return True if successful (no syntax error or so found).
104- If complete is True, then if there's nothing to complete and no
105- start of completion, won't open completions and return False.
106- If mode is given, will open a completion list only in this mode.
107- """
102+ # Find the completions and create the AutoCompleteWindow.
103+ # Return True if successful (no syntax error or so found).
104+ # If complete is True, then if there's nothing to complete and no
105+ # start of completion, won't open completions and return False. If mode is given, will open a completion list only in this mode.
106+
108107 evalfuncs , complete , wantwin , mode = args
109108 # Cancel another delayed call, if it exists.
110109 if self ._delayed_completion_id is not None :
@@ -115,11 +114,13 @@ def open_completions(self, args):
115114 curline = self .text .get ("insert linestart" , "insert" )
116115 i = j = len (curline )
117116 if hp .is_in_string () and (not mode or mode == FILES ):
117+
118118 # Find the beginning of the string.
119119 # fetch_completions will look at the file system to determine
120120 # whether the string value constitutes an actual file name
121121 # XXX could consider raw strings here and unescape the string
122122 # value if it's not raw.
123+
123124 self ._remove_autocomplete_window ()
124125 mode = FILES
125126 # Find last separator or string start
@@ -159,17 +160,16 @@ def open_completions(self, args):
159160 complete , mode , wantwin )
160161
161162 def fetch_completions (self , what , mode ):
162- """ Return a pair of lists of completions for something. The first list
163- is a sublist of the second. Both are sorted.
163+ # Return a pair of lists of completions for something. The first list
164+ # is a sublist of the second. Both are sorted.
164165
165- If there is a Python subprocess, get the comp. list there. Otherwise,
166- either fetch_completions() is running in the subprocess itself or it
167- was called in an IDLE EditorWindow before any script had been run.
166+ # If there is a Python subprocess, get the comp. list there. Otherwise,
167+ # either fetch_completions() is running in the subprocess itself or it
168+ # was called in an IDLE EditorWindow before any script had been run.
168169
169- The subprocess environment is that of the most recently run script. If
170- two unrelated modules are being edited some calltips in the current
171- module may be inoperative if the module was not the last to run.
172- """
170+ # The subprocess environment is that of the most recently run script. If
171+ # two unrelated modules are being edited some calltips in the current
172+ # module may be inoperative if the module was not the last to run.
173173 try :
174174 rpcclt = self .editwin .flist .pyshell .interp .rpcclt
175175 except :
@@ -220,7 +220,6 @@ def get_entity(self, name):
220220 "Lookup name in a namespace spanning sys.modules and __main.dict__."
221221 return eval (name , {** sys .modules , ** __main__ .__dict__ })
222222
223-
224223AutoComplete .reload ()
225224
226225if __name__ == '__main__' :
0 commit comments