Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for id_, item in conn.execute(self._sql_pop):
conn.execute(self._sql_del, (id_,))
return item
def close(self):
size = len(self)
self._db.close()
if not size:
os.remove(self._path)
def __len__(self):
with self._db as conn:
return next(conn.execute(self._sql_size))[0]
class LifoSQLiteQueue(FifoSQLiteQueue):
_sql_pop = 'SELECT id, item FROM queue ORDER BY id DESC LIMIT 1'