Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused imports #1251

Merged
merged 4 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/pylint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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::'

1 change: 0 additions & 1 deletion foqus_lib/foqus.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import signal
import sys
import time
import uuid
import traceback
import turbine

Expand Down
3 changes: 0 additions & 3 deletions foqus_lib/framework/graph/OptGraphOptim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down
3 changes: 0 additions & 3 deletions foqus_lib/framework/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions foqus_lib/framework/graph/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import logging
import math
import os
from collections import OrderedDict
from importlib import import_module

import numpy as np
Expand Down Expand Up @@ -178,8 +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

# throw warning if manually failed for test or if package actually not available
Expand All @@ -201,8 +198,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

# throw warning if manually failed for test or if package actually not available
Expand Down Expand Up @@ -1264,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()
Expand Down
2 changes: 0 additions & 2 deletions foqus_lib/framework/graph/nodeVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions foqus_lib/framework/listen/listen.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@
import copy
import logging
import threading
import time
from multiprocessing.connection import Listener

import numpy as np


class foqusListener2(threading.Thread):
"""
Expand Down
1 change: 0 additions & 1 deletion foqus_lib/framework/ml_ai_models/mlaiSearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
John Eslick, Carnegie Mellon University, 2014
"""

import importlib
import logging
import os
import sys
Expand Down
7 changes: 0 additions & 7 deletions foqus_lib/framework/optimizer/BFGS.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 0 additions & 7 deletions foqus_lib/framework/optimizer/NLopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 0 additions & 5 deletions foqus_lib/framework/optimizer/OptCMA.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 0 additions & 8 deletions foqus_lib/framework/optimizer/PSUADE.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 0 additions & 7 deletions foqus_lib/framework/optimizer/SLSQP.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 0 additions & 19 deletions foqus_lib/framework/optimizer/SM_Optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
8 changes: 0 additions & 8 deletions foqus_lib/framework/optimizer/Sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 0 additions & 10 deletions foqus_lib/framework/optimizer/Snobfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions foqus_lib/framework/optimizer/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions foqus_lib/framework/optimizer/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 1 addition & 3 deletions foqus_lib/framework/ouu/OUU.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion foqus_lib/framework/pymodel/heat_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#
# FOQUS_PYMODEL_PLUGIN

import logging
import subprocess

import numpy
Expand Down
2 changes: 0 additions & 2 deletions foqus_lib/framework/pymodel/pymodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#################################################################################
from collections import OrderedDict

import numpy

from foqus_lib.framework.graph.nodeVars import *


Expand Down
2 changes: 0 additions & 2 deletions foqus_lib/framework/pymodel/pymodel_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#
# FOQUS_PYMODEL_PLUGIN

import numpy

from foqus_lib.framework.graph.nodeVars import *
from foqus_lib.framework.pymodel.pymodel import *

Expand Down
1 change: 0 additions & 1 deletion foqus_lib/framework/sampleResults/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import json
import logging
import re
import time
from collections import OrderedDict
from io import StringIO

Expand Down
1 change: 0 additions & 1 deletion foqus_lib/framework/sampleResults/test/results_s3_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"""
import json
import logging
import time

from ...graph.graph import Graph
from .. import results
Expand Down
3 changes: 1 addition & 2 deletions foqus_lib/framework/sdoe/nusf_dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Loading
Loading