[NO TESTS] WIP
This commit is contained in:
parent
74af14847e
commit
544e1cd151
5 changed files with 12 additions and 19 deletions
4
.bazelrc
4
.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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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.
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue