示例#1
0
 def __init__(self, filename, autoflush = True, origin=None):
     '''
     Autoflush configures whether to flush after ever change. This is not at
     all a performant default! It trades that off for safety. If your code
     is at all performance-critical or deals with nontrivial sizes of data,
     you will want to turn off autoflush, and manually flush with either the
     flush function, or the "with" keyword.
     '''
     Sink.__init__(self, origin)
     self.filename = filename
     self.autoflush = autoflush
     self.backend = {}
     try:
         self.reload()
     except (OSError, IOError): # File doesn't exist yet
         pass
示例#2
0
 def __init__(self, path, origin = None, filemode='c'):
     Sink.__init__(self, origin)
     self.backend = anydbm.open(path, filemode)
示例#3
0
 def __init__(self, origin=None):
     Sink.__init__(self, origin)
     self.backend = {}