Skip to content

Commit

Permalink
Remove F401
Browse files Browse the repository at this point in the history
  • Loading branch information
relf committed Feb 21, 2024
1 parent 4490cbe commit 32e0ebb
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 52 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
requires = ["setuptools", "wheel", "numpy", "Cython"]

[tool.ruff.lint]
ignore = ["E402", "F401"]
ignore = ["E402"]
8 changes: 1 addition & 7 deletions smt/applications/tests/test_ego.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,6 @@ def test_branin_2D_mixed_tunnel(self):

@staticmethod
def function_test_mixed_integer(X):
import numpy as np

# float
x1 = X[:, 0]
# XType.ENUM 1
Expand Down Expand Up @@ -1164,10 +1162,7 @@ def function_test_1d(x):
def run_ego_mixed_integer_example():
import numpy as np
from smt.applications import EGO
from smt.applications.mixed_integer import (
MixedIntegerContext,
MixedIntegerSamplingMethod,
)
from smt.applications.mixed_integer import MixedIntegerContext
from smt.surrogate_models import MixIntKernelType
from smt.utils.design_space import (
DesignSpace,
Expand All @@ -1177,7 +1172,6 @@ def run_ego_mixed_integer_example():
)
import matplotlib.pyplot as plt
from smt.surrogate_models import KRG
from smt.sampling_methods import LHS

# Regarding the interface, the function to be optimized should handle
# categorical values as index values in the enumeration type specification.
Expand Down
17 changes: 3 additions & 14 deletions smt/applications/tests/test_mixed_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,7 @@ def run_mixed_integer_qp_example(self):
def run_mixed_integer_context_example(self):
import matplotlib.pyplot as plt
from smt.surrogate_models import KRG
from smt.applications.mixed_integer import (
MixedIntegerContext,
MixedIntegerSamplingMethod,
)
from smt.applications.mixed_integer import MixedIntegerContext
from smt.utils.design_space import (
DesignSpace,
FloatVariable,
Expand Down Expand Up @@ -1850,7 +1847,6 @@ def run_mixed_gower_example(self):
from smt.surrogate_models import KRG, MixIntKernelType
from smt.applications.mixed_integer import (
MixedIntegerKrigingModel,
MixedIntegerSamplingMethod,
)
from smt.utils.design_space import (
DesignSpace,
Expand Down Expand Up @@ -1981,7 +1977,6 @@ def run_mixed_cs_example(self):
from smt.surrogate_models import KRG, MixIntKernelType
from smt.applications.mixed_integer import (
MixedIntegerKrigingModel,
MixedIntegerSamplingMethod,
)
from smt.utils.design_space import (
DesignSpace,
Expand Down Expand Up @@ -2110,10 +2105,7 @@ def run_mixed_homo_gaussian_example(self):
import matplotlib.pyplot as plt

from smt.surrogate_models import KRG, MixIntKernelType
from smt.applications.mixed_integer import (
MixedIntegerKrigingModel,
MixedIntegerSamplingMethod,
)
from smt.applications.mixed_integer import MixedIntegerKrigingModel
from smt.utils.design_space import (
DesignSpace,
CategoricalVariable,
Expand Down Expand Up @@ -2241,10 +2233,7 @@ def run_mixed_homo_hyp_example(self):
import matplotlib.pyplot as plt

from smt.surrogate_models import KRG, MixIntKernelType
from smt.applications.mixed_integer import (
MixedIntegerKrigingModel,
MixedIntegerSamplingMethod,
)
from smt.applications.mixed_integer import MixedIntegerKrigingModel
from smt.utils.design_space import (
DesignSpace,
CategoricalVariable,
Expand Down
2 changes: 0 additions & 2 deletions smt/applications/tests/test_moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def test_1d_50_var(self):

if TestMOE.plot:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

y = moe.predict_values(xe)
plt.figure(1)
Expand Down Expand Up @@ -234,7 +233,6 @@ def test_norm1_2d_200(self):

if TestMOE.plot:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

y = moe.predict_values(xe)
plt.figure(1)
Expand Down
2 changes: 0 additions & 2 deletions smt/applications/tests/test_vfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
NO_MATPLOTLIB = True

import numpy as np
from scipy import linalg
from smt.utils.sm_test_case import SMTestCase
from smt.utils.silence import Silence

Expand All @@ -27,7 +26,6 @@

from smt.examples.rans_crm_wing.rans_crm_wing import (
get_rans_crm_wing,
plot_rans_crm_wing,
)


Expand Down
2 changes: 0 additions & 2 deletions smt/applications/vfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

import numpy as np

from smt.utils.options_dictionary import OptionsDictionary
from types import FunctionType
from smt.applications.application import SurrogateBasedApplication


Expand Down
8 changes: 5 additions & 3 deletions smt/examples/b777_engine/tests/test_b777_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
NO_MATPLOTLIB = True

try:
from smt.surrogate_models import RMTB, RMTC
from smt.surrogate_models import RMTB, RMTC # noqa: F401

NO_COMPILED = True
except ImportError:
Expand All @@ -22,14 +22,16 @@ class Test(unittest.TestCase):
"C compilation failed or matplotlib not installed",
)
def test_rmtb(self):
from smt.examples.b777_engine import run_b777_engine_rmtb
# just check import
from smt.examples.b777_engine import run_b777_engine_rmtb # noqa: F401

@unittest.skipIf(
NO_COMPILED or NO_MATPLOTLIB,
"C compilation failed or matplotlib not installed",
)
def test_rmtc(self):
from smt.examples.b777_engine import run_b777_engine_rmtc
# just check import
from smt.examples.b777_engine import run_b777_engine_rmtc # noqa: F401


if __name__ == "__main__":
Expand Down
8 changes: 5 additions & 3 deletions smt/examples/one_D_step/tests/test_one_D_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
NO_MATPLOTLIB = True

try:
from smt.surrogate_models import RMTB, RMTC
from smt.surrogate_models import RMTB, RMTC # noqa: F401

NO_COMPILED = True
except ImportError:
Expand All @@ -22,11 +22,13 @@ class Test(unittest.TestCase):
"C compilation failed or matplotlib not installed",
)
def test_rmtb(self):
from smt.examples.one_D_step import run_one_D_step_rmtb
# just check import
from smt.examples.one_D_step import run_one_D_step_rmtb # noqa: F401

@unittest.skipIf(
NO_COMPILED or NO_MATPLOTLIB,
"C compilation failed or matplotlib not installed",
)
def test_rmtc(self):
from smt.examples.one_D_step import run_one_D_step_rmtc
# just check import
from smt.examples.one_D_step import run_one_D_step_rmtc # noqa: F401
8 changes: 5 additions & 3 deletions smt/examples/rans_crm_wing/tests/test_rans_crm_wing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
NO_MATPLOTLIB = True

try:
from smt.surrogate_models import RMTB, RMTC
from smt.surrogate_models import RMTB, RMTC # noqa: F401

NO_COMPILED = True
except ImportError:
Expand All @@ -22,14 +22,16 @@ class Test(unittest.TestCase):
"C compilation failed or matplotlib not installed",
)
def test_rmtb(self):
from smt.examples.rans_crm_wing import run_rans_crm_wing_rmtb
# just check import
from smt.examples.rans_crm_wing import run_rans_crm_wing_rmtb # noqa: F401

@unittest.skipIf(
NO_COMPILED or NO_MATPLOTLIB,
"C compilation failedor matplotlib not installed",
)
def test_rmtc(self):
from smt.examples.rans_crm_wing import run_rans_crm_wing_rmtc
# just check import
from smt.examples.rans_crm_wing import run_rans_crm_wing_rmtc # noqa: F401


if __name__ == "__main__":
Expand Down
1 change: 0 additions & 1 deletion smt/examples/run_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""

import numpy as np
from scipy import linalg
from smt.utils.misc import compute_rms_error

from smt.problems import Sphere, NdimRobotArm
Expand Down
3 changes: 1 addition & 2 deletions smt/surrogate_models/tests/test_kpls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import unittest
import numpy as np
from smt.surrogate_models import KPLS
from smt.problems import Sphere
from smt.sampling_methods import FullFactorial, LHS
from smt.sampling_methods import LHS


class TestKPLS(unittest.TestCase):
Expand Down
1 change: 0 additions & 1 deletion smt/surrogate_models/tests/test_krg_het_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from smt.surrogate_models import KRG
from smt.utils.sm_test_case import SMTestCase
from smt.utils.misc import compute_rms_error


class Test(SMTestCase):
Expand Down
3 changes: 1 addition & 2 deletions smt/surrogate_models/tests/test_krg_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import unittest
import numpy as np
from smt.surrogate_models import KRG
from smt.problems import Sphere
from smt.sampling_methods import FullFactorial, LHS
from smt.sampling_methods import LHS


class TestKRG(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions smt/surrogate_models/tests/test_mgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import unittest
import numpy as np
from smt.surrogate_models import MGP
from smt.problems import Sphere
from smt.sampling_methods import FullFactorial, LHS
from smt.sampling_methods import LHS


class TestMGP(unittest.TestCase):
Expand Down
7 changes: 2 additions & 5 deletions smt/surrogate_models/tests/test_qp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
import unittest
import numpy as np

from smt.surrogate_models import QP, KRG
from smt.examples.rans_crm_wing.rans_crm_wing import (
get_rans_crm_wing,
plot_rans_crm_wing,
)
from smt.surrogate_models import QP
from smt.examples.rans_crm_wing.rans_crm_wing import get_rans_crm_wing


class TestQP(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions smt/surrogate_models/tests/test_surrogate_model_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
NO_MATPLOTLIB = True

try:
from smt.surrogate_models import IDW, RBF, RMTB, RMTC
from smt.surrogate_models import IDW, RBF, RMTB, RMTC # noqa: F401

NO_COMPILED = False
except ImportError:
Expand Down Expand Up @@ -447,7 +447,6 @@ def test_kplsk(self):
@unittest.skipIf(NO_MATPLOTLIB, "Matplotlib not installed")
def test_gekpls(self):
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

from smt.surrogate_models import GEKPLS, DesignSpace
Expand Down

0 comments on commit 32e0ebb

Please sign in to comment.