Beispiel #1
0
def comms(kernel):
    """Get the comms"""
    commA = dummyComm()
    commB = dummyComm()
    commA.other = commB
    commB.other = commA

    frontend_comm = FrontendComm(kernel)
    kernel_comm = KernelComm()

    class DummyKernelClient():
        comm_channel = None

    kernel_comm.kernel_client = DummyKernelClient()

    kernel_comm._register_comm(commA)

    # Bypass the target system as this is not what is being tested
    frontend_comm._comm_open(commB,
                             {'content': {
                                 'data': {
                                     'pickle_protocol': 2
                                 }
                             }})

    return (kernel_comm, frontend_comm)
Beispiel #2
0
def comms(kernel):
    """Get the comms"""
    commA = dummyComm()
    commB = dummyComm()
    commA.other = commB
    commB.other = commA

    frontend_comm = FrontendComm(kernel)
    kernel_comm = KernelComm()

    def dummy_set_comm_port(port):
        """There is no port to set."""
        pass

    kernel_comm.register_call_handler('_set_comm_port', dummy_set_comm_port)

    class DummyKernelClient():
        comm_channel = 0
        shell_channel = 0

    kernel_comm.kernel_client = DummyKernelClient()

    kernel_comm._register_comm(commA)

    # Bypass the target system as this is not what is being tested
    frontend_comm._comm_open(commB,
                             {'content': {'data': {'pickle_protocol': 2}}})

    return (kernel_comm, frontend_comm)
Beispiel #3
0
    def __init__(self, *args, **kwargs):
        super(SpyderKernel, self).__init__(*args, **kwargs)

        self.frontend_comm = FrontendComm(self)

        # All functions that can be called through the comm
        handlers = {
            'set_breakpoints': self.set_spyder_breakpoints,
            'set_pdb_ignore_lib': self.set_pdb_ignore_lib,
            'set_pdb_execute_events': self.set_pdb_execute_events,
            'set_pdb_use_exclamation_mark': self.set_pdb_use_exclamation_mark,
            'get_value': self.get_value,
            'load_data': self.load_data,
            'save_namespace': self.save_namespace,
            'is_defined': self.is_defined,
            'get_doc': self.get_doc,
            'get_source': self.get_source,
            'set_value': self.set_value,
            'remove_value': self.remove_value,
            'copy_value': self.copy_value,
            'set_cwd': self.set_cwd,
            'get_cwd': self.get_cwd,
            'get_syspath': self.get_syspath,
            'get_env': self.get_env,
            'close_all_mpl_figures': self.close_all_mpl_figures,
            'show_mpl_backend_errors': self.show_mpl_backend_errors,
            'get_namespace_view': self.get_namespace_view,
            'set_namespace_view_settings': self.set_namespace_view_settings,
            'get_var_properties': self.get_var_properties,
            'set_sympy_forecolor': self.set_sympy_forecolor,
            'update_syspath': self.update_syspath,
            'is_special_kernel_valid': self.is_special_kernel_valid,
            'get_matplotlib_backend': self.get_matplotlib_backend,
            'set_matplotlib_backend': self.set_matplotlib_backend,
            'set_mpl_inline_figure_format': self.set_mpl_inline_figure_format,
            'set_mpl_inline_resolution': self.set_mpl_inline_resolution,
            'set_mpl_inline_figure_size': self.set_mpl_inline_figure_size,
            'set_mpl_inline_bbox_inches': self.set_mpl_inline_bbox_inches,
            'set_jedi_completer': self.set_jedi_completer,
            'set_greedy_completer': self.set_greedy_completer,
            'set_autocall': self.set_autocall,
            'pdb_input_reply': self.pdb_input_reply,
            '_interrupt_eventloop': self._interrupt_eventloop,
        }
        for call_id in handlers:
            self.frontend_comm.register_call_handler(call_id,
                                                     handlers[call_id])

        self.namespace_view_settings = {}

        self._pdb_obj = None
        self._pdb_step = None
        self._do_publish_pdb_state = True
        self._mpl_backend_error = None
        self._running_namespace = None
        self._pdb_input_line = None
        self.shell.get_local_scope = self.get_local_scope
Beispiel #4
0
    def __init__(self, *args, **kwargs):
        super(SpyderKernel, self).__init__(*args, **kwargs)

        self.comm_manager.get_comm = self._get_comm
        self.frontend_comm = FrontendComm(self)

        # All functions that can be called through the comm
        handlers = {
            'set_breakpoints': self.set_spyder_breakpoints,
            'set_pdb_ignore_lib': self.set_pdb_ignore_lib,
            'set_pdb_execute_events': self.set_pdb_execute_events,
            'set_pdb_use_exclamation_mark': self.set_pdb_use_exclamation_mark,
            'get_value': self.get_value,
            'load_data': self.load_data,
            'save_namespace': self.save_namespace,
            'is_defined': self.is_defined,
            'get_doc': self.get_doc,
            'get_source': self.get_source,
            'set_value': self.set_value,
            'remove_value': self.remove_value,
            'copy_value': self.copy_value,
            'set_cwd': self.set_cwd,
            'get_cwd': self.get_cwd,
            'get_syspath': self.get_syspath,
            'get_env': self.get_env,
            'close_all_mpl_figures': self.close_all_mpl_figures,
            'show_mpl_backend_errors': self.show_mpl_backend_errors,
            'get_namespace_view': self.get_namespace_view,
            'set_namespace_view_settings': self.set_namespace_view_settings,
            'get_var_properties': self.get_var_properties,
            'set_sympy_forecolor': self.set_sympy_forecolor,
            'update_syspath': self.update_syspath,
            'is_special_kernel_valid': self.is_special_kernel_valid,
            'get_matplotlib_backend': self.get_matplotlib_backend,
            'get_mpl_interactive_backend': self.get_mpl_interactive_backend,
            'pdb_input_reply': self.pdb_input_reply,
            '_interrupt_eventloop': self._interrupt_eventloop,
            'enable_faulthandler': self.enable_faulthandler,
            "flush_std": self.flush_std,
            'get_current_frames': self.get_current_frames,
        }
        for call_id in handlers:
            self.frontend_comm.register_call_handler(call_id,
                                                     handlers[call_id])

        self.namespace_view_settings = {}
        self._mpl_backend_error = None
        self._running_namespace = None
        self.faulthandler_handle = None

        self.control_handlers['comm_msg'] = self.control_comm_msg
        self.control_handlers['complete_request'] = self.shell_handlers[
            'complete_request']
Beispiel #5
0
    def __init__(self, *args, **kwargs):
        super(SpyderKernel, self).__init__(*args, **kwargs)

        self.frontend_comm = FrontendComm(self)

        # All functions that can be called through the comm
        handlers = {
            'set_breakpoints': self.set_spyder_breakpoints,
            'set_pdb_ignore_lib': self.set_pdb_ignore_lib,
            'set_pdb_execute_events': self.set_pdb_execute_events,
            'get_value': self.get_value,
            'load_data': self.load_data,
            'save_namespace': self.save_namespace,
            'is_defined': self.is_defined,
            'get_doc': self.get_doc,
            'get_source': self.get_source,
            'set_value': self.set_value,
            'remove_value': self.remove_value,
            'copy_value': self.copy_value,
            'set_cwd': self.set_cwd,
            'get_cwd': self.get_cwd,
            'get_syspath': self.get_syspath,
            'get_env': self.get_env,
            'close_all_mpl_figures': self.close_all_mpl_figures,
            'show_mpl_backend_errors': self.show_mpl_backend_errors,
            'get_namespace_view': self.get_namespace_view,
            'set_namespace_view_settings': self.set_namespace_view_settings,
            'get_var_properties': self.get_var_properties,
            'set_sympy_forecolor': self.set_sympy_forecolor,
            'set_pdb_echo_code': self.set_pdb_echo_code,
            'update_syspath': self.update_syspath,
            'is_special_kernel_valid': self.is_special_kernel_valid
            }
        for call_id in handlers:
            self.frontend_comm.register_call_handler(
                call_id, handlers[call_id])

        self.namespace_view_settings = {}

        self._pdb_obj = None
        self._pdb_step = None
        self._pdb_print_code = True
        self._do_publish_pdb_state = True
        self._mpl_backend_error = None
        self._running_namespace = None
        self.shell.get_local_scope = self.get_local_scope