def iterkeys(self):
return iter(self.__db.keys())
- def has_key(self, cpv):
+ def __contains__(self, cpv):
return cpv in self.__db
def __del__(self):
raise cache_errors.CacheCorruption(cpv, e)
- def has_key(self, cpv):
+ def __contains__(self, cpv):
return os.path.exists(os.path.join(self.location, cpv))
raise cache_errors.CacheCorruption(cpv, e)
- def has_key(self, cpv):
+ def __contains__(self, cpv):
return os.path.exists(os.path.join(self._base, cpv))
else:
del self.db_rw[cpv]
- def has_key(self, cpv):
+ def __contains__(self, cpv):
try:
self[cpv] # validates whiteout when necessary
except KeyError:
return self.con.fetchone()[0]
- def has_key(self, cpv):
+ def __contains__(self, cpv):
if not self.autocommits:
try: self.commit()
except self._BaseError, e:
self._db_table["packages"]["package_key"],
self._db_escape_string(cpv)))
- def has_key(self, cpv):
+ def __contains__(self, cpv):
cursor = self._db_cursor
cursor.execute(" ".join(
["SELECT %s FROM %s" %
raise NotImplementedError
def has_key(self, cpv):
- raise NotImplementedError
+ return cpv in self
def keys(self):
return tuple(self.iterkeys())
raise NotImplementedError
def __contains__(self, cpv):
- return self.has_key(cpv)
+ raise NotImplementedError
def get(self, k, x=None):
try: