##// END OF EJS Templates
Warn that blck transformer will break complete-input detection....
Matthias Bussonnier -
Show More
@@ -24,6 +24,7 b' import sys'
24 24 import tokenize
25 25 import warnings
26 26
27 from IPython.utils.py3compat import cast_unicode
27 28 from IPython.core.inputtransformer import (leading_indent,
28 29 classic_prompt,
29 30 ipy_prompt,
@@ -686,6 +687,7 b' class IPythonInputSplitter(InputSplitter):'
686 687 """
687 688
688 689 # We must ensure all input is pure unicode
690 lines = cast_unicode(lines, self.encoding)
689 691 # ''.splitlines() --> [], but we need to push the empty line to transformers
690 692 lines_list = lines.splitlines()
691 693 if not lines_list:
@@ -74,6 +74,13 b' function.'
74 74 Transforming a full block
75 75 -------------------------
76 76
77 .. warning::
78
79 Transforming a full block at once will break the automatic detection of
80 wether a block of code is complete in interface relying on this
81 functionality, as for example terminal IPython. You will need to use a
82 shortcut to force-execute your cells.
83
77 84 Transforming a full block of python code is possible by implementing a
78 85 :class:`~IPython.core.inputtransformer.Inputtransformer` and overwriting the
79 86 ``push`` and ``reset`` methods. The reset method should send the full block of
@@ -108,9 +115,11 b' should give up any code it has accumulated.'
108 115 You may use :meth:`CoroutineInputTransformer.wrap` to simplify the creation of
109 116 such a transformer.
110 117
111 Here is a simple :class:`CoroutineInputTransformer` that can be though of be
118 Here is a simple :class:`CoroutineInputTransformer` that can be thought of
112 119 being the identity::
113 120
121 from IPython.core.inputtransformer import CoroutineInputTransformer
122
114 123 @CoroutineInputTransformer.wrap
115 124 def noop():
116 125 line = ''
General Comments 0
You need to be logged in to leave comments. Login now