environment/lib/python2.7/site-packages/IPython/extensions/autoreload.py
def check(self, check_all=False):
        """Check whether some modules need to be reloaded."""

        if not self.enabled and not check_all:
            return

        if check_all or self.check_all:
            modules = sys.modules.keys()
        else:
            modules = self.modules.keys()

        for modname in modules:
            m = sys.modules.get(modname, None)

            if modname in self.skip_modules:
                continue

            if not hasattr(m, '__file__'):
                continue

            if m.__name__ == '__main__':
                # we cannot reload(__main__)
                continue

            filename = m.__file__
            path, ext = os.path.splitext(filename)

            if ext.lower() == '.py':
                ext = PY_COMPILED_EXT
                pyc_filename = pyfile.cache_from_source(filename)
                py_filename = filename
            else:
                pyc_filename = filename
                try:
                    py_filename = pyfile.source_from_cache(filename)
                except ValueError:
                    continue

            try:
                pymtime = os.stat(py_filename).st_mtime
                if pymtime <= os.stat(pyc_filename).st_mtime:
                    continue
                if self.failed.get(py_filename, None) == pymtime:
                    continue
            except OSError:
                continue

            try:
                superreload(m, reload, self.old_objects)
                if py_filename in self.failed:
                    del self.failed[py_filename]
            except:
                print >> sys.stderr, "[autoreload of %s failed: %s]" % (
                        modname, traceback.format_exc(1))
                self.failed[py_filename] = pymtime
def check(self, check_all=False):
        if not self.enabled and not check_all:
            return

        if check_all or self.check_all:
            modules = sys.modules.keys()
        else:
            modules = self.modules.keys()

        for modname in modules:
            m = sys.modules.get(modname, None)

            if modname in self.skip_modules:
                continue

            if not hasattr(m, '__file__'):
                continue

            if m.__name__ == '__main__':
                # we cannot reload(__main__)
                continue

            filename = m.__file__
            path, ext = os.path.splitext(filename)

            if ext.lower() == '.py':
                ext = PY_COMPILED_EXT
                pyc_filename = pyfile.cache_from_source(filename)
                py_filename = filename
            else:
                pyc_filename = filename
                try:
                    py_filename = pyfile.source_from_cache(filename)
                except ValueError:
                    continue

            try:
                pymtime = os.stat(py_filename).st_mtime
                if pymtime <= os.stat(pyc_filename).st_mtime:
                    continue
                if self.failed.get(py_filename, None) == pymtime:
                    continue
            except OSError:
                continue

            try:
                superreload(m, reload, self.old_objects)
                if py_filename in self.failed:
                    del self.failed[py_filename]
            except:
                print >> sys.stderr, "[autoreload of %s failed: %s]" % (
                        modname, traceback.format_exc(1))
                self.failed[py_filename] = pymtime
def check ( self , check_all = False ) : if not self . enabled and not check_all : return if check_all or self . check_all : modules = sys . modules . keys ( ) else : modules = self . modules . keys ( ) for modname in modules : m = sys . modules . get ( modname , None ) if modname in self . skip_modules : continue if not hasattr ( m , '__file__' ) : continue if m . __name__ == '__main__' : # we cannot reload(__main__) continue filename = m . __file__ path , ext = os . path . splitext ( filename ) if ext . lower ( ) == '.py' : ext = PY_COMPILED_EXT pyc_filename = pyfile . cache_from_source ( filename ) py_filename = filename else : pyc_filename = filename try : py_filename = pyfile . source_from_cache ( filename ) except ValueError : continue try : pymtime = os . stat ( py_filename ) . st_mtime if pymtime <= os . stat ( pyc_filename ) . st_mtime : continue if self . failed . get ( py_filename , None ) == pymtime : continue except OSError : continue try : superreload ( m , reload , self . old_objects ) if py_filename in self . failed : del self . failed [ py_filename ] except : print >> sys . stderr , "[autoreload of %s failed: %s]" % ( modname , traceback . format_exc ( 1 ) ) self . failed [ py_filename ] = pymtime
Check whether some modules need to be reloaded.
Check whether some modules need to be reloaded .