From 9de5493e96fd0c9ed58b2df80a48de59143ac081 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sun, 7 May 2023 06:28:46 -0700 Subject: [PATCH] move utilities into a utilities submodule --- thursday/candidates/dlib.py | 2 +- thursday/candidates/evolopy.py | 2 +- thursday/candidates/fcmaes.py | 2 +- thursday/candidates/notwa.py | 2 +- thursday/candidates/random.py | 2 +- thursday/candidates/scipy.py | 2 +- thursday/go_benchmark_it.py | 5 ++--- thursday/utilities/__init__.py | 10 ++++++++++ thursday/{ => utilities}/prog80.py | 0 thursday/{ => utilities}/utils.py | 8 -------- thursday/{ => utilities}/utils_np.py | 0 11 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 thursday/utilities/__init__.py rename thursday/{ => utilities}/prog80.py (100%) rename thursday/{ => utilities}/utils.py (98%) rename thursday/{ => utilities}/utils_np.py (100%) diff --git a/thursday/candidates/dlib.py b/thursday/candidates/dlib.py index a69ae9c..8db9159 100644 --- a/thursday/candidates/dlib.py +++ b/thursday/candidates/dlib.py @@ -1,6 +1,6 @@ from dlib import find_min_global from .random import another_random_cube -from ..utils import wrap_untrustworthy, final +from ..utilities import wrap_untrustworthy, final def dlib_cube(objective, n_trials, n_dim, with_count): diff --git a/thursday/candidates/evolopy.py b/thursday/candidates/evolopy.py index b1c565c..5d239c5 100644 --- a/thursday/candidates/evolopy.py +++ b/thursday/candidates/evolopy.py @@ -1,4 +1,4 @@ -from ..utils import wrap_untrustworthy, final, ExhaustedTrialsError +from ..utilities import wrap_untrustworthy, final, ExhaustedTrialsError import numpy as np diff --git a/thursday/candidates/fcmaes.py b/thursday/candidates/fcmaes.py index d9bca5f..dc61bce 100644 --- a/thursday/candidates/fcmaes.py +++ b/thursday/candidates/fcmaes.py @@ -1,6 +1,6 @@ from scipy.optimize import Bounds from unittest.mock import patch -from ..utils import wrap_untrustworthy, final +from ..utilities import wrap_untrustworthy, final import numpy as np diff --git a/thursday/candidates/notwa.py b/thursday/candidates/notwa.py index 452a672..f223d31 100644 --- a/thursday/candidates/notwa.py +++ b/thursday/candidates/notwa.py @@ -1,5 +1,5 @@ from .. import tinytweaks as tt -from ..utils import wrap_untrustworthy, check, final +from ..utilities import wrap_untrustworthy, check, final import numpy as np diff --git a/thursday/candidates/random.py b/thursday/candidates/random.py index 8344810..9bfdbf8 100644 --- a/thursday/candidates/random.py +++ b/thursday/candidates/random.py @@ -1,4 +1,4 @@ -from ..utils import phi +from ..utilities import phi import numpy as np diff --git a/thursday/candidates/scipy.py b/thursday/candidates/scipy.py index 3e46dac..00d0b84 100644 --- a/thursday/candidates/scipy.py +++ b/thursday/candidates/scipy.py @@ -1,4 +1,4 @@ -from ..utils import wrap_untrustworthy, check, final, ExhaustedTrialsError +from ..utilities import wrap_untrustworthy, check, final, ExhaustedTrialsError import numpy as np import scipy.optimize as scopt diff --git a/thursday/go_benchmark_it.py b/thursday/go_benchmark_it.py index 5b32c63..3ecdfd0 100644 --- a/thursday/go_benchmark_it.py +++ b/thursday/go_benchmark_it.py @@ -1,9 +1,8 @@ from .go_benchmark_lists import * from .go_benchmarks import problems_2d, problems_3d, problems_4d from .notwacube import book_of_optimizers -from .prog80 import prog -from .utils import OWrap, COWrap, m1, m33, m36 -from .utils import perform_another_experimental_scoring_method +from .utilities import OWrap, COWrap, m1, m33, m36, prog +from .utilities import perform_another_experimental_scoring_method import numpy as np all_problems = { diff --git a/thursday/utilities/__init__.py b/thursday/utilities/__init__.py new file mode 100644 index 0000000..96161e7 --- /dev/null +++ b/thursday/utilities/__init__.py @@ -0,0 +1,10 @@ +from .utils import * + +try: + import numpy +except ModuleNotFoundError: + pass +else: + from .utils_np import * + +from .prog80 import prog diff --git a/thursday/prog80.py b/thursday/utilities/prog80.py similarity index 100% rename from thursday/prog80.py rename to thursday/utilities/prog80.py diff --git a/thursday/utils.py b/thursday/utilities/utils.py similarity index 98% rename from thursday/utils.py rename to thursday/utilities/utils.py index 84fb7e3..0a308d2 100644 --- a/thursday/utils.py +++ b/thursday/utilities/utils.py @@ -265,11 +265,3 @@ def merge_summaries(all_summaries): new_summaries[new_key] = value break return new_summaries - - -try: - import numpy -except ModuleNotFoundError: - pass -else: - from .utils_np import * diff --git a/thursday/utils_np.py b/thursday/utilities/utils_np.py similarity index 100% rename from thursday/utils_np.py rename to thursday/utilities/utils_np.py