diff --git a/.cirrus.yml b/.cirrus.yml new file mode 100644 index 0000000..7805bc7 --- /dev/null +++ b/.cirrus.yml @@ -0,0 +1,68 @@ +# Reference: +# - https://cirrus-ci.org/guide/writing-tasks/ +# - https://cirrus-ci.org/guide/linux/ +# - https://cirrus-ci.org/guide/macOS/ +# - https://cirrus-ci.org/guide/windows/ +# - https://hub.docker.com/_/gcc/ +# - https://hub.docker.com/_/python/ + +# +# Global defaults. +# +container: + image: python:3.8 + +env: + # Maximum cache period (in weeks) before forcing a new cache upload. + CACHE_PERIOD: "2" + # Increment the build number to force new mambaforge cache upload. + MAMBA_CACHE_BUILD: "0" + # Increment the build number to force new phash cache upload. + PHASH_CACHE_BUILD: "0" + # Base environment conda packages to be installed + MAMBA_CACHE_PACKAGES: "conda-lock" + +# +# Testing (Linux) +# +linux_task: + auto_cancellation: true + container: + image: gcc:latest + env: + PATH: ${HOME}/mambaforge/bin:${PATH} + ENV_NAME: phash + YAML_FILE: ${CIRRUS_WORKING_DIR}/requirements.yml + mamba_cache: + folder: ${HOME}/mambaforge + fingerprint_script: + - wget --quiet https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh -O mambaforge.sh + - echo "${CIRRUS_OS} $(sha256sum mambaforge.sh)" + - echo "${MAMBA_CACHE_PACKAGES}" + - echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${MAMBA_CACHE_BUILD}" + - uname -r + populate_script: + - export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)" + - bash mambaforge.sh -b -p ${HOME}/mambaforge + - conda config --set always_yes yes --set changeps1 no + - conda config --set show_channel_urls True + - conda config --add channels conda-forge + - conda install --quiet --name base ${MAMBA_CACHE_PACKAGES} + check_script: + - conda info --all + - conda list --name base + phash_cache: + folder: ${CIRRUS_WORKING_DIR}/mambaforge/envs/${ENV_NAME} + fingerprint_script: + - echo "${CIRRUS_OS} ${ENV_NAME} tests" + - echo "$(date +%Y).$(expr $(date +%U) / ${CACHE_PERIOD}):${PHASH_CACHE_BUILD}" + - cat ${YAML_FILE} + - uname -r + populate_script: + - export CONDA_OVERRIDE_LINUX="$(uname -r | cut -d'+' -f1)" + - conda-lock --mamba --platform linux-64 --file ${YAML_FILE} + - mamba create --name ${ENV_NAME} --quiet --file conda-linux-64.lock + - conda info --envs + test_script: + - source activate ${ENV_NAME} + - python run_test.py diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..1dc5aa6 --- /dev/null +++ b/.flake8 @@ -0,0 +1,25 @@ +[flake8] +# References: +# https://flake8.readthedocs.io/en/latest/user/configuration.html +# https://flake8.readthedocs.io/en/latest/user/error-codes.html +# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes + +max-line-length = 80 +select = C,E,F,W,B,B950 +ignore = + # E203: whitespace before ':' + E203, + # E226: missing whitespace around arithmetic operator + E226, + # E231: missing whitespace after ',', ';', or ':' + E231, + # E402: module level imports on one line + E402, + # E501: line too long + E501, + # E731: do not assign a lambda expression, use a def + E731, + # W503: line break before binary operator + W503, + # W504: line break after binary operator + W504, diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..2c1cbdb --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,31 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: 'v3.4.0' + hooks: + # Prevent giant files from being committed. + - id: check-added-large-files + # Check whether files parse as valid Python. + - id: check-ast + # Check for file name conflicts on case-insensitive filesytems. + - id: check-case-conflict + # Check for files that contain merge conflict strings. + - id: check-merge-conflict + # Check for debugger imports and py37+ `breakpoint()` calls in Python source. + - id: debug-statements + # Don't commit to master branch. + - id: no-commit-to-branch +- repo: https://github.com/psf/black + rev: '20.8b1' + hooks: + - id: black + # Force black to run on whole repo, using settings from pyproject.toml + pass_filenames: false + args: [--config=./pyproject.toml, .] +- repo: https://gitlab.com/pycqa/flake8 + rev: '3.9.0' + hooks: + # Run flake8. + - id: flake8 + args: [--config=./.flake8] diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8993e65..0000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -language: minimal -dist: xenial - -env: - matrix: - - PYTHON_VERSION=3.7 - -git: - # We need a deep clone so that we can compute the age of the files using their git history. - depth: 10000 - -branches: - only: - - gh-pages - -install: - # Fetch and install conda - # ----------------------- - - export CONDA_BASE="http://repo.continuum.io/miniconda/Miniconda3" - - wget ${CONDA_BASE}-latest-Linux-x86_64.sh -O miniconda.sh; - - bash miniconda.sh -b -p ${HOME}/miniconda - - export PATH="${HOME}/miniconda/bin:${PATH}" - - # Create the testing environment - # ------------------------------ - - conda config --set always_yes true - - conda config --set changeps1 no - - conda config --set show_channel_urls true - - conda config --add channels conda-forge - - ENV_NAME="test-environment" - - conda create --quiet -n ${ENV_NAME} python=${PYTHON_VERSION} - - source activate ${ENV_NAME} - - # Customise the testing environment - # --------------------------------- - - conda install --quiet --file conda-requirements.txt - - # Summerise environment - # --------------------- - - conda list - - conda info -a - -script: python run_test.py diff --git a/README.rst b/README.rst index a352cf9..c3cc14b 100644 --- a/README.rst +++ b/README.rst @@ -1,9 +1,9 @@ Test Iris ImageHash =================== -|Travis|_ +|CirrusCI|_ |PreCommit|_ |Black|_ -\(C) British Crown Copyright 2015 - 2020, Met Office +\(C) British Crown Copyright 2015 - 2021, Met Office A perceptual hash image store for graphical testing of `SciTools iris `_. @@ -11,5 +11,9 @@ Images shall not be removed from this repository, it is to be added to only. All files in the images folder shall be named with the perceptual image hash of the file (plus a suitable suffix). -.. |Travis| image:: https://travis-ci.org/SciTools/test-iris-imagehash.svg?branch=gh-pages -.. _Travis: https://travis-ci.org/SciTools/test-iris-imagehash +.. |CirrusCI| image:: https://api.cirrus-ci.com/github/SciTools/test-iris-imagehash.svg?branch=gh-pages +.. _CirrusCI: https://cirrus-ci.com/github/SciTools/iris +.. |PreCommit| image:: https://results.pre-commit.ci/badge/github/SciTools/test-iris-imagehash/gh-pages.svg +.. _PreCommit: https://results.pre-commit.ci/latest/github/SciTools/test-iris-imagehash/gh-pages +.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg +.. _Black: https://github.com/psf/black diff --git a/conda-requirements.txt b/conda-requirements.txt deleted file mode 100644 index 573295a..0000000 --- a/conda-requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -imagehash>=4.0 -pillow<7 diff --git a/images/v4/a3fd95ea6a11258c3217c966e4019a56c96f3c859b62492584fe7a699db46adb.png b/images/v4/a3fd95ea6a11258c3217c966e4019a56c96f3c859b62492584fe7a699db46adb.png new file mode 100644 index 0000000..1e31dea Binary files /dev/null and b/images/v4/a3fd95ea6a11258c3217c966e4019a56c96f3c859b62492584fe7a699db46adb.png differ diff --git a/images/v4/a6fa1e967f00950eb00f9d0f914fcdc2d560c9f3c1fb3a9084266e34daa52f6c.png b/images/v4/a6fa1e967f00950eb00f9d0f914fcdc2d560c9f3c1fb3a9084266e34daa52f6c.png new file mode 100644 index 0000000..a260f90 Binary files /dev/null and b/images/v4/a6fa1e967f00950eb00f9d0f914fcdc2d560c9f3c1fb3a9084266e34daa52f6c.png differ diff --git a/images/v4/aad73e0cf710952c840195acd528c1e2d1ecc9f3c1ec49f3c1ec6a536a1737f3.png b/images/v4/aad73e0cf710952c840195acd528c1e2d1ecc9f3c1ec49f3c1ec6a536a1737f3.png new file mode 100644 index 0000000..4702c34 Binary files /dev/null and b/images/v4/aad73e0cf710952c840195acd528c1e2d1ecc9f3c1ec49f3c1ec6a536a1737f3.png differ diff --git a/images/v4/aff21eb6bd04952cbc0f950f914fedc1c0f961f3e1f9329084266e345a850f6c.png b/images/v4/aff21eb6bd04952cbc0f950f914fedc1c0f961f3e1f9329084266e345a850f6c.png new file mode 100644 index 0000000..47dd0a0 Binary files /dev/null and b/images/v4/aff21eb6bd04952cbc0f950f914fedc1c0f961f3e1f9329084266e345a850f6c.png differ diff --git a/images/v4/be8137e0954ac05fc0ff3e81c07fc97a6d0094af3fa0c17f36a53244d97e2da0.png b/images/v4/be8137e0954ac05fc0ff3e81c07fc97a6d0094af3fa0c17f36a53244d97e2da0.png new file mode 100644 index 0000000..f087419 Binary files /dev/null and b/images/v4/be8137e0954ac05fc0ff3e81c07fc97a6d0094af3fa0c17f36a53244d97e2da0.png differ diff --git a/images/v4/be816a85957a955ac0ff1e8bc07f7f806e01c07f3f80c07f3fa23f80c07f3d00.png b/images/v4/be816a85957a955ac0ff1e8bc07f7f806e01c07f3f80c07f3fa23f80c07f3d00.png new file mode 100644 index 0000000..f05db69 Binary files /dev/null and b/images/v4/be816a85957a955ac0ff1e8bc07f7f806e01c07f3f80c07f3fa23f80c07f3d00.png differ diff --git a/images/v4/be816ab5907ae508c17e955ac07f3fa0945ac07f3f80c07f3aa32f81c0ff3f80.png b/images/v4/be816ab5907ae508c17e955ac07f3fa0945ac07f3f80c07f3aa32f81c0ff3f80.png new file mode 100644 index 0000000..cc06b9d Binary files /dev/null and b/images/v4/be816ab5907ae508c17e955ac07f3fa0945ac07f3f80c07f3aa32f81c0ff3f80.png differ diff --git a/images/v4/be816ab5907ee508c17e975ac07f3fa09459c07f3f80c07f3a812f81c0ff3f80.png b/images/v4/be816ab5907ee508c17e975ac07f3fa09459c07f3f80c07f3a812f81c0ff3f80.png new file mode 100644 index 0000000..e2d123c Binary files /dev/null and b/images/v4/be816ab5907ee508c17e975ac07f3fa09459c07f3f80c07f3a812f81c0ff3f80.png differ diff --git a/images/v4/bf802e85c07fc17fc07eb42ac17f3f829161c06e3f81c07f7ba02e85c07f3e81.png b/images/v4/bf802e85c07fc17fc07eb42ac17f3f829161c06e3f81c07f7ba02e85c07f3e81.png new file mode 100644 index 0000000..f4c5b91 Binary files /dev/null and b/images/v4/bf802e85c07fc17fc07eb42ac17f3f829161c06e3f81c07f7ba02e85c07f3e81.png differ diff --git a/images/v4/e665326d999acc9b3319b3246666cce69b496cccccc966996719333666669986.png b/images/v4/e665326d999acc9b3319b3246666cce69b496cccccc966996719333666669986.png new file mode 100644 index 0000000..c12b8c7 Binary files /dev/null and b/images/v4/e665326d999acc9b3319b3246666cce69b496cccccc966996719333666669986.png differ diff --git a/images/v4/ea57396995a8c6d691ea3e25664569d96b16c63684e9958b91ea4a559431793b.png b/images/v4/ea57396995a8c6d691ea3e25664569d96b16c63684e9958b91ea4a559431793b.png new file mode 100644 index 0000000..b019714 Binary files /dev/null and b/images/v4/ea57396995a8c6d691ea3e25664569d96b16c63684e9958b91ea4a559431793b.png differ diff --git a/images/v4/ea853a85957a857a957a857a957ac05ac56b3ac46ae16b817a816f647a853af4.png b/images/v4/ea853a85957a857a957a857a957ac05ac56b3ac46ae16b817a816f647a853af4.png new file mode 100644 index 0000000..a31c691 Binary files /dev/null and b/images/v4/ea853a85957a857a957a857a957ac05ac56b3ac46ae16b817a816f647a853af4.png differ diff --git a/images/v4/ea853f10957a85e1957a854e957a203e955e6aa76ae17aa16a856a8f6ab1de12.png b/images/v4/ea853f10957a85e1957a854e957a203e955e6aa76ae17aa16a856a8f6ab1de12.png new file mode 100644 index 0000000..3ff791e Binary files /dev/null and b/images/v4/ea853f10957a85e1957a854e957a203e955e6aa76ae17aa16a856a8f6ab1de12.png differ diff --git a/images/v4/ea856a85954a957ac17e954ac17a9d22956ac0fe3e81c07f3e857aa5c27d3f80.png b/images/v4/ea856a85954a957ac17e954ac17a9d22956ac0fe3e81c07f3e857aa5c27d3f80.png new file mode 100644 index 0000000..a8b20df Binary files /dev/null and b/images/v4/ea856a85954a957ac17e954ac17a9d22956ac0fe3e81c07f3e857aa5c27d3f80.png differ diff --git a/images/v4/ea856a95955a954ac17f950ac07e3f44951ac07e3f81c0ff3ea16aa1c0ff3e81.png b/images/v4/ea856a95955a954ac17f950ac07e3f44951ac07e3f81c0ff3ea16aa1c0ff3e81.png new file mode 100644 index 0000000..1502dcf Binary files /dev/null and b/images/v4/ea856a95955a954ac17f950ac07e3f44951ac07e3f81c0ff3ea16aa1c0ff3e81.png differ diff --git a/images/v4/ea856a95955a954ac17f954ac07e3f44951ac07e3e81c07f7ea16aa1c0ff3e81.png b/images/v4/ea856a95955a954ac17f954ac07e3f44951ac07e3e81c07f7ea16aa1c0ff3e81.png new file mode 100644 index 0000000..553f04d Binary files /dev/null and b/images/v4/ea856a95955a954ac17f954ac07e3f44951ac07e3e81c07f7ea16aa1c0ff3e81.png differ diff --git a/images/v4/ea858782957a703f957a3878957a7a65957a6b806ae56f846ad50fd46a859c50.png b/images/v4/ea858782957a703f957a3878957a7a65957a6b806ae56f846ad50fd46a859c50.png new file mode 100644 index 0000000..dc1f4ae Binary files /dev/null and b/images/v4/ea858782957a703f957a3878957a7a65957a6b806ae56f846ad50fd46a859c50.png differ diff --git a/images/v4/ea953f83954ac2bc956ac07e956a3509c0de61796ab57a916a856a916ab590fb.png b/images/v4/ea953f83954ac2bc956ac07e956a3509c0de61796ab57a916a856a916ab590fb.png new file mode 100644 index 0000000..1ffdb76 Binary files /dev/null and b/images/v4/ea953f83954ac2bc956ac07e956a3509c0de61796ab57a916a856a916ab590fb.png differ diff --git a/images/v4/eaa9b5299d56854e9156856ed05625fdc0292bfdc0a90afd85b97e00857e6ad6.png b/images/v4/eaa9b5299d56854e9156856ed05625fdc0292bfdc0a90afd85b97e00857e6ad6.png new file mode 100644 index 0000000..2ce49dd Binary files /dev/null and b/images/v4/eaa9b5299d56854e9156856ed05625fdc0292bfdc0a90afd85b97e00857e6ad6.png differ diff --git a/images/v4/eaa9b529f756850ea0169566d1568d6dd86909ed88290afd9ded7e008d666ad6.png b/images/v4/eaa9b529f756850ea0169566d1568d6dd86909ed88290afd9ded7e008d666ad6.png new file mode 100644 index 0000000..f5c16bb Binary files /dev/null and b/images/v4/eaa9b529f756850ea0169566d1568d6dd86909ed88290afd9ded7e008d666ad6.png differ diff --git a/images/v4/eaf73e0c9402952c950195acd528c1fac1ecc1f3c1ec63f3c0ec6a536a179ff2.png b/images/v4/eaf73e0c9402952c950195acd528c1fac1ecc1f3c1ec63f3c0ec6a536a179ff2.png new file mode 100644 index 0000000..5d4b61a Binary files /dev/null and b/images/v4/eaf73e0c9402952c950195acd528c1fac1ecc1f3c1ec63f3c0ec6a536a179ff2.png differ diff --git a/images/v4/eaf9a6c9f728943032168d66d4cb8d2e9567497b81304aedc9e51e2d9d186ada.png b/images/v4/eaf9a6c9f728943032168d66d4cb8d2e9567497b81304aedc9e51e2d9d186ada.png new file mode 100644 index 0000000..96f23e7 Binary files /dev/null and b/images/v4/eaf9a6c9f728943032168d66d4cb8d2e9567497b81304aedc9e51e2d9d186ada.png differ diff --git a/images/v4/eafd86c9f8219430fe96a56684c3852e95656b7b85b86acdc0e5162da5186eda.png b/images/v4/eafd86c9f8219430fe96a56684c3852e95656b7b85b86acdc0e5162da5186eda.png new file mode 100644 index 0000000..0f1db28 Binary files /dev/null and b/images/v4/eafd86c9f8219430fe96a56684c3852e95656b7b85b86acdc0e5162da5186eda.png differ diff --git a/images/v4/eea16abfc05ab500956e974ac13f3da0925ac07f3fa1c07e3fa12da1c25e3f80.png b/images/v4/eea16abfc05ab500956e974ac13f3da0925ac07f3fa1c07e3fa12da1c25e3f80.png new file mode 100644 index 0000000..23a5ef7 Binary files /dev/null and b/images/v4/eea16abfc05ab500956e974ac13f3da0925ac07f3fa1c07e3fa12da1c25e3f80.png differ diff --git a/images/v4/fa1585e885ea7a1785fa7a157a177a017a1585e817a885ea85e86a1785fa7a17.png b/images/v4/fa1585e885ea7a1785fa7a157a177a017a1585e817a885ea85e86a1785fa7a17.png new file mode 100644 index 0000000..a8a3cd1 Binary files /dev/null and b/images/v4/fa1585e885ea7a1785fa7a157a177a017a1585e817a885ea85e86a1785fa7a17.png differ diff --git a/images/v4/fa813e81857e857a857e7a81857e6a85817b0aa63e993e857e81c17e7a81956e.png b/images/v4/fa813e81857e857a857e7a81857e6a85817b0aa63e993e857e81c17e7a81956e.png new file mode 100644 index 0000000..bc1f78c Binary files /dev/null and b/images/v4/fa813e81857e857a857e7a81857e6a85817b0aa63e993e857e81c17e7a81956e.png differ diff --git a/images/v4/fa81857e857a7e01857e7a81857e7a81a0577a816a8585fa7a85857e7a85857e.png b/images/v4/fa81857e857a7e01857e7a81857e7a81a0577a816a8585fa7a85857e7a85857e.png new file mode 100644 index 0000000..6b4f523 Binary files /dev/null and b/images/v4/fa81857e857a7e01857e7a81857e7a81a0577a816a8585fa7a85857e7a85857e.png differ diff --git a/images/v4/fa81c17a857e1ea5857e734a7a81cd257e8484da857e3b29817a68f47a81c799.png b/images/v4/fa81c17a857e1ea5857e734a7a81cd257e8484da857e3b29817a68f47a81c799.png new file mode 100644 index 0000000..9f18b5d Binary files /dev/null and b/images/v4/fa81c17a857e1ea5857e734a7a81cd257e8484da857e3b29817a68f47a81c799.png differ diff --git a/images/v4/fa856a85957a957ac17e954ac17e0da2954bc07e3e81c07f3a806a85c1ff3f81.png b/images/v4/fa856a85957a957ac17e954ac17e0da2954bc07e3e81c07f3a806a85c1ff3f81.png new file mode 100644 index 0000000..3ad37c8 Binary files /dev/null and b/images/v4/fa856a85957a957ac17e954ac17e0da2954bc07e3e81c07f3a806a85c1ff3f81.png differ diff --git a/images/v4/fb966ba6846194dbd01f3665c0e4399a3f1bc2653f90c99e2f613e64c01e3f81.png b/images/v4/fb966ba6846194dbd01f3665c0e4399a3f1bc2653f90c99e2f613e64c01e3f81.png new file mode 100644 index 0000000..cd6e2e8 Binary files /dev/null and b/images/v4/fb966ba6846194dbd01f3665c0e4399a3f1bc2653f90c99e2f613e64c01e3f81.png differ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..abb4363 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,22 @@ +[tool.black] +line-length = 79 +target-version = ['py38'] +include = '\.pyi?$' +exclude = ''' + +( + /( + \.eggs # exclude a few common directories in the + | \.git # root of the project + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | _build + | buck-out + | build + | dist + | etc + )/ +) +''' diff --git a/recreate_v4_files_listing.py b/recreate_v4_files_listing.py index c0c5881..e0cb115 100644 --- a/recreate_v4_files_listing.py +++ b/recreate_v4_files_listing.py @@ -6,25 +6,26 @@ REPO_MAIN_DIRPATH = os.path.dirname(os.path.abspath(__file__)) -V4_DIR = os.sep.join([REPO_MAIN_DIRPATH, 'images', 'v4']) -V4_LISTFILE_NAME = 'v4_files_listing.txt' +V4_DIR = os.sep.join([REPO_MAIN_DIRPATH, "images", "v4"]) +V4_LISTFILE_NAME = "v4_files_listing.txt" V4_LISTFILE_PATH = os.sep.join([REPO_MAIN_DIRPATH, V4_LISTFILE_NAME]) -def get_v4_imagefile_names(search_dirpath=V4_DIR, filespec='*.png'): +def get_v4_imagefile_names(search_dirpath=V4_DIR, filespec="*.png"): """Return a list of the current image files in the v4 subdirectory.""" files_spec = os.path.join(search_dirpath, filespec) file_paths = glob(files_spec) return [os.path.basename(file_path) for file_path in file_paths] -def create_v4_images_listfile(search_dirpath=V4_DIR, filespec='*.png', - output_filepath=V4_LISTFILE_PATH): +def create_v4_images_listfile( + search_dirpath=V4_DIR, filespec="*.png", output_filepath=V4_LISTFILE_PATH +): file_names = get_v4_imagefile_names(search_dirpath, filespec) - with open(output_filepath, 'w') as f_out: + with open(output_filepath, "w") as f_out: for file_name in sorted(file_names): - f_out.write('{}\n'.format(file_name)) + f_out.write("{}\n".format(file_name)) -if __name__ == '__main__': +if __name__ == "__main__": create_v4_images_listfile() diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..a539322 --- /dev/null +++ b/requirements.yml @@ -0,0 +1,11 @@ +name: phash-dev + +channels: + - conda-forge + +dependencies: + - black=20.8b1 + - flake8 + - imagehash>=4.0 + - pillow<7 + - pre-commit diff --git a/run_test.py b/run_test.py index 1b80eca..f4f7909 100755 --- a/run_test.py +++ b/run_test.py @@ -20,8 +20,10 @@ def test(self): fname_base = os.path.basename(fname) fname_hash = os.path.splitext(fname_base)[0] if str(phash) != fname_hash: - msg = 'Calculated phash {} does not match filename {!r}.' - exceptions.append(ValueError(msg.format(str(phash), fname_base))) + msg = "Calculated phash {} does not match filename {!r}." + exceptions.append( + ValueError(msg.format(str(phash), fname_base)) + ) self.assertEqual([], exceptions) @@ -34,27 +36,29 @@ def test(self): listing_filepath = v4list.V4_LISTFILE_NAME self.assertTrue(os.path.exists(listing_filepath)) with open(listing_filepath) as listing_file: - listed_names = [line.strip() - for line in listing_file.readlines()] + listed_names = [line.strip() for line in listing_file.readlines()] files = set(file_names) listed = set(listed_names) if listed != files: - msg = ('Filenames in the listing file {} do not match the image ' - 'file contents of the {} directory:') + msg = ( + "Filenames in the listing file {} do not match the image " + "file contents of the {} directory:" + ) msg = msg.format(v4list.V4_LISTFILE_NAME, v4list.V4_DIR) newfiles = files - listed if newfiles: - msg += '\n Names in directory, but not in the listing file:' - msg += ''.join(['\n ' + name for name in newfiles]) + msg += "\n Names in directory, but not in the listing file:" + msg += "".join(["\n " + name for name in newfiles]) missing = listed - files if missing: - msg += '\n Names in the listing, but not in the directory:' - msg += ''.join(['\n ' + name for name in missing]) - msg += ('\n\n*** Please run "{}.py" to correct. ***'.format( - os.path.basename(v4list.__name__))) + msg += "\n Names in the listing, but not in the directory:" + msg += "".join(["\n " + name for name in missing]) + msg += '\n\n*** Please run "{}.py" to correct. ***'.format( + os.path.basename(v4list.__name__) + ) self.assertEqual(listed, files, msg) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/v4_files_listing.txt b/v4_files_listing.txt index 524fa90..b2e3801 100644 --- a/v4_files_listing.txt +++ b/v4_files_listing.txt @@ -109,6 +109,7 @@ a3fac1947c99184e62669ca7f65bc96ab81d97b7e248199cc7913662d94ac5a1.png a3fac1b47c99184e62669ca7f65bc96ab81d97b7e248199cc7913662d84acda0.png a3fd956a7a01a5ee3217c9e66691996ec15fdca593680d2586785a259dfa5a01.png a3fd956a7a01a5ee321fc96666919b6ec15fdca593600d2586785a259dfa5a01.png +a3fd95ea6a11258c3217c966e4019a56c96f3c859b62492584fe7a699db46adb.png a3ff34e87f0049496d17c4d9c04fc225d256971392d39f1696df0f16cec00f36.png a3ffc1d87e00b49964179d28f16bce4b98724b268c6d58e1972e4874998b2e7e.png a3ffc1de7e009c7030019786f438cde3810fd93c9b734a778ce47c9799b02731.png @@ -123,6 +124,7 @@ a5f896d99a67b94c621ceda3f6d392cccd246db3901898dec4836de9cd249292.png a5f896d99a67b94c621deda3f69392cccd246db39018989ec4836de9ed249292.png a6bfb5097f84cde2224599d1649f8d6cd2388c76d0799867d009da76c1f8d866.png a6eaa57e6e81ddf999311ba3b3775e20845d5889c199673b4e22a4675e8ca11c.png +a6fa1e967f00950eb00f9d0f914fcdc2d560c9f3c1fb3a9084266e34daa52f6c.png a6fb4b967f00950eb00f9d0f900fcd62dc7868f2c1bb3a909c266e34daa52f6c.png a6fb958dfb50c03e203598dca4c9cd26933f9cb3886e1df1dc047b4289ec2e72.png a6fb958dff50c03e203598dca4c9cd26933f9cf3886e1de1dc047b4289ec2672.png @@ -145,6 +147,7 @@ a95e3c1f96a096a5d6a5eb40c3f0ebe0c1c0c3f07c0b3e3e96a13c1e6d5b694a.png aa5b3c0c978187a4b60199bc605f6976687e6873d07c99e390acdc0391fc2f7b.png aa953d0f85fab50fd0f2956a7a1785fafa176877d00f68f1d02c60f2f008d0f0.png aa97b70ff5f0970f20b2956a6a17957af805da71d06f5a75d02cd870d800d8f2.png +aad73e0cf710952c840195acd528c1e2d1ecc9f3c1ec49f3c1ec6a536a1737f3.png aad73e0df78085ac840395ac9428d9fad56cd8f2906c48f2d0ec7a536a1737f3.png aad73e0df78085acb50195ac8029d9f2d16cd8f2d1ec48f280ec6a536a17b7f3.png aafec5e9e5e03e099a07e0f86542db879438261ec3b13ce78d8dc65a92d83d89.png @@ -192,6 +195,7 @@ afac26367251d3493617632df45c26a6e126c6f392593b4937266f26ccf232d0.png afea950ddb13c03e34359ad8a4c86f24913f2693807e3ff1f4087b4285fd28f2.png afea97094f07c9c870d79129ce16269f91096af6c4f861f6c07960f6d0797a16.png afee9632de05c9d9f180d168c454a53e931b3e84956a3b8c85d94ce703ff7284.png +aff21eb6bd04952cbc0f950f914fedc1c0f961f3e1f9329084266e345a850f6c.png aff24ab7bd05952fbd0f950f914fcd48c47860f3e1b9329094266e345a850f6c.png aff24ab7fd05952dbd0f950f914fcd40c47868f3e1b9329094266e345a850f6c.png aff8946c7a14c99fb193d263e42432d8d00c2d27944a3f8dc5223ef703ff6b90.png @@ -242,14 +246,18 @@ be0e695ac3f096b5943fd2a185fc1e8590e594ee1e05c17a4f403d0fe1fe4b42.png be21a71bc1de58e43a31871f7e856470c1fa9b8c7b81647384665b9ed1b998c1.png be21a71bc1de58e43a63a71b3e016061c1fe9b8c3e01a473847e5b94d1fb9ac3.png be812fc1c078c03e930e3627672369c1d8d85c5b96463662e1fc699d9b9f7e03.png +be8137e0954ac05fc0ff3e81c07fc97a6d0094af3fa0c17f36a53244d97e2da0.png be8137f4954ac03fc0ff3e81d03f496a6d00b4af3ea0c07f6fa232c0db7f2d00.png be813a81c17ec57ec17e952ac07f3f808556c17e3f80c07f3e813f80c27e3f81.png be813ea0c17ec55ac17ed23dc07e295ac57e3b653f803f813e816e853e81b542.png be813fc0c15ac13dc1bfc27dc17e1d93c51fc43f1ea1c17a3ec138e4b1721a81.png be813fe0954ac07fc0ff3e81c03fc97a6d0094af3f80c17f36a53240d97f2d82.png be816a81d17ec57ac07e952ac07f3aa0955ec17e3f80c07f3f803f80c0bf3f81.png +be816a85957a955ac0ff1e8bc07f7f806e01c07f3f80c07f3fa23f80c07f3d00.png be816a95907ae508c17e955ac07f3fa0945bc07f3f80c07f3aa36f01c0ff3f80.png be816a95957a957ac0fe1e8bc07f7f806e01c07f3f80c07f3fa23f00c07f3d00.png +be816ab5907ae508c17e955ac07f3fa0945ac07f3f80c07f3aa32f81c0ff3f80.png +be816ab5907ee508c17e975ac07f3fa09459c07f3f80c07f3a812f81c0ff3f80.png be816af5907ee508c17e955ac03f3f809419c07f3f80c07f3a8b6f81c0ff3f80.png be817a87845ea56cec79817a919e338436a5c1e73fa16c736c4a3e816a1e6b1c.png be81857ec17e7a81c17e7e81857e3e803e81817a3e81c17e7a81c17ec97e2c2b.png @@ -262,6 +270,7 @@ bec11ab5c1be857ac13e7ae53c422d423e017a85b542fc00c1fefe0091fe03ff.png bec1329dc5be85dac01d58d73e419d423e41daa59822dc00c5fefe0091fe03ff.png bec13a81c13ec56ac13e5afdd11e256a3e412afd3e4002ff2ee0fe0035fa817a.png bec13e81c5bec55ac03dd896d17e8d6a1e410af7380008ff1de6fe0099ea237b.png +bf802e85c07fc17fc07eb42ac17f3f829161c06e3f81c07f7ba02e85c07f3e81.png bf802f85c17fc17fc07eb42ac07f3f929130c07e3f80c07f7aa02e85c07f3e81.png bf803f00c05fc4bfc07ec15dc05fd8bbc07cc96c333a32113bd02dd27ced3ec0.png bf80e2b1c17f1d0ac4f7c8d739a637202749699b6bb3ce3666e4b048944d9d89.png @@ -294,6 +303,7 @@ e5a665a69a599659e5db1865c2653b869996cce63e99e19a1a912639e7181e65.png e5a761a79a589e58c07d1e48c07c3f819e41c07f3d84c17e3fa62585c0fe3f83.png e5a761b69a589a4bc46f9e48c65c6631ce61d1ce3982c13739b33193c0ee3f8c.png e63399cd99cd64b29999335965369b262649c98c9b3966c6998d3319ccd69333.png +e665326d999acc9b3319b3246666cce69b496cccccc966996719333666669986.png e665326d999ecc9b3319b3246666cce69b496cccccc9669923193336666699a6.png e66c6619999933666666c6d99999336663646d9999c1332667b60cf964d8672c.png e68665de9a699659c1fe99a5896965966996c46e3e19c1da3a652669c51e1a26.png @@ -364,6 +374,7 @@ ea159694856a6b5096afa53a36941da1e4f5c369cd1ae6d69b6a1c80625af2f6.png ea1f781f95e085e885e0954295e195ea95a085e87a153e7f95e06a1778557a1f.png ea1f781f95e085e895e0fd4295e095ea95a085e87a153e7e95e06a1778157a17.png ea5649c434ac92e5d9c9361b95b39c38c3835a5ec6d966ced34c633099ace5a5.png +ea57396995a8c6d691ea3e25664569d96b16c63684e9958b91ea4a559431793b.png ea57396995a8c6d691ea3f25664569d86b16c63686ed958991ea4a549531393b.png ea57685f95a886a1c0de9da090be3e2497e1c0ef3f01c17e6b366c17c07b3f01.png ea57685f95a886a1c0de9da090be3e2697e1c0ff3f00c17e6b266c17c07f3f00.png @@ -377,14 +388,19 @@ ea811831957fe3cea68c6ce0d9f29b9b6a816463953e61cc917f1ae36ac09d38.png ea817a81957e857e957e953e957e857e857e6aa06a816ac16a017a816a9585fa.png ea851f00957ac0f7957ac07f957a628d815e7b126ab13e816a953ae46a859ed3.png ea853a85857a857a957a857a957ad05a857b3e946a606b917a816f647a853af4.png +ea853a85957a857a957a857a957ac05ac56b3ac46ae16b817a816f647a853af4.png ea853e48957ac1df957ac8be852bc1b1944e7a9878e03f4c6a253e6c7a912dc2.png ea853f00957ac07c957ac0be951a69f3c47c7a5f3a6127816b953e646b813761.png ea853f10956ac5e1957a854e957a203e955e6aa76ae17aa16a856aaf6ab19e12.png +ea853f10957a85e1957a854e957a203e955e6aa76ae17aa16a856a8f6ab1de12.png ea85603f956a9741951e9d83c1fa8d2fd0a55af0d25f345ae5f062c72d68612d.png ea856a85954a957ac17e954ac17a9c3e956ac07e3e80c07f3e857aa5c27d3f80.png ea856a85954a957ac17e954ac17a9c3e956ac07e3e81c07f3e857aa5c2753f80.png +ea856a85954a957ac17e954ac17a9d22956ac0fe3e81c07f3e857aa5c27d3f80.png ea856a85957a957ac17e954ac17e1ca2954ac07e3e81c07f3e807a85c1ff3f81.png +ea856a95955a954ac17f950ac07e3f44951ac07e3f81c0ff3ea16aa1c0ff3e81.png ea856a95955a954ac17f954a807e3f48951ac07e3e81c0ff7ea16a81c0ff3f81.png +ea856a95955a954ac17f954ac07e3f44951ac07e3e81c07f7ea16aa1c0ff3e81.png ea856a95955a954ac17f954ac07e3f48951ec07e3e81c0ff7ea16a81c0bf3e81.png ea856a95955a956ac17f950a807e3f4c951ac07e3f81c0ff3ea16aa1c0bd3f81.png ea856a95955a956ac17f950ac07e3f48951ac07f3f81c0ff3ea16aa1c0be3e81.png @@ -395,6 +411,7 @@ ea857a81957ac57e957a857a957a958ac5723b0d6ac56b833e856e606a923e90.png ea85856e857e4893957a7aa1956a7b81954b3b817a856fd46a85846e6e85857e.png ea85857a857e7e81957a7a81957a6a85857acac6c1fb6aa67a81956e6a81b506.png ea85857a857e7e81957a7a81957a6a85857acae6c1fb6aa47a81956e6a81b506.png +ea858782957a703f957a3878957a7a65957a6b806ae56f846ad50fd46a859c50.png ea858782957a703f957a3878957a7a65957a6bc06ae76f806ad50fd06a859c50.png ea858782957a703f957a3878957a7a65957e6bc06ae56f806ad50fd06a859c50.png ea9130db95668524913c6ac178995b0d956e917ec76396b96a853dcf94696935.png @@ -407,6 +424,7 @@ ea9521fb956a394069921e93f07f4aad856cc47e4e95857a1ea5da3591ba1b81.png ea95317b9562e4d1649f5a05856e4ca4da52947e4ea5f13f1b499d42f13b1b41.png ea953bfb956ac4f4649f1a05c56e6ca45a53945e6ea5c13f1b498542c13f1b41.png ea953f83954ac2bc956ac07e956a3509c0de61796ab57a816a856ad16ab590fb.png +ea953f83954ac2bc956ac07e956a3509c0de61796ab57a916a856a916ab590fb.png ea953f83954ac2fc956ac07e956a3509c0de61796ab57a816a854ad16ab590fb.png ea9561ef956a7b92609b922dc16e6ec6845ac47e5aa5c57e5ec04861957b1b81.png ea95629d956a996069939e9bc07f7aad856cc47e5e81857a1e254a35c1be1b81.png @@ -416,6 +434,8 @@ ea95956a95626993941a6a2d956e6ed6845a6e65c4bec7b64a9594686ea19578.png ea95969c874a63d39ca3ad2a231cdbc9c4973631cd6336c633182cbc61c3d3f2.png eaa5684eb54a947ad09eb731c521978dc2fb1cc0e4966ce26e2c6b2d3a6e691a.png eaa5e03f957a4f80954a9e41e16e9c60970fb5b24ada634e6e93692d4ba562d8.png +eaa9b5299d56854e9156856ed05625fdc0292bfdc0a90afd85b97e00857e6ad6.png +eaa9b529f756850ea0169566d1568d6dd86909ed88290afd9ded7e008d666ad6.png eaa9b549f756854ea0168d6ed556896dd8e909ed88290afdd9e97e008d6e2296.png eaa9b549f756854ea0169d6ad5568969d9a909ed80290afdd9e97e008d6e6a96.png eaa9b5699556854e9456854ed05625f9c0a92bfdc0a90afd81f97e00857e6af6.png @@ -426,7 +446,10 @@ eae0943295154bcc844e6c314fb093ce7bc7c4b3a4307bc4916f3f316ed2b4ce.png eae942146540b869961f8de694589da69543cc9af1014afbc3fd596b84fe19a7.png eae942526540b869961f8da694589da69543cc9af1014afbc3fd596b84fe19a7.png eaece0173d17951fbd03974a914964e8c04a72e8c1531ee1cc746bb293973ecd.png +eaf73e0c9402952c950195acd528c1fac1ecc1f3c1ec63f3c0ec6a536a179ff2.png eaf73e0d9503852c950395ac9528c1fad16cc0f2d1ec6af2c0ec6a536a1797f3.png +eaf9a6c9f728943032168d66d4cb8d2e9567497b81304aedc9e51e2d9d186ada.png +eafd86c9f8219430fe96a56684c3852e95656b7b85b86acdc0e5162da5186eda.png eafd9e12a5a061e9925ec716de489e9685078ec981b229e70ddb79219cc3768d.png eafdc6c9f720943030968d67d5d28d6e95674b7b81304aedc9651cad8d186c9a.png eafdc6c9f720953030968d6795d28d6a95674b7b81304aedc9e51cad8d186c9a.png @@ -466,6 +489,7 @@ ee819cb7913b63c8846e64737bb1999c6ec52633953a69c8916f6c636e92911c.png ee856299954a1da699b6915ec25b6e419729c42c3f84bd8fa7d262d1d1dac076.png ee856aa5957a955ac0bf954bc17e3b819548c07f3e81c07e2ec46ea4c07f3e84.png ee953f0591ea3f07914a95fa7e07d1fa68156a15d07c6a3dd038c0fef000d0fa.png +eea16abfc05ab500956e974ac13f3da0925ac07f3fa1c07e3fa12da1c25e3f80.png eea16affc05ab500956e974ac53f3d80925ac03f2f81c07e3fa12da1c2fe3f80.png eea16affc05ab500956e974ac53f3d80925ac03f3f80c07e3fa12da1c27f3f80.png eea16affc05ab500956e974ac53f3d80925ac03f3f81c07e3fa12da1c27e3f80.png @@ -479,6 +503,7 @@ f9913b919536c46e966ec2e96ac99726c7526d9139a03859b4b4932e974b6ce1.png fa15615e97a193adc15e1e81c4fa3eb49d30817e3e05c17e7ba59927817e1e01.png fa1585e885e86a1785fa7a177a177e807a1585e817a885ea85e86817857f7a17.png fa1585e885e87a1785fa7a177a177e807a1585e85fa0857a85e86817857f6a16.png +fa1585e885ea7a1785fa7a157a177a017a1585e817a885ea85e86a1785fa7a17.png fa1594f3858a670c94e37b1cccb13e736a1d84f17a1d94e2c11d938e9463678e.png fa1594f3858a670c94e37b1cccb13e736a1d8cf17a1d94e2c11993ae9463678c.png fa1594f3858a670c94e37b1cccb13e736a1d8cf17a1f94e2c119938e9463678c.png @@ -488,6 +513,7 @@ fa17291f95e895e8645e7a95c17a6eece4b4e1333b01c07e1bb13909914b9ec1.png fa56c3cc34e891b1c9a91c36c5a170e3c71b3e5993a784e492c49b4ecec76393.png fa56f295c5e0694a3c17a58d95e8da536233da99984c5af4c6739b4a9a444eb4.png fa813e81857e857a857e7a81857e6a85817b00e63eb93e857e81c17e7a81956e.png +fa813e81857e857a857e7a81857e6a85817b0aa63e993e857e81c17e7a81956e.png fa816a85857a955ae17e957ec57e7a81855fc17e3a81c57e1a813a85c57a1a05.png fa816a85957a857ac17e954ac17e1fa2950bc07e3e81c07f3e807a85c17f3f81.png fa816a85957a857ac17e954ac17e3fa29506c07e3e81c07f3e807a84c1ff3f81.png @@ -507,6 +533,7 @@ fa81817e857e7a81857a7a81957a6e81917a6caa3a85c57a3a8585fa6a8591fe.png fa81817e857e7a81857e7a81817a7e81817a668f7a91857e7a81857e7a85817e.png fa81817ec40a7a81857e957e857ef40a857ef60b7a81c40a7b81e60f7a814aff.png fa81857e857a7a84857a7a85857e7a813a2f7a817a85857a7a85857a7a85857a.png +fa81857e857a7e01857e7a81857e7a81a0577a816a8585fa7a85857e7a85857e.png fa81857e857a7e01857e7a81857e7a81e8177a816a8585fa7a85857e7a81857e.png fa81857e857e3e80857e7a817a817a817a81817f7a81857e857e857e857e7a81.png fa81857e857e3e85857e7a81857e7a81857e7a817e81780b7a81c56a7a81857e.png @@ -526,6 +553,7 @@ fa81917e857e6e81857e7a857a81917a7a81857e857e7e81857e7a817a81852e.png fa81948e857e4971907ea72e95fa66b2952e4ead6d429b527ac7a5286e981836.png fa81b54a817eca35817ec701857e3e64943e7bb41b846f996e817e006ee1b19b.png fa81c17a857e1ea5857e634a7a81cd257e8584da857e3b29817e68f47a81c791.png +fa81c17a857e1ea5857e734a7a81cd257e8484da857e3b29817a68f47a81c799.png fa81e535857e92ca8ec23d21b13ce15e7a811ea5c47e1a5ac17b652d3b05e4f2.png fa8460b9c17b78723e05a5a9954edaf062333799954e9ca5c63b9a52d24e4a9d.png fa852f81955ac532c0bf9e89c57edae69357e13f4ea0c05a3f8561a4935a3e01.png @@ -541,6 +569,7 @@ fa8562b7c2763d09956a955a855a1d88d45ec57a3f81c07e6ae16b21c0ff7a81.png fa8562f6c0773d09b54a955a857a3f81955ac47e3e85c17e7aa16a25c0765aa1.png fa856a85957a857ac17e954ac17e9d02954ac07e3e81c07f3e857a85c2fd3f80.png fa856a85957a957ac17e954ac17a1f06954ac07e3e81c07f3e817a85c0ff3f80.png +fa856a85957a957ac17e954ac17e0da2954bc07e3e81c07f3a806a85c1ff3f81.png fa856a85957a957ac17e954ac17e1ca2950bc07e3e80c07f3e807a85c1ff3f81.png fa856a95e15ab51a953e9485857a1f409552857e1fc1c07e5abd4a35e07f4aa5.png fa85857ec45a7a81857e854a857ee56a917ec56a3a85c56a3a85c4ea7a8112fe.png @@ -565,6 +594,7 @@ fb11731a94cea4ee64b35e91d1d2304e9e5ac7397b20e1fe12852487e666ce46.png fb8d4f21c472b27e919d2e216f216b3178e69c7e961ab39a84696c616d245b94.png fb946ba484e194dbc01f3665c0e4399a3f0fc2653f90c99e3f613e64c81e3f81.png fb946ba684e194fb901b3a0587641ad03b1ae7674e64c15a5b99c767c47e3a98.png +fb966ba6846194dbd01f3665c0e4399a3f1bc2653f90c99e2f613e64c01e3f81.png fba0cbf1845e34be912787416edcc8bc3b881f9b62332762a5ad32cdc1b2cd21.png fbe0623dc9879d91b41e4b449b6579e78798a49b7872d2644b8c919b39306e6c.png fe812f88957a955a857a9257c17f7aa5c03dc0bf5a85c07e7f402d40a57a3f01.png