docstr: Make a new demo object.  To run the demo, simply call the object.
  
  See the module docstring for full details and an example (you can use
  IPython.Demo? in IPython to see it).
  
  Inputs:
  
    - src is either a file, or file-like object, or a
        string that can be resolved to a filename.
  
  Optional inputs:
  
    - title: a string to use as the demo name.  Of most use when the demo
      you are making comes from an object that has no filename, or if you
      want an alternate denotation distinct from the filename.
  
    - arg_str(''): a string of arguments, internally converted to a list
      just like sys.argv, so the demo script can see a similar
      environment.
  
    - auto_all(None): global flag to run all blocks automatically without
      confirmation.  This attribute overrides the block-level tags and
      applies to the whole demo.  It is an attribute of the object, and
      can be changed at runtime simply by reassigning it to a boolean
      value.
    
docstr_tok: ["Make","a","new","demo","object",".","To","run","the","demo",",","simply","call","the","object",".","See","the","module","docstring","for","full","details","and","an","example","(","you","can","use","IPython.Demo","?","in","IPython","to","see","it",")",".","Inputs",":","-","src","is","either","a","file",",","or","file-like","object",",","or","a","string","that","can","be","resolved","to","a","filename",".","Optional","inputs",":","-","title",":","a","string","to","use","as","the","demo","name",".","Of","most","use","when","the","demo","you","are","making","comes","from","an","object","that","has","no","filename",",","or","if","you","want","an","alternate","denotation","distinct","from","the","filename",".","-","arg_str","(","``",")",":","a","string","of","arguments",",","internally","converted","to","a","list","just","like","sys.argv",",","so","the","demo","script","can","see","a","similar","environment",".","-","auto_all","(","None",")",":","global","flag","to","run","all","blocks","automatically","without","confirmation",".","This","attribute","overrides","the","block-level","tags","and","applies","to","the","whole","demo",".","It","is","an","attribute","of","the","object",",","and","can","be","changed","at","runtime","simply","by","reassigning","it","to","a","boolean","value","."]
code: def __init__(self, src, title="", arg_str="", auto_all=None):
      """Make a new demo object.  To run the demo, simply call the object.
  
      See the module docstring for full details and an example (you can use
      IPython.Demo? in IPython to see it).
  
      Inputs:
  
        - src is either a file, or file-like object, or a
            string that can be resolved to a filename.
  
      Optional inputs:
  
        - title: a string to use as the demo name.  Of most use when the demo
          you are making comes from an object that has no filename, or if you
          want an alternate denotation distinct from the filename.
  
        - arg_str(''): a string of arguments, internally converted to a list
          just like sys.argv, so the demo script can see a similar
          environment.
  
        - auto_all(None): global flag to run all blocks automatically without
          confirmation.  This attribute overrides the block-level tags and
          applies to the whole demo.  It is an attribute of the object, and
          can be changed at runtime simply by reassigning it to a boolean
          value.
      """
      if hasattr(src, "read"):
          # It seems to be a file or a file-like object
          self.fname = "from a file-like object"
          if title == "":
              self.title = "from a file-like object"
          else:
              self.title = title
      else:
          # Assume it's a string or something that can be converted to one
          self.fname = src
          if title == "":
              (filepath, filename) = os.path.split(src)
              self.title = filename
          else:
              self.title = title
      self.sys_argv = [src] + shlex.split(arg_str)
      self.auto_all = auto_all
      self.src = src
  
      # get a few things from ipython.  While it's a bit ugly design-wise,
      # it ensures that things like color scheme and the like are always in
      # sync with the ipython mode being used.  This class is only meant to
      # be used inside ipython anyways,  so it's OK.
      ip = (
          get_ipython()
      )  # this is in builtins whenever IPython is running
      self.ip_ns = ip.user_ns
      self.ip_colorize = ip.pycolorize
      self.ip_showtb = ip.showtraceback
      self.ip_run_cell = ip.run_cell
      self.shell = ip
  
      # load user data and initialize data structures
      self.reload()
  
imports: from __future__ import unicode_literals
  from __future__ import print_function
  import os
  import re
  import shlex
  import sys
  from IPython.utils import io
  from IPython.utils.text import marquee
  from IPython.utils import openpy
  from IPython.utils import py3compat
label_desc: Use image node_id 1 to create a new Demo object from inherited base classes: object with example: obj = Demo(src, title, arg_str, auto_all)