diff options
author | Clayton G. Hobbs <clay@lakeserv.net> | 2016-02-16 13:14:28 -0500 |
---|---|---|
committer | Clayton G. Hobbs <clay@lakeserv.net> | 2016-02-16 13:14:28 -0500 |
commit | 1c2928ff1a68db1f0408e02138121e8ac1253239 (patch) | |
tree | 8b62e00c0f6a30d4f14acb86caf9336f68dab8c4 /hasher.py | |
parent | b95f1154291f6af9e95193b442abc61e9d457fcc (diff) |
Reorganize classes into a "kayleevc" package
That's "Kaylee Voice Command" if you didn't figure it out. I think everything still works properly, but I'll do more testing later to verify.
Diffstat (limited to 'hasher.py')
-rw-r--r-- | hasher.py | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/hasher.py b/hasher.py deleted file mode 100644 index 4aebd51..0000000 --- a/hasher.py +++ /dev/null @@ -1,37 +0,0 @@ -# This is part of Kaylee -# -- this code is licensed GPLv3 -# Copyright 2015-2016 Clayton G. Hobbs -# Portions Copyright 2013 Jezra - -import json -import hashlib - -class Hasher: - """Keep track of hashes for Kaylee""" - - def __init__(self, config): - self.config = config - try: - with open(self.config.hash_file, 'r') as f: - self.hashes = json.load(f) - except IOError: - # No stored hash - self.hashes = {} - - def __getitem__(self, hashname): - try: - return self.hashes[hashname] - except (KeyError, TypeError): - return None - - def __setitem__(self, hashname, value): - self.hashes[hashname] = value - - def get_hash_object(self): - """Returns an object to compute a new hash""" - return hashlib.sha256() - - def store(self): - """Store the current hashes into a the hash file""" - with open(self.config.hash_file, 'w') as f: - json.dump(self.hashes, f) |