From f66b33720a3c81a63d3787150b8cb1558c3373f8 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 32443c4..73182e9 100755 --- 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 0cf2729..7c55314 100644 --- a/whitematteranalysis/register_two_subjects.py +++ b/whitematteranalysis/register_two_subjects.py @@ -25,14 +25,6 @@ class RegisterTractography import numpy as np 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 f72dd32..2d39183 100644 --- a/whitematteranalysis/register_two_subjects_nonrigid.py +++ b/whitematteranalysis/register_two_subjects_nonrigid.py @@ -25,14 +25,6 @@ class RegisterTractographyNonrigid import numpy as np 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 eff709b..8bc7b06 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 63ec132..668432b 100644 --- a/whitematteranalysis/relative_distance.py +++ b/whitematteranalysis/relative_distance.py @@ -16,15 +16,6 @@ class RelativeDistanceModel import numpy as np 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