##// END OF EJS Templates
Make fun_name_regexp and exclude_regexp configurable....
Bradley M. Froehle -
Show More
@@ -35,7 +35,9 b' from IPython.core.macro import Macro'
35 from IPython.core.splitinput import split_user_input, LineInfo
35 from IPython.core.splitinput import split_user_input, LineInfo
36 from IPython.core import page
36 from IPython.core import page
37
37
38 from IPython.utils.traitlets import List, Integer, Any, Unicode, CBool, Bool, Instance
38 from IPython.utils.traitlets import (
39 List, Integer, Any, Unicode, CBool, Bool, Instance, CRegExp
40 )
39 from IPython.utils.autoattr import auto_attr
41 from IPython.utils.autoattr import auto_attr
40
42
41 #-----------------------------------------------------------------------------
43 #-----------------------------------------------------------------------------
@@ -659,6 +661,11 b' class AutocallChecker(PrefilterChecker):'
659
661
660 priority = Integer(1000, config=True)
662 priority = Integer(1000, config=True)
661
663
664 function_name_regexp = CRegExp(re_fun_name, config=True,
665 help="RegExp to identify potential function names.")
666 exclude_regexp = CRegExp(re_exclude_auto, config=True,
667 help="RegExp to exclude strings with this start from autocalling.")
668
662 def check(self, line_info):
669 def check(self, line_info):
663 "Check if the initial word/function is callable and autocall is on."
670 "Check if the initial word/function is callable and autocall is on."
664 if not self.shell.autocall:
671 if not self.shell.autocall:
@@ -669,8 +676,8 b' class AutocallChecker(PrefilterChecker):'
669 return None
676 return None
670
677
671 if callable(oinfo['obj']) \
678 if callable(oinfo['obj']) \
672 and (not re_exclude_auto.match(line_info.the_rest)) \
679 and (not self.exclude_regexp.match(line_info.the_rest)) \
673 and re_fun_name.match(line_info.ifun):
680 and self.function_name_regexp.match(line_info.ifun):
674 return self.prefilter_manager.get_handler_by_name('auto')
681 return self.prefilter_manager.get_handler_by_name('auto')
675 else:
682 else:
676 return None
683 return None
General Comments 0
You need to be logged in to leave comments. Login now