##// END OF EJS Templates
core.completer: Clean up excessive and unused code....
Bradley M. Froehle -
Show More
@@ -130,19 +130,6 b' def protect_filename(s):'
130 return "".join([(ch in PROTECTABLES and '\\' + ch or ch)
130 return "".join([(ch in PROTECTABLES and '\\' + ch or ch)
131 for ch in s])
131 for ch in s])
132
132
133
134 def mark_dirs(matches):
135 """Mark directories in input list by appending '/' to their names."""
136 out = []
137 isdir = os.path.isdir
138 for x in matches:
139 if isdir(x):
140 out.append(x+'/')
141 else:
142 out.append(x)
143 return out
144
145
146 def expand_user(path):
133 def expand_user(path):
147 """Expand '~'-style usernames in strings.
134 """Expand '~'-style usernames in strings.
148
135
@@ -191,28 +178,6 b' def compress_user(path, tilde_expand, tilde_val):'
191 else:
178 else:
192 return path
179 return path
193
180
194
195 def single_dir_expand(matches):
196 "Recursively expand match lists containing a single dir."
197
198 if len(matches) == 1 and os.path.isdir(matches[0]):
199 # Takes care of links to directories also. Use '/'
200 # explicitly, even under Windows, so that name completions
201 # don't end up escaped.
202 d = matches[0]
203 if d[-1] in ['/','\\']:
204 d = d[:-1]
205
206 subdirs = os.listdir(d)
207 if subdirs:
208 matches = [ (d + '/' + p) for p in subdirs]
209 return single_dir_expand(matches)
210 else:
211 return matches
212 else:
213 return matches
214
215
216 class Bunch(object): pass
181 class Bunch(object): pass
217
182
218 DELIMS = ' \t\n`!@#$^&*()=+[{]}\\|;:\'",<>?'
183 DELIMS = ' \t\n`!@#$^&*()=+[{]}\\|;:\'",<>?'
@@ -604,7 +569,10 b' class IPCompleter(Completer):'
604 protect_filename(f) for f in m0]
569 protect_filename(f) for f in m0]
605
570
606 #io.rprint('mm', matches) # dbg
571 #io.rprint('mm', matches) # dbg
607 return mark_dirs(matches)
572
573 # Mark directories in input list by appending '/' to their names.
574 matches = [x+'/' if os.path.isdir(x) else x for x in matches]
575 return matches
608
576
609 def magic_matches(self, text):
577 def magic_matches(self, text):
610 """Match magics"""
578 """Match magics"""
General Comments 0
You need to be logged in to leave comments. Login now