##// END OF EJS Templates
Merge pull request #9468 from Carreau/t42-prefilter...
Thomas Kluyver -
r22334:5ea832c5 merge
parent child Browse files
Show More
@@ -129,7 +129,7 b' class PrefilterManager(Configurable):'
129 or :meth:`sort_transformers` method after changing the priority.
129 or :meth:`sort_transformers` method after changing the priority.
130 """
130 """
131
131
132 multi_line_specials = CBool(True, config=True)
132 multi_line_specials = CBool(True).tag(config=True)
133 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
133 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
134
134
135 def __init__(self, shell=None, **kwargs):
135 def __init__(self, shell=None, **kwargs):
@@ -359,12 +359,12 b' class PrefilterManager(Configurable):'
359 class PrefilterTransformer(Configurable):
359 class PrefilterTransformer(Configurable):
360 """Transform a line of user input."""
360 """Transform a line of user input."""
361
361
362 priority = Integer(100, config=True)
362 priority = Integer(100).tag(config=True)
363 # Transformers don't currently use shell or prefilter_manager, but as we
363 # Transformers don't currently use shell or prefilter_manager, but as we
364 # move away from checkers and handlers, they will need them.
364 # move away from checkers and handlers, they will need them.
365 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
365 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
366 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager', allow_none=True)
366 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager', allow_none=True)
367 enabled = Bool(True, config=True)
367 enabled = Bool(True).tag(config=True)
368
368
369 def __init__(self, shell=None, prefilter_manager=None, **kwargs):
369 def __init__(self, shell=None, prefilter_manager=None, **kwargs):
370 super(PrefilterTransformer, self).__init__(
370 super(PrefilterTransformer, self).__init__(
@@ -389,10 +389,10 b' class PrefilterTransformer(Configurable):'
389 class PrefilterChecker(Configurable):
389 class PrefilterChecker(Configurable):
390 """Inspect an input line and return a handler for that line."""
390 """Inspect an input line and return a handler for that line."""
391
391
392 priority = Integer(100, config=True)
392 priority = Integer(100).tag(config=True)
393 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
393 shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)
394 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager', allow_none=True)
394 prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager', allow_none=True)
395 enabled = Bool(True, config=True)
395 enabled = Bool(True).tag(config=True)
396
396
397 def __init__(self, shell=None, prefilter_manager=None, **kwargs):
397 def __init__(self, shell=None, prefilter_manager=None, **kwargs):
398 super(PrefilterChecker, self).__init__(
398 super(PrefilterChecker, self).__init__(
@@ -411,8 +411,8 b' class PrefilterChecker(Configurable):'
411
411
412 class EmacsChecker(PrefilterChecker):
412 class EmacsChecker(PrefilterChecker):
413
413
414 priority = Integer(100, config=True)
414 priority = Integer(100).tag(config=True)
415 enabled = Bool(False, config=True)
415 enabled = Bool(False).tag(config=True)
416
416
417 def check(self, line_info):
417 def check(self, line_info):
418 "Emacs ipython-mode tags certain input lines."
418 "Emacs ipython-mode tags certain input lines."
@@ -424,7 +424,7 b' class EmacsChecker(PrefilterChecker):'
424
424
425 class MacroChecker(PrefilterChecker):
425 class MacroChecker(PrefilterChecker):
426
426
427 priority = Integer(250, config=True)
427 priority = Integer(250).tag(config=True)
428
428
429 def check(self, line_info):
429 def check(self, line_info):
430 obj = self.shell.user_ns.get(line_info.ifun)
430 obj = self.shell.user_ns.get(line_info.ifun)
@@ -436,7 +436,7 b' class MacroChecker(PrefilterChecker):'
436
436
437 class IPyAutocallChecker(PrefilterChecker):
437 class IPyAutocallChecker(PrefilterChecker):
438
438
439 priority = Integer(300, config=True)
439 priority = Integer(300).tag(config=True)
440
440
441 def check(self, line_info):
441 def check(self, line_info):
442 "Instances of IPyAutocall in user_ns get autocalled immediately"
442 "Instances of IPyAutocall in user_ns get autocalled immediately"
@@ -450,7 +450,7 b' class IPyAutocallChecker(PrefilterChecker):'
450
450
451 class AssignmentChecker(PrefilterChecker):
451 class AssignmentChecker(PrefilterChecker):
452
452
453 priority = Integer(600, config=True)
453 priority = Integer(600).tag(config=True)
454
454
455 def check(self, line_info):
455 def check(self, line_info):
456 """Check to see if user is assigning to a var for the first time, in
456 """Check to see if user is assigning to a var for the first time, in
@@ -468,7 +468,7 b' class AssignmentChecker(PrefilterChecker):'
468
468
469 class AutoMagicChecker(PrefilterChecker):
469 class AutoMagicChecker(PrefilterChecker):
470
470
471 priority = Integer(700, config=True)
471 priority = Integer(700).tag(config=True)
472
472
473 def check(self, line_info):
473 def check(self, line_info):
474 """If the ifun is magic, and automagic is on, run it. Note: normal,
474 """If the ifun is magic, and automagic is on, run it. Note: normal,
@@ -492,7 +492,7 b' class AutoMagicChecker(PrefilterChecker):'
492
492
493 class PythonOpsChecker(PrefilterChecker):
493 class PythonOpsChecker(PrefilterChecker):
494
494
495 priority = Integer(900, config=True)
495 priority = Integer(900).tag(config=True)
496
496
497 def check(self, line_info):
497 def check(self, line_info):
498 """If the 'rest' of the line begins with a function call or pretty much
498 """If the 'rest' of the line begins with a function call or pretty much
@@ -507,11 +507,11 b' class PythonOpsChecker(PrefilterChecker):'
507
507
508 class AutocallChecker(PrefilterChecker):
508 class AutocallChecker(PrefilterChecker):
509
509
510 priority = Integer(1000, config=True)
510 priority = Integer(1000).tag(config=True)
511
511
512 function_name_regexp = CRegExp(re_fun_name, config=True,
512 function_name_regexp = CRegExp(re_fun_name).tag(config=True,
513 help="RegExp to identify potential function names.")
513 help="RegExp to identify potential function names.")
514 exclude_regexp = CRegExp(re_exclude_auto, config=True,
514 exclude_regexp = CRegExp(re_exclude_auto).tag(config=True,
515 help="RegExp to exclude strings with this start from autocalling.")
515 help="RegExp to exclude strings with this start from autocalling.")
516
516
517 def check(self, line_info):
517 def check(self, line_info):
@@ -611,11 +611,9 b' class AutoHandler(PrefilterHandler):'
611 line = line_info.line
611 line = line_info.line
612 ifun = line_info.ifun
612 ifun = line_info.ifun
613 the_rest = line_info.the_rest
613 the_rest = line_info.the_rest
614 pre = line_info.pre
615 esc = line_info.esc
614 esc = line_info.esc
616 continue_prompt = line_info.continue_prompt
615 continue_prompt = line_info.continue_prompt
617 obj = line_info.ofind(self.shell)['obj']
616 obj = line_info.ofind(self.shell)['obj']
618 #print 'pre <%s> ifun <%s> rest <%s>' % (pre,ifun,the_rest) # dbg
619
617
620 # This should only be active for single-line input!
618 # This should only be active for single-line input!
621 if continue_prompt:
619 if continue_prompt:
General Comments 0
You need to be logged in to leave comments. Login now