From 1849bc46ca9e8c5fc0634aabe2db4fdd7fc75c97 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Tue, 24 Oct 2023 18:02:27 +0200 Subject: [PATCH] Remove outdated Python2 code Remove `six` package --- .github/workflows/testing.yml | 2 +- examples/hashimages.py | 1 - find_similar_images.py | 1 - imagehash/__init__.py | 1 - setup.py | 1 - tests/__init__.py | 2 -- tests/test_average_hash.py | 2 -- tests/test_colorhash.py | 2 -- tests/test_crop_resistant_hash.py | 2 -- tests/test_dhash.py | 2 -- tests/test_hex_conversions_multihash.py | 2 -- tests/test_phash.py | 2 -- tests/test_readme.py | 3 +-- tests/test_whash.py | 11 ++++------- tests/utils.py | 2 -- 15 files changed, 6 insertions(+), 30 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 5fdd5d4..c31526a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -40,7 +40,7 @@ jobs: run: ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/share/miniconda/envs/test/lib/libstdc++.so.6 - name: Install testing dependencies run: | - conda install -c conda-forge --file requirements-conda.txt --file requirements-linting-old.txt six packaging pytest coveralls coverage libstdcxx-ng + conda install -c conda-forge --file requirements-conda.txt --file requirements-linting-old.txt packaging pytest coveralls coverage libstdcxx-ng pip install git+https://github.com/JohannesBuchner/coverage-lcov - name: Conda info run: | diff --git a/examples/hashimages.py b/examples/hashimages.py index b407565..716b75f 100644 --- a/examples/hashimages.py +++ b/examples/hashimages.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -from __future__ import absolute_import, division, print_function import sys diff --git a/find_similar_images.py b/find_similar_images.py index 3237eab..a932d90 100755 --- a/find_similar_images.py +++ b/find_similar_images.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -from __future__ import absolute_import, division, print_function from PIL import Image diff --git a/imagehash/__init__.py b/imagehash/__init__.py index bf9f644..8082bb7 100644 --- a/imagehash/__init__.py +++ b/imagehash/__init__.py @@ -28,7 +28,6 @@ >>> """ -from __future__ import absolute_import, division, print_function import sys diff --git a/setup.py b/setup.py index c7c7618..471fb26 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- try: from setuptools import setup diff --git a/tests/__init__.py b/tests/__init__.py index 9c602ab..027675b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,3 +1 @@ -from __future__ import absolute_import, division, print_function - from .utils import TestImageHash # noqa: F401 Testing the import diff --git a/tests/test_average_hash.py b/tests/test_average_hash.py index 357990d..55172e2 100644 --- a/tests/test_average_hash.py +++ b/tests/test_average_hash.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function - import unittest import imagehash diff --git a/tests/test_colorhash.py b/tests/test_colorhash.py index 00cd507..f601f90 100644 --- a/tests/test_colorhash.py +++ b/tests/test_colorhash.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function - import unittest import imagehash diff --git a/tests/test_crop_resistant_hash.py b/tests/test_crop_resistant_hash.py index b0d345a..d2096f5 100644 --- a/tests/test_crop_resistant_hash.py +++ b/tests/test_crop_resistant_hash.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function - import unittest from datetime import datetime diff --git a/tests/test_dhash.py b/tests/test_dhash.py index bdac0c5..0d38cd9 100644 --- a/tests/test_dhash.py +++ b/tests/test_dhash.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function - import unittest import imagehash diff --git a/tests/test_hex_conversions_multihash.py b/tests/test_hex_conversions_multihash.py index cc55cb9..db6af76 100644 --- a/tests/test_hex_conversions_multihash.py +++ b/tests/test_hex_conversions_multihash.py @@ -1,5 +1,3 @@ -from __future__ import (absolute_import, division, print_function) - import unittest import imagehash diff --git a/tests/test_phash.py b/tests/test_phash.py index 40a3201..15c8bb5 100644 --- a/tests/test_phash.py +++ b/tests/test_phash.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function - import unittest import imagehash diff --git a/tests/test_readme.py b/tests/test_readme.py index 0a4b60d..6f23be7 100644 --- a/tests/test_readme.py +++ b/tests/test_readme.py @@ -1,5 +1,4 @@ import os -import six def test_run(): @@ -12,4 +11,4 @@ def test_run(): code = ''.join(chunk) print("running::\n" + code) - print("result:", six.exec_(code, {}, {})) + print("result:", exec(code, {}, {})) diff --git a/tests/test_whash.py b/tests/test_whash.py index 4aed972..b7baf9e 100644 --- a/tests/test_whash.py +++ b/tests/test_whash.py @@ -1,8 +1,5 @@ -from __future__ import absolute_import, division, print_function - import unittest -import six from PIL import Image import imagehash @@ -50,14 +47,14 @@ def test_hash_size_for_small_images(self): def test_hash_size_not_2power(self): emsg = 'hash_size is not power of 2' for hash_size in [3, 7, 12]: - with six.assertRaisesRegex(self, AssertionError, emsg): + with self.assertRaisesRegex(AssertionError, emsg): imagehash.whash(self.image, hash_size=hash_size) def test_hash_size_is_less_than_image_scale(self): image = self._get_white_image((120, 200)) emsg = 'hash_size in a wrong range' for hash_size in [128, 512]: - with six.assertRaisesRegex(self, AssertionError, emsg): + with self.assertRaisesRegex(AssertionError, emsg): imagehash.whash(image, hash_size=hash_size, image_scale=64) def test_custom_hash_size_and_scale(self): @@ -67,13 +64,13 @@ def test_custom_hash_size_and_scale(self): def test_hash_size_more_than_scale(self): emsg = 'hash_size in a wrong range' - with six.assertRaisesRegex(self, AssertionError, emsg): + with self.assertRaisesRegex(AssertionError, emsg): imagehash.whash(self.image, hash_size=32, image_scale=16) def test_image_scale_not_2power(self): emsg = 'image_scale is not power of 2' for image_scale in [4, 8, 16]: - with six.assertRaisesRegex(self, AssertionError, emsg): + with self.assertRaisesRegex(AssertionError, emsg): imagehash.whash(self.image, image_scale=image_scale + 1) diff --git a/tests/utils.py b/tests/utils.py index 9360620..654b946 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,5 +1,3 @@ -from __future__ import absolute_import, division, print_function - import os import os.path import unittest