class_docstr: Mixin for configurable classes that work with connection files
class_docstr_tok: ["Mixin","for","configurable","classes","that","work","with","connection","files"]
docstr: Return the connection info as a dict
  
  Parameters
  ----------
  session : bool [default: False]
      If True, return our session object will be included in the connection info.
      If False (default), the configuration parameters of our session object will be included,
      rather than the session object itself.
  
  Returns
  -------
  connect_info : dict
      dictionary of connection information.
docstr_tok: ["Return","the","connection","info","as","a","dict","Parameters","--","--","--","--","--","session",":","bool","[","default",":","False","]","If","True",",","return","our","session","object","will","be","included","in","the","connection","info",".","If","False","(","default",")",",","the","configuration","parameters","of","our","session","object","will","be","included",",","rather","than","the","session","object","itself",".","Returns","--","--","--","-","connect_info",":","dict","dictionary","of","connection","information","."]
code: def get_connection_info(
      self, session: bool = False
  ) -> KernelConnectionInfo:
      """Return the connection info as a dict
  
      Parameters
      ----------
      session : bool [default: False]
          If True, return our session object will be included in the connection info.
          If False (default), the configuration parameters of our session object will be included,
          rather than the session object itself.
  
      Returns
      -------
      connect_info : dict
          dictionary of connection information.
      """
      info = {
          "transport": self.transport,
          "ip": self.ip,
          "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,
      }
      if session:
          # add *clone* of my session,
          # so that state such as digest_history is not shared.
          info["session"] = self.session.clone()
      else:
          # add session info
          info.update(
              {
                  "signature_scheme": self.session.signature_scheme,
                  "key": self.session.key,
              }
          )
      return info
  
imports: from __future__ import annotations
  import errno
  import glob
  import json
  import os
  import socket
  import stat
  import tempfile
  import warnings
  from getpass import getpass
  from typing import TYPE_CHECKING, Any, Dict, Union, cast
  import zmq
  from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write
  from traitlets import Bool, CaselessStrEnum, Instance, Integer, Type, Unicode, observe
  from traitlets.config import LoggingConfigurable, SingletonConfigurable
  from .localinterfaces import localhost
  from .utils import _filefind
label_desc: Use image node_id 6 for calling the ConnectionFileMixin obj's underlying member method code with example usage: obj.get_connection_info(session) and returns: info