bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def u64(v, unpack=struct.unpack): h, v = unpack(">ii", v) if v < 0: v=t32-v if h: if h < 0: h=t32-h v=h*t32+v return v | def u64(v, unpack=struct.unpack): h, v = unpack(">ii", v) if v < 0: v=t32-v if h: if h < 0: h=t32+h v=h*t32+v return v | 27,000 |
def p64(v, pack=struct.pack): """Pack an integer or long into a 8-byte string""" if v < t32: h=0 else: h=v/t32 v=v%t32 return pack(">II", h, v) | def p64(v, pack=struct.pack): """Pack an integer or long into a 8-byte string""" if v < t32: h = 0 else: h=v/t32 v=v%t32 return pack(">II", h, v) | 27,001 |
def p64(v, pack=struct.pack): """Pack an integer or long into a 8-byte string""" if v < t32: h=0 else: h=v/t32 v=v%t32 return pack(">II", h, v) | def p64(v, pack=struct.pack): """Pack an integer or long into a 8-byte string""" if v < t32: h=0 else: h, v = divmod(v, t32) return pack(">II", h, v) | 27,002 |
def u64(v, unpack=struct.unpack): """Unpack an 8-byte string into a 64-bit (or long) integer""" h, v = unpack(">ii", v) if v < 0: v=t32+v if h: if h < 0: h=t32+h v=h*t32+v return v | def u64(v, unpack=struct.unpack): """Unpack an 8-byte string into a 64-bit (or long) integer""" h, v = unpack(">ii", v) if v < 0: v = t32 + v if h: if h < 0: h=t32+h v=h*t32+v return v | 27,003 |
def u64(v, unpack=struct.unpack): """Unpack an 8-byte string into a 64-bit (or long) integer""" h, v = unpack(">ii", v) if v < 0: v=t32+v if h: if h < 0: h=t32+h v=h*t32+v return v | def u64(v, unpack=struct.unpack): """Unpack an 8-byte string into a 64-bit (or long) integer""" h, v = unpack(">ii", v) if v < 0: v=t32+v if h: if h < 0: h = t32 + h v = (h << 32) + v return v | 27,004 |
def U64(v, unpack=struct.unpack): """Same as u64 but always returns a long.""" h, v = unpack(">II", v) if h: v=h*t32+v return v | def U64(v, unpack=struct.unpack): """Same as u64 but always returns a long.""" h, v = unpack(">II", v) if h: v = (h << 32) + v return v | 27,005 |
def log(msg, level=zLOG.INFO): zLOG.LOG("ZEC", level, msg) | def log(msg, level=zLOG.INFO): zLOG.LOG("ZEC", level, msg) | 27,006 |
def __init__(self, storage='1', size=20000000, client=None, var=None): # Arguments: # storage -- storage name (used in persistent cache file names only) # size -- size limit in bytes of both files together # client -- if not None, use a persistent cache file and use this name # var -- directory where to create persiste... | def __init__(self, storage='1', size=20000000, client=None, var=None): # Arguments: # storage -- storage name (used in persistent cache file names only) # size -- size limit in bytes of both files together # client -- if not None, use a persistent cache file and use this name # var -- directory where to create persiste... | 27,007 |
def __init__(self, storage='1', size=20000000, client=None, var=None): # Arguments: # storage -- storage name (used in persistent cache file names only) # size -- size limit in bytes of both files together # client -- if not None, use a persistent cache file and use this name # var -- directory where to create persiste... | def __init__(self, storage='1', size=20000000, client=None, var=None): # Arguments: # storage -- storage name (used in persistent cache file names only) # size -- size limit in bytes of both files together # client -- if not None, use a persistent cache file and use this name # var -- directory where to create persiste... | 27,008 |
def open(self): # Two tasks: # - Set self._index, self._get, and self._pos. # - Read and validate both cache files, returning a list of # serials to be used by verify(). # This may be called more than once (by the cache verification code). self._acquire() try: self._index = index = {} self._get = index.get serial = {... | def open(self): # Two tasks: # - Set self._index, self._get, and self._pos. # - Read and validate both cache files, returning a list of # serials to be used by verify(). # This may be called more than once (by the cache verification code). self._acquire() try: self._index = index = {} self._get = index.get serial = {... | 27,009 |
def invalidate(self, oid, version): self._acquire() try: p = self._get(oid, None) if p is None: self._trace(0x10, oid, version) return None f = self._f[p < 0] ap = abs(p) f.seek(ap) h = f.read(27) if len(h) != 27: log("invalidate: short record for oid %16x " "at position %d in cache file %d" % (U64(oid), ap, p < 0)) de... | def invalidate(self, oid, version): self._acquire() try: p = self._get(oid, None) if p is None: self._trace(0x10, oid, version) return None f = self._f[p < 0] ap = abs(p) f.seek(ap) h = f.read(27) if len(h) != 27: self.log("invalidate: short record for oid %16x " "at position %d in cache file %d" % (U64(oid), ap, p < 0... | 27,010 |
def invalidate(self, oid, version): self._acquire() try: p = self._get(oid, None) if p is None: self._trace(0x10, oid, version) return None f = self._f[p < 0] ap = abs(p) f.seek(ap) h = f.read(27) if len(h) != 27: log("invalidate: short record for oid %16x " "at position %d in cache file %d" % (U64(oid), ap, p < 0)) de... | def invalidate(self, oid, version): self._acquire() try: p = self._get(oid, None) if p is None: self._trace(0x10, oid, version) return None f = self._f[p < 0] ap = abs(p) f.seek(ap) h = f.read(27) if len(h) != 27: log("invalidate: short record for oid %16x " "at position %d in cache file %d" % (U64(oid), ap, p < 0)) de... | 27,011 |
def load(self, oid, version): self._acquire() try: p = self._get(oid, None) if p is None: self._trace(0x20, oid, version) return None f = self._f[p < 0] ap = abs(p) seek = f.seek read = f.read seek(ap) h = read(27) if len(h)==27 and h[8] in 'nv' and h[:8]==oid: tlen, vlen, dlen = unpack(">iHi", h[9:19]) else: tlen = -1... | def load(self, oid, version): self._acquire() try: p = self._get(oid, None) if p is None: self._trace(0x20, oid, version) return None f = self._f[p < 0] ap = abs(p) seek = f.seek read = f.read seek(ap) h = read(27) if len(h)==27 and h[8] in 'nv' and h[:8]==oid: tlen, vlen, dlen = unpack(">iHi", h[9:19]) else: tlen = -1... | 27,012 |
def modifiedInVersion(self, oid): # This should return: # - The version from the record for oid, if there is one. # - '', if there is no version in the record and its status is 'v'. # - None, if we don't know: no valid record or status is 'n'. self._acquire() try: p = self._get(oid, None) if p is None: self._trace(0x40... | def modifiedInVersion(self, oid): # This should return: # - The version from the record for oid, if there is one. # - '', if there is no version in the record and its status is 'v'. # - None, if we don't know: no valid record or status is 'n'. self._acquire() try: p = self._get(oid, None) if p is None: self._trace(0x40... | 27,013 |
def checkSize(self, size): # Make sure we aren't going to exceed the target size. # If we are, then flip the cache. self._acquire() try: if self._pos + size > self._limit: current = not self._current self._current = current self._trace(0x70) log("flipping cache files. new current = %d" % current) # Delete the half of ... | def checkSize(self, size): # Make sure we aren't going to exceed the target size. # If we are, then flip the cache. self._acquire() try: if self._pos + size > self._limit: current = not self._current self._current = current self._trace(0x70) self.log("flipping cache files. new current = %d" % current) # Delete the hal... | 27,014 |
def _setup_trace(self): # See if cache tracing is requested through $ZEO_CACHE_TRACE. # If not, or if we can't write to the trace file, # disable tracing by setting self._trace to a dummy function. self._tracefile = None tfn = os.environ.get("ZEO_CACHE_TRACE") if tfn: try: self._tracefile = open(tfn, "ab") self._trace(... | def _setup_trace(self): # See if cache tracing is requested through $ZEO_CACHE_TRACE. # If not, or if we can't write to the trace file, # disable tracing by setting self._trace to a dummy function. self._tracefile = None tfn = os.environ.get("ZEO_CACHE_TRACE") if tfn: try: self._tracefile = open(tfn, "ab") self._trace(... | 27,015 |
def read_index(index, serial, f, fileindex): seek = f.seek read = f.read pos = 4 count = 0 while 1: f.seek(pos) h = read(27) if len(h) != 27: # An empty read is expected, anything else is suspect if h: rilog("truncated header", pos, fileindex) break if h[8] in 'vni': tlen, vlen, dlen = unpack(">iHi", h[9:19]) else: t... | def read_index(self, serial, fileindex): index = self._index f = self._f[fileindex] seek = f.seek read = f.read pos = 4 count = 0 while 1: f.seek(pos) h = read(27) if len(h) != 27: if h: self.rilog("truncated header", pos, fileindex) break if h[8] in 'vni': tlen, vlen, dlen = unpack(">iHi", h[9:19]) else: tlen = -1 ... | 27,016 |
def read_index(index, serial, f, fileindex): seek = f.seek read = f.read pos = 4 count = 0 while 1: f.seek(pos) h = read(27) if len(h) != 27: # An empty read is expected, anything else is suspect if h: rilog("truncated header", pos, fileindex) break if h[8] in 'vni': tlen, vlen, dlen = unpack(">iHi", h[9:19]) else: t... | def read_index(index, serial, f, fileindex): seek = f.seek read = f.read pos = 4 count = 0 while 1: f.seek(pos) h = read(27) if len(h) != 27: # An empty read is expected, anything else is suspect if h: rilog("truncated header", pos, fileindex) break if h[8] in 'vni': tlen, vlen, dlen = unpack(">iHi", h[9:19]) else: t... | 27,017 |
def check_server(addr, storage, write): if ZEO_VERSION == 2: cs = ClientStorage(addr, storage=storage, debug=1, wait=1) else: cs = ClientStorage(addr, storage=storage, debug=1, wait_for_server_on_startup=1) # _startup() is an artifact of the way ZEO 1.0 works. The # ClientStorage doesn't get fully initialized until re... | def check_server(addr, storage, write): if ZEO_VERSION == 2: cs = ClientStorage(addr, storage=storage, wait=1, read_only=1) else: cs = ClientStorage(addr, storage=storage, debug=1, wait_for_server_on_startup=1) # _startup() is an artifact of the way ZEO 1.0 works. The # ClientStorage doesn't get fully initialized unti... | 27,018 |
def testEmptyFirstBucketReportedByGuido(self): b = self.t for i in xrange(29972): # reduce to 29971 and it works b[i] = i for i in xrange(30): # reduce to 29 and it works del b[i] b[i+40000] = i | def XXXtestEmptyFirstBucketReportedByGuido(self): b = self.t for i in xrange(29972): # reduce to 29971 and it works b[i] = i for i in xrange(30): # reduce to 29 and it works del b[i] b[i+40000] = i | 27,019 |
def new_oid(self, last=None): if self._is_read_only: raise POSException.ReadOnlyError() # avoid multiple oid requests to server at the same time self._oid_lock.acquire() if not self._oids: self._oids = self._server.new_oids() self._oids.reverse() oid = self._oids.pop() self._oid_lock.release() return oid | def new_oid(self, last=None): if self._is_read_only: raise POSException.ReadOnlyError() # avoid multiple oid requests to server at the same time self._oid_lock.acquire() if not self._oids: self._oids = self._server.new_oids() self._oids.reverse() oid = self._oids.pop() self._oid_lock.release() return oid | 27,020 |
def __getattr__(self, name): """Get attributes that can't be gotten the usual way | def __getattr__(self, name): """Get attributes that can't be gotten the usual way | 27,021 |
def __setitem__(self, key, v): | def __setitem__(self, key, v): | 27,022 |
def __delitem__(self, key): | def __delitem__(self, key): | 27,023 |
def keys(self): | def keys(self): | 27,024 |
def keys(self): | def keys(self): | 27,025 |
def clear(self): | def clear(self): | 27,026 |
def copyTransactionsFrom(self, other, verbose=0): """Copy transactions from another storage. | def copyTransactionsFrom(self, other, verbose=0): """Copy transactions from another storage. | 27,027 |
def main(args): opts, args = getopt.getopt(args, 'zd:n:Ds:M') z=s=None data=sys.argv[0] nrep=5 minimize=0 for o, v in opts: if o=='-n': nrep=string.atoi(v) elif o=='-d': data=v elif o=='-s': s=v elif o=='-z': global zlib import zlib z=compress elif o=='-M': minimize=1 elif o=='-D': global debug os.environ['STUPID_LOG_... | def main(args): opts, args = getopt.getopt(args, 'zd:n:Ds:L') z=s=None data=sys.argv[0] nrep=5 minimize=0 for o, v in opts: if o=='-n': nrep=string.atoi(v) elif o=='-d': data=v elif o=='-s': s=v elif o=='-z': global zlib import zlib z=compress elif o=='-M': minimize=1 elif o=='-D': global debug os.environ['STUPID_LOG_... | 27,028 |
def __repr__(self): if self._version: ver = ' (in version %s)' % `self._version` else: ver = '' return '<Connection at %08x%s>' % (id(self),ver) | def __repr__(self): if self._version: ver = ' (in version %s)' % `self._version` else: ver = '' return '<Connection at %08x%s>' % (id(self),ver) | 27,029 |
def abort(self, object, transaction): """Abort the object in the transaction. | def abort(self, object, transaction): """Abort the object in the transaction. | 27,030 |
def invalidate(self, oid): """Invalidate a particular oid | def invalidate(self, oid): """Invalidate a particular oid | 27,031 |
def setstate(self, object): oid=object._p_oid | def setstate(self, object): oid=object._p_oid | 27,032 |
def setstate(self, object): oid=object._p_oid | def setstate(self, object): oid=object._p_oid | 27,033 |
def setstate(self, object): oid=object._p_oid | def setstate(self, object): oid=object._p_oid | 27,034 |
def setstate(self, object): oid=object._p_oid | def setstate(self, object): oid=object._p_oid | 27,035 |
def setstate(self, object): oid=object._p_oid | def setstate(self, object): oid=object._p_oid | 27,036 |
def setstate(self, object): oid=object._p_oid | def setstate(self, object): oid=object._p_oid | 27,037 |
def setstate(self, object): oid=object._p_oid | def setstate(self, object): oid=object._p_oid | 27,038 |
def _handle_serial(self, store_return, oid=None, change=1): """Handle the returns from store() and tpc_vote() calls.""" | def_handle_serial(self,store_return,oid=None,change=1):"""Handlethereturnsfromstore()andtpc_vote()calls.""" | 27,039 |
def tpc_finish(self, transaction): | deftpc_finish(self,transaction): | 27,040 |
def _invalidate_invalidating(self): invalidate=self._db.invalidate for oid in self._invalidating: invalidate(oid, self) self._db.finish_invalidation() | def _invalidate_invalidating(self): for oid in self._invalidating: invalidate(oid, self) self._db.finish_invalidation() | 27,041 |
def _invalidate_invalidating(self): invalidate=self._db.invalidate for oid in self._invalidating: invalidate(oid, self) self._db.finish_invalidation() | def _invalidate_invalidating(self): invalidate=self._db.invalidate for oid in self._invalidating: assert oid is not None self._db.invalidate(oid, self) self._db.finish_invalidation() | 27,042 |
def getDebugInfo(self): return self._debug_info | def getDebugInfo(self): return self._debug_info | 27,043 |
def getTransferCounts(self, clear=0): """Returns the number of objects loaded and stored. | def getTransferCounts(self, clear=0): """Returns the number of objects loaded and stored. | 27,044 |
def setCacheDeactivateAfter(self, v): self._cache_deactivate_after=v | def setCacheDeactivateAfter(self, v): self._cache_deactivate_after=v | 27,045 |
def setVersionCacheSize(self, v): self._version_cache_size=v | def setVersionCacheSize(self, v): self._version_cache_size=v | 27,046 |
def __getitem__(self, oid, tt=type(()), ct=type(HelperClass)): cache=self._cache if cache.has_key(oid): return cache[oid] | def __getitem__(self, oid, tt=type(()), ct=type(HelperClass)): cache=self._cache if cache.has_key(oid): return cache[oid] | 27,047 |
def __getitem__(self, oid, tt=type(()), ct=type(HelperClass)): cache=self._cache if cache.has_key(oid): return cache[oid] | def __getitem__(self, oid, tt=type(()), ct=type(HelperClass)): cache=self._cache if cache.has_key(oid): return cache[oid] | 27,048 |
def checkSize(self, size): # Make sure we aren't going to exceed the target size. # If we are, then flip the cache. if self._pos+size > self._limit: current=not current self._current=current self._f[current]=open(self._p[current],'w+b') self._f[current].write(magic) self._pos=pos=4 | def checkSize(self, size): # Make sure we aren't going to exceed the target size. # If we are, then flip the cache. if self._pos+size > self._limit: current=not self._current self._current=current self._f[current]=open(self._p[current],'w+b') self._f[current].write(magic) self._pos=pos=4 | 27,049 |
def setstate(self,object): # Note, we no longer mess with the object's state # flag, _p_changed. This is the object's job. oid=object._p_oid invalid=self._invalid if invalid(oid) or invalid(None): raise ConflictError, oid p, serial = self._storage.load(oid, self._version) file=StringIO(p) unpickler=Unpickler(file) unp... | def setstate(self,object): # Note, we no longer mess with the object's state # flag, _p_changed. This is the object's job. oid=object._p_oid invalid=self._invalid if invalid(oid) or invalid(None): raise ConflictError, oid p, serial = self._storage.load(oid, self._version) file=StringIO(p) unpickler=Unpickler(file) unp... | 27,050 |
def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises require = self.assert_ self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to su... | 27,051 |
def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty require(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to... | 27,052 |
def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | 27,053 |
def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | 27,054 |
def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | 27,055 |
def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | 27,056 |
def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | 27,057 |
def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | 27,058 |
def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | 27,059 |
def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | 27,060 |
def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | 27,061 |
def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | def checkTimeoutProvokingConflicts(self): eq = self.assertEqual raises = self.assertRaises unless = self.failUnless self._storage = storage = self.openClientStorage() # Assert that the zeo cache is empty unless(not list(storage._cache.contents())) # Create the object oid = storage.new_oid() obj = MinPO(7) # We need to ... | 27,062 |
def commit(self, subtransaction=None): 'Finalize the transaction' | def commit(self, subtransaction=None): 'Finalize the transaction' | 27,063 |
def verifyEntry(self, f, time=None, subsys=None, severity=None, summary=None, detail=None, error=None): # skip to the beginning of next entry line = f.readline() while line != "------\n": if not line: self.fail("can't find entry in log file") line = f.readline() line = f.readline().strip() _time, rest = line.split(" "... | def verifyEntry(self, f, time=None, subsys=None, severity=None, summary=None, detail=None, error=None): # skip to the beginning of next entry line = f.readline().strip() while line != "------": if not line: self.fail("can't find entry in log file") line = f.readline() line = f.readline().strip() _time, rest = line.spl... | 27,064 |
def verifyEntry(self, f, time=None, subsys=None, severity=None, summary=None, detail=None, error=None): # skip to the beginning of next entry line = f.readline() while line != "------\n": if not line: self.fail("can't find entry in log file") line = f.readline() line = f.readline().strip() _time, rest = line.split(" "... | def verifyEntry(self, f, time=None, subsys=None, severity=None, summary=None, detail=None, error=None): # skip to the beginning of next entry line = f.readline().strip() while line != "------\n": if not line: self.fail("can't find entry in log file") line = f.readline().strip() line = f.readline().strip() _time, rest ... | 27,065 |
def verifyEntry(self, f, time=None, subsys=None, severity=None, summary=None, detail=None, error=None): # skip to the beginning of next entry line = f.readline() while line != "------\n": if not line: self.fail("can't find entry in log file") line = f.readline() line = f.readline().strip() _time, rest = line.split(" "... | def verifyEntry(self, f, time=None, subsys=None, severity=None, summary=None, detail=None, error=None): # skip to the beginning of next entry line = f.readline() while line != "------\n": if not line: self.fail("can't find entry in log file") line = f.readline() line = f.readline().strip() _time, rest = line.split(" "... | 27,066 |
def verifyEntry(self, f, time=None, subsys=None, severity=None, summary=None, detail=None, error=None): # skip to the beginning of next entry line = f.readline() while line != "------\n": if not line: self.fail("can't find entry in log file") line = f.readline() line = f.readline().strip() _time, rest = line.split(" "... | def verifyEntry(self, f, time=None, subsys=None, severity=None, summary=None, detail=None, error=None): # skip to the beginning of next entry line = f.readline().strip() while line != "------\n": if not line: self.fail("can't find entry in log file") line = f.readline().strip() line = f.readline().strip() _time, rest ... | 27,067 |
def verifyEntry(self, f, time=None, subsys=None, severity=None, summary=None, detail=None, error=None): # skip to the beginning of next entry line = f.readline() while line != "------\n": if not line: self.fail("can't find entry in log file") line = f.readline() line = f.readline().strip() _time, rest = line.split(" "... | def verifyEntry(self, f, time=None, subsys=None, severity=None, summary=None, detail=None, error=None): # skip to the beginning of next entry line = f.readline() while line != "------\n": if not line: self.fail("can't find entry in log file") line = f.readline() line = f.readline().strip() _time, rest = line.split(" "... | 27,068 |
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,069 |
def __init__(self, storage, pool_size=7, cache_size=400, cache_deactivate_after=60, version_pool_size=3, version_cache_size=100, version_cache_deactivate_after=10, ): """Create an object database. | def __init__(self, storage, pool_size=7, cache_size=400, cache_deactivate_after=60, version_pool_size=3, version_cache_size=100, version_cache_deactivate_after=10, ): """Create an object database. | 27,070 |
def check_server(addr, storage): cs = ClientStorage(addr, storage=storage, wait_for_server_on_startup=0) # _startup() is an artifact of the way ZEO 1.0 works. The # ClientStorage doesn't get fully initialized until registerDB() # is called. The only thing we care about, though, is that # registerDB() calls _startup()... | def check_server(addr, storage): cs = ClientStorage(addr, storage=storage, debug=1, wait_for_server_on_startup=0) # _startup() is an artifact of the way ZEO 1.0 works. The # ClientStorage doesn't get fully initialized until registerDB() # is called. The only thing we care about, though, is that # registerDB() calls _... | 27,071 |
def load(self, oid, version, _stuff=None): self._lock_acquire() try: cache=self._cache p = cache.load(oid, version) if p: return p p, s, v, pv, sv = self._call('zeoLoad', oid) cache.checkSize(size) cache.store(oid, p, s, v, pv, sv) if not v or not version or version != v: if s: return p, s raise KeyError, oid # no non-... | def load(self, oid, version, _stuff=None): self._lock_acquire() try: cache=self._cache p = cache.load(oid, version) if p: return p p, s, v, pv, sv = self._call('zeoLoad', oid) cache.checkSize(0) cache.store(oid, p, s, v, pv, sv) if not v or not version or version != v: if s: return p, s raise KeyError, oid # no non-ver... | 27,072 |
def serialize(self, obj): # We don't use __class__ here, because obj could be a persistent proxy. # We don't want to be folled by proxies. klass = type(obj) | def serialize(self, obj): # We don't use __class__ here, because obj could be a persistent proxy. # We don't want to be folled by proxies. klass = type(obj) | 27,073 |
def removefs(base): """Remove all files created by FileStorage with path base.""" for ext in '', '.old', '.tmp', '.lock', '.index', '.pack': path = base + ext try: os.remove(path) except os.error, err: if err[0] != errno.ENOENT: raise | def removefs(base): """Remove all files created by FileStorage with path base.""" for ext in '', '.old', '.tmp', '.lock', '.index', '.pack': path = base + ext try: os.remove(path) except os.error, err: if err[0] != errno.ENOENT: raise | 27,074 |
def setUp(self): self.pids = {} self.env = Environment(self.cmd) | def setUp(self): self.pids = {} self.env = Environment(self.cmd) | 27,075 |
def testLogRestart(self): port = 9090 logfile1 = tempfile.mktemp(suffix="log") logfile2 = tempfile.mktemp(suffix="log") os.environ["EVENT_LOG_FILE"] = logfile1 | def testLogRestart(self): port = 9090 logfile1 = tempfile.mktemp(suffix="log") logfile2 = tempfile.mktemp(suffix="log") os.environ["EVENT_LOG_FILE"] = logfile1 | 27,076 |
def testEmptyRangeSearches(self): t=self.t t.update([(1,1),(5,5),(9,9)]) self.assertEqual(list(t.keys(-6,-4)),[], list(t.keys(-6,-4))) self.assertEqual(list(t.keys(2,4)),[], list(t.keys(2,4))) self.assertEqual(list(t.keys(6,8)),[], list(t.keys(6,8))) self.assertEqual(list(t.keys(10,12)),[], list(t.keys(10,12))) | def testEmptyRangeSearches(self): t=self.t t.update([(1,1),(5,5),(9,9)]) self.assertEqual(list(t.keys(-6,-4)),[], list(t.keys(-6,-4))) self.assertEqual(list(t.keys(2,4)),[], list(t.keys(2,4))) self.assertEqual(list(t.keys(6,8)),[], list(t.keys(6,8))) self.assertEqual(list(t.keys(10,12)),[], list(t.keys(10,12))) | 27,077 |
def testEmptyRangeSearches(self): t=self.t t.update([1,5,9]) self.assertEqual(list(t.keys(-6,-4)),[], list(t.keys(-6,-4))) self.assertEqual(list(t.keys(2,4)),[], list(t.keys(2,4))) self.assertEqual(list(t.keys(6,8)),[], list(t.keys(6,8))) self.assertEqual(list(t.keys(10,12)),[], list(t.keys(10,12))) | def testEmptyRangeSearches(self): t=self.t t.update([1,5,9]) self.assertEqual(list(t.keys(-6,-4)),[], list(t.keys(-6,-4))) self.assertEqual(list(t.keys(2,4)),[], list(t.keys(2,4))) self.assertEqual(list(t.keys(6,8)),[], list(t.keys(6,8))) self.assertEqual(list(t.keys(10,12)),[], list(t.keys(10,12))) | 27,078 |
def invalidate(self, *args): pass | def invalidate(self, *args): pass | 27,079 |
def invalidate(self, *args): pass | def invalidate(self, *args): pass | 27,080 |
def setUp(self): """Start a ZEO server using a Unix domain socket | def setUp(self): """Start a ZEO server using a Unix domain socket | 27,081 |
def openClientStorage(self, cache='', cache_size=200000, wait=1, read_only=0, read_only_fallback=0): base = ClientStorage(self.addr, client=cache, cache_size=cache_size, wait=wait, min_disconnect_poll=0.1, read_only=read_only, read_only_fallback=read_only_fallback) storage = base storage.registerDB(DummyDB(), None) ret... | def openClientStorage(self, cache='', cache_size=200000, wait=1, read_only=0, read_only_fallback=0, addr=None): if addr is None: addr = self.addr storage = ClientStorage(addr, client=cache, cache_size=cache_size, wait=wait, min_disconnect_poll=0.1, read_only=read_only, read_only_fallback=read_only_fallback) storage.reg... | 27,082 |
def checkReconnectSwitch(self): # A fallback client initially connects to a read-only server, # then discovers a read-write server and switches to that | def checkReconnectSwitch(self): # A fallback client initially connects to a read-only server, # then discovers a read-write server and switches to that | 27,083 |
def checkReconnection(self): # Check that the client reconnects when a server restarts. | def checkReconnection(self): # Check that the client reconnects when a server restarts. | 27,084 |
def _setDB(self, odb): """Begin a new transaction. | def _setDB(self, odb): """Begin a new transaction. | 27,085 |
def testLogRestart(self): port = 9090 logfile1 = tempfile.mktemp(suffix="log") logfile2 = tempfile.mktemp(suffix="log") os.environ["EVENT_LOG_FILE"] = logfile1 | def testLogRestart(self): port = 9090 logfile1 = tempfile.mktemp(suffix="log") logfile2 = tempfile.mktemp(suffix="log") os.environ["EVENT_LOG_FILE"] = logfile1 | 27,086 |
def testLogRestart(self): port = 9090 logfile1 = tempfile.mktemp(suffix="log") logfile2 = tempfile.mktemp(suffix="log") os.environ["EVENT_LOG_FILE"] = logfile1 | def testLogRestart(self): port = 9090 logfile1 = tempfile.mktemp(suffix="log") logfile2 = tempfile.mktemp(suffix="log") os.environ["EVENT_LOG_FILE"] = logfile1 | 27,087 |
def notify_closed(self): self.connected = 0 self.connection = None self.client.notifyDisconnected() if not self.closed: self.connect() | def notify_closed(self): self.connected = 0 self.connection = None self.client.notifyDisconnected() if not self.closed: self.connect() | 27,088 |
def close(self): self._incrgc() db=self._db self._db=self._storage=self._tmp=self.new_oid=None db._closeConnection(self) | def close(self): self._incrgc() db=self._db self._db=self._storage=self._tmp=self.new_oid=self._opened=None self._debug_info=() db._closeConnection(self) | 27,089 |
def set_uid(uid): """Try to set uid and gid based on -u argument. This will only work if this script is run by root. """ try: import pwd except ImportError: LOG('ZEO Server', INFO, ("Can't set uid to %s." "pwd module is not available." % uid)) return try: gid = None try: UID = int(UID) except: # conversion could raise... | def set_uid(arg): """Try to set uid and gid based on -u argument. This will only work if this script is run by root. """ try: import pwd except ImportError: LOG('ZEO Server', INFO, ("Can't set uid to %s." "pwd module is not available." % uid)) return try: gid = None try: UID = int(UID) except: # conversion could raise... | 27,090 |
def set_uid(uid): """Try to set uid and gid based on -u argument. This will only work if this script is run by root. """ try: import pwd except ImportError: LOG('ZEO Server', INFO, ("Can't set uid to %s." "pwd module is not available." % uid)) return try: gid = None try: UID = int(UID) except: # conversion could raise... | def set_uid(uid): """Try to set uid and gid based on -u argument. This will only work if this script is run by root. """ try: import pwd except ImportError: LOG('ZEO Server', INFO, ("Can't set uid to %s." "pwd module is not available." % uid)) return try: gid = None try: arg = int(arg) except: # conversion could raise... | 27,091 |
def set_uid(uid): """Try to set uid and gid based on -u argument. This will only work if this script is run by root. """ try: import pwd except ImportError: LOG('ZEO Server', INFO, ("Can't set uid to %s." "pwd module is not available." % uid)) return try: gid = None try: UID = int(UID) except: # conversion could raise... | def set_uid(uid): """Try to set uid and gid based on -u argument. This will only work if this script is run by root. """ try: import pwd except ImportError: LOG('ZEO Server', INFO, ("Can't set uid to %s." "pwd module is not available." % uid)) return try: gid = None try: UID = int(UID) except: # conversion could raise... | 27,092 |
def set_uid(uid): """Try to set uid and gid based on -u argument. This will only work if this script is run by root. """ try: import pwd except ImportError: LOG('ZEO Server', INFO, ("Can't set uid to %s." "pwd module is not available." % uid)) return try: gid = None try: UID = int(UID) except: # conversion could raise... | def set_uid(uid): """Try to set uid and gid based on -u argument. This will only work if this script is run by root. """ try: import pwd except ImportError: LOG('ZEO Server', INFO, ("Can't set uid to %s." "pwd module is not available." % uid)) return try: gid = None try: UID = int(UID) except: # conversion could raise... | 27,093 |
def set_uid(uid): """Try to set uid and gid based on -u argument. This will only work if this script is run by root. """ try: import pwd except ImportError: LOG('ZEO Server', INFO, ("Can't set uid to %s." "pwd module is not available." % uid)) return try: gid = None try: UID = int(UID) except: # conversion could raise... | def set_uid(uid): """Try to set uid and gid based on -u argument. This will only work if this script is run by root. """ try: import pwd except ImportError: LOG('ZEO Server', INFO, ("Can't set uid to %s." "pwd module is not available." % uid)) return try: gid = None try: UID = int(UID) except: # conversion could raise... | 27,094 |
def main(argv): me = argv[0] sys.path.insert(0, directory(me, 2)) global LOG, INFO, ERROR from zLOG import LOG, INFO, ERROR, PANIC # XXX hack for profiling support global unix, storages, zeo_pid, asyncore args = [] last = '' for a in argv[1:]: if (a[:1] != '-' and a.find('=') > 0 and last != '-S'): # lame, sorry a =... | def main(argv): me = argv[0] sys.path.insert(0, directory(me, 2)) global LOG, INFO, ERROR from zLOG import LOG, INFO, ERROR, PANIC # XXX hack for profiling support global unix, storages, zeo_pid, asyncore args = [] last = '' for a in argv[1:]: if (a[:1] != '-' and a.find('=') > 0 and last != '-S'): # lame, sorry a =... | 27,095 |
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,096 |
def _finish(self, tid, u, d, e): file=self._file write=file.write tfile=self._tfile dlen=tfile.tell() tfile.seek(0) id=self._serial user, desc, ext = self._ude | def _finish(self, tid, u, d, e): file=self._file write=file.write tfile=self._tfile dlen=tfile.tell() tfile.seek(0) id=self._serial user, desc, ext = self._ude | 27,097 |
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.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,098 |
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.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,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.