Show More
@@ -35,8 +35,8 b' License: MIT open source license.' | |||
|
35 | 35 | |
|
36 | 36 | from IPython.external.path import path as Path |
|
37 | 37 | import os,stat,time |
|
38 | import collections | |
|
38 | 39 | import cPickle as pickle |
|
39 | import UserDict | |
|
40 | 40 | import glob |
|
41 | 41 | |
|
42 | 42 | def gethashfile(key): |
@@ -44,7 +44,7 b' def gethashfile(key):' | |||
|
44 | 44 | |
|
45 | 45 | _sentinel = object() |
|
46 | 46 | |
|
47 |
class PickleShareDB( |
|
|
47 | class PickleShareDB(collections.MutableMapping): | |
|
48 | 48 | """ The main 'connection' object for PickleShare database """ |
|
49 | 49 | def __init__(self,root): |
|
50 | 50 | """ Return a db object that will manage the specied directory""" |
@@ -187,6 +187,12 b' class PickleShareDB(UserDict.DictMixin):' | |||
|
187 | 187 | else: |
|
188 | 188 | files = [Path(p) for p in glob.glob(self.root/globpat)] |
|
189 | 189 | return [self._normalized(p) for p in files if p.isfile()] |
|
190 | ||
|
191 | def __iter__(self): | |
|
192 | return iter(keys) | |
|
193 | ||
|
194 | def __len__(self): | |
|
195 | return len(keys) | |
|
190 | 196 | |
|
191 | 197 | def uncache(self,*items): |
|
192 | 198 | """ Removes all, or specified items from cache |
General Comments 0
You need to be logged in to leave comments.
Login now