[NO TESTS] WIP

This commit is contained in:
Reid 'arrdem' McKenzie 2021-09-06 21:54:12 -06:00
parent d3c63f0e77
commit 714d11da01
5 changed files with 12 additions and 19 deletions

View file

@ -1,5 +1,5 @@
test --test_output=errors test --test_output=errors
# To enable flake8 on all build steps, uncomment this - # To enable flake8 on all build steps, uncomment this -
build --aspects="//tools/flake8:flake8.bzl%flake8_aspect" --output_groups=flake8_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 # build --aspects="//tools/black:black.bzl%black_aspect" --output_groups=black_checks

View file

@ -5,8 +5,7 @@ A tree deduplicator and archiver tool.
import argparse import argparse
from pathlib import Path from pathlib import Path
from hashlib import sha256 from hashlib import sha256
from shutil import copyfile from shutil import copy2 as copyfile
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("from_dir", type=Path) parser.add_argument("from_dir", type=Path)

View file

@ -361,7 +361,7 @@ def checksum(p: Path, sum=sha256) -> str:
return digest.hexdigest() 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.""" """Compute the checksum of a bunch of stuff from an iterable."""
sum = sum() sum = sum()
@ -509,7 +509,9 @@ class ImgInfo(t.NamedTuple):
shasum_prefix: int = 9 shasum_prefix: int = 9
def device_fingerprint(self): 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_make,
self.camera_model, self.camera_model,
self.camera_sn, self.camera_sn,
@ -520,6 +522,11 @@ class ImgInfo(t.NamedTuple):
])[:self.shasum_prefix] ])[:self.shasum_prefix]
def file_fingerprint(self): 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] return self.file_sha256sum()[:self.shasum_prefix]
def file_sha256sum(self): def file_sha256sum(self):

View file

@ -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.

View file

@ -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. 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. 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)