class_docstr: The base Jupyter console application.
class_docstr_tok: ["The","base","Jupyter","console","application","."]
docstr: Initialize the kernel manager.
docstr_tok: ["Initialize","the","kernel","manager","."]
code: def init_kernel_manager(self) -> None:
      """Initialize the kernel manager."""
      # Don't let Qt or ZMQ swallow KeyboardInterupts.
      if self.existing:
          self.kernel_manager = None
          return
      signal.signal(signal.SIGINT, signal.SIG_DFL)
  
      # Create a KernelManager and start a kernel.
      try:
          self.kernel_manager = self.kernel_manager_class(
              ip=self.ip,
              session=self.session,
              transport=self.transport,
              shell_port=self.shell_port,
              iopub_port=self.iopub_port,
              stdin_port=self.stdin_port,
              hb_port=self.hb_port,
              control_port=self.control_port,
              connection_file=self.connection_file,
              kernel_name=self.kernel_name,
              parent=self,
              data_dir=self.data_dir,
          )
      except NoSuchKernel:
          self.log.critical(
              "Could not find kernel %s", self.kernel_name
          )
          self.exit(1)  # type:ignore[attr-defined]
  
      self.kernel_manager = t.cast(KernelManager, self.kernel_manager)
      self.kernel_manager.client_factory = self.kernel_client_class
      kwargs = {}
      kwargs["extra_arguments"] = self.kernel_argv
      self.kernel_manager.start_kernel(**kwargs)
      atexit.register(self.kernel_manager.cleanup_ipc_files)
  
      if self.sshserver:
          # ssh, write new connection file
          self.kernel_manager.write_connection_file()
  
      # in case KM defaults / ssh writing changes things:
      km = self.kernel_manager
      self.shell_port = km.shell_port
      self.iopub_port = km.iopub_port
      self.stdin_port = km.stdin_port
      self.hb_port = km.hb_port
      self.control_port = km.control_port
      self.connection_file = km.connection_file
  
      atexit.register(self.kernel_manager.cleanup_connection_file)
  
imports: import atexit
  import os
  import signal
  import sys
  import typing
  import uuid
  import warnings
  from jupyter_core.application import base_aliases, base_flags
  from traitlets import CBool, CUnicode, Dict, List, Type, Unicode
  from traitlets.config.application import boolean_flag
  from .None import KernelManager, connect, find_connection_file, tunnel_to_kernel
  from .blocking import BlockingKernelClient
  from .connect import KernelConnectionInfo
  from .kernelspec import NoSuchKernel
  from .localinterfaces import localhost
  from .restarter import KernelRestarter
  from .session import Session
  from .utils import _filefind
label_desc: Use image node_id 6 for calling the JupyterConsoleApp obj's underlying member method code with example usage: obj.init_kernel_manager() without return types