environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py
def _handle_cell_magic(self, lines):
        """Process lines when they start with %%, which marks cell magics.
        """
        self.processing_cell_magic = True
        first, _, body = lines.partition('\n')
        magic_name, _, line = first.partition(' ')
        magic_name = magic_name.lstrip(ESC_MAGIC)
        # We store the body of the cell and create a call to a method that
        # will use this stored value. This is ugly, but it's a first cut to
        # get it all working, as right now changing the return API of our
        # methods would require major refactoring.
        self.cell_magic_parts = [body]
        tpl = 'get_ipython()._run_cached_cell_magic(%r, %r)'
        tlines = tpl % (magic_name, line)
        self._store(tlines)
        self._store(lines, self._buffer_raw, 'source_raw')
        # We can actually choose whether to allow for single blank lines here
        # during input for clients that use cell mode to decide when to stop
        # pushing input (currently only the Qt console).
        # My first implementation did that, and then I realized it wasn't
        # consistent with the terminal behavior, so I've reverted it to one
        # line.  But I'm leaving it here so we can easily test both behaviors,
        # I kind of liked having full blank lines allowed in the cell magics...
        #self._is_complete = last_two_blanks(lines)
        self._is_complete = last_blank(lines)
        return self._is_complete
def _handle_cell_magic(self, lines):
        """Process lines when they start with %%, which marks cell magics.
        """
        self.processing_cell_magic = True
        first, _, body = lines.partition('\n')
        magic_name, _, line = first.partition(' ')
        magic_name = magic_name.lstrip(ESC_MAGIC)
        # We store the body of the cell and create a call to a method that
        # will use this stored value. This is ugly, but it's a first cut to
        # get it all working, as right now changing the return API of our
        # methods would require major refactoring.
        self.cell_magic_parts = [body]
        tpl = 'get_ipython()._run_cached_cell_magic(%r, %r)'
        tlines = tpl % (magic_name, line)
        self._store(tlines)
        self._store(lines, self._buffer_raw, 'source_raw')
        # We can actually choose whether to allow for single blank lines here
        # during input for clients that use cell mode to decide when to stop
        # pushing input (currently only the Qt console).
        # My first implementation did that, and then I realized it wasn't
        # consistent with the terminal behavior, so I've reverted it to one
        # line.  But I'm leaving it here so we can easily test both behaviors,
        # I kind of liked having full blank lines allowed in the cell magics...
        #self._is_complete = last_two_blanks(lines)
        self._is_complete = last_blank(lines)
        return self._is_complete
Process lines when they start with %%, which marks cell magics.