Logo Search packages:      
Sourcecode: ipython version File versions  Download package

def IPython::Extensions::pickleshare::PickleShareDB::__getitem__ (   self,
  key 
)

db['key'] reading 

Definition at line 59 of file pickleshare.py.

00059                              :
        """ db['key'] reading """
        fil = self.root / key
        try:
            mtime = (fil.stat()[stat.ST_MTIME])
        except OSError:
            raise KeyError(key)

        if fil in self.cache and mtime == self.cache[fil][1]:
            return self.cache[fil][0]
        try:
            # The cached item has expired, need to read
            obj = pickle.load(fil.open())
        except:
            raise KeyError(key)
            
        self.cache[fil] = (obj,mtime)
        return obj
    
    def __setitem__(self,key,value):


Generated by  Doxygen 1.6.0   Back to index