From 28c1fe6e14edbcd901fa1312cad98a322f55588c Mon Sep 17 00:00:00 2001 From: Keith Beattie Date: Wed, 13 Nov 2024 12:28:48 -0800 Subject: [PATCH 1/4] Removing all unused imports, as reported by pylint. --- foqus_lib/foqus.py | 1 - foqus_lib/framework/graph/OptGraphOptim.py | 3 --- foqus_lib/framework/graph/graph.py | 3 --- foqus_lib/framework/graph/node.py | 3 --- foqus_lib/framework/graph/nodeVars.py | 2 -- foqus_lib/framework/listen/listen.py | 2 -- .../framework/ml_ai_models/mlaiSearch.py | 1 - foqus_lib/framework/optimizer/BFGS.py | 7 ------- foqus_lib/framework/optimizer/NLopt.py | 7 ------- foqus_lib/framework/optimizer/OptCMA.py | 5 ----- foqus_lib/framework/optimizer/PSUADE.py | 8 ------- foqus_lib/framework/optimizer/SLSQP.py | 7 ------- foqus_lib/framework/optimizer/SM_Optimizer.py | 19 ----------------- foqus_lib/framework/optimizer/Sample.py | 8 ------- foqus_lib/framework/optimizer/Snobfit.py | 10 --------- foqus_lib/framework/optimizer/optimization.py | 5 ----- foqus_lib/framework/optimizer/problem.py | 2 -- foqus_lib/framework/ouu/OUU.py | 4 +--- .../framework/pymodel/heat_integration.py | 1 - foqus_lib/framework/pymodel/pymodel.py | 2 -- foqus_lib/framework/pymodel/pymodel_test.py | 2 -- foqus_lib/framework/sampleResults/results.py | 1 - .../sampleResults/test/results_s3_test.py | 1 - foqus_lib/framework/sdoe/nusf_dask.py | 3 +-- foqus_lib/framework/sdoe/sdoe.py | 1 - .../framework/sdoe/test/nusf_benchmark.py | 1 - foqus_lib/framework/session/hhmmss.py | 1 - foqus_lib/framework/session/session.py | 5 +---- .../framework/sim/turbineConfiguration.py | 2 -- .../sintervectorize/SinterFileVectorize.py | 3 --- foqus_lib/framework/solventfit/SolventFit.py | 2 +- .../solventfit/SolventFit_testing.py | 5 ----- foqus_lib/framework/surrogate/ACOSSO.py | 8 ------- foqus_lib/framework/surrogate/ALAMO.py | 4 ---- foqus_lib/framework/surrogate/BSS-ANOVA.py | 8 ------- .../framework/surrogate/foqusALAMOClient.py | 3 --- foqus_lib/framework/surrogate/keras_nn.py | 19 ----------------- foqus_lib/framework/surrogate/pytorch_nn.py | 20 ------------------ foqus_lib/framework/surrogate/scikit_nn.py | 21 ------------------- foqus_lib/framework/surrogate/surrogate.py | 1 - foqus_lib/framework/uq/Common.py | 1 - foqus_lib/framework/uq/DataProcessor.py | 1 - foqus_lib/framework/uq/ExperimentalDesign.py | 2 -- foqus_lib/framework/uq/Model.py | 2 -- foqus_lib/framework/uq/RSAnalyzer.py | 2 -- foqus_lib/framework/uq/RSInference.py | 4 +--- foqus_lib/framework/uq/RSVisualization.py | 1 - foqus_lib/framework/uq/RawDataAnalyzer.py | 1 - foqus_lib/framework/uq/SampleRefiner.py | 3 --- foqus_lib/framework/uq/SurrogateParser.py | 2 -- foqus_lib/framework/uq/Visualizer.py | 2 -- foqus_lib/gui/basic_data/basicDataFrame.py | 8 ++----- foqus_lib/gui/dialogs/variableBrowser.py | 2 +- foqus_lib/gui/flowsheet/dataBrowserFrame.py | 1 - foqus_lib/gui/flowsheet/dataFilterDialog.py | 6 +----- foqus_lib/gui/flowsheet/dataModel.py | 1 - foqus_lib/gui/flowsheet/drawFlowsheet.py | 1 - foqus_lib/gui/flowsheet/nodePanel.py | 3 --- foqus_lib/gui/help/helpBrowser.py | 1 - foqus_lib/gui/main/Dash.py | 2 +- foqus_lib/gui/main/mainWindow.py | 7 ------- foqus_lib/gui/main/sessionDescriptionEdit.py | 2 +- foqus_lib/gui/main/settingsFrame.py | 2 -- foqus_lib/gui/main/turbineConfig.py | 3 +-- foqus_lib/gui/model/gatewayUploadDialog.py | 2 -- foqus_lib/gui/optimization/optMonitor.py | 1 - foqus_lib/gui/optimization/optSetupFrame.py | 4 +--- foqus_lib/gui/ouu/ouuSetupFrame.py | 2 -- foqus_lib/gui/pysyntax_hl/pysyntax_hl.py | 1 - foqus_lib/gui/sdoe/sdoeSetupFrame.py | 1 + foqus_lib/gui/sinter/__init__.py | 1 - foqus_lib/gui/sinter/sinter_config.py | 3 +-- .../sintervectorize/SinterVectorizeDialog.py | 10 --------- .../gui/solventfit/solventFitSetupFrame.py | 4 ---- foqus_lib/gui/surrogate/surrogateFrame.py | 3 +-- foqus_lib/gui/uq/AnalysisDialog.py | 1 - foqus_lib/gui/uq/AnalysisInfoDialog.py | 1 - foqus_lib/gui/uq/InferenceDialog.py | 4 ---- foqus_lib/gui/uq/Preview.py | 4 ---- foqus_lib/gui/uq/RSCombos.py | 1 - foqus_lib/gui/uq/SimSetup.py | 3 --- foqus_lib/gui/uq/dialogTest.py | 2 +- foqus_lib/gui/uq/uqSetupFrame.py | 3 +-- foqus_lib/service/flowsheet.py | 6 +----- .../service/test/flowsheet_control_test.py | 3 +-- foqus_lib/unit_test/massBalance_test.py | 4 ---- foqus_lib/unit_test/nodeVarList_test.py | 5 ----- foqus_lib/unit_test/nodeVars_test.py | 3 --- foqus_lib/unit_test/turbineLite_test.py | 6 ------ 89 files changed, 20 insertions(+), 329 deletions(-) diff --git a/foqus_lib/foqus.py b/foqus_lib/foqus.py index ee260ffc3..d1d7b8286 100644 --- a/foqus_lib/foqus.py +++ b/foqus_lib/foqus.py @@ -28,7 +28,6 @@ import signal import sys import time -import uuid import traceback import turbine diff --git a/foqus_lib/framework/graph/OptGraphOptim.py b/foqus_lib/framework/graph/OptGraphOptim.py index 43ac82d2e..e5ebb4e3b 100644 --- a/foqus_lib/framework/graph/OptGraphOptim.py +++ b/foqus_lib/framework/graph/OptGraphOptim.py @@ -12,9 +12,6 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import math -import time - import numpy from foqus_lib.framework.graph.edge import * diff --git a/foqus_lib/framework/graph/graph.py b/foqus_lib/framework/graph/graph.py index 554e6fc92..ce57215c3 100644 --- a/foqus_lib/framework/graph/graph.py +++ b/foqus_lib/framework/graph/graph.py @@ -22,11 +22,8 @@ """ import copy -import csv import logging import math -import multiprocessing.dummy as multiprocessing -import queue import sys import threading import time diff --git a/foqus_lib/framework/graph/node.py b/foqus_lib/framework/graph/node.py index e4f9bbc1c..d6a7d626a 100644 --- a/foqus_lib/framework/graph/node.py +++ b/foqus_lib/framework/graph/node.py @@ -23,7 +23,6 @@ import logging import math import os -from collections import OrderedDict from importlib import import_module import numpy as np @@ -178,7 +177,6 @@ def attempt_load_smt(try_imports=True): # smt should be installed, but not required for non ML/AI models import pickle - import smt smt_pickle_load = pickle.load @@ -201,7 +199,6 @@ def attempt_load_jenn(try_imports=True): # jenn should be installed, but not required for non ML/AI models import pickle - import jenn jenn_pickle_load = pickle.load diff --git a/foqus_lib/framework/graph/nodeVars.py b/foqus_lib/framework/graph/nodeVars.py index b28436e71..d43312349 100644 --- a/foqus_lib/framework/graph/nodeVars.py +++ b/foqus_lib/framework/graph/nodeVars.py @@ -21,12 +21,10 @@ """ import copy -import json import logging import math from collections import OrderedDict -import numpy as np from foqus_lib.framework.foqusException.foqusException import * from foqus_lib.framework.uq.Distribution import Distribution diff --git a/foqus_lib/framework/listen/listen.py b/foqus_lib/framework/listen/listen.py index 23f5ca84f..ecf566e09 100644 --- a/foqus_lib/framework/listen/listen.py +++ b/foqus_lib/framework/listen/listen.py @@ -26,10 +26,8 @@ import copy import logging import threading -import time from multiprocessing.connection import Listener -import numpy as np class foqusListener2(threading.Thread): diff --git a/foqus_lib/framework/ml_ai_models/mlaiSearch.py b/foqus_lib/framework/ml_ai_models/mlaiSearch.py index c595fba06..cd2efe60d 100644 --- a/foqus_lib/framework/ml_ai_models/mlaiSearch.py +++ b/foqus_lib/framework/ml_ai_models/mlaiSearch.py @@ -20,7 +20,6 @@ John Eslick, Carnegie Mellon University, 2014 """ -import importlib import logging import os import sys diff --git a/foqus_lib/framework/optimizer/BFGS.py b/foqus_lib/framework/optimizer/BFGS.py index c9b6c18dd..dfa30fe59 100644 --- a/foqus_lib/framework/optimizer/BFGS.py +++ b/foqus_lib/framework/optimizer/BFGS.py @@ -23,16 +23,9 @@ John Eslick, Carnegie Mellon University, 2014 """ -import copy -import csv import logging import math -import os -import pickle -import queue -import sys import time -import traceback import numpy diff --git a/foqus_lib/framework/optimizer/NLopt.py b/foqus_lib/framework/optimizer/NLopt.py index 5ed61826a..b445aedad 100644 --- a/foqus_lib/framework/optimizer/NLopt.py +++ b/foqus_lib/framework/optimizer/NLopt.py @@ -25,16 +25,9 @@ John Eslick, Carnegie Mellon University, 2014 """ -import copy # too lazy to sort out which I really need in here -import csv import logging import math -import os -import pickle -import queue -import sys import time # Some of these things are left over from CMA-ES -import traceback import numpy diff --git a/foqus_lib/framework/optimizer/OptCMA.py b/foqus_lib/framework/optimizer/OptCMA.py index a775efe8e..e49ef14e2 100644 --- a/foqus_lib/framework/optimizer/OptCMA.py +++ b/foqus_lib/framework/optimizer/OptCMA.py @@ -32,14 +32,9 @@ John Eslick, Carnegie Mellon University, 2014 """ -import copy -import csv import logging import math -import os import pickle -import queue -import sys import time import traceback diff --git a/foqus_lib/framework/optimizer/PSUADE.py b/foqus_lib/framework/optimizer/PSUADE.py index bd2021a10..bcc0bd26a 100644 --- a/foqus_lib/framework/optimizer/PSUADE.py +++ b/foqus_lib/framework/optimizer/PSUADE.py @@ -19,21 +19,13 @@ text). They also need to have a .py extension and inherit the optimization class. """ -import copy -import csv import logging -import math -import os -import queue -import sys # # PSUADE # import time -import traceback -import numpy from foqus_lib.framework.optimizer.optimization import optimization diff --git a/foqus_lib/framework/optimizer/SLSQP.py b/foqus_lib/framework/optimizer/SLSQP.py index 1dbfacbbe..ccb95e472 100644 --- a/foqus_lib/framework/optimizer/SLSQP.py +++ b/foqus_lib/framework/optimizer/SLSQP.py @@ -24,16 +24,9 @@ John Eslick, Carnegie Mellon University, 2014 """ -import copy -import csv import logging import math -import os -import pickle -import queue -import sys import time -import traceback import numpy diff --git a/foqus_lib/framework/optimizer/SM_Optimizer.py b/foqus_lib/framework/optimizer/SM_Optimizer.py index 78f0c873e..4c75f16fb 100644 --- a/foqus_lib/framework/optimizer/SM_Optimizer.py +++ b/foqus_lib/framework/optimizer/SM_Optimizer.py @@ -23,34 +23,22 @@ Anuja Deshpande, KeyLogic Systems, Inc. - NETL """ -import copy -import csv import importlib import logging import math import os -import pickle -import queue import re -import shutil import subprocess -import sys -import threading import time -import traceback import numpy as np try: - import win32api # used to get short file name for alamo sim exe import win32process except: pass -from foqus_lib.framework.graph.edge import edge, edgeConnect -from foqus_lib.framework.graph.nodeVars import NodeVars from foqus_lib.framework.optimizer.optimization import optimization -from foqus_lib.framework.surrogate.surrogate import surrogate from foqus_lib.framework.uq.SurrogateParser import SurrogateParser # Check that the required pyomo, pyDOE, and smt packages are available for the surrogate based optimization plugin and import it. @@ -61,22 +49,15 @@ # to make pylint happy without affecting the existing runtime behavior import pyutilib.subprocess.GlobalData from pyomo.environ import ( - ConcreteModel, - Constraint, ConstraintList, Objective, - PositiveReals, Var, - exp, - log, value, ) from pyomo.opt import SolverFactory pyutilib.subprocess.GlobalData.DEFINE_SIGNAL_HANDLERS_DEFAULT = False from pyDOE import * - from pyomo.core.expr import current as EXPR - from pyomo.core.expr.current import clone_expression from smt.sampling_methods import LHS packages_available = True diff --git a/foqus_lib/framework/optimizer/Sample.py b/foqus_lib/framework/optimizer/Sample.py index 69c21634c..3b33685da 100644 --- a/foqus_lib/framework/optimizer/Sample.py +++ b/foqus_lib/framework/optimizer/Sample.py @@ -24,15 +24,7 @@ John Eslick, Carnegie Mellon University, 2014 """ -import copy -import csv -import logging -import math -import os -import queue -import sys import time -import traceback import numpy diff --git a/foqus_lib/framework/optimizer/Snobfit.py b/foqus_lib/framework/optimizer/Snobfit.py index 353f95e77..968e9e563 100644 --- a/foqus_lib/framework/optimizer/Snobfit.py +++ b/foqus_lib/framework/optimizer/Snobfit.py @@ -23,27 +23,17 @@ Anuja Deshpande, KeyLogic Systems, Inc. - NETL """ -import copy -import csv import logging import math -import os -import pickle -import queue -import sys import time -import traceback import numpy -from foqus_lib.framework.graph.nodeVars import NodeVars -from foqus_lib.framework.graph.OptGraphOptim import optim, optimObj from foqus_lib.framework.optimizer.optimization import optimization # Check that the Snobfit module is available and import it if possible. # If not the Snobfit plug-in will not be available. try: - import SQCommon import SQSnobFit snobfit_available = True diff --git a/foqus_lib/framework/optimizer/optimization.py b/foqus_lib/framework/optimizer/optimization.py index 1c8154a83..c23890b62 100644 --- a/foqus_lib/framework/optimizer/optimization.py +++ b/foqus_lib/framework/optimizer/optimization.py @@ -19,14 +19,9 @@ John Eslick, Carnegie Mellon University, 2014 """ -import copy -import importlib import logging -import os import queue -import sys import threading -import traceback from foqus_lib.framework.foqusOptions.optionList import optionList diff --git a/foqus_lib/framework/optimizer/problem.py b/foqus_lib/framework/optimizer/problem.py index 5d99ac337..79a528443 100644 --- a/foqus_lib/framework/optimizer/problem.py +++ b/foqus_lib/framework/optimizer/problem.py @@ -23,13 +23,11 @@ import csv import json import logging -import math import operator import time from functools import reduce from foqus_lib.framework.at_dict.at_dict import AtDict -from foqus_lib.framework.foqusOptions.optionList import optionList class objectiveFunction(object): diff --git a/foqus_lib/framework/ouu/OUU.py b/foqus_lib/framework/ouu/OUU.py index 7b91a19a9..21c4c1bd7 100644 --- a/foqus_lib/framework/ouu/OUU.py +++ b/foqus_lib/framework/ouu/OUU.py @@ -15,16 +15,14 @@ import os import platform import re -import subprocess import tempfile import numpy as np -from PyQt5 import QtCore, QtGui +from PyQt5 import QtCore from foqus_lib.framework.uq.Common import Common from foqus_lib.framework.uq.Distribution import Distribution from foqus_lib.framework.uq.LocalExecutionModule import LocalExecutionModule -from foqus_lib.framework.uq.Model import Model from foqus_lib.framework.uq.RSAnalyzer import RSAnalyzer from foqus_lib.framework.uq.SampleData import SampleData from foqus_lib.framework.uq.SamplingMethods import SamplingMethods diff --git a/foqus_lib/framework/pymodel/heat_integration.py b/foqus_lib/framework/pymodel/heat_integration.py index 4a93738f2..764ea5ba0 100644 --- a/foqus_lib/framework/pymodel/heat_integration.py +++ b/foqus_lib/framework/pymodel/heat_integration.py @@ -15,7 +15,6 @@ # # FOQUS_PYMODEL_PLUGIN -import logging import subprocess import numpy diff --git a/foqus_lib/framework/pymodel/pymodel.py b/foqus_lib/framework/pymodel/pymodel.py index a48b3c30d..4190ecfd2 100644 --- a/foqus_lib/framework/pymodel/pymodel.py +++ b/foqus_lib/framework/pymodel/pymodel.py @@ -14,8 +14,6 @@ ################################################################################# from collections import OrderedDict -import numpy - from foqus_lib.framework.graph.nodeVars import * diff --git a/foqus_lib/framework/pymodel/pymodel_test.py b/foqus_lib/framework/pymodel/pymodel_test.py index 0fe5aea5a..54ac20631 100644 --- a/foqus_lib/framework/pymodel/pymodel_test.py +++ b/foqus_lib/framework/pymodel/pymodel_test.py @@ -15,8 +15,6 @@ # # FOQUS_PYMODEL_PLUGIN -import numpy - from foqus_lib.framework.graph.nodeVars import * from foqus_lib.framework.pymodel.pymodel import * diff --git a/foqus_lib/framework/sampleResults/results.py b/foqus_lib/framework/sampleResults/results.py index c34d88fce..9a70d3d05 100644 --- a/foqus_lib/framework/sampleResults/results.py +++ b/foqus_lib/framework/sampleResults/results.py @@ -23,7 +23,6 @@ import json import logging import re -import time from collections import OrderedDict from io import StringIO diff --git a/foqus_lib/framework/sampleResults/test/results_s3_test.py b/foqus_lib/framework/sampleResults/test/results_s3_test.py index 40fffc4fb..d0417e5e1 100644 --- a/foqus_lib/framework/sampleResults/test/results_s3_test.py +++ b/foqus_lib/framework/sampleResults/test/results_s3_test.py @@ -22,7 +22,6 @@ """ import json import logging -import time from ...graph.graph import Graph from .. import results diff --git a/foqus_lib/framework/sdoe/nusf_dask.py b/foqus_lib/framework/sdoe/nusf_dask.py index 19db5e6a7..151777c26 100644 --- a/foqus_lib/framework/sdoe/nusf_dask.py +++ b/foqus_lib/framework/sdoe/nusf_dask.py @@ -18,9 +18,8 @@ import dask.bag as db import numpy as np import pandas as pd # only used for the final output of criterion -from scipy.stats import rankdata -from .distance import compute_dist, compute_min_params +from .distance import compute_min_params from .nusf import compute_dmat, scale_xs, scale_y, update_min_dist diff --git a/foqus_lib/framework/sdoe/sdoe.py b/foqus_lib/framework/sdoe/sdoe.py index 57148fed2..a53f4aaea 100644 --- a/foqus_lib/framework/sdoe/sdoe.py +++ b/foqus_lib/framework/sdoe/sdoe.py @@ -16,7 +16,6 @@ import logging import os import platform -import re import tempfile import time from typing import Tuple, Dict diff --git a/foqus_lib/framework/sdoe/test/nusf_benchmark.py b/foqus_lib/framework/sdoe/test/nusf_benchmark.py index 0fb0996cb..2f53a61e4 100644 --- a/foqus_lib/framework/sdoe/test/nusf_benchmark.py +++ b/foqus_lib/framework/sdoe/test/nusf_benchmark.py @@ -15,7 +15,6 @@ ################################################################################# import time -import numpy as np import pandas as pd from dask.distributed import Client diff --git a/foqus_lib/framework/session/hhmmss.py b/foqus_lib/framework/session/hhmmss.py index f71a924e1..45c42a677 100644 --- a/foqus_lib/framework/session/hhmmss.py +++ b/foqus_lib/framework/session/hhmmss.py @@ -12,7 +12,6 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import math def hhmmss(sec_in): diff --git a/foqus_lib/framework/session/session.py b/foqus_lib/framework/session/session.py index 0fa1d0cee..b325fe3e8 100644 --- a/foqus_lib/framework/session/session.py +++ b/foqus_lib/framework/session/session.py @@ -30,20 +30,17 @@ from foqus_lib import core import foqus_lib.framework.optimizer.problem as oprob -from foqus_lib.framework.graph.graph import Graph, GraphEx -from foqus_lib.framework.graph.node import nodeModelTypes +from foqus_lib.framework.graph.graph import Graph from foqus_lib.framework.ml_ai_models import mlaiSearch from foqus_lib.framework.optimizer import problem # these are just imported so py2exe will pick them up since they # are used only in plugins -from foqus_lib.framework.optimizer.optimization import optimization as junk from foqus_lib.framework.plugins import pluginSearch from foqus_lib.framework.pymodel import pymodel from foqus_lib.framework.sampleResults.results import Results from foqus_lib.framework.sim.turbineConfiguration import TurbineConfiguration from foqus_lib.framework.surrogate import surrogate -from foqus_lib.framework.surrogate.surrogate import surrogate as junk2 from foqus_lib.framework.uq.LocalExecutionModule import * from foqus_lib.framework.uq.Model import * from foqus_lib.framework.uq.SampleData import * diff --git a/foqus_lib/framework/sim/turbineConfiguration.py b/foqus_lib/framework/sim/turbineConfiguration.py index f0536b19c..dd197d1db 100644 --- a/foqus_lib/framework/sim/turbineConfiguration.py +++ b/foqus_lib/framework/sim/turbineConfiguration.py @@ -47,9 +47,7 @@ from turbine.commands import turbine_session_result_script from turbine.commands.requests_base import ( HTTPStatusCode, - delete_page, get_page_by_url, - post_page_by_url, read_configuration, ) diff --git a/foqus_lib/framework/sintervectorize/SinterFileVectorize.py b/foqus_lib/framework/sintervectorize/SinterFileVectorize.py index 5dccb7a6d..6193aba65 100644 --- a/foqus_lib/framework/sintervectorize/SinterFileVectorize.py +++ b/foqus_lib/framework/sintervectorize/SinterFileVectorize.py @@ -21,13 +21,10 @@ import copy import json import os -import sys -from collections import OrderedDict # Check that the win32com module is available and import it if possible. # If not, the module will not be used. try: - import win32com from win32com import client as win32 module_available = True diff --git a/foqus_lib/framework/solventfit/SolventFit.py b/foqus_lib/framework/solventfit/SolventFit.py index 54555334b..a0e7bf207 100644 --- a/foqus_lib/framework/solventfit/SolventFit.py +++ b/foqus_lib/framework/solventfit/SolventFit.py @@ -15,7 +15,7 @@ import csv import os import platform -import subprocess +import shutil import numpy as np diff --git a/foqus_lib/framework/solventfit/SolventFit_testing.py b/foqus_lib/framework/solventfit/SolventFit_testing.py index a94f4dfb0..238e9d66f 100644 --- a/foqus_lib/framework/solventfit/SolventFit_testing.py +++ b/foqus_lib/framework/solventfit/SolventFit_testing.py @@ -18,11 +18,6 @@ # print(sys.path) # sys.path.append('/Users/a241211/Documents/CCSI/Solvents/RCode/SolventFit/'); # sys.path.append('/Users/a241211/Documents/CCSI/Solvents/RCode/SolventFit/foqus_lib/framework/uq/'); -import shutil -import subprocess -import sys - -import numpy as np from foqus_lib.framework.uq.Common import * from foqus_lib.framework.uq.Distribution import * diff --git a/foqus_lib/framework/surrogate/ACOSSO.py b/foqus_lib/framework/surrogate/ACOSSO.py index 9a4b490e7..5b140f6ce 100644 --- a/foqus_lib/framework/surrogate/ACOSSO.py +++ b/foqus_lib/framework/surrogate/ACOSSO.py @@ -25,23 +25,15 @@ John Eslick, Carnegie Mellon University, 2014 """ -import copy import json import logging import os -import queue -import re import shutil import subprocess import sys -import threading import time -import traceback -from multiprocessing.connection import Client -import numpy as np -from foqus_lib.framework.listen import listen from foqus_lib.framework.surrogate.surrogate import surrogate from foqus_lib.framework.uq.SurrogateParser import SurrogateParser diff --git a/foqus_lib/framework/surrogate/ALAMO.py b/foqus_lib/framework/surrogate/ALAMO.py index 16605b7b4..6dfa4c9ae 100644 --- a/foqus_lib/framework/surrogate/ALAMO.py +++ b/foqus_lib/framework/surrogate/ALAMO.py @@ -35,20 +35,16 @@ import logging import math import os -import queue import re import shutil import subprocess import sys -import threading import time -import traceback from multiprocessing.connection import Client import numpy as np from foqus_lib.framework.listen import listen -from foqus_lib.framework.session.session import exePath # from foqus_lib.framework.graph.graph import Graph from foqus_lib.framework.surrogate.surrogate import surrogate diff --git a/foqus_lib/framework/surrogate/BSS-ANOVA.py b/foqus_lib/framework/surrogate/BSS-ANOVA.py index 956f7bccd..b7b0d8b48 100644 --- a/foqus_lib/framework/surrogate/BSS-ANOVA.py +++ b/foqus_lib/framework/surrogate/BSS-ANOVA.py @@ -26,23 +26,15 @@ John Eslick, Carnegie Mellon University, 2014 """ -import copy import json import logging import os -import queue -import re import shutil import subprocess import sys -import threading import time -import traceback -from multiprocessing.connection import Client -import numpy as np -from foqus_lib.framework.listen import listen from foqus_lib.framework.surrogate.surrogate import surrogate from foqus_lib.framework.uq.SurrogateParser import SurrogateParser diff --git a/foqus_lib/framework/surrogate/foqusALAMOClient.py b/foqus_lib/framework/surrogate/foqusALAMOClient.py index ecc340eef..952cba181 100644 --- a/foqus_lib/framework/surrogate/foqusALAMOClient.py +++ b/foqus_lib/framework/surrogate/foqusALAMOClient.py @@ -23,11 +23,8 @@ John Eslick, Carnegie Mellon University, 2014 """ -import sys -import time from multiprocessing.connection import Client -import numpy as np if __name__ == "__main__": inputFile = "input.txt" diff --git a/foqus_lib/framework/surrogate/keras_nn.py b/foqus_lib/framework/surrogate/keras_nn.py index a045a5b52..167a6d23b 100644 --- a/foqus_lib/framework/surrogate/keras_nn.py +++ b/foqus_lib/framework/surrogate/keras_nn.py @@ -22,35 +22,16 @@ import contextlib -import copy import io -import logging -import math import os -import queue import random as rn -import re -import shutil -import subprocess -import sys -import threading -import time -import traceback -from contextlib import nullcontext -from multiprocessing.connection import Client -from pathlib import Path -from tokenize import String import numpy as np -import pandas as pd import tensorflow as tf # pylint: disable=import-error -from foqus_lib.framework.listen import listen -from foqus_lib.framework.session.session import exePath # from foqus_lib.framework.graph.graph import Graph from foqus_lib.framework.surrogate.surrogate import surrogate -from foqus_lib.framework.uq.SurrogateParser import SurrogateParser # custom class to define Keras NN layers diff --git a/foqus_lib/framework/surrogate/pytorch_nn.py b/foqus_lib/framework/surrogate/pytorch_nn.py index f1fb2f15f..de85864ed 100644 --- a/foqus_lib/framework/surrogate/pytorch_nn.py +++ b/foqus_lib/framework/surrogate/pytorch_nn.py @@ -21,35 +21,15 @@ """ -import copy -import logging -import math -import os -import queue import random as rn -import re -import shutil -import subprocess -import sys -import threading -import time -import traceback -from contextlib import nullcontext -from multiprocessing.connection import Client -from pathlib import Path -from tokenize import String import numpy as np -import pandas as pd import torch # pylint: disable=import-error import torch.nn as nn # pylint: disable=import-error -from foqus_lib.framework.listen import listen -from foqus_lib.framework.session.session import exePath # from foqus_lib.framework.graph.graph import Graph from foqus_lib.framework.surrogate.surrogate import surrogate -from foqus_lib.framework.uq.SurrogateParser import SurrogateParser # custom class to define Keras NN layers np.random.seed(46) diff --git a/foqus_lib/framework/surrogate/scikit_nn.py b/foqus_lib/framework/surrogate/scikit_nn.py index 85736ad3f..2ca9f71f8 100644 --- a/foqus_lib/framework/surrogate/scikit_nn.py +++ b/foqus_lib/framework/surrogate/scikit_nn.py @@ -21,36 +21,15 @@ """ -import copy -import logging -import math -import os import pickle -import queue -import random as rn -import re -import shutil -import subprocess -import sys -import threading -import time -import traceback -from contextlib import nullcontext -from multiprocessing.connection import Client -from pathlib import Path -from tokenize import String from types import SimpleNamespace import numpy as np -import pandas as pd from sklearn.neural_network import MLPRegressor # pylint: disable=import-error -from foqus_lib.framework.listen import listen -from foqus_lib.framework.session.session import exePath # from foqus_lib.framework.graph.graph import Graph from foqus_lib.framework.surrogate.surrogate import surrogate -from foqus_lib.framework.uq.SurrogateParser import SurrogateParser def validate_training_data(xdata: np.ndarray, zdata: np.ndarray): diff --git a/foqus_lib/framework/surrogate/surrogate.py b/foqus_lib/framework/surrogate/surrogate.py index 798bfda85..46d2ce5ce 100644 --- a/foqus_lib/framework/surrogate/surrogate.py +++ b/foqus_lib/framework/surrogate/surrogate.py @@ -21,7 +21,6 @@ import pandas as pd -import foqus_lib.framework.uq.SurrogateParser from foqus_lib.framework.foqusOptions.optionList import optionList diff --git a/foqus_lib/framework/uq/Common.py b/foqus_lib/framework/uq/Common.py index 064235b1f..82dcaec52 100644 --- a/foqus_lib/framework/uq/Common.py +++ b/foqus_lib/framework/uq/Common.py @@ -17,7 +17,6 @@ import os import platform import re -import shutil import subprocess import sys import tempfile diff --git a/foqus_lib/framework/uq/DataProcessor.py b/foqus_lib/framework/uq/DataProcessor.py index c23932e1d..bbdc34333 100644 --- a/foqus_lib/framework/uq/DataProcessor.py +++ b/foqus_lib/framework/uq/DataProcessor.py @@ -14,7 +14,6 @@ ################################################################################# import os import platform -import subprocess import tempfile from .Common import Common diff --git a/foqus_lib/framework/uq/ExperimentalDesign.py b/foqus_lib/framework/uq/ExperimentalDesign.py index b9818a383..9c08509ac 100644 --- a/foqus_lib/framework/uq/ExperimentalDesign.py +++ b/foqus_lib/framework/uq/ExperimentalDesign.py @@ -12,10 +12,8 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import copy import os import platform -import subprocess import tempfile import numpy diff --git a/foqus_lib/framework/uq/Model.py b/foqus_lib/framework/uq/Model.py index 404cc14f7..c1991cf69 100644 --- a/foqus_lib/framework/uq/Model.py +++ b/foqus_lib/framework/uq/Model.py @@ -105,12 +105,10 @@ import collections.abc import json -import numbers import numpy from .Distribution import * -from .SamplingMethods import SamplingMethods class Model: diff --git a/foqus_lib/framework/uq/RSAnalyzer.py b/foqus_lib/framework/uq/RSAnalyzer.py index 9c652c1b3..619cfa607 100644 --- a/foqus_lib/framework/uq/RSAnalyzer.py +++ b/foqus_lib/framework/uq/RSAnalyzer.py @@ -17,7 +17,6 @@ import os import platform import re -import subprocess import tempfile import numpy as np @@ -28,7 +27,6 @@ from .LocalExecutionModule import LocalExecutionModule from .Model import Model from .Plotter import Plotter -from .RawDataAnalyzer import RawDataAnalyzer from .ResponseSurfaces import ResponseSurfaces from .SampleData import SampleData from .SamplingMethods import SamplingMethods diff --git a/foqus_lib/framework/uq/RSInference.py b/foqus_lib/framework/uq/RSInference.py index 76be137db..b5d7505e8 100644 --- a/foqus_lib/framework/uq/RSInference.py +++ b/foqus_lib/framework/uq/RSInference.py @@ -12,17 +12,15 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import abc import copy import os import platform -import subprocess import tempfile import numpy as np # from PySide import QtCore, QtGui -from PyQt5 import QtCore, QtGui +from PyQt5 import QtCore from scipy.stats import beta, expon, gamma, lognorm, norm, triang, weibull_min from .Common import Common diff --git a/foqus_lib/framework/uq/RSVisualization.py b/foqus_lib/framework/uq/RSVisualization.py index 4b67ea713..850c5634e 100644 --- a/foqus_lib/framework/uq/RSVisualization.py +++ b/foqus_lib/framework/uq/RSVisualization.py @@ -12,7 +12,6 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import numpy from .Common import Common from .ResponseSurfaces import ResponseSurfaces diff --git a/foqus_lib/framework/uq/RawDataAnalyzer.py b/foqus_lib/framework/uq/RawDataAnalyzer.py index 04d1e8d0c..dd839e414 100644 --- a/foqus_lib/framework/uq/RawDataAnalyzer.py +++ b/foqus_lib/framework/uq/RawDataAnalyzer.py @@ -14,7 +14,6 @@ ################################################################################# import os import platform -import subprocess import tempfile from .Common import Common diff --git a/foqus_lib/framework/uq/SampleRefiner.py b/foqus_lib/framework/uq/SampleRefiner.py index 6035b0160..9184a416a 100644 --- a/foqus_lib/framework/uq/SampleRefiner.py +++ b/foqus_lib/framework/uq/SampleRefiner.py @@ -14,16 +14,13 @@ ################################################################################# import os import platform -import subprocess import tempfile from PyQt5 import QtWidgets from .Common import Common from .LocalExecutionModule import LocalExecutionModule -from .Plotter import Plotter from .SampleData import SampleData -from .SamplingMethods import SamplingMethods class SampleRefiner: diff --git a/foqus_lib/framework/uq/SurrogateParser.py b/foqus_lib/framework/uq/SurrogateParser.py index 48ba067c1..d9a268c62 100644 --- a/foqus_lib/framework/uq/SurrogateParser.py +++ b/foqus_lib/framework/uq/SurrogateParser.py @@ -12,12 +12,10 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import os import re import numpy as np -from .Distribution import Distribution from .Model import Model from .SampleData import SampleData from .SamplingMethods import SamplingMethods diff --git a/foqus_lib/framework/uq/Visualizer.py b/foqus_lib/framework/uq/Visualizer.py index 137a482df..a63331451 100644 --- a/foqus_lib/framework/uq/Visualizer.py +++ b/foqus_lib/framework/uq/Visualizer.py @@ -14,8 +14,6 @@ ################################################################################# import os import platform -import re -import subprocess import tempfile import numpy as np diff --git a/foqus_lib/gui/basic_data/basicDataFrame.py b/foqus_lib/gui/basic_data/basicDataFrame.py index cf122b1ec..cd3f866da 100644 --- a/foqus_lib/gui/basic_data/basicDataFrame.py +++ b/foqus_lib/gui/basic_data/basicDataFrame.py @@ -12,16 +12,12 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import logging import os -import platform -import subprocess -from io import StringIO -from urllib.request import urlopen if os.name == "nt": try: - import win32process + # Not entirely sure why this is here (ksb 2024-11) + import win32process # pylint: disable=unused-import except: pass diff --git a/foqus_lib/gui/dialogs/variableBrowser.py b/foqus_lib/gui/dialogs/variableBrowser.py index 9cee16b8b..26ea979dd 100644 --- a/foqus_lib/gui/dialogs/variableBrowser.py +++ b/foqus_lib/gui/dialogs/variableBrowser.py @@ -14,7 +14,7 @@ ################################################################################# import os -from PyQt5 import QtCore, uic +from PyQt5 import uic from PyQt5.QtWidgets import QTreeWidgetItem mypath = os.path.dirname(__file__) diff --git a/foqus_lib/gui/flowsheet/dataBrowserFrame.py b/foqus_lib/gui/flowsheet/dataBrowserFrame.py index 13296dec2..5aa0b7aa4 100644 --- a/foqus_lib/gui/flowsheet/dataBrowserFrame.py +++ b/foqus_lib/gui/flowsheet/dataBrowserFrame.py @@ -18,7 +18,6 @@ John Eslick, Carnegie Mellon University, 2014 """ -import json import os from PyQt5 import uic diff --git a/foqus_lib/gui/flowsheet/dataFilterDialog.py b/foqus_lib/gui/flowsheet/dataFilterDialog.py index 3b567c74c..5b2a79fee 100644 --- a/foqus_lib/gui/flowsheet/dataFilterDialog.py +++ b/foqus_lib/gui/flowsheet/dataFilterDialog.py @@ -19,25 +19,21 @@ John Eslick, Carnegie Mellon University, 2014 """ -import json import logging import os _log = logging.getLogger("foqus.{}".format(__name__)) from PyQt5 import uic -from PyQt5.QtCore import QDataStream, QEvent, QObject, QSize, Qt -from PyQt5.QtGui import QColor +from PyQt5.QtCore import QDataStream, QEvent, QObject, Qt from PyQt5.QtWidgets import ( QAbstractItemView, QApplication, QInputDialog, QLineEdit, QMessageBox, - QSplitter, ) -import foqus_lib.gui.helpers.guiHelpers as gh from foqus_lib.framework.sampleResults.results import * from foqus_lib.gui.flowsheet.calculatedColumns import calculatedColumnsDialog diff --git a/foqus_lib/gui/flowsheet/dataModel.py b/foqus_lib/gui/flowsheet/dataModel.py index eafc9068f..d4f998d0d 100644 --- a/foqus_lib/gui/flowsheet/dataModel.py +++ b/foqus_lib/gui/flowsheet/dataModel.py @@ -19,7 +19,6 @@ John Eslick, Carnegie Mellon University, 2014 """ import json -import logging import numpy as np from PyQt5 import QtCore diff --git a/foqus_lib/gui/flowsheet/drawFlowsheet.py b/foqus_lib/gui/flowsheet/drawFlowsheet.py index 1614c8c4e..fdb7aa295 100644 --- a/foqus_lib/gui/flowsheet/drawFlowsheet.py +++ b/foqus_lib/gui/flowsheet/drawFlowsheet.py @@ -18,7 +18,6 @@ John Eslick, Carnegie Mellon University, 2014 """ import math -import types from PyQt5 import QtCore from PyQt5.QtGui import ( diff --git a/foqus_lib/gui/flowsheet/nodePanel.py b/foqus_lib/gui/flowsheet/nodePanel.py index e984ec93c..aaabda3d5 100644 --- a/foqus_lib/gui/flowsheet/nodePanel.py +++ b/foqus_lib/gui/flowsheet/nodePanel.py @@ -21,9 +21,6 @@ import os import re import platform -import types -from configparser import RawConfigParser -from io import StringIO from shutil import copyfile import time diff --git a/foqus_lib/gui/help/helpBrowser.py b/foqus_lib/gui/help/helpBrowser.py index 426065e17..0ca452fdb 100644 --- a/foqus_lib/gui/help/helpBrowser.py +++ b/foqus_lib/gui/help/helpBrowser.py @@ -28,7 +28,6 @@ import logging import os import threading -import time from datetime import datetime from typing import Optional diff --git a/foqus_lib/gui/main/Dash.py b/foqus_lib/gui/main/Dash.py index 89797eaf9..540226318 100644 --- a/foqus_lib/gui/main/Dash.py +++ b/foqus_lib/gui/main/Dash.py @@ -20,7 +20,7 @@ """ import os -from PyQt5 import QtCore, QtGui, QtWidgets, uic +from PyQt5 import QtGui, QtWidgets, uic mypath = os.path.dirname(__file__) _dashFrameUI, _dashFrame = uic.loadUiType(os.path.join(mypath, "Dash_UI.ui")) diff --git a/foqus_lib/gui/main/mainWindow.py b/foqus_lib/gui/main/mainWindow.py index 79359e1eb..1f42f1a7d 100644 --- a/foqus_lib/gui/main/mainWindow.py +++ b/foqus_lib/gui/main/mainWindow.py @@ -18,14 +18,9 @@ John Eslick, Carnegie Mellon University, 2014 """ -import array -import collections import functools import logging -import math import os -import platform -import subprocess import time from configparser import * @@ -41,14 +36,12 @@ QWidget, ) -from foqus_lib.framework import optimizer from foqus_lib.framework.graph.graph import * from foqus_lib.framework.session.hhmmss import * from foqus_lib.framework.session.session import * from foqus_lib.framework.sim.turbineConfiguration import * from foqus_lib.framework.sintervectorize.SinterFileVectorize import * from foqus_lib.framework.uq.Model import * -from foqus_lib.gui import icons_rc from foqus_lib.gui.basic_data.basicDataParentFrame import * from foqus_lib.gui.dialogs.variableBrowser import * from foqus_lib.gui.flowsheet.dataBrowserDialog import * diff --git a/foqus_lib/gui/main/sessionDescriptionEdit.py b/foqus_lib/gui/main/sessionDescriptionEdit.py index 41702d597..c90fdec84 100644 --- a/foqus_lib/gui/main/sessionDescriptionEdit.py +++ b/foqus_lib/gui/main/sessionDescriptionEdit.py @@ -14,7 +14,7 @@ ################################################################################# import os -from PyQt5 import QtCore, QtGui, uic +from PyQt5 import QtGui, uic mypath = os.path.dirname(__file__) _sessionDescriptionDialogUI, _sessionDescriptionDialog = uic.loadUiType( diff --git a/foqus_lib/gui/main/settingsFrame.py b/foqus_lib/gui/main/settingsFrame.py index 9534a4273..239853725 100644 --- a/foqus_lib/gui/main/settingsFrame.py +++ b/foqus_lib/gui/main/settingsFrame.py @@ -18,14 +18,12 @@ """ import logging import os -import pickle # not sure why this is here probably remove import re import shutil import subprocess import time import xml.etree.ElementTree as ET from io import StringIO -from pprint import pprint from PyQt5 import QtCore, uic from PyQt5.QtWidgets import QFileDialog, QInputDialog, QMessageBox diff --git a/foqus_lib/gui/main/turbineConfig.py b/foqus_lib/gui/main/turbineConfig.py index 1956173f6..04abc4b28 100644 --- a/foqus_lib/gui/main/turbineConfig.py +++ b/foqus_lib/gui/main/turbineConfig.py @@ -19,12 +19,11 @@ """ import os -from PyQt5 import QtCore, uic +from PyQt5 import uic from PyQt5.QtWidgets import QDialog, QFileDialog, QMessageBox from foqus_lib.framework.sim.turbineConfiguration import ( TurbineConfiguration, - TurbineInterfaceEx, ) mypath = os.path.dirname(__file__) diff --git a/foqus_lib/gui/model/gatewayUploadDialog.py b/foqus_lib/gui/model/gatewayUploadDialog.py index bf5647553..9861f41f7 100644 --- a/foqus_lib/gui/model/gatewayUploadDialog.py +++ b/foqus_lib/gui/model/gatewayUploadDialog.py @@ -17,11 +17,9 @@ John Eslick, Carnegie Mellon University, 2014 """ -import json import logging import os import subprocess -import sys from PyQt5 import QtCore, uic from PyQt5.QtWidgets import QDialog, QFileDialog, QInputDialog, QLineEdit, QMessageBox diff --git a/foqus_lib/gui/optimization/optMonitor.py b/foqus_lib/gui/optimization/optMonitor.py index 7acdacd21..e2372cf6d 100644 --- a/foqus_lib/gui/optimization/optMonitor.py +++ b/foqus_lib/gui/optimization/optMonitor.py @@ -20,7 +20,6 @@ import os import time -import matplotlib import numpy as np from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure diff --git a/foqus_lib/gui/optimization/optSetupFrame.py b/foqus_lib/gui/optimization/optSetupFrame.py index 53b5326f4..1d713e34e 100644 --- a/foqus_lib/gui/optimization/optSetupFrame.py +++ b/foqus_lib/gui/optimization/optSetupFrame.py @@ -18,13 +18,11 @@ John Eslick, Carnegie Mellon University, 2014 """ -import copy -import json import os from PyQt5 import QtCore, uic from PyQt5.QtGui import QColor -from PyQt5.QtWidgets import QDialog, QMessageBox +from PyQt5.QtWidgets import QDialog import foqus_lib.gui.helpers.guiHelpers as gh from foqus_lib.framework.graph.graph import * diff --git a/foqus_lib/gui/ouu/ouuSetupFrame.py b/foqus_lib/gui/ouu/ouuSetupFrame.py index 496187b09..787e719a6 100644 --- a/foqus_lib/gui/ouu/ouuSetupFrame.py +++ b/foqus_lib/gui/ouu/ouuSetupFrame.py @@ -19,7 +19,6 @@ import sys from multiprocessing.connection import Client -import matplotlib from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure from PyQt5 import QtCore, uic @@ -30,7 +29,6 @@ QFileDialog, QGroupBox, QMessageBox, - QRadioButton, QTableWidgetItem, QVBoxLayout, ) diff --git a/foqus_lib/gui/pysyntax_hl/pysyntax_hl.py b/foqus_lib/gui/pysyntax_hl/pysyntax_hl.py index d0de626b3..87b9a08e7 100644 --- a/foqus_lib/gui/pysyntax_hl/pysyntax_hl.py +++ b/foqus_lib/gui/pysyntax_hl/pysyntax_hl.py @@ -20,7 +20,6 @@ from May 8, 2015 """ -import sys from PyQt5.QtCore import QRegExp from PyQt5.QtGui import QColor, QFont, QSyntaxHighlighter, QTextCharFormat diff --git a/foqus_lib/gui/sdoe/sdoeSetupFrame.py b/foqus_lib/gui/sdoe/sdoeSetupFrame.py index 5b1b5047d..4d27f9a3b 100644 --- a/foqus_lib/gui/sdoe/sdoeSetupFrame.py +++ b/foqus_lib/gui/sdoe/sdoeSetupFrame.py @@ -16,6 +16,7 @@ import logging import os import platform +import shutil import time from datetime import datetime diff --git a/foqus_lib/gui/sinter/__init__.py b/foqus_lib/gui/sinter/__init__.py index e289ebc0f..75a426285 100644 --- a/foqus_lib/gui/sinter/__init__.py +++ b/foqus_lib/gui/sinter/__init__.py @@ -12,4 +12,3 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -from .sinter_config import SinterConfigMainWindow diff --git a/foqus_lib/gui/sinter/sinter_config.py b/foqus_lib/gui/sinter/sinter_config.py index 08eb9e264..7d6501c9e 100644 --- a/foqus_lib/gui/sinter/sinter_config.py +++ b/foqus_lib/gui/sinter/sinter_config.py @@ -17,13 +17,12 @@ import logging import os -from PyQt5 import QtCore, uic +from PyQt5 import uic from PyQt5.QtWidgets import ( QAbstractItemView, QDialog, QFileDialog, QMessageBox, - QTableWidgetItem, ) import foqus_lib.gui.helpers.guiHelpers as gh diff --git a/foqus_lib/gui/sintervectorize/SinterVectorizeDialog.py b/foqus_lib/gui/sintervectorize/SinterVectorizeDialog.py index d8e344e87..62e6d7a5e 100644 --- a/foqus_lib/gui/sintervectorize/SinterVectorizeDialog.py +++ b/foqus_lib/gui/sintervectorize/SinterVectorizeDialog.py @@ -15,24 +15,14 @@ """SinterVectorizeDialog.py * dialog to vectorize SimSinter (.json) files """ -import json -import logging import os -import subprocess -import sys from PyQt5 import QtCore, uic from PyQt5.QtWidgets import ( QDialog, - QFileDialog, - QInputDialog, - QLineEdit, - QMessageBox, - QTextEdit, ) import foqus_lib.framework.sintervectorize.SinterFileVectorize as sv -import foqus_lib.gui.helpers.guiHelpers as gh mypath = os.path.dirname(__file__) _SinterVectorizeDialogUI, _SinterVectorizeDialog = uic.loadUiType( diff --git a/foqus_lib/gui/solventfit/solventFitSetupFrame.py b/foqus_lib/gui/solventfit/solventFitSetupFrame.py index e4c526075..d4f3925fe 100644 --- a/foqus_lib/gui/solventfit/solventFitSetupFrame.py +++ b/foqus_lib/gui/solventfit/solventFitSetupFrame.py @@ -23,11 +23,9 @@ QApplication, QCheckBox, QFileDialog, - QLabel, QMainWindow, QMessageBox, QTableWidgetItem, - QVBoxLayout, ) from foqus_lib.framework.solventfit.SolventFit import SolventFit @@ -37,9 +35,7 @@ from foqus_lib.framework.uq.RSInference import * from foqus_lib.framework.uq.SampleData import * from foqus_lib.framework.uq.SamplingMethods import * -from foqus_lib.framework.uq.Visualizer import Visualizer from foqus_lib.gui.common.InputPriorTable import InputPriorTable -from foqus_lib.gui.uq import RSCombos mypath = os.path.dirname(__file__) _solventFitSetupFrameUI, _solventFitSetupFrame = uic.loadUiType( diff --git a/foqus_lib/gui/surrogate/surrogateFrame.py b/foqus_lib/gui/surrogate/surrogateFrame.py index 54d839b0d..55f581592 100644 --- a/foqus_lib/gui/surrogate/surrogateFrame.py +++ b/foqus_lib/gui/surrogate/surrogateFrame.py @@ -24,13 +24,12 @@ import math import os -import shutil import time import traceback from PyQt5 import QtCore, uic from PyQt5.QtGui import QColor -from PyQt5.QtWidgets import QFileDialog, QMessageBox, QTableWidget +from PyQt5.QtWidgets import QMessageBox, QTableWidget import foqus_lib.gui.helpers.guiHelpers as gh from foqus_lib.framework.session.hhmmss import * diff --git a/foqus_lib/gui/uq/AnalysisDialog.py b/foqus_lib/gui/uq/AnalysisDialog.py index 1028043c2..881098b4a 100644 --- a/foqus_lib/gui/uq/AnalysisDialog.py +++ b/foqus_lib/gui/uq/AnalysisDialog.py @@ -14,7 +14,6 @@ ################################################################################# import os import shutil -import sys import textwrap import numpy diff --git a/foqus_lib/gui/uq/AnalysisInfoDialog.py b/foqus_lib/gui/uq/AnalysisInfoDialog.py index d7feea641..fd7856ff4 100644 --- a/foqus_lib/gui/uq/AnalysisInfoDialog.py +++ b/foqus_lib/gui/uq/AnalysisInfoDialog.py @@ -13,7 +13,6 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import copy -from collections import OrderedDict from PyQt5 import QtCore from PyQt5.QtGui import QFont diff --git a/foqus_lib/gui/uq/InferenceDialog.py b/foqus_lib/gui/uq/InferenceDialog.py index 1ab6a1d7c..60f6b0ebe 100644 --- a/foqus_lib/gui/uq/InferenceDialog.py +++ b/foqus_lib/gui/uq/InferenceDialog.py @@ -13,8 +13,6 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os -import shutil -import sys # from InferenceDialog_UI import Ui_Dialog from PyQt5 import QtCore, uic @@ -22,14 +20,12 @@ from PyQt5.QtGui import * from PyQt5.QtWidgets import * -from foqus_lib.framework.solventfit.SolventFit import SolventFit from foqus_lib.framework.uq.Common import * from foqus_lib.framework.uq.Model import * from foqus_lib.framework.uq.ResponseSurfaces import * from foqus_lib.framework.uq.RSInference import * from foqus_lib.framework.uq.SampleData import * from foqus_lib.framework.uq.SamplingMethods import * -from foqus_lib.framework.uq.Visualizer import Visualizer from foqus_lib.gui.common.InputPriorTable import InputPriorTable from . import RSCombos diff --git a/foqus_lib/gui/uq/Preview.py b/foqus_lib/gui/uq/Preview.py index c24963d00..0afb0f73f 100644 --- a/foqus_lib/gui/uq/Preview.py +++ b/foqus_lib/gui/uq/Preview.py @@ -13,7 +13,6 @@ # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# import os -import sys from PyQt5 import uic from PyQt5.QtCore import Qt @@ -21,8 +20,6 @@ from PyQt5.QtWidgets import ( QAbstractItemView, QApplication, - QDialogButtonBox, - QFileDialog, QListWidgetItem, QTableWidgetItem, ) @@ -30,7 +27,6 @@ from foqus_lib.framework.uq.Common import * from foqus_lib.framework.uq.Model import Model from foqus_lib.framework.uq.RSInference import RSInferencer -from foqus_lib.framework.uq.SampleData import SampleData from foqus_lib.framework.uq.Visualizer import Visualizer # from Preview_UI import Ui_Dialog diff --git a/foqus_lib/gui/uq/RSCombos.py b/foqus_lib/gui/uq/RSCombos.py index 0f6811aed..1aa06bab7 100644 --- a/foqus_lib/gui/uq/RSCombos.py +++ b/foqus_lib/gui/uq/RSCombos.py @@ -14,7 +14,6 @@ ################################################################################# import time -import numpy from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QComboBox, QFileDialog, QSpinBox diff --git a/foqus_lib/gui/uq/SimSetup.py b/foqus_lib/gui/uq/SimSetup.py index adfab6228..1b0b4b332 100644 --- a/foqus_lib/gui/uq/SimSetup.py +++ b/foqus_lib/gui/uq/SimSetup.py @@ -26,12 +26,9 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import ( - QAbstractItemView, QApplication, QComboBox, - QDialogButtonBox, QFileDialog, - QListWidgetItem, QMessageBox, QStackedLayout, ) diff --git a/foqus_lib/gui/uq/dialogTest.py b/foqus_lib/gui/uq/dialogTest.py index ca44e69ee..4aa9448a5 100644 --- a/foqus_lib/gui/uq/dialogTest.py +++ b/foqus_lib/gui/uq/dialogTest.py @@ -14,7 +14,7 @@ ################################################################################# import sys -from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt5 import QtCore, QtWidgets class Dialog(QtWidgets.QDialog): # QtWidgets.QMainWindow): diff --git a/foqus_lib/gui/uq/uqSetupFrame.py b/foqus_lib/gui/uq/uqSetupFrame.py index ec938dfae..f3aef0543 100644 --- a/foqus_lib/gui/uq/uqSetupFrame.py +++ b/foqus_lib/gui/uq/uqSetupFrame.py @@ -20,10 +20,9 @@ import numpy from PyQt5 import QtCore, QtGui, uic from PyQt5.QtCore import QCoreApplication, QEvent, QRect, QSize -from PyQt5.QtGui import QColor, QCursor +from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import ( QApplication, - QButtonGroup, QDialog, QInputDialog, QMenu, diff --git a/foqus_lib/service/flowsheet.py b/foqus_lib/service/flowsheet.py index b2e71da51..c1af08263 100644 --- a/foqus_lib/service/flowsheet.py +++ b/foqus_lib/service/flowsheet.py @@ -22,11 +22,8 @@ import json import logging import logging.config -import optparse import os -import signal import socket -import sys import threading import time import traceback @@ -34,7 +31,6 @@ import urllib.parse import urllib.request import uuid -from os.path import expanduser import functools import boto3 import botocore.exceptions @@ -44,7 +40,7 @@ from turbine.commands import turbine_simulation_script from foqus_lib.framework.foqusException.foqusException import * from foqus_lib.framework.graph.graph import Graph -from foqus_lib.framework.graph.nodeVars import NodeVarEx, NodeVarListEx +from foqus_lib.framework.graph.nodeVars import NodeVarListEx from foqus_lib.framework.plugins import pluginSearch from foqus_lib.framework.pymodel import pymodel from foqus_lib.framework.session.session import generalSettings as FoqusSettings diff --git a/foqus_lib/service/test/flowsheet_control_test.py b/foqus_lib/service/test/flowsheet_control_test.py index e8983e342..09cdaf484 100644 --- a/foqus_lib/service/test/flowsheet_control_test.py +++ b/foqus_lib/service/test/flowsheet_control_test.py @@ -22,7 +22,6 @@ import io import json import os -import urllib.request import uuid from shutil import copyfile from urllib.parse import urlparse @@ -38,7 +37,7 @@ from foqus_lib.framework.sim.turbineConfiguration import TurbineConfiguration try: - from unittest.mock import MagicMock, PropertyMock, patch + from unittest.mock import MagicMock, patch except ImportError: from mock import MagicMock, patch diff --git a/foqus_lib/unit_test/massBalance_test.py b/foqus_lib/unit_test/massBalance_test.py index 56f177e3f..9c6bbde9c 100644 --- a/foqus_lib/unit_test/massBalance_test.py +++ b/foqus_lib/unit_test/massBalance_test.py @@ -12,14 +12,10 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import copy import json import os -import traceback import unittest -import numpy - from foqus_lib.framework.graph.graph import * diff --git a/foqus_lib/unit_test/nodeVarList_test.py b/foqus_lib/unit_test/nodeVarList_test.py index 7c7fbbc8b..7883a6ae5 100644 --- a/foqus_lib/unit_test/nodeVarList_test.py +++ b/foqus_lib/unit_test/nodeVarList_test.py @@ -12,13 +12,8 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import copy -import json -import traceback import unittest -import numpy - from foqus_lib.framework.graph.nodeVars import * diff --git a/foqus_lib/unit_test/nodeVars_test.py b/foqus_lib/unit_test/nodeVars_test.py index 40b4c1aed..073ac6fa0 100644 --- a/foqus_lib/unit_test/nodeVars_test.py +++ b/foqus_lib/unit_test/nodeVars_test.py @@ -14,11 +14,8 @@ ################################################################################# import copy import json -import traceback import unittest -import numpy - from foqus_lib.framework.graph.nodeVars import * diff --git a/foqus_lib/unit_test/turbineLite_test.py b/foqus_lib/unit_test/turbineLite_test.py index 41ab3a9fd..4006298f7 100644 --- a/foqus_lib/unit_test/turbineLite_test.py +++ b/foqus_lib/unit_test/turbineLite_test.py @@ -12,14 +12,8 @@ # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". ################################################################################# -import copy -import json -import os -import traceback import unittest -import numpy - from foqus_lib.framework.sim.turbineConfiguration import * From bafa7cc791ca9f81656b55053108d4972b943325 Mon Sep 17 00:00:00 2001 From: Keith Beattie Date: Wed, 13 Nov 2024 12:31:33 -0800 Subject: [PATCH 2/4] Add the unused-import check to pylint --- .github/actions/pylint/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/pylint/action.yml b/.github/actions/pylint/action.yml index 7d7e4be1b..cd3c74143 100644 --- a/.github/actions/pylint/action.yml +++ b/.github/actions/pylint/action.yml @@ -15,6 +15,6 @@ runs: shell: bash run: | echo '::group::Output of pylint' - pylint --rcfile=.pylint/pylintrc --disable=all --enable=E --enable=wrong-import-order foqus_lib/ + pylint --rcfile=.pylint/pylintrc --disable=all --enable=E --enable=wrong-import-order,unused-import foqus_lib/ echo '::endgroup::' From b1e2e7aed6de2e3bc2c55e7080ea5b593862d42b Mon Sep 17 00:00:00 2001 From: Keith Beattie Date: Wed, 13 Nov 2024 12:36:07 -0800 Subject: [PATCH 3/4] Running black --- foqus_lib/framework/graph/node.py | 2 -- foqus_lib/framework/listen/listen.py | 1 - 2 files changed, 3 deletions(-) diff --git a/foqus_lib/framework/graph/node.py b/foqus_lib/framework/graph/node.py index d6a7d626a..d7744b0dc 100644 --- a/foqus_lib/framework/graph/node.py +++ b/foqus_lib/framework/graph/node.py @@ -177,7 +177,6 @@ def attempt_load_smt(try_imports=True): # smt should be installed, but not required for non ML/AI models import pickle - smt_pickle_load = pickle.load # throw warning if manually failed for test or if package actually not available @@ -199,7 +198,6 @@ def attempt_load_jenn(try_imports=True): # jenn should be installed, but not required for non ML/AI models import pickle - jenn_pickle_load = pickle.load # throw warning if manually failed for test or if package actually not available diff --git a/foqus_lib/framework/listen/listen.py b/foqus_lib/framework/listen/listen.py index ecf566e09..ff5354bf8 100644 --- a/foqus_lib/framework/listen/listen.py +++ b/foqus_lib/framework/listen/listen.py @@ -29,7 +29,6 @@ from multiprocessing.connection import Listener - class foqusListener2(threading.Thread): """ A multiprocessing listener to allow FOQUS to be controlled over a socket From e0ce1c612699cc6567527be2d13416fef85b3f4a Mon Sep 17 00:00:00 2001 From: Keith Beattie Date: Wed, 13 Nov 2024 12:39:32 -0800 Subject: [PATCH 4/4] Fixing old spelling typo in comment --- foqus_lib/framework/graph/node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foqus_lib/framework/graph/node.py b/foqus_lib/framework/graph/node.py index d7744b0dc..b646dc04b 100644 --- a/foqus_lib/framework/graph/node.py +++ b/foqus_lib/framework/graph/node.py @@ -1259,7 +1259,7 @@ def setSim(self, newType=None, newModel=None, force=False, ids=None): ) elif self.isModelML: # assume a custom layer exists unless the model form indicates otherwise - # for Keras models when expected attriutes don't exist + # for Keras models when expected attributes don't exist self.keras_has_custom_layer = True # link to pymodel class for ml/ai models cwd = os.getcwd()