From c77eb85060753ebaa9aaceeae158020a40d45b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Sat, 21 Oct 2023 16:55:58 -0400 Subject: [PATCH] ENH: Remove unused imports contained within `try`/`expect` blocks Remove unused imports contained within `try`/`expect` blocks. --- bin/wm_cluster_remove_outliers.py | 8 -------- whitematteranalysis/register_two_subjects.py | 8 -------- .../register_two_subjects_nonrigid.py | 8 -------- .../register_two_subjects_nonrigid_bsplines.py | 12 ++---------- whitematteranalysis/relative_distance.py | 9 --------- 5 files changed, 2 insertions(+), 43 deletions(-) diff --git a/bin/wm_cluster_remove_outliers.py b/bin/wm_cluster_remove_outliers.py index b7297afa..006d6f5d 100644 --- a/bin/wm_cluster_remove_outliers.py +++ b/bin/wm_cluster_remove_outliers.py @@ -11,14 +11,6 @@ import whitematteranalysis as wma -try: - from joblib import Parallel, delayed - USE_PARALLEL = 1 -except ImportError: - USE_PARALLEL = 0 - print(f"<{os.path.basename(__file__)}> Failed to import joblib, cannot multiprocess.") - print(f"<{os.path.basename(__file__)}> Please install joblib for this functionality.") - def _build_arg_parser(): diff --git a/whitematteranalysis/register_two_subjects.py b/whitematteranalysis/register_two_subjects.py index 1fc2b761..7a6cd81b 100644 --- a/whitematteranalysis/register_two_subjects.py +++ b/whitematteranalysis/register_two_subjects.py @@ -25,14 +25,6 @@ class RegisterTractography import numpy import vtk -try: - from joblib import Parallel, delayed - USE_PARALLEL = 1 -except ImportError: - USE_PARALLEL = 0 - print(f"<{os.path.basename(__file__)}> Failed to import joblib, cannot multiprocess.") - print(f"<{os.path.basename(__file__)}> Please install joblib for this functionality.") - import whitematteranalysis as wma diff --git a/whitematteranalysis/register_two_subjects_nonrigid.py b/whitematteranalysis/register_two_subjects_nonrigid.py index 3f3e3e00..a94f3700 100644 --- a/whitematteranalysis/register_two_subjects_nonrigid.py +++ b/whitematteranalysis/register_two_subjects_nonrigid.py @@ -25,14 +25,6 @@ class RegisterTractographyNonrigid import numpy import vtk -try: - from joblib import Parallel, delayed - USE_PARALLEL = 1 -except ImportError: - USE_PARALLEL = 0 - print(f"<{os.path.basename(__file__)}> Failed to import joblib, cannot multiprocess.") - print(f"<{os.path.basename(__file__)}> Please install joblib for this functionality.") - import whitematteranalysis as wma diff --git a/whitematteranalysis/register_two_subjects_nonrigid_bsplines.py b/whitematteranalysis/register_two_subjects_nonrigid_bsplines.py index 88c8606e..d0d1b43a 100644 --- a/whitematteranalysis/register_two_subjects_nonrigid_bsplines.py +++ b/whitematteranalysis/register_two_subjects_nonrigid_bsplines.py @@ -27,19 +27,11 @@ class RegisterTractographyNonrigid import vtk import vtk.util.numpy_support +import whitematteranalysis as wma + # debug only #import resource -try: - from joblib import Parallel, delayed - USE_PARALLEL = 1 -except ImportError: - USE_PARALLEL = 0 - print(f"<{os.path.basename(__file__)}> Failed to import joblib, cannot multiprocess.") - print(f"<{os.path.basename(__file__)}> Please install joblib for this functionality.") - -import whitematteranalysis as wma - class RegisterTractographyNonrigid(wma.register_two_subjects.RegisterTractography): diff --git a/whitematteranalysis/relative_distance.py b/whitematteranalysis/relative_distance.py index 28d87870..da293843 100644 --- a/whitematteranalysis/relative_distance.py +++ b/whitematteranalysis/relative_distance.py @@ -16,15 +16,6 @@ class RelativeDistanceModel import numpy import vtk -try: - from joblib import Parallel, delayed - USE_PARALLEL = 1 -except ImportError: - USE_PARALLEL = 0 - print(f"<{os.path.basename(__file__)}> Failed to import joblib, cannot multiprocess.") - print(f"<{os.path.basename(__file__)}> Please install joblib for this functionality.") - - import whitematteranalysis.fibers import whitematteranalysis.similarity