From 49b2ee57aec94e84c97964161444ff60f2f2bc2e Mon Sep 17 00:00:00 2001 From: "Martin A. Brown" Date: Fri, 1 Apr 2016 22:37:53 -0700 Subject: [PATCH] add a place to capture the MD5 data of the source --- tldp/outputs.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tldp/outputs.py b/tldp/outputs.py index 5087f1f..a023459 100644 --- a/tldp/outputs.py +++ b/tldp/outputs.py @@ -31,6 +31,10 @@ class OutputNamingConvention(object): self.dirname = dirname self.stem = stem + @property + def MD5SUMS(self): + return os.path.join(self.dirname, '.LDP-source-MD5SUMS') + @property def name_txt(self): return os.path.join(self.dirname, self.stem + '.txt') @@ -84,6 +88,15 @@ class OutputNamingConvention(object): missing.add(name) return missing + @property + def md5sums(self): + d = dict() + with codecs.open(self.MD5SUMS, encoding='utf-8') as f: + for line in f: + hashval, fname = line.strip().split() + d[fname] = hashval + return d + class OutputDirectory(OutputNamingConvention): '''A class providing a container for each set of output documents