diff options
| author | adamhrv <adam@ahprojects.com> | 2018-12-05 12:00:15 +0100 |
|---|---|---|
| committer | adamhrv <adam@ahprojects.com> | 2018-12-05 12:00:15 +0100 |
| commit | 90abf459d1df1f21960c1d653a1f936d1ec30256 (patch) | |
| tree | facab8e9bac6c56e69c369c2140cdbea218a01df /megapixels/app/utils/file_utils.py | |
| parent | 0529d4cd1618016319e995c37aa118bf8c2d501b (diff) | |
.
Diffstat (limited to 'megapixels/app/utils/file_utils.py')
| -rw-r--r-- | megapixels/app/utils/file_utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/megapixels/app/utils/file_utils.py b/megapixels/app/utils/file_utils.py index 773667b1..99282bd0 100644 --- a/megapixels/app/utils/file_utils.py +++ b/megapixels/app/utils/file_utils.py @@ -175,7 +175,7 @@ def write_pickle(data, fp_out, ensure_path=True): pickle.dump(data, fp) -def write_json(data, fp_out, minify=True, ensure_path=True, sort_keys=True): +def write_json(data, fp_out, minify=True, ensure_path=True, sort_keys=True, verbose=False): """ """ if ensure_path: @@ -185,6 +185,8 @@ def write_json(data, fp_out, minify=True, ensure_path=True, sort_keys=True): json.dump(data, fp, separators=(',',':'), sort_keys=sort_keys) else: json.dump(data, fp, indent=2, sort_keys=sort_keys) + if verbose: + log.info('Wrote JSON: {}'.format(fp_out)) def write_csv(data, fp_out, header=None): """ """ @@ -277,7 +279,7 @@ def sha256(fp_in, block_size=65536): """ sha256 = hashlib.sha256() with open(fp_in, 'rb') as fp: - for block in iter(lambda: f.read(block_size), b''): + for block in iter(lambda: fp.read(block_size), b''): sha256.update(block) return sha256.hexdigest() |
