コード例 #1
0
ファイル: inputsplitter.py プロジェクト: pyarnold/ipython
    def __init__(self, line_input_checker=True, physical_line_transforms=None,
                 logical_line_transforms=None, python_line_transforms=None):
        super(IPythonInputSplitter, self).__init__()
        self._buffer_raw = []
        self._validate = True

        if physical_line_transforms is not None:
            self.physical_line_transforms = physical_line_transforms
        else:
            self.physical_line_transforms = [
                leading_indent(),
                classic_prompt(),
                ipy_prompt(),
                strip_encoding_cookie(),
                cellmagic(end_on_blank_line=line_input_checker),
            ]

        self.assemble_logical_lines = assemble_logical_lines()
        if logical_line_transforms is not None:
            self.logical_line_transforms = logical_line_transforms
        else:
            self.logical_line_transforms = [
                help_end(),
                escaped_commands(),
                assign_from_magic(),
                assign_from_system(),
            ]

        self.assemble_python_lines = assemble_python_lines()
        if python_line_transforms is not None:
            self.python_line_transforms = python_line_transforms
        else:
            # We don't use any of these at present
            self.python_line_transforms = []
コード例 #2
0
    def __init__(self,
                 line_input_checker=True,
                 physical_line_transforms=None,
                 logical_line_transforms=None,
                 python_line_transforms=None):
        super(IPythonInputSplitter, self).__init__()
        self._buffer_raw = []
        self._validate = True

        if physical_line_transforms is not None:
            self.physical_line_transforms = physical_line_transforms
        else:
            self.physical_line_transforms = [
                leading_indent(),
                classic_prompt(),
                ipy_prompt(),
                cellmagic(end_on_blank_line=line_input_checker),
                strip_encoding_cookie(),
            ]

        self.assemble_logical_lines = assemble_logical_lines()
        if logical_line_transforms is not None:
            self.logical_line_transforms = logical_line_transforms
        else:
            self.logical_line_transforms = [
                help_end(),
                escaped_commands(),
                assign_from_magic(),
                assign_from_system(),
            ]

        self.assemble_python_lines = assemble_python_lines()
        if python_line_transforms is not None:
            self.python_line_transforms = python_line_transforms
        else:
            # We don't use any of these at present
            self.python_line_transforms = []