Exemplo n.º 1
0
    def default(self):
        """
        Return a new default configuration object

        EXAMPLES::

            sage: from sage.repl.configuration import sage_ipython_config
            sage: sage_ipython_config.default()
            {'InteractiveShell': {'colors': ...
        """
        from sage.repl.interpreter import SageTerminalInteractiveShell
        cfg = Config(
            TerminalIPythonApp=Config(
                display_banner=False,
                verbose_crash=True,
                test_shell=False,
                shell_class=SageTerminalInteractiveShell,
            ),
            InteractiveShell=Config(prompts_class=SagePrompts,
                                    ast_node_interactivity='all',
                                    colors=self.colors(),
                                    simple_prompt=self.simple_prompt(),
                                    term_title=self.term_title(),
                                    confirm_exit=False,
                                    separate_in=''),
            InteractiveShellApp=Config(extensions=[SAGE_EXTENSION]),
        )
        if self._doctest_mode():
            # Using the file-backed history causes problems in parallel tests
            cfg.HistoryManager = Config(hist_file=':memory:')
        return cfg
Exemplo n.º 2
0
    def default(self):
        """
        Return a new default configuration object

        EXAMPLES::
        
            sage: from sage.repl.configuration import sage_ipython_config
            sage: sage_ipython_config.default()
            {'InteractiveShell': {'colors': ...
        """
        from sage.repl.interpreter import SageTerminalInteractiveShell
        cfg = Config(
            TerminalIPythonApp=Config(
                display_banner=False,
                verbose_crash=True,
                test_shell=False,
                shell_class=SageTerminalInteractiveShell,
            ),
            InteractiveShell=Config(
                prompts_class=SagePrompts,
                ast_node_interactivity='all',
                colors=self.colors(),
                simple_prompt=self.simple_prompt(),
                term_title=self.term_title(),
                confirm_exit=False,
                separate_in=''
            ),
            InteractiveShellApp=Config(extensions=[SAGE_EXTENSION]),
        )
        if self._doctest_mode():
            # Using the file-backed history causes problems in parallel tests
            cfg.HistoryManager = Config(hist_file=':memory:')
        return cfg
Exemplo n.º 3
0
    def default(self):
        """
        Return a new default configuration object

        EXAMPLES::

            sage: from sage.repl.configuration import sage_ipython_config
            sage: conf = sage_ipython_config.default()
            sage: type(conf)
            <class 'traitlets.config.loader.Config'>
            sage: 'InteractiveShell' in conf
            True
        """
        from sage.repl.interpreter import SageTerminalInteractiveShell

        # Use the same config for both InteractiveShell, and its subclass
        # TerminalInteractiveShell (note: in fact some configs like term_title
        # only apply to the latter, but we can still use the same config for
        # both for simplicity's sake; see Trac #28289)
        InteractiveShell = Config(prompts_class=SagePrompts,
                                  ast_node_interactivity='all',
                                  colors=self.colors(),
                                  simple_prompt=self.simple_prompt(),
                                  term_title=self.term_title(),
                                  confirm_exit=False,
                                  separate_in='')

        cfg = Config(
            TerminalIPythonApp=Config(
                display_banner=False,
                verbose_crash=True,
                test_shell=False,
                shell_class=SageTerminalInteractiveShell,
            ),
            InteractiveShell=InteractiveShell,
            TerminalInteractiveShell=InteractiveShell,
            InteractiveShellApp=Config(extensions=[SAGE_EXTENSION]),
            # TODO: jedi is disabled by default because it causes too many troubles
            # disabling ticket: https://trac.sagemath.org/ticket/31648
            # reenabling ticket: https://trac.sagemath.org/ticket/31649
            IPCompleter=Config(use_jedi=False),
        )
        if self._doctest_mode():
            # Using the file-backed history causes problems in parallel tests
            cfg.HistoryManager = Config(hist_file=':memory:')
        return cfg