diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b4d1d1ca583eb211cc4b0a5ab9b2243c715bb45e..49337196592599a11942ecd8fc24a4230c5a196d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,20 +2,20 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/timothycrosley/isort - rev: 5.10.1 + rev: 5.12.0 hooks: - id: isort args: [--settings-path, "pyproject.toml"] - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 3.9.2 + rev: 6.0.0 hooks: - id: flake8 - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v4.4.0 hooks: - id: check-ast - id: check-case-conflict diff --git a/src/bob/bio/vein/algorithm/__init__.py b/src/bob/bio/vein/algorithm/__init__.py index 07c12d726e46f970662aa5ccd8976611d2315b55..603b850a9ecc49d01083715739e7aae73950de31 100644 --- a/src/bob/bio/vein/algorithm/__init__.py +++ b/src/bob/bio/vein/algorithm/__init__.py @@ -3,6 +3,7 @@ from .MiuraMatch import MiuraMatch from .Correlate import Correlate from .HammingDistance import HammingDistance + # gets sphinx autodoc done right - don't remove it def __appropriate__(*args): """Says object was actually declared here, an not on the import module. diff --git a/src/bob/bio/vein/database/utfvp.py b/src/bob/bio/vein/database/utfvp.py index aab0982ee3be82f56d2f2e04c6957db4b3ac1801..8f38b0fbd07a0680d2ffd7d707742d1aca70a8bb 100644 --- a/src/bob/bio/vein/database/utfvp.py +++ b/src/bob/bio/vein/database/utfvp.py @@ -164,7 +164,6 @@ class UtfvpDatabase(CSVDatabase): dataset_protocols_hash = "fe51ba85" def __init__(self, protocol): - super().__init__( name=self.name, protocol=protocol, diff --git a/src/bob/bio/vein/database/verafinger_contactless.py b/src/bob/bio/vein/database/verafinger_contactless.py index 4c71ff66cda9e05af6738f97c26d411990f64bfc..9e998d798c886cbc18c92865d99ca0971519765d 100644 --- a/src/bob/bio/vein/database/verafinger_contactless.py +++ b/src/bob/bio/vein/database/verafinger_contactless.py @@ -60,7 +60,6 @@ class VerafingerContactless(CSVDatabase): dataset_protocols_hash = "656ef935" def __init__(self, protocol): - super().__init__( name=self.name, protocol=protocol, diff --git a/src/bob/bio/vein/extractor/MaximumCurvature.py b/src/bob/bio/vein/extractor/MaximumCurvature.py index 518d5620f6102fc2bea09b79e528d56c72a30b0d..9119f7e0de0a233dd6241d0331d3fedb19e2c30d 100644 --- a/src/bob/bio/vein/extractor/MaximumCurvature.py +++ b/src/bob/bio/vein/extractor/MaximumCurvature.py @@ -472,7 +472,6 @@ class MaximumCurvature(Extractor): plt.show() def __call__(self, image): - finger_image = image[0].astype("float64") finger_mask = image[1] diff --git a/src/bob/bio/vein/extractor/RepeatedLineTracking.py b/src/bob/bio/vein/extractor/RepeatedLineTracking.py index 6a9ec79752c833ba2586528ece614e4c9a841da5..dd62de036d065132124b73a6bcf57bace8a0a8e3 100644 --- a/src/bob/bio/vein/extractor/RepeatedLineTracking.py +++ b/src/bob/bio/vein/extractor/RepeatedLineTracking.py @@ -28,7 +28,6 @@ class RepeatedLineTracking(Extractor): rescale=True, seed=0, # Seed for the algorithm's random walk ): - # call base class constructor Extractor.__init__( self, diff --git a/src/bob/bio/vein/extractor/WideLineDetector.py b/src/bob/bio/vein/extractor/WideLineDetector.py index d64899ffcc42a25a9cdc5695d173658a59beeefe..8eace9a6ae0f28e72da5534c5fe6be054ec05beb 100644 --- a/src/bob/bio/vein/extractor/WideLineDetector.py +++ b/src/bob/bio/vein/extractor/WideLineDetector.py @@ -22,7 +22,6 @@ class WideLineDetector(Extractor): g=41, # Sum of neigbourhood threshold rescale=True, ): - # call base class constructor Extractor.__init__( self, diff --git a/src/bob/bio/vein/preprocessor/__init__.py b/src/bob/bio/vein/preprocessor/__init__.py index 51771f946176a8d461e9b5dde7f04eec846c3a81..c5e182e857c267b341f813302003490955f56321 100644 --- a/src/bob/bio/vein/preprocessor/__init__.py +++ b/src/bob/bio/vein/preprocessor/__init__.py @@ -6,6 +6,7 @@ from .normalize import Normalizer, NoNormalization, HuangNormalization from .filters import Filter, NoFilter, HistogramEqualization from .preprocessor import Preprocessor + # gets sphinx autodoc done right - don't remove it def __appropriate__(*args): """Says object was actually declared here, an not on the import module. diff --git a/src/bob/bio/vein/preprocessor/mask.py b/src/bob/bio/vein/preprocessor/mask.py index 3e146fbd7f1487fc138075f337f152bef4b0e6e3..88e5ecd0b8eacef38d1447e5d9e28bec86c996ad 100644 --- a/src/bob/bio/vein/preprocessor/mask.py +++ b/src/bob/bio/vein/preprocessor/mask.py @@ -32,7 +32,6 @@ class Padder(object): """ def __init__(self, padding_width=5, padding_constant=51): - self.padding_width = padding_width self.padding_constant = padding_constant @@ -211,7 +210,6 @@ class KonoMask(Masker): """ def __init__(self, sigma=5, padder=Padder()): - self.sigma = sigma self.padder = padder diff --git a/src/bob/bio/vein/preprocessor/preprocessor.py b/src/bob/bio/vein/preprocessor/preprocessor.py index 724c6432c94b868df9ffe4aa6ff1ca431962b7f7..2b45b3dcd19aaa893b422e83b59402fafe0adb0f 100644 --- a/src/bob/bio/vein/preprocessor/preprocessor.py +++ b/src/bob/bio/vein/preprocessor/preprocessor.py @@ -40,14 +40,13 @@ class Preprocessor(BasePreprocessor): """ def __init__(self, crop, mask, normalize, filter, **kwargs): - BasePreprocessor.__init__( self, crop=crop, mask=mask, normalize=normalize, filter=filter, - **kwargs + **kwargs, ) self.crop = crop diff --git a/src/bob/bio/vein/script/blame.py b/src/bob/bio/vein/script/blame.py index eb2cfde6dde14843797548538fb5f11e2234ddeb..3773f1e10fe70ce1c355b70f9e42f3fc999a01f7 100644 --- a/src/bob/bio/vein/script/blame.py +++ b/src/bob/bio/vein/script/blame.py @@ -45,7 +45,6 @@ logger = bob.extension.log.setup("bob.bio.vein") def main(user_input=None): - if user_input is not None: argv = user_input else: diff --git a/src/bob/bio/vein/script/compare_rois.py b/src/bob/bio/vein/script/compare_rois.py index 7eb79816774ba10d9e6774221e5c4f75cb71e4aa..f1198a8d61279a4aec3bc7e1fd222e9ee907bfaf 100644 --- a/src/bob/bio/vein/script/compare_rois.py +++ b/src/bob/bio/vein/script/compare_rois.py @@ -139,7 +139,6 @@ def mean_std_for_column(table, column): def main(user_input=None): - if user_input is not None: argv = user_input else: diff --git a/src/bob/bio/vein/script/view_sample.py b/src/bob/bio/vein/script/view_sample.py index 24511e3ec1664624d51fa59a73c63b46bc94ef62..8ee768d89b28fc81090d4e6433387cb59d8337ec 100644 --- a/src/bob/bio/vein/script/view_sample.py +++ b/src/bob/bio/vein/script/view_sample.py @@ -198,7 +198,6 @@ def validate(args): def main(user_input=None): - if user_input is not None: argv = user_input else: diff --git a/tests/test_tools.py b/tests/test_tools.py index c8e045e3a032314ca809f4281393bebb991c0ffa..4d6a6d49c78201a6566a79174876efc15717025e 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -30,7 +30,6 @@ def F(parts): def test_cropping(): - # tests if the cropping stage at preprocessors works as planned from ..preprocessor.crop import FixedCrop, NoCrop @@ -80,7 +79,6 @@ def test_cropping(): def test_masking(): - # tests if the masking stage at preprocessors work as planned from ..database import AnnotatedArray @@ -128,7 +126,6 @@ def test_masking(): def test_preprocessor(): - # tests the whole preprocessing mechanism, compares to matlab source input_filename = F(("preprocessors", "0019_3_1_120509-160517.png")) @@ -171,7 +168,6 @@ def test_preprocessor(): def test_max_curvature(): - # Maximum Curvature method against Matlab reference image = bob.io.base.load(F(("extractors", "image.hdf5"))) @@ -253,7 +249,6 @@ def test_max_curvature_HE(): def test_repeated_line_tracking(): - # Repeated Line Tracking method against Matlab reference input_img_filename = F(("extractors", "miurarlt_input_img.mat.hdf5")) @@ -321,7 +316,6 @@ def test_repeated_line_tracking_HE(): def test_wide_line_detector(): - # Wide Line Detector method against Matlab reference input_img_filename = F(("extractors", "huangwl_input_img.mat.hdf5")) @@ -388,7 +382,6 @@ def test_wide_line_detector_HE(): def test_miura_match(): - # Match Ratio method against Matlab reference template_filename = F(("algorithms", "0001_2_1_120509-135338.mat.hdf5")) @@ -411,7 +404,6 @@ def test_miura_match(): def test_correlate(): - # Match Ratio method against Matlab reference template_filename = F(("algorithms", "0001_2_1_120509-135338.mat.hdf5")) @@ -431,7 +423,6 @@ def test_correlate(): def test_assert_points(): - # Tests that point assertion works as expected area = (10, 5) inside = [(0, 0), (3, 2), (9, 4)] @@ -454,7 +445,6 @@ def test_assert_points(): def test_fix_points(): - # Tests that point clipping works as expected area = (10, 5) inside = [(0, 0), (3, 2), (9, 4)] @@ -478,7 +468,6 @@ def test_fix_points(): def test_poly_to_mask(): - # Tests we can generate a mask out of a polygon correctly area = (10, 9) # 10 rows, 9 columns polygon = [(2, 2), (2, 7), (7, 7), (7, 2)] # square shape, (y, x) format @@ -525,7 +514,6 @@ def test_poly_to_mask(): def test_mask_to_image(): - # Tests we can correctly convert a boolean array into an image # that makes sense according to the data types sample = numpy.array([False, True]) @@ -560,7 +548,6 @@ def test_mask_to_image(): def test_jaccard_index(): - # Tests to verify the Jaccard index calculation is accurate a = numpy.array( [ @@ -598,7 +585,6 @@ def test_jaccard_index(): def test_intersection_ratio(): - # Tests to verify the intersection ratio calculation is accurate a = numpy.array( [ @@ -664,7 +650,6 @@ def test_intersection_ratio(): def test_hamming_distance(): - from ..algorithm.HammingDistance import HammingDistance HD = HammingDistance()