bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def f(con, m=m): t=getattr(con._cache,attr) m[0]=m[0]+t m[1]=m[1]+1
def f(con, m=m, attr=attr): t=getattr(con._cache,attr) m[0]=m[0]+t m[1]=m[1]+1
27,200
def undo(self, id): for oid in self._storage.undo(id): self.invalidate(oid)
def undo(self, id): for oid in self._storage.undo(id): self.invalidate(oid)
27,201
def tpc_begin(self, id, user, description, ext): t=self._transaction if t is not None: if id == t.id: return else: raise StorageServerError( "Multiple simultaneous tpc_begin requests from the same " "client." ) storage=self.__storage if storage._transaction is not None: try: waiting=storage.__waiting except: waiting=st...
def tpc_begin(self, id, user, description, ext): t=self._transaction if t is not None: if id == t.id: return else: raise StorageServerError( "Multiple simultaneous tpc_begin requests from the same " "client." ) storage=self.__storage if storage._transaction is not None: try: waiting=storage.__waiting except: waiting=st...
27,202
def tpc_begin_sync(self, id, user, description, ext): if self.__closed: return t=self._transaction if t is not None and id == t.id: return storage=self.__storage if storage._transaction is None: self.try_again_sync(id, user, description, ext) else: try: waiting=storage.__waiting except: waiting=storage.__waiting=[] wai...
def tpc_begin_sync(self, id, user, description, ext): if self.__closed: return t=self._transaction if t is not None and id == t.id: return storage=self.__storage if storage._transaction is None: self.try_again_sync(id, user, description, ext) else: try: waiting=storage.__waiting except: waiting=storage.__waiting=[] wai...
27,203
def main(): host = None port = None unix = None write = 1 storage = '1' try: opts, args = getopt.getopt(sys.argv[1:], 'p:h:U:S:1', ['nowrite']) for o, a in opts: if o == '-p': port = int(a) elif o == '-h': host = a elif o == '-U': unix = a elif o == '-S': storage = a elif o == '--nowrite': write = 0 elif o == '-1': ZEO...
def main(): host = None port = None unix = None write = 1 storage = '1' try: opts, args = getopt.getopt(sys.argv[1:], 'p:h:U:S:1', ['nowrite']) for o, a in opts: if o == '-p': port = int(a) elif o == '-h': host = a elif o == '-U': unix = a elif o == '-S': storage = a elif o == '--nowrite': write = 0 elif o == '-1': ZEO...
27,204
def main(): host = None port = None unix = None write = 1 storage = '1' try: opts, args = getopt.getopt(sys.argv[1:], 'p:h:U:S:1', ['nowrite']) for o, a in opts: if o == '-p': port = int(a) elif o == '-h': host = a elif o == '-U': unix = a elif o == '-S': storage = a elif o == '--nowrite': write = 0 elif o == '-1': ZEO...
def main(): host = None port = None unix = None write = 1 storage = '1' try: opts, args = getopt.getopt(sys.argv[1:], 'p:h:U:S:1', ['nowrite']) for o, a in opts: if o == '-p': port = int(a) elif o == '-h': host = a elif o == '-U': unix = a elif o == '-S': storage = a elif o == '--nowrite': write = 0 elif o == '-1': ZEO...
27,205
def panic(message, *data): message=message%data LOG('ZODB FS',PANIC,"%s ERROR: %s\n" % (packed_version, message)) raise CorruptedTransactionError, message
def panic(message, *data): message=message%data LOG('ZODB FS',PANIC,"%s ERROR: %s\n" % (packed_version, message)) raise CorruptedTransactionError, message
27,206
def main(): ZEOInstanceBuilder().run() print "All done."
defmain():ZEOInstanceBuilder().run()print"Alldone."
27,207
def run(self): try: opts, args = getopt.getopt(sys.argv[1:], "h", ["help"]) except getopt.error, msg: print msg sys.exit(2) program = os.path.basename(sys.argv[0]) if opts: # There's only the help options, so just dump some help: msg = __doc__ % {"program": program} print msg sys.exit() if len(args) not in [1, 2]: prin...
def run(self): try: opts, args = getopt.getopt(sys.argv[1:], "h", ["help"]) except getopt.error, msg: print msg sys.exit(2) program = os.path.basename(sys.argv[0]) if opts: # There's only the help options, so just dump some help: msg = __doc__ % {"program": program} print msg sys.exit() if len(args) not in [1, 2]: prin...
27,208
def run(self): try: opts, args = getopt.getopt(sys.argv[1:], "h", ["help"]) except getopt.error, msg: print msg sys.exit(2) program = os.path.basename(sys.argv[0]) if opts: # There's only the help options, so just dump some help: msg = __doc__ % {"program": program} print msg sys.exit() if len(args) not in [1, 2]: prin...
def run(self): try: opts, args = getopt.getopt(sys.argv[1:], "h", ["help"]) except getopt.error, msg: print msg sys.exit(2) program = os.path.basename(sys.argv[0]) if opts: # There's only the help options, so just dump some help: msg = __doc__ % {"program": program} print msg sys.exit() if len(args) not in [1, 2]: prin...
27,209
def get_params(self, home, port): return { "package": "zeo", "PACKAGE": "ZEO", "home": home, "port": port, "python": sys.executable, "server": which("runzeo.py"), "zdrun": which("zdrun.py"), "zdctl": which("zdctl.py"), }
def get_params(self, home, port): return { "package": "zeo", "PACKAGE": "ZEO", "zope_home": zope_home, "instance_home": instance_home, "port": port, "python": sys.executable, "server": which("runzeo.py"), "zdrun": which("zdrun.py"), "zdctl": which("zdctl.py"), }
27,210
def get_params(self, home, port): return { "package": "zeo", "PACKAGE": "ZEO", "home": home, "port": port, "python": sys.executable, "server": which("runzeo.py"), "zdrun": which("zdrun.py"), "zdctl": which("zdctl.py"), }
def get_params(self, home, port): return { "package": "zeo", "PACKAGE": "ZEO", "home": home, "port": port, "python": sys.executable, }
27,211
def loop(timeout=30.0, use_poll=0, map=None): """Invoke asyncore mainloop This function functions like the regular asyncore.loop() function except that it also triggers ThreadedAsync callback functions before starting the loop. """ if use_poll: if hasattr(select, 'poll'): poll_fun = asyncore.poll3 else: poll_fun = asy...
def loop(timeout=30.0, use_poll=0, map=None): """Invoke asyncore mainloop This function functions like the regular asyncore.loop() function except that it also triggers ThreadedAsync callback functions before starting the loop. """ if use_poll: if hasattr(select, 'poll'): poll_fun = asyncore.poll3 else: poll_fun = asy...
27,212
def slog(storage, msg, level=zLOG.INFO, error=None, pid=os.getpid()): name = getattr(storage, '__name__', None) if name is None: name = str(self.storage) zLOG.LOG("ZEO Server:%s:%s" % (pid, name), level, msg, error=error)
def slog(storage, msg, level=zLOG.INFO, error=None, pid=os.getpid()): name = getattr(storage, '__name__', None) if name is None: name = str(storage) zLOG.LOG("ZEO Server:%s:%s" % (pid, name), level, msg, error=error)
27,213
def _transactionalUndoRecord(self, oid, pos, serial, pre, version): """Get the indo information for a data record
def _transactionalUndoRecord(self, oid, pos, serial, pre, version): """Get the indo information for a data record
27,214
def panic(message, *data): message=message%data LOG('ZODB FS',PANIC,"%s ERROR: %s\n" % (packed_version, message)) raise CorruptedTransactionError, message
defpanic(message,*data):message=message%dataLOG('ZODBFS',PANIC,"%sERROR:%s\n"%(packed_version,message))raiseCorruptedTransactionError,message
27,215
def panic(message, *data): message=message%data LOG('ZODB FS',PANIC,"%s ERROR: %s\n" % (packed_version, message)) raise CorruptedTransactionError, message
def panic(message, *data): message=message%data LOG('ZODB FS',PANIC,"%s ERROR: %s\n" % (packed_version, message)) raise CorruptedTransactionError, message
27,216
def __init__(self, file_name, create=0, read_only=0, stop=None):
def __init__(self, file_name, create=0, read_only=0, stop=None):
27,217
def __init__(self, file_name, create=0, read_only=0, stop=None):
def __init__(self, file_name, create=0, read_only=0, stop=None):
27,218
def abortVersion(self, src, transaction): # We are going to abort by simply storing back pointers.
def abortVersion(self, src, transaction): # We are going to abort by simply storing back pointers.
27,219
def abortVersion(self, src, transaction): # We are going to abort by simply storing back pointers.
def abortVersion(self, src, transaction): # We are going to abort by simply storing back pointers.
27,220
def abortVersion(self, src, transaction): # We are going to abort by simply storing back pointers.
def abortVersion(self, src, transaction): # We are going to abort by simply storing back pointers.
27,221
def abortVersion(self, src, transaction): # We are going to abort by simply storing back pointers.
def abortVersion(self, src, transaction): # We are going to abort by simply storing back pointers.
27,222
def commitVersion(self, src, dest, transaction): # We are going to commit by simply storing back pointers. if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._a() try: file=self._file read=file.read seek=file.seek tfile=self._tfile write=tfile.write tappend=sel...
def commitVersion(self, src, dest, transaction): # We are going to commit by simply storing back pointers. if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._a() try: file=self._file read=file.read seek=file.seek tfile=self._tfile write=tfile.write tappend=sel...
27,223
def commitVersion(self, src, dest, transaction): # We are going to commit by simply storing back pointers. if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._a() try: file=self._file read=file.read seek=file.seek tfile=self._tfile write=tfile.write tappend=sel...
defcurrent_oids={} current=current_oids.has_key t=None tstatus=' ' commitVersion(self,current_oids={} current=current_oids.has_key t=None tstatus=' ' src,current_oids={} current=current_oids.has_key t=None tstatus=' ' dest,current_oids={} current=current_oids.has_key t=None tstatus=' ' transaction):current_oids={} ...
27,224
def commitVersion(self, src, dest, transaction): # We are going to commit by simply storing back pointers. if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._a() try: file=self._file read=file.read seek=file.seek tfile=self._tfile write=tfile.write tappend=sel...
def commitVersion(self, src, dest, transaction): # We are going to commit by simply storing back pointers. if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._a() try: file=self._file read=file.read seek=file.seek tfile=self._tfile write=tfile.write tappend=sel...
27,225
def commitVersion(self, src, dest, transaction): # We are going to commit by simply storing back pointers. if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._a() try: file=self._file read=file.read seek=file.seek tfile=self._tfile write=tfile.write tappend=sel...
def commitVersion(self, src, dest, transaction): # We are going to commit by simply storing back pointers. if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._a() try: file=self._file read=file.read seek=file.seek tfile=self._tfile write=tfile.write tappend=sel...
27,226
def commitVersion(self, src, dest, transaction): # We are going to commit by simply storing back pointers. if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._a() try: file=self._file read=file.read seek=file.seek tfile=self._tfile write=tfile.write tappend=sel...
def commitVersion(self, src, dest, transaction): # We are going to commit by simply storing back pointers. if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._a() try: file=self._file read=file.read seek=file.seek tfile=self._tfile write=tfile.write tappend=sel...
27,227
def commitVersion(self, src, dest, transaction): # We are going to commit by simply storing back pointers. if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._a() try: file=self._file read=file.read seek=file.seek tfile=self._tfile write=tfile.write tappend=sel...
def commitVersion(self, src, dest, transaction): # We are going to commit by simply storing back pointers. if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._a() try: file=self._file read=file.read seek=file.seek tfile=self._tfile write=tfile.write tappend=sel...
27,228
def getSize(self): return self._pos
def getSize(self): return self._pos
27,229
def load(self, oid, version, _stuff=None): self._a() try: pos=self._index[oid] file=self._file file.seek(pos) read=file.read h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if doid != oid: raise CorruptedDataError, h if vlen: pnv=read(8) # Read location of non-version data if (not version or len(...
def load(self, oid, version, _stuff=None): self._lock_acquire() try: pos=self._index[oid] file=self._file file.seek(pos) read=file.read h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if doid != oid: raise CorruptedDataError, h if vlen: pnv=read(8) # Read location of non-version data if (not vers...
27,230
def load(self, oid, version, _stuff=None): self._a() try: pos=self._index[oid] file=self._file file.seek(pos) read=file.read h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if doid != oid: raise CorruptedDataError, h if vlen: pnv=read(8) # Read location of non-version data if (not version or len(...
def load(self, oid, version, _stuff=None): self._a() try: pos=self._index[oid] file=self._file file.seek(pos) read=file.read h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if doid != oid: raise CorruptedDataError, h if vlen: pnv=read(8) # Read location of non-version data if (not version or len(...
27,231
def modifiedInVersion(self, oid): self._a() try: pos=self._index[oid] file=self._file seek=file.seek seek(pos) doid,serial,prev,tloc,vlen = unpack(">8s8s8s8sH", file.read(34)) if doid != oid: raise CorruptedDataError, h if vlen: seek(24,1) # skip plen, pnv, and pv return file.read(vlen) return '' finally: self._r()
def modifiedInVersion(self, oid): self._lock_acquire() try: pos=self._index[oid] file=self._file seek=file.seek seek(pos) doid,serial,prev,tloc,vlen = unpack(">8s8s8s8sH", file.read(34)) if doid != oid: raise CorruptedDataError, h if vlen: seek(24,1) # skip plen, pnv, and pv return file.read(vlen) return '' finally: se...
27,232
def modifiedInVersion(self, oid): self._a() try: pos=self._index[oid] file=self._file seek=file.seek seek(pos) doid,serial,prev,tloc,vlen = unpack(">8s8s8s8sH", file.read(34)) if doid != oid: raise CorruptedDataError, h if vlen: seek(24,1) # skip plen, pnv, and pv return file.read(vlen) return '' finally: self._r()
def modifiedInVersion(self, oid): self._a() try: pos=self._index[oid] file=self._file seek=file.seek seek(pos) doid,serial,prev,tloc,vlen = unpack(">8s8s8s8sH", file.read(34)) if doid != oid: raise CorruptedDataError, h if vlen: seek(24,1) # skip plen, pnv, and pv return file.read(vlen) return '' finally: self._r()
27,233
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction)
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction)
27,234
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction)
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction)
27,235
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction)
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction)
27,236
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction)
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction)
27,237
def supportsVersions(self): return 1
def supportsVersions(self): return 1
27,238
def tpc_abort(self, transaction): self._a() try: if transaction is not self._transaction: return del self._tindex[:] self._transaction=None self._cr() finally: self._r()
def tpc_abort(self, transaction): self._a() try: if transaction is not self._transaction: return del self._tindex[:] self._transaction=None self._cr() finally: self._r()
27,239
def undo(self, transaction_id): self._a() try: file=self._file seek=file.seek read=file.read indexpos=self._indexpos unpack=struct.unpack transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) seek(tpos) h=read(23) if len(h) != 23 or h[:8] != tid: raise UndoErr...
def undo(self, transaction_id): self._a() try: file=self._file seek=file.seek read=file.read index_get=self._index_get unpack=struct.unpack transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) seek(tpos) h=read(23) if len(h) != 23 or h[:8] != tid: raise UndoE...
27,240
def undo(self, transaction_id): self._a() try: file=self._file seek=file.seek read=file.read indexpos=self._indexpos unpack=struct.unpack transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) seek(tpos) h=read(23) if len(h) != 23 or h[:8] != tid: raise UndoErr...
def undo(self, transaction_id): self._a() try: file=self._file seek=file.seek read=file.read indexpos=self._indexpos unpack=struct.unpack seek(tpos) h=read(23) if len(h) != 23 or h[:8] != tid: raise UndoError, 'Invalid undo transaction id' if h[16] == 'u': return if h[16] != ' ': raise UndoError, 'Undoable transaction'...
27,241
def undo(self, transaction_id): self._a() try: file=self._file seek=file.seek read=file.read indexpos=self._indexpos unpack=struct.unpack transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) seek(tpos) h=read(23) if len(h) != 23 or h[:8] != tid: raise UndoErr...
def undo(self, transaction_id): self._a() try: file=self._file seek=file.seek read=file.read indexpos=self._indexpos unpack=struct.unpack transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) seek(tpos) h=read(23) if len(h) != 23 or h[:8] != tid: raise UndoErr...
27,242
def undo(self, transaction_id): self._a() try: file=self._file seek=file.seek read=file.read indexpos=self._indexpos unpack=struct.unpack transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) seek(tpos) h=read(23) if len(h) != 23 or h[:8] != tid: raise UndoErr...
def undo(self, transaction_id): self._a() try: file=self._file seek=file.seek read=file.read indexpos=self._indexpos unpack=struct.unpack transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) seek(tpos) h=read(23) if len(h) != 23 or h[:8] != tid: raise UndoErr...
27,243
def undo(self, transaction_id): self._a() try: file=self._file seek=file.seek read=file.read indexpos=self._indexpos unpack=struct.unpack transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) seek(tpos) h=read(23) if len(h) != 23 or h[:8] != tid: raise UndoErr...
def undo(self, transaction_id): self._a() try: file=self._file seek=file.seek read=file.read indexpos=self._indexpos unpack=struct.unpack transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) seek(tpos) h=read(23) if len(h) != 23 or h[:8] != tid: raise UndoErr...
27,244
def undo(self, transaction_id): self._a() try: file=self._file seek=file.seek read=file.read indexpos=self._indexpos unpack=struct.unpack transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) seek(tpos) h=read(23) if len(h) != 23 or h[:8] != tid: raise UndoErr...
def undo(self, transaction_id): self._a() try: file=self._file seek=file.seek read=file.read indexpos=self._indexpos unpack=struct.unpack transaction_id=base64.decodestring(transaction_id+'==\n') tid, tpos = transaction_id[:8], u64(transaction_id[8:]) seek(tpos) h=read(23) if len(h) != 23 or h[:8] != tid: raise UndoErr...
27,245
def undoLog(self, first, last, filter=None): self._a() try: pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unpack strip=string.strip encode=base64.encodestring r=[] append=r.append i=0 while i < last and pos > 39: seek(pos-8) pos=pos-u64(read(8))-8 if i < first: continu...
def undoLog(self, first, last, filter=None): self._lock_acquire() try: pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unpack strip=string.strip encode=base64.encodestring r=[] append=r.append i=0 while i < last and pos > 39: seek(pos-8) pos=pos-u64(read(8))-8 if i < fir...
27,246
def undoLog(self, first, last, filter=None): self._a() try: pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unpack strip=string.strip encode=base64.encodestring r=[] append=r.append i=0 while i < last and pos > 39: seek(pos-8) pos=pos-u64(read(8))-8 if i < first: continu...
def undoLog(self, first, last, filter=None): self._a() try: pos=self._pos if pos < 39: return [] file=self._file seek=file.seek read=file.read unpack=struct.unpack strip=string.strip encode=base64.encodestring r=[] append=r.append i=0 while i < last and pos > 39: seek(pos-8) pos=pos-u64(read(8))-8 if i < first: continu...
27,247
def versionEmpty(self, version): return not self._vindex.get(version, 0)
def versionEmpty(self, version): return not self._vindex.get(version, 0)
27,248
def versions(self, max=None): if max: return self._vindex.keys()[:max] return self._vindex.keys()
def versions(self, max=None): if max: return self._vindex.keys()[:max] return self._vindex.keys()
27,249
def read_index(file, name, index, vindex, tindex, stop='\377'*8): indexpos=index.get vndexpos=vindex.get tappend=tindex.append read=file.read seek=file.seek seek(0,2) file_size=file.tell() seek(0) if file_size: if file_size < 4: raise FileStorageFormatError, file.name if read(4) != packed_version: raise FileStorageFor...
def read_index(file, name, index, vindex, tindex, stop='\377'*8): index_get=index.get vndexpos=vindex.get tappend=tindex.append read=file.read seek=file.seek seek(0,2) file_size=file.tell() seek(0) if file_size: if file_size < 4: raise FileStorageFormatError, file.name if read(4) != packed_version: raise FileStorageFo...
27,250
def read_index(file, name, index, vindex, tindex, stop='\377'*8): indexpos=index.get vndexpos=vindex.get tappend=tindex.append read=file.read seek=file.seek seek(0,2) file_size=file.tell() seek(0) if file_size: if file_size < 4: raise FileStorageFormatError, file.name if read(4) != packed_version: raise FileStorageFor...
def read_index(file, name, index, vindex, tindex, stop='\377'*8): indexpos=index.get vndexpos=vindex.get tappend=tindex.append read=file.read seek=file.seek seek(0,2) file_size=file.tell() seek(0) if file_size: if file_size < 4: raise FileStorageFormatError, file.name if read(4) != packed_version: raise FileStorageFor...
27,251
def read_index(file, name, index, vindex, tindex, stop='\377'*8): indexpos=index.get vndexpos=vindex.get tappend=tindex.append read=file.read seek=file.seek seek(0,2) file_size=file.tell() seek(0) if file_size: if file_size < 4: raise FileStorageFormatError, file.name if read(4) != packed_version: raise FileStorageFor...
def read_index(file, name, index, vindex, tindex, stop='\377'*8): indexpos=index.get vndexpos=vindex.get tappend=tindex.append read=file.read seek=file.seek seek(0,2) file_size=file.tell() seek(0) if file_size: if file_size < 4: raise FileStorageFormatError, file.name if read(4) != packed_version: raise FileStorageFor...
27,252
def read_index(file, name, index, vindex, tindex, stop='\377'*8): indexpos=index.get vndexpos=vindex.get tappend=tindex.append read=file.read seek=file.seek seek(0,2) file_size=file.tell() seek(0) if file_size: if file_size < 4: raise FileStorageFormatError, file.name if read(4) != packed_version: raise FileStorageFor...
def read_index(file, name, index, vindex, tindex, stop='\377'*8): indexpos=index.get vndexpos=vindex.get tappend=tindex.append read=file.read seek=file.seek seek(0,2) file_size=file.tell() seek(0) if file_size: if file_size < 4: raise FileStorageFormatError, file.name if read(4) != packed_version: raise FileStorageFor...
27,253
def _loadBack(file, oid, back): seek=file.seek read=file.read while 1: old=u64(back) if not old: raise KeyError, oid seek(old) h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) #if doid != oid: # panic(lambda x: None, # "%s version record back pointer points to " # "invalid re...
def _loadBack(file, oid, back): seek=file.seek read=file.read while 1: old=u64(back) if not old: raise KeyError, oid seek(old) h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) #if doid != oid: #panic(lambda x: None, # "%s version record back pointer points to " # "invalid record as %s", name, b...
27,254
def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print "Recovering", inp, "into", outp if os.path.exists(outp) and not force: die("%s exists" % outp) f = open(inp, "rb") if f.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") f.seek(0,2) file_size = f.tell() ofs = ZODB.File...
def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print "Recovering", inp, "into", outp if os.path.exists(outp) and not force: die("%s exists" % outp) f = open(inp, "rb") if f.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") f.seek(0,2) file_size = f.tell() ofs = ZODB.File...
27,255
def BTreeExtension(flavor): key = flavor[0] value = flavor[1] name = "BTrees._%sBTree" % flavor sources = ["src/BTrees/_%sBTree.c" % flavor] kwargs = {"include_dirs": include} if flavor != "fs": kwargs["depends"] = (base_btrees_depends + [KEY_H % _flavors[key], VALUE_H % _flavors[value]]) if key != "O": kwargs["define_...
def BTreeExtension(flavor): key = flavor[0] value = flavor[1] name = "BTrees._%sBTree" % flavor sources = ["src/BTrees/_%sBTree.c" % flavor] kwargs = {"include_dirs": include} if flavor != "fs": kwargs["depends"] = (base_btrees_depends + [KEY_H % _flavors[key], VALUE_H % _flavors[value]]) if key != "O": kwargs["define_...
27,256
def tpc_abort(self, id): if not self._check_tid(id): return self.strategy.tpc_abort() self._transaction = None self.strategy = None self._handle_waiting()
def tpc_abort(self, id): if not self._check_tid(id): return strategy = self.strategy strategy.tpc_abort() self._transaction = None self.strategy = None self._handle_waiting()
27,257
def tpc_abort(self, id): if not self._check_tid(id): return self.strategy.tpc_abort() self._transaction = None self.strategy = None self._handle_waiting()
def tpc_abort(self, id): if not self._check_tid(id): return self.strategy.tpc_abort() self._transaction = None self.strategy = None self._handle_waiting()
27,258
def connectionDebugInfo(self): r=[] pools,pooll=self._pools for version, (pool, allocated, lock) in pools.items(): for c in allocated: r.append({ 'opened': c._opened and ctime(c._opened), 'info': c._debug_info, 'version': version, }) return r
def connectionDebugInfo(self): r=[] pools,pooll=self._pools for version, (pool, allocated, lock) in pools.items(): for c in allocated: r.append({ 'opened': o and ("%s (%.2fs)" % (ctime(o), t-o)), 'info': c._debug_info, 'version': version, }) return r
27,259
def __nonzero__(): """Check if the collection is non-empty.
def __nonzero__(): """Check if the collection is non-empty.
27,260
def update(seq): """Add the items from the given sequence to the set"""
def update(seq): """Add the items from the given sequence to the set"""
27,261
def __getitem__(index): """Return the key in the given index position
def __getitem__(index): """Return the key in the given index position
27,262
def insert(key, value): """Insert a key and value into the collection.
def insert(key, value): """Insert a key and value into the collection.
27,263
def weightedIntersection(c1, c2, weight1=1, weight2=1): """Compute the weighted intersection of c1 and c2.
def weightedIntersection(c1, c2, weight1=1, weight2=1): """Compute the weighted intersection of c1 and c2.
27,264
def panic(message, *data): message=message%data LOG('ZODB FS',PANIC,"%s ERROR: %s\n" % (packed_version, message)) raise CorruptedTransactionError, message
def panic(message, *data): message=message%data LOG('ZODB FS',PANIC,"%s ERROR: %s\n" % (packed_version, message)) raise CorruptedTransactionError, message
27,265
def _loada(self, oid, _index, file): "Read any version and return the version" pos=_index[oid] file.seek(pos) read=file.read h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if vlen: file.seek(16,1) version=read(vlen) else: version=''
def _loada(self, oid, _index, file): "Read any version and return the version" pos=_index[oid] file.seek(pos) read=file.read h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if vlen: nv = read(8) != z64 file.seek(8,1) version=read(vlen) else: version=''
27,266
def _loada(self, oid, _index, file): "Read any version and return the version" pos=_index[oid] file.seek(pos) read=file.read h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if vlen: file.seek(16,1) version=read(vlen) else: version=''
def _loada(self, oid, _index, file): "Read any version and return the version" pos=_index[oid] file.seek(pos) read=file.read h=read(42) doid,serial,prev,tloc,vlen,plen = unpack(">8s8s8s8sH8s", h) if vlen: file.seek(16,1) version=read(vlen) else: version=''
27,267
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc...
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc...
27,268
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc...
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc...
27,269
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc...
def pack(self, t, referencesf): """Copy data from the current database file to a packed fileNon-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records.Also, data back pointers that point before packtss are resolved and the associated data are copied, since th...
27,270
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc...
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc...
27,271
def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc...
def pack(self, t, referencesf): """Copy data from the current database file to a packed fileNon-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records.Also, data back pointers that point before packtss are resolved and the associated data are copied, since th...
27,272
def read_index(file, name, index, vindex, tindex, stop='\377'*8): index_get=index.get vndexpos=vindex.get tappend=tindex.append read=file.read seek=file.seek seek(0,2) file_size=file.tell() seek(0) if file_size: if file_size < 4: raise FileStorageFormatError, file.name if read(4) != packed_version: raise FileStorageFo...
def read_index(file, name, index, vindex, tindex, stop='\377'*8): index_get=index.get vndexpos=vindex.get tappend=tindex.appendread=file.read seek=file.seek seek(0,2) file_size=file.tell() seek(0) if file_size: if file_size < 4: raise FileStorageFormatError, file.name if read(4) != packed_version: raise FileStorageForm...
27,273
def _bad_message(self, msg): # Establish a connection, then send the server an ill-formatted # request. Verify that the connection is closed and that it is # possible to establish a new connection.
def _bad_message(self, msg): # Establish a connection, then send the server an ill-formatted # request. Verify that the connection is closed and that it is # possible to establish a new connection.
27,274
def checkMultiStorageTransaction(self): # Configuration parameters (larger values mean more likely deadlocks) N = 2 # These don't *have* to be all the same, but it's convenient this way self.nservers = N self.nthreads = N self.ntrans = N self.nobj = N
def NOcheckMultiStorageTransaction(self): # Configuration parameters (larger values mean more likely deadlocks) N = 2 # These don't *have* to be all the same, but it's convenient this way self.nservers = N self.nthreads = N self.ntrans = N self.nobj = N
27,275
def main(): # Parse options verbose = 0 dostats = 1 try: opts, args = getopt.getopt(sys.argv[1:], "vS") except getopt.error, msg: usage(msg) return 2 for o, a in opts: if o == "-v": verbose = 1 if o == "-S": dostats = 0 verbose = 1 if len(args) != 1: usage("exactly one file argument required") return 2 filename = args[...
def main(): # Parse options verbose = 0 dostats = 1 try: opts, args = getopt.getopt(sys.argv[1:], "vS") except getopt.error, msg: usage(msg) return 2 for o, a in opts: if o == "-v": verbose = 1 if o == "-S": dostats = 0 verbose = 1 if len(args) != 1: usage("exactly one file argument required") return 2 filename = args[...
27,276
def main(): # Parse options verbose = 0 dostats = 1 try: opts, args = getopt.getopt(sys.argv[1:], "vS") except getopt.error, msg: usage(msg) return 2 for o, a in opts: if o == "-v": verbose = 1 if o == "-S": dostats = 0 verbose = 1 if len(args) != 1: usage("exactly one file argument required") return 2 filename = args[...
def main(): # Parse options verbose = 0 dostats = 1 try: opts, args = getopt.getopt(sys.argv[1:], "vS") except getopt.error, msg: usage(msg) return 2 for o, a in opts: if o == "-v": verbose = 1 if o == "-S": dostats = 0 verbose = 1 if len(args) != 1: usage("exactly one file argument required") return 2 filename = args[...
27,277
def U64(s): h, v = unpack(">II", s) return (long(h) << 32) + v
def U64(s): h, v = struct.unpack(">II", s) return (long(h) << 32) + v
27,278
def get_monitor_output(self): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('', 42000)) L = [] while 1: buf = s.recv(8192) if buf: L.append(buf) else: break s.close() return "".join(L)
def get_monitor_output(self): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('localhost', 42000)) L = [] while 1: buf = s.recv(8192) if buf: L.append(buf) else: break s.close() return "".join(L)
27,279
def LOG(subsystem, severity, summary, detail='', error=None, reraise=None): """Log some information The required arguments are: subsystem -- The subsystem generating the message (e.g. ZODB) severity -- The "severity" of the event. This may be an integer or a floating point number. Logging back ends may consider th...
def LOG(subsystem, severity, summary, detail='', error=None, reraise=None): """Log some information The required arguments are: subsystem -- The subsystem generating the message (e.g. ZODB) severity -- The "severity" of the event. This may be an integer or a floating point number. Logging back ends may consider th...
27,280
def insert(key, value): """Insert a key and value into the colelction.
def insert(key, value): """Insert a key and value into the colelction.
27,281
def handler(signum, frame, storages=storages, die=signal.SIGTERM): for storage in storages.values(): try: storage.close() finally: pass if signum==dir: sys.exit(0) else: sys.exit(1)
def handler(signum, frame, storages=storages, die=signal.SIGTERM): for storage in storages.values(): try: storage.close() finally: pass if signum==dir: sys.exit(0) else: sys.exit(1)
27,282
def create_server(self): from ZEO.StorageServer import StorageServer self.server = StorageServer( self.options.address, self.storages, read_only=self.options.read_only, invalidation_queue_size=self.options.invalidation_queue_size, transaction_timeout=self.options.transaction_timeout, monitor_address=self.options.monito...
def create_server(self): from ZEO.StorageServer import StorageServer self.server = StorageServer( self.options.address, self.storages, read_only=self.options.read_only, invalidation_queue_size=self.options.invalidation_queue_size, transaction_timeout=self.options.transaction_timeout, monitor_address=self.options.monito...
27,283
def testReadConflictIgnored(self): # Test that an application that catches a read conflict and # continues can not commit the transaction later. root = self._db.open().root() root["real_data"] = real_data = PersistentDict() root["index"] = index = PersistentDict()
def checkReadConflictIgnored(self): # Test that an application that catches a read conflict and # continues can not commit the transaction later. root = self._db.open().root() root["real_data"] = real_data = PersistentDict() root["index"] = index = PersistentDict()
27,284
def testReadConflictIgnored(self): # Test that an application that catches a read conflict and # continues can not commit the transaction later. root = self._db.open().root() root["real_data"] = real_data = PersistentDict() root["index"] = index = PersistentDict()
def testReadConflictIgnored(self): # Test that an application that catches a read conflict and # continues can not commit the transaction later. root = self._db.open().root() root["real_data"] = real_data = PersistentDict() root["index"] = index = PersistentDict()
27,285
def testReadConflictIgnored(self): # Test that an application that catches a read conflict and # continues can not commit the transaction later. root = self._db.open().root() root["real_data"] = real_data = PersistentDict() root["index"] = index = PersistentDict()
def testReadConflictIgnored(self): # Test that an application that catches a read conflict and # continues can not commit the transaction later. root = self._db.open().root() root["real_data"] = real_data = PersistentDict() root["index"] = index = PersistentDict()
27,286
def testReadConflictIgnored(self): # Test that an application that catches a read conflict and # continues can not commit the transaction later. root = self._db.open().root() root["real_data"] = real_data = PersistentDict() root["index"] = index = PersistentDict()
def testReadConflictIgnored(self): # Test that an application that catches a read conflict and # continues can not commit the transaction later. root = self._db.open().root() root["real_data"] = real_data = PersistentDict() root["index"] = index = PersistentDict()
27,287
def testExceptionInTpcFinish(self):
def testExceptionInTpcFinish(self):
27,288
def testHoserStoppage(self):
def testHoserStoppage(self):
27,289
def handle_read(self): self.__input_lock.acquire() try: # Use a single __inp buffer and integer indexes to make this fast. try: d = self.recv(8192) except socket.error, err: if err[0] in expected_socket_read_errors: return raise if not d: return
def handle_read(self): self.__input_lock.acquire() try: # Use a single __inp buffer and integer indexes to make this fast. try: d = self.recv(8192) except socket.error, err: if err[0] in expected_socket_read_errors: return raise if not d: return
27,290
def pack(self): # Pack copies all data reachable at the pack time or later. # # Copying occurs in two phases. In the first phase, txns # before the pack time are copied if the contain any reachable # data. In the second phase, all txns after the pack time # are copied. # # Txn and data records contain pointers to pre...
def pack(self): # Pack copies all data reachable at the pack time or later. # # Copying occurs in two phases. In the first phase, txns # before the pack time are copied if the contain any reachable # data. In the second phase, all txns after the pack time # are copied. # # Txn and data records contain pointers to pre...
27,291
def _read_header(self): self._file.seek(self._pos) self._hdr = self._file.read(TRANS_HDR_LEN) (self.tid, length, self.status, self.user_len, self.descr_len, self.ext_len) = struct.unpack(TRANS_HDR, self._hdr) self.length = u64(length)
def _read_header(self): self._file.seek(self._pos) self._hdr = self._file.read(TRANS_HDR_LEN) (self.tid, self.length, self.status, self.user_len, self.descr_len, self.ext_len) = struct.unpack(TRANS_HDR, self._hdr) self.length = u64(length)
27,292
def _read_header(self): self._file.seek(self._pos) self._hdr = self._file.read(TRANS_HDR_LEN) (self.tid, length, self.status, self.user_len, self.descr_len, self.ext_len) = struct.unpack(TRANS_HDR, self._hdr) self.length = u64(length)
def _read_header(self): self._file.seek(self._pos) self._hdr = self._file.read(TRANS_HDR_LEN) (self.tid, length, self.status, self.user_len, self.descr_len, self.ext_len) = struct.unpack(TRANS_HDR, self._hdr) self.length = u64(length)
27,293
def main(): TIOBTree = makeSuite(TestIOBTrees, 'test') TOOBTree = makeSuite(TestOOBTrees, 'test') TOIBTree = makeSuite(TestOIBTrees, 'test') TIIBTree = makeSuite(TestIIBTrees, 'test') TIOSet = makeSuite(TestIOSets, 'test') TOOSet = makeSuite(TestOOSets, 'test') TOISet = makeSuite(TestIOSets, 'test') TIISet = makeSuite...
def test_suite(): TIOBTree = makeSuite(TestIOBTrees, 'test') TOOBTree = makeSuite(TestOOBTrees, 'test') TOIBTree = makeSuite(TestOIBTrees, 'test') TIIBTree = makeSuite(TestIIBTrees, 'test') TIOSet = makeSuite(TestIOSets, 'test') TOOSet = makeSuite(TestOOSets, 'test') TOISet = makeSuite(TestIOSets, 'test') TIISet = mak...
27,294
def lsubtract(l1, l2): l = filter(lambda x, l1=l1: x not in l1, l2) l = l + filter(lambda x, l2=l2: x not in l2, l1) return l
def lsubtract(l1, l2): l1=list(l1) l2=list(l2) l = filter(lambda x, l1=l1: x not in l1, l2) l = l + filter(lambda x, l2=l2: x not in l2, l1) return l
27,295
def realseq(itemsob): return map(lambda x: x, itemsob)
def realseq(itemsob): return map(lambda x: x, itemsob)
27,296
def testLoadAndStore(self): t = self.t try: root = self._getRoot() root['t'] = t get_transaction().commit() except: self._closeDB(root) self._delDB() raise
def testLoadAndStore(self): t = self.t try: root = self._getRoot() root['t'] = t get_transaction().commit() except: self._closeDB(root) self._delDB() raise
27,297
def testGhostUnghost(self): t = self.t try: root = self._getRoot() root['t'] = t get_transaction().commit() except: self._closeDB(root) self._delDB() raise
def testGhostUnghost(self): t = self.t try: root = self._getRoot() root['t'] = t get_transaction().commit() except: self._closeDB(root) self._delDB() raise
27,298
def testLen(self): # should sets know their length? t = self.t r = xrange(10000) for x in r: t.insert(x) assert len(t) == 1000, len(t)
def testLen(self): # should sets know their length? t = self.t r = xrange(10000) for x in r: t.insert(x) assert len(t) == 10000, len(t)
27,299