This repository has been archived on 2021-03-01. You can view files and clone it, but cannot push or open issues or pull requests.
kaneton/test/packages/ktp/queue.py
Mercier Pierre-Olivier fee4dd4e6d Initial snapshot
2013-02-11 22:04:30 +01:00

60 lines
1.1 KiB
Python

#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/KANETON-TEST-SYSTEM/packages/ktp/queue.py
#
# created julien quintard [mon oct 25 19:58:10 2010]
# updated julien quintard [wed feb 2 20:59:25 2011]
#
#
# ---------- packages ---------------------------------------------------------
#
import os
import ktp
#
# ---------- functions --------------------------------------------------------
#
#
# this function adds an identifier to the queue.
#
def Push(directory,
identifier):
handle = None
path = None
path = directory + "/" + identifier
ktp.miscellaneous.Push("",
path)
#
# this function returns the next queue'd identifier, or None if none.
#
def Pop(directory):
identifier = None
entries = None
entry = None
path = None
entries = os.listdir(directory)
for entry in entries:
path = directory + "/" + entry
identifier = entry
ktp.miscellaneous.Remove(path)
return identifier
return None