This repository has been archived on 2021-03-01. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
kaneton/test/packages/ktp/report.py
Mercier Pierre-Olivier fee4dd4e6d Initial snapshot
2013-02-11 22:04:30 +01:00

67 lines
1.3 KiB
Python

#
# ---------- header -----------------------------------------------------------
#
# project kaneton
#
# license kaneton
#
# file /home/mycure/KANETON-TEST-SYSTEM/packages/ktp/report.py
#
# created julien quintard [tue oct 26 11:12:10 2010]
# updated julien quintard [wed feb 2 14:41:38 2011]
#
#
# ---------- packages ---------------------------------------------------------
#
import yaml
import os
import re
import miscellaneous
#
# ---------- definitions ------------------------------------------------------
#
Extension = ".rpt"
StateInProgress = "in progress"
StateDone = "done"
#
# ---------- functions --------------------------------------------------------
#
#
# this function returns a list of report identifiers.
#
def List(directory):
reports = []
entries = None
entry = None
path = None
entries = os.listdir(directory)
for entry in entries:
path = directory + "/" + entry
if os.path.isfile(path) and re.search("^.*" + Extension + "$", path):
reports += [ entry[:-len(Extension)] ]
return reports
#
# this function stores a report.
#
def Store(report, path):
yaml.dump(report,
file(path, 'w'))
#
# this function loads a report.
#
def Load(path):
return yaml.load(file(path, 'r'))