diff options
| author | dgrisham <dgrisham@mines.edu> | 2018-09-27 10:50:13 -0600 |
|---|---|---|
| committer | dgrisham <dgrisham@mines.edu> | 2018-09-27 10:50:13 -0600 |
| commit | b08648c7201c9d3e7b10b412c43b494791e4b52e (patch) | |
| tree | 30ac3ac41ad33d32cb256a6045ae4bb88ed6b271 /pywal/util.py | |
| parent | 499b1c4ff5b90a754384a5ca91b770d062d76db8 (diff) | |
move hashf() to util.py
Diffstat (limited to 'pywal/util.py')
| -rw-r--r-- | pywal/util.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pywal/util.py b/pywal/util.py index 0557cc4..b58f5e4 100644 --- a/pywal/util.py +++ b/pywal/util.py @@ -2,6 +2,7 @@ Misc helper functions. """ import colorsys +import hashlib import json import logging import os @@ -178,3 +179,12 @@ def get_pid(name): return False return True + + +def hashf(fpath): + return hashlib.md5(file_bytes(open(fpath, 'rb'))).hexdigest() + + +def file_bytes(fpath): + with fpath: + return fpath.read() |
