class_docstr: Magics for talking to scripts
  
  This defines a base `%%script` cell magic for running a cell
  with a program in a subprocess, and registers a few top-level
  magics that call %%script with common interpreters.
class_docstr_tok: ["Magics","for","talking","to","scripts","This","defines","a","base","`","%","%","script","`","cell","magic","for","running","a","cell","with","a","program","in","a","subprocess",",","and","registers","a","few","top-level","magics","that","call","%","%","script","with","common","interpreters","."]
docstr: Kill all BG processes which are still running.
docstr_tok: ["Kill","all","BG","processes","which","are","still","running","."]
code: def kill_bg_processes(self):
      """Kill all BG processes which are still running."""
      if not self.bg_processes:
          return
      for p in self.bg_processes:
          if p.poll() is None:
              try:
                  p.send_signal(signal.SIGINT)
              except:
                  pass
      time.sleep(0.1)
      self._gc_bg_processes()
      if not self.bg_processes:
          return
      for p in self.bg_processes:
          if p.poll() is None:
              try:
                  p.terminate()
              except:
                  pass
      time.sleep(0.1)
      self._gc_bg_processes()
      if not self.bg_processes:
          return
      for p in self.bg_processes:
          if p.poll() is None:
              try:
                  p.kill()
              except:
                  pass
      self._gc_bg_processes()
  
imports: from __future__ import print_function
  import errno
  import os
  import sys
  import signal
  import time
  from subprocess import Popen, PIPE
  import atexit
  from IPython.core import magic_arguments
  from IPython.core.magic import Magics, magics_class, line_magic, cell_magic
  from IPython.lib.backgroundjobs import BackgroundJobManager
  from IPython.utils import py3compat
  from IPython.utils.process import arg_split
  from traitlets import List, Dict, default
label_desc: Use image node_id 9 for calling the ScriptMagics obj's underlying member method code with example usage: obj.kill_bg_processes() without return types