From 3e5506e4b3dcb0c9d85f23148d36e55712bff5a3 Mon Sep 17 00:00:00 2001 From: Tiago Freitas Pereira <tiagofrepereira@gmail.com> Date: Sat, 2 May 2020 17:01:35 +0200 Subject: [PATCH] Some cosmetic changes in the legacy wrap function --- .../base/pipelines/vanilla_biometrics/__init__.py | 7 +------ bob/bio/base/test/test_transformers.py | 8 ++++---- bob/bio/base/test/test_vanilla_biometrics.py | 12 ++++++------ bob/bio/base/wrappers.py | 2 +- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/bob/bio/base/pipelines/vanilla_biometrics/__init__.py b/bob/bio/base/pipelines/vanilla_biometrics/__init__.py index 40b552d2..5f6a8820 100644 --- a/bob/bio/base/pipelines/vanilla_biometrics/__init__.py +++ b/bob/bio/base/pipelines/vanilla_biometrics/__init__.py @@ -1,11 +1,6 @@ -# see https://docs.python.org/3/library/pkgutil.html -from pkgutil import extend_path - from .pipelines import VanillaBiometricsPipeline from .biometric_algorithms import Distance from .score_writers import FourColumnsScoreWriter, CSVScoreWriter from .wrappers import BioAlgorithmCheckpointWrapper, BioAlgorithmDaskWrapper, dask_vanilla_biometrics -from .legacy import BioAlgorithmLegacy, DatabaseConnector - -__path__ = extend_path(__path__, __name__) +from .legacy import BioAlgorithmLegacy, DatabaseConnector \ No newline at end of file diff --git a/bob/bio/base/test/test_transformers.py b/bob/bio/base/test/test_transformers.py index 658f448b..ed8575b8 100644 --- a/bob/bio/base/test/test_transformers.py +++ b/bob/bio/base/test/test_transformers.py @@ -19,7 +19,7 @@ from bob.bio.base.wrappers import ( wrap_preprocessor, wrap_extractor, wrap_algorithm, - wrap_transform_bob, + wrap_bob_legacy, ) from sklearn.pipeline import make_pipeline @@ -263,13 +263,13 @@ def test_wrap_bob_pipeline(): with tempfile.TemporaryDirectory() as dir_name: pipeline = make_pipeline( - wrap_transform_bob( + wrap_bob_legacy( FakePreprocesor(), dir_name, transform_extra_arguments=(("annotations", "annotations"),), ), - wrap_transform_bob(FakeExtractor(), dir_name,), - wrap_transform_bob(FakeAlgorithm(), dir_name), + wrap_bob_legacy(FakeExtractor(), dir_name,), + wrap_bob_legacy(FakeAlgorithm(), dir_name), ) oracle = [7.0, 7.0, 7.0, 7.0] training_samples = generate_samples(n_subjects=2, n_samples_per_subject=2) diff --git a/bob/bio/base/test/test_vanilla_biometrics.py b/bob/bio/base/test/test_vanilla_biometrics.py index d36ae165..2a85d334 100644 --- a/bob/bio/base/test/test_vanilla_biometrics.py +++ b/bob/bio/base/test/test_vanilla_biometrics.py @@ -7,7 +7,7 @@ import os import numpy as np import tempfile from sklearn.pipeline import make_pipeline -from bob.bio.base.wrappers import wrap_transform_bob +from bob.bio.base.wrappers import wrap_bob_legacy from bob.bio.base.test.test_transformers import FakePreprocesor, FakeExtractor, FakeAlgorithm from bob.bio.base.pipelines.vanilla_biometrics import ( Distance, @@ -96,25 +96,25 @@ class DummyDatabase: def _make_transformer(dir_name): pipeline = make_pipeline( - wrap_transform_bob( + wrap_bob_legacy( FakePreprocesor(), dir_name, transform_extra_arguments=(("annotations", "annotations"),), ), - wrap_transform_bob(FakeExtractor(), dir_name,) + wrap_bob_legacy(FakeExtractor(), dir_name,) ) return pipeline def _make_transformer_with_algorithm(dir_name): pipeline = make_pipeline( - wrap_transform_bob( + wrap_bob_legacy( FakePreprocesor(), dir_name, transform_extra_arguments=(("annotations", "annotations"),), ), - wrap_transform_bob(FakeExtractor(), dir_name), - wrap_transform_bob(FakeAlgorithm(), dir_name) + wrap_bob_legacy(FakeExtractor(), dir_name), + wrap_bob_legacy(FakeAlgorithm(), dir_name) ) return pipeline diff --git a/bob/bio/base/wrappers.py b/bob/bio/base/wrappers.py index cee89200..dc2ef7d8 100644 --- a/bob/bio/base/wrappers.py +++ b/bob/bio/base/wrappers.py @@ -13,7 +13,7 @@ import bob.pipelines as mario import os -def wrap_transform_bob( +def wrap_bob_legacy( bob_object, dir_name, fit_extra_arguments=(("y", "subject"),), -- GitLab