bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def __init__(self): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | def __init__(self): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | 27,500 |
def __init__(self): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | def __init__(self): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | 27,501 |
def __init__(self): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | def __init__(self): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | 27,502 |
def __init__(self): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | def __init__(self): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | 27,503 |
def commitVersion(self, src, dest, transaction, abort=None): # We are going to commit by simply storing back pointers. | defcommitVersion(self,src,dest,transaction,abort=None):#Wearegoingtocommitbysimplystoringbackpointers. | 27,504 |
def commitVersion(self, src, dest, transaction, abort=None): # We are going to commit by simply storing back pointers. | def commitVersion(self, src, dest, transaction, abort=None): # We are going to commit by simply storing back pointers. | 27,505 |
def _setupConflict(self): base=self.t d={} for i in range(20): d[random.randrange(-10000, 10001)]=i*100000 | def _setupConflict(self): base=self.t d={} for i in range(20): d[random.randrange(-10000, 10001)]=i*100000 | 27,506 |
def _setupConflict(self): base=self.t d={} for i in range(20): d[random.randrange(-10000, 10001)]=i*100000 | def _setupConflict(self): l=[ -5124, -7377, 2274, 8801, -9901, 7327, 1565, 17, -679, 3686, -3607, 14, 6419, -5637, 6040, -4556, -8622, 3847, 7191, -4067] e1=[-1704, 5420, -239, 4024, -6984] e2=[7745, 4868, -2548, -2711, -3154] base=self.t d={} for i in range(20): d[random.randrange(-10000, 10001)]=i*100000 | 27,507 |
def _setupConflict(self): base=self.t d={} for i in range(20): d[random.randrange(-10000, 10001)]=i*100000 | def _setupConflict(self): base=self.t d={} for i in range(20): d[random.randrange(-10000, 10001)]=i*100000 | 27,508 |
def commit_sub(self, t): tmp=self._tmp if tmp is None: return src=self._storage self._storage=tmp self._tmp=None | def commit_sub(self, t): tmp=self._tmp if tmp is None: return src=self._storage self._storage=tmp self._tmp=None | 27,509 |
def commit_sub(self, t): tmp=self._tmp if tmp is None: return src=self._storage self._storage=tmp self._tmp=None | def commit_sub(self, t): tmp=self._tmp if tmp is None: return src=self._storage self._storage=tmp self._tmp=None | 27,510 |
def commit_sub(self, t): tmp=self._tmp if tmp is None: return src=self._storage self._storage=tmp self._tmp=None | def commit_sub(self, t): tmp=self._tmp if tmp is None: return src=self._storage self._storage=tmp self._tmp=None | 27,511 |
... def hook(self, oid, tid, version): | ... def hook(self, oid, tid, version): | 27,512 |
... def hook(self, oid, tid, version): | ... def hook(self, oid, tid, version): | 27,513 |
... def hook(self, oid, tid, version): | ... def hook(self, oid, tid, version): | 27,514 |
def copyTransactionsFrom(self, other, verbose=0): """Copy transactions from another storage. | def copyTransactionsFrom(self, other, verbose=0): """Copy transactions from another storage. | 27,515 |
def __init__(self, sock, addr, obj=None): self.obj = None self.marshal = Marshaller() self.closed = 0 self.msgid = 0 self.peer_protocol_version = None # Set in recv_handshake() if isinstance(addr, types.TupleType): self.log_label = "zrpc-conn:%s:%d" % addr else: self.log_label = "zrpc-conn:%s" % addr self.__super_init(... | def __init__(self, sock, addr, obj=None): self.obj = None self.marshal = Marshaller() self.closed = False self.msgid = 0 self.peer_protocol_version = None # Set in recv_handshake() if isinstance(addr, types.TupleType): self.log_label = "zrpc-conn:%s:%d" % addr else: self.log_label = "zrpc-conn:%s" % addr self.__super_i... | 27,516 |
def __init__(self, sock, addr, obj=None): self.obj = None self.marshal = Marshaller() self.closed = 0 self.msgid = 0 self.peer_protocol_version = None # Set in recv_handshake() if isinstance(addr, types.TupleType): self.log_label = "zrpc-conn:%s:%d" % addr else: self.log_label = "zrpc-conn:%s" % addr self.__super_init(... | def __init__(self, sock, addr, obj=None): self.obj = None self.marshal = Marshaller() self.closed = 0 self.msgid = 0 self.peer_protocol_version = None # Set in recv_handshake() if isinstance(addr, types.TupleType): self.log_label = "zrpc-conn:%s:%d" % addr else: self.log_label = "zrpc-conn:%s" % addr self.__super_init(... | 27,517 |
def __init__(self, sock, addr, obj=None): self.obj = None self.marshal = Marshaller() self.closed = 0 self.msgid = 0 self.peer_protocol_version = None # Set in recv_handshake() if isinstance(addr, types.TupleType): self.log_label = "zrpc-conn:%s:%d" % addr else: self.log_label = "zrpc-conn:%s" % addr self.__super_init(... | def __init__(self, sock, addr, obj=None): self.obj = None self.marshal = Marshaller() self.closed = 0 self.msgid = 0 self.peer_protocol_version = None # Set in recv_handshake() if isinstance(addr, types.TupleType): self.log_label = "zrpc-conn:%s:%d" % addr else: self.log_label = "zrpc-conn:%s" % addr self.__super_init(... | 27,518 |
def __init__(self, sock, addr, obj=None): self.obj = None self.marshal = Marshaller() self.closed = 0 self.msgid = 0 self.peer_protocol_version = None # Set in recv_handshake() if isinstance(addr, types.TupleType): self.log_label = "zrpc-conn:%s:%d" % addr else: self.log_label = "zrpc-conn:%s" % addr self.__super_init(... | def __init__(self, sock, addr, obj=None): self.obj = None self.marshal = Marshaller() self.closed = 0 self.msgid = 0 self.peer_protocol_version = None # Set in recv_handshake() if isinstance(addr, types.TupleType): self.log_label = "zrpc-conn:%s:%d" % addr else: self.log_label = "zrpc-conn:%s" % addr self.__super_init(... | 27,519 |
def close(self): if self.closed: return self._map.clear() self.closed = 1 self.close_trigger() self.__super_close() | def close(self): if self.closed: return self._singleton.clear() self.closed = True self.close_trigger() self.__super_close() | 27,520 |
def handle_request(self, msgid, flags, name, args): if not self.check_method(name): msg = "Invalid method name: %s on %s" % (name, repr(self.obj)) raise ZRPCError(msg) if __debug__: self.log("calling %s%s" % (name, short_repr(args)), level=zLOG.DEBUG) | def handle_request(self, msgid, flags, name, args): if not self.check_method(name): msg = "Invalid method name: %s on %s" % (name, repr(self.obj)) raise ZRPCError(msg) if __debug__: self.log("calling %s%s" % (name, short_repr(args)), level=zLOG.DEBUG) | 27,521 |
def handle_request(self, msgid, flags, name, args): if not self.check_method(name): msg = "Invalid method name: %s on %s" % (name, repr(self.obj)) raise ZRPCError(msg) if __debug__: self.log("calling %s%s" % (name, short_repr(args)), level=zLOG.DEBUG) | def handle_request(self, msgid, flags, name, args): if not self.check_method(name): msg = "Invalid method name: %s on %s" % (name, repr(self.obj)) raise ZRPCError(msg) if __debug__: self.log("calling %s%s" % (name, short_repr(args)), level=zLOG.DEBUG) | 27,522 |
def _deferred_call(self, method, *args): if self.closed: raise DisconnectedError() msgid = self.send_call(method, args, 0) asyncore.poll(0.01, self._map) return msgid | def _deferred_call(self, method, *args): if self.closed: raise DisconnectedError() msgid = self.send_call(method, args, 0) asyncore.poll(0.01, self._singleton) return msgid | 27,523 |
def _prepare_async(self): self.thr_async = 0 ThreadedAsync.register_loop_callback(self.set_async) # XXX If we are not in async mode, this will cause dead # Connections to be leaked. | def _prepare_async(self): self.thr_async = False ThreadedAsync.register_loop_callback(self.set_async) # XXX If we are not in async mode, this will cause dead # Connections to be leaked. | 27,524 |
def set_async(self, map): self.trigger = trigger() self.thr_async = 1 | def set_async(self, map): self.trigger = trigger() self.thr_async = 1 | 27,525 |
def wait(self, msgid): """Invoke asyncore mainloop and wait for reply.""" if __debug__: self.log("wait(%d), async=%d" % (msgid, self.is_async()), level=zLOG.TRACE) if self.is_async(): self._pull_trigger() | def wait(self, msgid): """Invoke asyncore mainloop and wait for reply.""" if __debug__: self.log("wait(%d), async=%d" % (msgid, self.is_async()), level=zLOG.TRACE) if self.is_async(): self._pull_trigger() | 27,526 |
def poll(self): """Invoke asyncore mainloop to get pending message out.""" if __debug__: self.log("poll(), async=%d" % self.is_async(), level=zLOG.TRACE) if self.is_async(): self._pull_trigger() else: asyncore.poll(0.0, self._map) | def poll(self): """Invoke asyncore mainloop to get pending message out.""" if __debug__: self.log("poll(), async=%d" % self.is_async(), level=zLOG.TRACE) if self.is_async(): self._pull_trigger() else: asyncore.poll(0.0, self._map) | 27,527 |
def check_mgr_async(self): if not self.thr_async and self.mgr.thr_async: assert self.mgr.trigger is not None, \ "manager (%s) has no trigger" % self.mgr self.thr_async = 1 self.trigger = self.mgr.trigger return 1 return 0 | def check_mgr_async(self): if not self.thr_async and self.mgr.thr_async: assert self.mgr.trigger is not None, \ "manager (%s) has no trigger" % self.mgr self.thr_async = True self.trigger = self.mgr.trigger return 1 return 0 | 27,528 |
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,529 |
def next(self, index=0): pos = self._pos while pos < self._tend: # Read the data records for this transaction self._file.seek(pos) h = self._file.read(DATA_HDR_LEN) oid, serial, sprev, stloc, vlen, splen = unpack(DATA_HDR, h) prev = U64(sprev) tloc = U64(stloc) plen = U64(splen) | defnext(self,index=0):pos=self._poswhilepos<self._tend:#Readthedatarecordsforthistransactionself._file.seek(pos)h=self._file.read(DATA_HDR_LEN)oid,serial,sprev,stloc,vlen,splen=unpack(DATA_HDR,h)prev=U64(sprev)tloc=U64(stloc)plen=U64(splen) | 27,530 |
def close_server(self): """Close the dispatcher so that there are no new connections. | def close_server(self): """Close the dispatcher so that there are no new connections. | 27,531 |
def run(self): while not self._stop: self._active.wait() self._lock.acquire() try: howlong = self._deadline - time.time() finally: self._lock.release() if howlong <= 0: self.timeout() else: time.sleep(howlong) | def run(self): while not self._stop: self._active.wait() self._lock.acquire() try: deadline = self._deadline if deadline is None: continue howlong = deadline - time.time() finally: self._lock.release() if howlong <= 0: self.timeout() else: time.sleep(howlong) | 27,532 |
def zeoVerify(self, oid, s, sv): try: p, os, v, pv, osv = self.zeoLoad(oid) except: # except what? return None if os != s: self.client.invalidateVerify((oid, '')) elif osv != sv: self.client.invalidateVerify((oid, v)) | def zeoVerify(self, oid, s, sv): try: p, os, v, pv, osv = self.zeoLoad(oid) except: # except what? return None if os != s: self.client.invalidateVerify((oid, '')) elif osv != sv: self.client.invalidateVerify((oid, v)) | 27,533 |
def zeoVerify(self, oid, s, sv): try: p, os, v, pv, osv = self.zeoLoad(oid) except: # except what? return None if os != s: self.client.invalidateVerify((oid, '')) elif osv != sv: self.client.invalidateVerify((oid, v)) | def zeoVerify(self, oid, s, sv): try: p, os, v, pv, osv = self.zeoLoad(oid) except: # except what? return None if os != s: self.client.invalidateVerify((oid, '')) elif osv != sv: self.client.invalidateVerify((oid, v)) | 27,534 |
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,535 |
def invalidate(self, oid, connection=None, version='', rc=sys.getrefcount): """Invalidate references to a given oid. | def invalidate(self, oid, connection=None, version='', rc=sys.getrefcount): """Invalidate references to a given oid. | 27,536 |
def commit(self, reallyme, t): db=self._db dest=self._dest for oid in db._storage.commitVersion(self._version, dest, t): db.invalidate(oid, version=dest) | def commit(self, reallyme, t): db=self._db dest=self._dest oids=db._storage.commitVersion(self._version, dest, t) for oid in oids: db.invalidate(oid, version=dest) if dest: for oid in oids: db.invalidate(oid, version=self._version) | 27,537 |
def set_pack_time(): snooze() pack_times.append(time.time()) | def set_pack_time(): snooze() pack_times.append(time.time()) | 27,538 |
def checkPackAllRevisions(self): self._initroot() eq = self.assertEqual raises = self.assertRaises # Create a `persistent' object obj = self._newobj() oid = obj.getoid() obj.value = 1 # Commit three different revisions revid1 = self._dostoreNP(oid, data=pickle.dumps(obj)) obj.value = 2 revid2 = self._dostoreNP(oid, rev... | def time.sleep(1) checkPackAllRevisions(self): time.sleep(1) self._initroot() time.sleep(1) eq time.sleep(1) = time.sleep(1) self.assertEqual time.sleep(1) raises time.sleep(1) = time.sleep(1) self.assertRaises time.sleep(1) # time.sleep(1) Create time.sleep(1) a time.sleep(1) `persistent' time.sleep(1) ob... | 27,539 |
# def persistent_id(object, | # def persistent_id(object, | 27,540 |
def commit_sub(self, t, _type=type, _st=type(''), _None=None): """Commit all work done in subtransactions""" tmp=self._tmp if tmp is _None: return src=self._storage | def commit_sub(self, t, _type=type, _st=type(''), _None=None): """Commit all work done in subtransactions""" tmp=self._tmp if tmp is _None: return src=self._storage | 27,541 |
def tpc_vote(self, transaction, _type=type, _st=type('')): self.__onCommitActions = () try: vote=self._storage.tpc_vote except: return s=vote(transaction) if s: get=self._cache.get for oid, s in s: o=get(oid, oid) if o is not oid: if _type(s) is not _st: raise s if s == ResolvedSerial: o._p_changed=None else: o._p_seri... | def tpc_vote(self, transaction, _type=type, _st=type('')): self.__onCommitActions = () try: vote=self._storage.tpc_vote except: return s=vote(transaction) if s: get=self._cache.get for oid, s in s: o=get(oid, oid) if o is not oid: if _type(s) is not _st: raise s if s == ResolvedSerial: o._p_changed=None else: o._p_seri... | 27,542 |
def options(args): """Password-specific options loaded from regular ZEO config file.""" schema = ZConfig.loadSchema(os.path.join(os.path.dirname(ZEO.__file__), "schema.xml")) try: options, args = getopt.getopt(args, "C:", ["configure="]) except getopt.error, msg: usage(msg) config = None delete = False for k, v in op... | def options(args): """Password-specific options loaded from regular ZEO config file.""" try: options, args = getopt.getopt(args, "C:", ["configure="]) except getopt.error, msg: usage(msg) config = None delete = False for k, v in options: if k == '-C' or k == '--configure': config, nil = ZConfig.loadConfig(schema, v) i... | 27,543 |
def options(args): """Password-specific options loaded from regular ZEO config file.""" schema = ZConfig.loadSchema(os.path.join(os.path.dirname(ZEO.__file__), "schema.xml")) try: options, args = getopt.getopt(args, "C:", ["configure="]) except getopt.error, msg: usage(msg) config = None delete = False for k, v in op... | def options(args): """Password-specific options loaded from regular ZEO config file.""" schema = ZConfig.loadSchema(os.path.join(os.path.dirname(ZEO.__file__), "schema.xml")) try: options, args = getopt.getopt(args, "dr:p:f:C:", ["configure=", "protocol=", "filename=", "realm"]) except getopt.error, msg: usage(msg) c... | 27,544 |
def options(args): """Password-specific options loaded from regular ZEO config file.""" schema = ZConfig.loadSchema(os.path.join(os.path.dirname(ZEO.__file__), "schema.xml")) try: options, args = getopt.getopt(args, "C:", ["configure="]) except getopt.error, msg: usage(msg) config = None delete = False for k, v in op... | def options(args): """Password-specific options loaded from regular ZEO config file.""" schema = ZConfig.loadSchema(os.path.join(os.path.dirname(ZEO.__file__), "schema.xml")) try: options, args = getopt.getopt(args, "C:", ["configure="]) except getopt.error, msg: usage(msg) config = None delete = 0 auth_protocol = No... | 27,545 |
def options(args): """Password-specific options loaded from regular ZEO config file.""" schema = ZConfig.loadSchema(os.path.join(os.path.dirname(ZEO.__file__), "schema.xml")) try: options, args = getopt.getopt(args, "C:", ["configure="]) except getopt.error, msg: usage(msg) config = None delete = False for k, v in op... | def options(args): """Password-specific options loaded from regular ZEO config file.""" schema = ZConfig.loadSchema(os.path.join(os.path.dirname(ZEO.__file__), "schema.xml")) try: options, args = getopt.getopt(args, "C:", ["configure="]) except getopt.error, msg: usage(msg) config = None delete = False for k, v in op... | 27,546 |
def options(args): """Password-specific options loaded from regular ZEO config file.""" schema = ZConfig.loadSchema(os.path.join(os.path.dirname(ZEO.__file__), "schema.xml")) try: options, args = getopt.getopt(args, "C:", ["configure="]) except getopt.error, msg: usage(msg) config = None delete = False for k, v in op... | def options(args): """Password-specific options loaded from regular ZEO config file.""" schema = ZConfig.loadSchema(os.path.join(os.path.dirname(ZEO.__file__), "schema.xml")) try: options, args = getopt.getopt(args, "C:", ["configure="]) except getopt.error, msg: usage(msg) config = None delete = False for k, v in op... | 27,547 |
def main(args=None): options, delete, username, password = options(args) p = options.authentication_protocol if p is None: usage("ZEO configuration does not specify authentication-protocol") if p == "digest": from ZEO.auth.auth_digest import DigestDatabase as Database elif p == "srp": from ZEO.auth.auth_srp import SRPD... | def main(args=None): p, auth_db, auth_realm, delete, username, password = options(args) if p is None: usage("ZEO configuration does not specify authentication-protocol") if p == "digest": from ZEO.auth.auth_digest import DigestDatabase as Database elif p == "srp": from ZEO.auth.auth_srp import SRPDatabase as Database i... | 27,548 |
def main(args=None): options, delete, username, password = options(args) p = options.authentication_protocol if p is None: usage("ZEO configuration does not specify authentication-protocol") if p == "digest": from ZEO.auth.auth_digest import DigestDatabase as Database elif p == "srp": from ZEO.auth.auth_srp import SRPD... | def main(args=None): options, delete, username, password = options(args) p = options.authentication_protocol if p is None: usage("ZEO configuration does not specify authentication-protocol") if p == "digest": from ZEO.auth.auth_digest import DigestDatabase as Database elif p == "srp": from ZEO.auth.auth_srp import SRPD... | 27,549 |
def main(args=None): options, delete, username, password = options(args) p = options.authentication_protocol if p is None: usage("ZEO configuration does not specify authentication-protocol") if p == "digest": from ZEO.auth.auth_digest import DigestDatabase as Database elif p == "srp": from ZEO.auth.auth_srp import SRPD... | def main(args=None): options, delete, username, password = options(args) p = options.authentication_protocol if p is None: usage("ZEO configuration does not specify authentication-protocol") if p == "digest": from ZEO.auth.auth_digest import DigestDatabase as Database elif p == "srp": from ZEO.auth.auth_srp import SRPD... | 27,550 |
def main(args=None): options, delete, username, password = options(args) p = options.authentication_protocol if p is None: usage("ZEO configuration does not specify authentication-protocol") if p == "digest": from ZEO.auth.auth_digest import DigestDatabase as Database elif p == "srp": from ZEO.auth.auth_srp import SRPD... | def main(args=None): options, delete, username, password = options(args) p = options.authentication_protocol if p is None: usage("ZEO configuration does not specify authentication-protocol") if p == "digest": from ZEO.auth.auth_digest import DigestDatabase as Database elif p == "srp": from ZEO.auth.auth_srp import SRPD... | 27,551 |
def _setDB(self, odb=None): """Begin a new transaction. | def _setDB(self, odb): """Begin a new transaction. | 27,552 |
def close(self): self._incrgc() self._db._closeConnection(self) self._db=self._storage=self._tmp=None | def close(self): self._incrgc() self._db._closeConnection(self) self._db=self._storage=self._tmp=None | 27,553 |
def startServer(self, create=1, index=0, read_only=0, ro_svr=0): addr = self.addr[index] zLOG.LOG("testZEO", zLOG.INFO, "startServer(create=%d, index=%d, read_only=%d) @ %s" % (create, index, read_only, addr)) path = "%s.%d" % (self.file, index) sconf = self.getConfig(path, create, read_only) zconf = forker.ZEOConfig(a... | def startServer(self, create=1, index=0, read_only=0, ro_svr=0): addr = self.addr[index] zLOG.LOG("testZEO", zLOG.INFO, "startServer(create=%d, index=%d, read_only=%d) @ %s" % (create, index, read_only, addr)) path = "%s.%d" % (self.file, index) sconf = self.getConfig(path, create, read_only) zconf = forker.ZEOConfig(a... | 27,554 |
def abortVersion(self, src, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._lock_acquire() try: oids=self._call('abortVersion', src, self._serial) invalidate=self._cache.invalidate for oid in oids: invalidate(oid, src) return oids finally: self.... | def abortVersion(self, src, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._lock_acquire() try: oids=self._call('abortVersion', src, self._serial) vlen = pack(">H", len(src)) for oid in oids: self._tfile.write("i%s%s%s" % (oid, vlen, src)) retur... | 27,555 |
def commitVersion(self, src, dest, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._lock_acquire() try: oids=self._call('commitVersion', src, dest, self._serial) invalidate=self._cache.invalidate if dest: # just invalidate our version data for oi... | def commitVersion(self, src, dest, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._lock_acquire() try: oids=self._call('commitVersion', src, dest, self._serial) invalidate=self._cache.invalidate if dest: # just invalidate our version data for oi... | 27,556 |
def commitVersion(self, src, dest, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._lock_acquire() try: oids=self._call('commitVersion', src, dest, self._serial) invalidate=self._cache.invalidate if dest: # just invalidate our version data for oi... | def commitVersion(self, src, dest, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._lock_acquire() try: oids=self._call('commitVersion', src, dest, self._serial) invalidate=self._cache.invalidate if dest: # just invalidate our version data for oi... | 27,557 |
def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._lock_acquire() try: serial=self._call.sendMessage('storea', oid, serial, data, version, self._serial) write=self._tfile.write write(oid+pack(">HI", len(... | def store(self, oid, serial, data, version, transaction): if transaction is not self._transaction: raise POSException.StorageTransactionError(self, transaction) self._lock_acquire() try: serial=self._call.sendMessage('storea', oid, serial, data, version, self._serial) write=self._tfile.write write(oid+pack(">HI", len(... | 27,558 |
def tpc_finish(self, transaction, f=None): self._lock_acquire() try: if transaction is not self._transaction: return if f is not None: f() | def tpc_finish(self, transaction, f=None): self._lock_acquire() try: if transaction is not self._transaction: return if f is not None: f() | 27,559 |
def stop_server(self): self.kill(pids=self.getpids()) # XXX Wait for the pidfile to disappear; not really clean. # Needed since we're not actually waiting for the ZEO server # process to exit (it's a grandchild, not a child). It we # don't wait, there's a race condition between one test and # the next -- if the ZEO se... | def stop_server(self): self.kill(pids=self.getpids()) # XXX Wait for the pidfile to disappear; not really clean. # Needed since we're not actually waiting for the ZEO server # process to exit (it's a grandchild, not a child). It we # don't wait, there's a race condition between one test and # the next -- if the ZEO se... | 27,560 |
def free_transaction(_id=thread.get_ident, _t=_t): id = _id() try: del _t[id] except KeyError: pass | def free_transaction(_id=thread.get_ident, _t=_t): id = _id() try: del _t[id] except KeyError: pass | 27,561 |
def __init__(self, storage='', size=20000000, client=None, var=None): | def __init__(self, storage='', size=20000000, client=None, var=None): | 27,562 |
def invalidate(self, oid, version): self._acquire() try: p = self._get(oid, None) if p is None: return None f = self._f[p < 0] ap = abs(p) f.seek(ap) h = f.read(8) if h != oid: return f.seek(8, 1) # Dang, we shouldn't have to do this. Bad Solaris & NT if version: f.write('n') else: del self._index[oid] f.write('i') fin... | def invalidate(self, oid, version): self._acquire() try: p = self._get(oid, None) if p is None: return None f = self._f[p < 0] ap = abs(p) f.seek(ap) h = f.read(8) if h != oid: return f.seek(p+8) # Dang, we shouldn't have to do this. Bad Solaris & NT if version: f.write('n') else: del self._index[oid] f.write('i') fina... | 27,563 |
def __init__(self, storage, pool_size=7, cache_size=400, cache_deactivate_after=None, version_pool_size=3, version_cache_size=100, version_cache_deactivate_after=None, ): """Create an object database. | def __init__(self, storage, pool_size=7, cache_size=400, cache_deactivate_after=None, version_pool_size=3, version_cache_size=100, version_cache_deactivate_after=None, ): """Create an object database. | 27,564 |
def __init__(self, storage, pool_size=7, cache_size=400, cache_deactivate_after=None, version_pool_size=3, version_cache_size=100, version_cache_deactivate_after=None, ): """Create an object database. | def __init__(self, storage, pool_size=7, cache_size=400, cache_deactivate_after=None, version_pool_size=3, version_cache_size=100, version_cache_deactivate_after=None, ): """Create an object database. | 27,565 |
def _cacheMean(self, attr): # XXX this method doesn't work m=[0,0] def f(con, m=m, attr=attr): t=getattr(con._cache, attr) m[0]=m[0]+t m[1]=m[1]+1 | def _cacheMean(self, attr): # XXX this method doesn't work m = [0, 0] def f(con, m=m, attr=attr): t=getattr(con._cache, attr) m[0]=m[0]+t m[1]=m[1]+1 | 27,566 |
def f(con, m=m, attr=attr): 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,567 |
def f(con, m=m, attr=attr): 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,568 |
def _closeConnection(self, connection): """Return a connection to the pool. | def_closeConnection(self,connection):"""Returnaconnectiontothepool. | 27,569 |
def _connectionMap(self, f): self._a() try: pools,pooll=self._pools for pool, allocated in pooll: for cc in allocated: f(cc) | def _connectionMap(self, f): self._a() try: pools, pooll = self._pools for pool, allocated in pooll: for cc in allocated: f(cc) | 27,570 |
def _connectionMap(self, f): self._a() try: pools,pooll=self._pools for pool, allocated in pooll: for cc in allocated: f(cc) | def _connectionMap(self, f): self._a() try: pools,pooll=self._pools for pool, allocated in pooll: for cc in allocated: f(cc) | 27,571 |
def _connectionMap(self, f): self._a() try: pools,pooll=self._pools for pool, allocated in pooll: for cc in allocated: f(cc) | def _connectionMap(self, f): self._a() try: pools,pooll=self._pools for pool, allocated in pooll: for cc in allocated: f(cc) | 27,572 |
def _connectionMap(self, f): self._a() try: pools,pooll=self._pools for pool, allocated in pooll: for cc in allocated: f(cc) | def _connectionMap(self, f): self._a() try: pools,pooll=self._pools for pool, allocated in pooll: for cc in allocated: f(cc) | 27,573 |
def f(con, detail=detail, have_detail=detail.has_key): for oid, ob in con._cache.items(): module = getattr(ob.__class__, '__module__', '') module = module and '%s.' % module or '' c = "%s%s" % (module, ob.__class__.__name__) if have_detail(c): detail[c] = detail[c] + 1 else: detail[c] = 1 | def f(con, detail=detail, have_detail=detail.has_key): for oid, ob in con._cache.items(): module = getattr(ob.__class__, '__module__', '') module = module and '%s.' % module or '' c = "%s%s" % (module, ob.__class__.__name__) if have_detail(c): detail[c] += 1 else: detail[c] = 1 | 27,574 |
def f(con, m=m): t=con._cache.cache_last_gc_time if t > m[0]: m[0]=t | def f(con, m=m): t=con._cache.cache_last_gc_time if t > m[0]: m[0]=t | 27,575 |
def cacheMeanAge(self): return self._cacheMean('cache_mean_age') | def cacheMeanAge(self): return self._cacheMean('cache_mean_age') | 27,576 |
def f(con, m=m): m[0] = m[0] + con._cache.cache_non_ghost_count | def f(con, m=m): m[0] = m[0] + con._cache.cache_non_ghost_count | 27,577 |
def cacheDetailSize(self): m=[] def f(con, m=m): m.append({'connection':repr(con), 'ngsize':con._cache.cache_non_ghost_count, 'size':len(con._cache)}) self._connectionMap(f) m.sort() return m | def cacheDetailSize(self): m = [] def f(con, m=m): m.append({'connection':repr(con), 'ngsize':con._cache.cache_non_ghost_count, 'size':len(con._cache)}) self._connectionMap(f) m.sort() return m | 27,578 |
def getName(self): return self._storage.getName() | def getName(self): return self._storage.getName() | 27,579 |
def invalidate(self, tid, oids, connection=None, version=''): """Invalidate references to a given oid. | def invalidate(self, tid, oids, connection=None, version=''): """Invalidate references to a given oid. | 27,580 |
def invalidate(self, tid, oids, connection=None, version=''): """Invalidate references to a given oid. | def invalidate(self, tid, oids, connection=None, version=''): """Invalidate references to a given oid. | 27,581 |
def invalidate(self, tid, oids, connection=None, version=''): """Invalidate references to a given oid. | def invalidate(self, tid, oids, connection=None, version=''): """Invalidate references to a given oid. | 27,582 |
def modifiedInVersion(self, oid): h=hash(oid)%131 cache=self._miv_cache o=cache.get(h, None) if o and o[0]==oid: return o[1] v=self._storage.modifiedInVersion(oid) cache[h]=oid, v return v | def modifiedInVersion(self, oid): h = hash(oid) % 131 cache = self._miv_cache o=cache.get(h, None) if o and o[0]==oid: return o[1] v=self._storage.modifiedInVersion(oid) cache[h]=oid, v return v | 27,583 |
def modifiedInVersion(self, oid): h=hash(oid)%131 cache=self._miv_cache o=cache.get(h, None) if o and o[0]==oid: return o[1] v=self._storage.modifiedInVersion(oid) cache[h]=oid, v return v | def modifiedInVersion(self, oid): h=hash(oid)%131 cache=self._miv_cache o=cache.get(h, None) if o and o[0]==oid: return o[1] v = self._storage.modifiedInVersion(oid) cache[h] = oid, v return v | 27,584 |
def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | defopen(self,version='',transaction=None,temporary=0,force=None,waitflag=1,mvcc=True,txn_mgr=None,synch=True):"""ReturnadatabaseConnectionforusebyapplicationcode. | 27,585 |
def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | def open(self, version='', transaction=None, temporary=0, force=None, waitflag=1, mvcc=True, txn_mgr=None, synch=True): """Return a database Connection for use by application code. | 27,586 |
def connectionDebugInfo(self): r=[] pools,pooll=self._pools t=time() for version, (pool, allocated, lock) in pools.items(): for c in allocated: o=c._opened d=c._debug_info if d: if len(d)==1: d=d[0] else: d='' d="%s (%s)" % (d, len(c._cache)) | def connectionDebugInfo(self): r = [] pools, pooll = self._pools t = time() for version, (pool, allocated, lock) in pools.items(): for c in allocated: o=c._opened d=c._debug_info if d: if len(d)==1: d=d[0] else: d='' d="%s (%s)" % (d, len(c._cache)) | 27,587 |
def connectionDebugInfo(self): r=[] pools,pooll=self._pools t=time() for version, (pool, allocated, lock) in pools.items(): for c in allocated: o=c._opened d=c._debug_info if d: if len(d)==1: d=d[0] else: d='' d="%s (%s)" % (d, len(c._cache)) | def connectionDebugInfo(self): r=[] pools,pooll=self._pools t=time() for version, (pool, allocated, lock) in pools.items(): for c in allocated: o = c._opened d = c._debug_info if d: if len(d)==1: d=d[0] else: d='' d="%s (%s)" % (d, len(c._cache)) | 27,588 |
def connectionDebugInfo(self): r=[] pools,pooll=self._pools t=time() for version, (pool, allocated, lock) in pools.items(): for c in allocated: o=c._opened d=c._debug_info if d: if len(d)==1: d=d[0] else: d='' d="%s (%s)" % (d, len(c._cache)) | def connectionDebugInfo(self): r=[] pools,pooll=self._pools t=time() for version, (pool, allocated, lock) in pools.items(): for c in allocated: o=c._opened d=c._debug_info if d: if len(d)==1: d=d[0] else: d='' d="%s (%s)" % (d, len(c._cache)) | 27,589 |
def setPoolSize(self, v): self._pool_size=v | def setPoolSize(self, v): self._pool_size=v | 27,590 |
def setVersionCacheSize(self, v): self._version_cache_size=v for ver in self._pools[0].keys(): if ver: for c in self._pools[0][ver][1]: c._cache.cache_size=v | def setVersionCacheSize(self, v): self._version_cache_size = v for ver in self._pools[0].keys(): if ver: for c in self._pools[0][ver][1]: c._cache.cache_size=v | 27,591 |
def setVersionCacheSize(self, v): self._version_cache_size=v for ver in self._pools[0].keys(): if ver: for c in self._pools[0][ver][1]: c._cache.cache_size=v | def setVersionCacheSize(self, v): self._version_cache_size=v for ver in self._pools[0].keys(): if ver: for c in self._pools[0][ver][1]: c._cache.cache_size=v | 27,592 |
def commit(self, ob, t): dest=self._dest tid, oids = self._db._storage.commitVersion(self._version, self._dest, t) oids = dict.fromkeys(oids, 1) self._db.invalidate(tid, oids, version=self._dest) if self._dest: # the code above just invalidated the dest version. # now we need to invalidate the source! self._db.invalida... | def commit(self, ob, t): dest = self._dest tid, oids = self._db._storage.commitVersion(self._version, self._dest, t) oids = dict.fromkeys(oids, 1) self._db.invalidate(tid, oids, version=self._dest) if self._dest: # the code above just invalidated the dest version. # now we need to invalidate the source! self._db.invali... | 27,593 |
def commit(self, ob, t): tid, oids = self._db._storage.abortVersion(self._version, t) self._db.invalidate(tid, dict.fromkeys(oids, 1), version=self._version) | def commit(self, ob, t): tid, oids = self._db._storage.abortVersion(self._version, t) self._db.invalidate(tid, dict.fromkeys(oids, 1), version=self._version) | 27,594 |
def finishConnect(self, s): SizedMessageAsyncConnection.__init__(self, s, {}) | def finishConnect(self, s): SizedMessageAsyncConnection.__init__(self, s, {}) | 27,595 |
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... | deftvindex=self._tvindex commitVersion(self,tvindex=self._tvindex src,tvindex=self._tvindex dest,tvindex=self._tvindex transaction):tvindex=self._tvindex #tvindex=self._tvindex Wetvindex=self._tvindex aretvindex=self._tvindex goingtvindex=self._tvindex totvindex=self._tvindex committvindex=self._tvindex bytv... | 27,596 |
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,597 |
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: | 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: | 27,598 |
def _abort(self): if self._nextpos: self._file.truncate(self._nextpos) | def _abort(self): if self._nextpos: self._file.truncate(self._nextpos) | 27,599 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.