environment/lib/python2.7/site-packages/IPython/lib/demo.py
def reload(self):
        """Reload source from disk and initialize state."""
        self.fload()

        self.src     = self.fobj.read()
        src_b        = [b.strip() for b in self.re_stop.split(self.src) if b]
        self._silent = [bool(self.re_silent.findall(b)) for b in src_b]
        self._auto   = [bool(self.re_auto.findall(b)) for b in src_b]

        # if auto_all is not given (def. None), we read it from the file
        if self.auto_all is None:
            self.auto_all = bool(self.re_auto_all.findall(src_b[0]))
        else:
            self.auto_all = bool(self.auto_all)

        # Clean the sources from all markup so it doesn't get displayed when
        # running the demo
        src_blocks = []
        auto_strip = lambda s: self.re_auto.sub('',s)
        for i,b in enumerate(src_b):
            if self._auto[i]:
                src_blocks.append(auto_strip(b))
            else:
                src_blocks.append(b)
        # remove the auto_all marker
        src_blocks[0] = self.re_auto_all.sub('',src_blocks[0])

        self.nblocks = len(src_blocks)
        self.src_blocks = src_blocks

        # also build syntax-highlighted source
        self.src_blocks_colored = map(self.ip_colorize,self.src_blocks)

        # ensure clean namespace and seek offset
        self.reset()
def reload(self):
        """Reload source from disk and initialize state."""
        self.fload()

        self.src     = self.fobj.read()
        src_b        = [b.strip() for b in self.re_stop.split(self.src) if b]
        self._silent = [bool(self.re_silent.findall(b)) for b in src_b]
        self._auto   = [bool(self.re_auto.findall(b)) for b in src_b]

        # if auto_all is not given (def. None), we read it from the file
        if self.auto_all is None:
            self.auto_all = bool(self.re_auto_all.findall(src_b[0]))
        else:
            self.auto_all = bool(self.auto_all)

        # Clean the sources from all markup so it doesn't get displayed when
        # running the demo
        src_blocks = []
        auto_strip = lambda s: self.re_auto.sub('',s)
        for i,b in enumerate(src_b):
            if self._auto[i]:
                src_blocks.append(auto_strip(b))
            else:
                src_blocks.append(b)
        # remove the auto_all marker
        src_blocks[0] = self.re_auto_all.sub('',src_blocks[0])

        self.nblocks = len(src_blocks)
        self.src_blocks = src_blocks

        # also build syntax-highlighted source
        self.src_blocks_colored = map(self.ip_colorize,self.src_blocks)

        # ensure clean namespace and seek offset
        self.reset()
def reload ( self ) : self . fload ( ) self . src = self . fobj . read ( ) src_b = [ b . strip ( ) for b in self . re_stop . split ( self . src ) if b ] self . _silent = [ bool ( self . re_silent . findall ( b ) ) for b in src_b ] self . _auto = [ bool ( self . re_auto . findall ( b ) ) for b in src_b ] # if auto_all is not given (def. None), we read it from the file if self . auto_all is None : self . auto_all = bool ( self . re_auto_all . findall ( src_b [ 0 ] ) ) else : self . auto_all = bool ( self . auto_all ) # Clean the sources from all markup so it doesn't get displayed when # running the demo src_blocks = [ ] auto_strip = lambda s : self . re_auto . sub ( '' , s ) for i , b in enumerate ( src_b ) : if self . _auto [ i ] : src_blocks . append ( auto_strip ( b ) ) else : src_blocks . append ( b ) # remove the auto_all marker src_blocks [ 0 ] = self . re_auto_all . sub ( '' , src_blocks [ 0 ] ) self . nblocks = len ( src_blocks ) self . src_blocks = src_blocks # also build syntax-highlighted source self . src_blocks_colored = map ( self . ip_colorize , self . src_blocks ) # ensure clean namespace and seek offset self . reset ( )
Reload source from disk and initialize state.
Reload source from disk and initialize state .