Show More
@@ -140,8 +140,8 b' def prefilter(line_info, ip):' | |||||
140 | checkEscChars, |
|
140 | checkEscChars, | |
141 | checkAssignment, |
|
141 | checkAssignment, | |
142 | checkAutomagic, |
|
142 | checkAutomagic, | |
143 | checkPythonOps, |
|
|||
144 | checkAlias, |
|
143 | checkAlias, | |
|
144 | checkPythonOps, | |||
145 | checkAutocall, |
|
145 | checkAutocall, | |
146 | ]: |
|
146 | ]: | |
147 | handler = check(line_info, ip) |
|
147 | handler = check(line_info, ip) | |
@@ -238,17 +238,6 b' def checkAutomagic(l_info,ip):' | |||||
238 | return ip.handle_magic |
|
238 | return ip.handle_magic | |
239 |
|
239 | |||
240 |
|
240 | |||
241 | def checkPythonOps(l_info,ip): |
|
|||
242 | """If the 'rest' of the line begins with a function call or pretty much |
|
|||
243 | any python operator, we should simply execute the line (regardless of |
|
|||
244 | whether or not there's a possible alias or autocall expansion). This |
|
|||
245 | avoids spurious (and very confusing) geattr() accesses.""" |
|
|||
246 | if l_info.theRest and l_info.theRest[0] in '!=()<>,+*/%^&|': |
|
|||
247 | return ip.handle_normal |
|
|||
248 | else: |
|
|||
249 | return None |
|
|||
250 |
|
||||
251 |
|
||||
252 | def checkAlias(l_info,ip): |
|
241 | def checkAlias(l_info,ip): | |
253 | "Check if the initital identifier on the line is an alias." |
|
242 | "Check if the initital identifier on the line is an alias." | |
254 | # Note: aliases can not contain '.' |
|
243 | # Note: aliases can not contain '.' | |
@@ -262,6 +251,17 b' def checkAlias(l_info,ip):' | |||||
262 | return ip.handle_alias |
|
251 | return ip.handle_alias | |
263 |
|
252 | |||
264 |
|
253 | |||
|
254 | def checkPythonOps(l_info,ip): | |||
|
255 | """If the 'rest' of the line begins with a function call or pretty much | |||
|
256 | any python operator, we should simply execute the line (regardless of | |||
|
257 | whether or not there's a possible autocall expansion). This avoids | |||
|
258 | spurious (and very confusing) geattr() accesses.""" | |||
|
259 | if l_info.theRest and l_info.theRest[0] in '!=()<>,+*/%^&|': | |||
|
260 | return ip.handle_normal | |||
|
261 | else: | |||
|
262 | return None | |||
|
263 | ||||
|
264 | ||||
265 | def checkAutocall(l_info,ip): |
|
265 | def checkAutocall(l_info,ip): | |
266 | "Check if the initial word/function is callable and autocall is on." |
|
266 | "Check if the initial word/function is callable and autocall is on." | |
267 | if not ip.rc.autocall: |
|
267 | if not ip.rc.autocall: |
@@ -292,6 +292,7 b' for ac_state in [0,1]:' | |||||
292 | # XXX See note above |
|
292 | # XXX See note above | |
293 | #("alias_head.with_dot unshadowed, autocall=%s" % ac_state, handle_alias), |
|
293 | #("alias_head.with_dot unshadowed, autocall=%s" % ac_state, handle_alias), | |
294 | ("alias_cmd.something aliases must match whole expr", handle_normal), |
|
294 | ("alias_cmd.something aliases must match whole expr", handle_normal), | |
|
295 | ("alias_cmd /", handle_alias), | |||
295 | ]) |
|
296 | ]) | |
296 |
|
297 | |||
297 | for ns in [ip.user_ns, ip.IP.internal_ns, __builtin__.__dict__ ]: |
|
298 | for ns in [ip.user_ns, ip.IP.internal_ns, __builtin__.__dict__ ]: |
General Comments 0
You need to be logged in to leave comments.
Login now