From 714d11da016c9d4c6b568a169ba4a240edcbdc6e Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Mon, 6 Sep 2021 21:54:12 -0600 Subject: [PATCH] [NO TESTS] WIP --- .bazelrc | 4 ++-- projects/archiver/hash_copy.py | 3 +-- projects/archiver/org_photos.py | 11 +++++++++-- projects/ratchet/LICENSE.md | 7 ------- projects/ratchet/README.md | 6 ------ 5 files changed, 12 insertions(+), 19 deletions(-) delete mode 100644 projects/ratchet/LICENSE.md diff --git a/.bazelrc b/.bazelrc index e824c02..47d731b 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,5 +1,5 @@ test --test_output=errors # To enable flake8 on all build steps, uncomment this - -build --aspects="//tools/flake8:flake8.bzl%flake8_aspect" --output_groups=flake8_checks -build --aspects="//tools/black:black.bzl%black_aspect" --output_groups=black_checks +# build --aspects="//tools/flake8:flake8.bzl%flake8_aspect" --output_groups=flake8_checks +# build --aspects="//tools/black:black.bzl%black_aspect" --output_groups=black_checks diff --git a/projects/archiver/hash_copy.py b/projects/archiver/hash_copy.py index c4252e9..b3fc281 100644 --- a/projects/archiver/hash_copy.py +++ b/projects/archiver/hash_copy.py @@ -5,8 +5,7 @@ A tree deduplicator and archiver tool. import argparse from pathlib import Path from hashlib import sha256 -from shutil import copyfile - +from shutil import copy2 as copyfile parser = argparse.ArgumentParser() parser.add_argument("from_dir", type=Path) diff --git a/projects/archiver/org_photos.py b/projects/archiver/org_photos.py index 349b4b1..c32052f 100644 --- a/projects/archiver/org_photos.py +++ b/projects/archiver/org_photos.py @@ -361,7 +361,7 @@ def checksum(p: Path, sum=sha256) -> str: return digest.hexdigest() -def checksum_str(iter, sum=sha256): +def checksum_list(iter, sum=sha256): """Compute the checksum of a bunch of stuff from an iterable.""" sum = sum() @@ -509,7 +509,9 @@ class ImgInfo(t.NamedTuple): shasum_prefix: int = 9 def device_fingerprint(self): - return checksum_str([ + """Compute a stable 'fingerprint' for the device that took the shot.""" + + return checksum_list([ self.camera_make, self.camera_model, self.camera_sn, @@ -520,6 +522,11 @@ class ImgInfo(t.NamedTuple): ])[:self.shasum_prefix] def file_fingerprint(self): + """Compute a 'fingerprint' for the file itself. + + Note that this hash DOES include EXIF data, and is not stable. + + """ return self.file_sha256sum()[:self.shasum_prefix] def file_sha256sum(self): diff --git a/projects/ratchet/LICENSE.md b/projects/ratchet/LICENSE.md deleted file mode 100644 index 7bcf084..0000000 --- a/projects/ratchet/LICENSE.md +++ /dev/null @@ -1,7 +0,0 @@ -Copyright 2019 Reid 'arrdem' McKenzie - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/projects/ratchet/README.md b/projects/ratchet/README.md index 61198c2..f43249b 100644 --- a/projects/ratchet/README.md +++ b/projects/ratchet/README.md @@ -11,9 +11,3 @@ Ratchet provides tools for implementing _durable_ messaging, event and request/r By _durable_, we mean that an acceptably performant commit log is used to record all signals and any changes to their states. The decision to adopt an architectural commit log such as that implemented in Ratchet enables the components of a system to be more failure oblivious and pushes the overall system towards monotone or ratcheted behavior. If state was committed prior to a failure, it can easily be recovered. If state was not committed, well nothing happened. - - - -## License - -Published under the MIT license. See [LICENSE.md](LICENSE.md)