Skip to content

Commit

Permalink
First pass at removing wildcard imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ksbeattie committed Nov 20, 2024
1 parent 62534b8 commit 0b912dd
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 24 deletions.
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,unused-import foqus_lib/
pylint --rcfile=.pylint/pylintrc --disable=all --enable=E --enable=wrong-import-order,unused-import,wildcard-import foqus_lib/
echo '::endgroup::'
12 changes: 9 additions & 3 deletions foqus_lib/foqus.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
Keith Beattie, Lawrence Berkeley National Labs, 2020
"""

# Imports
import argparse
import json
import logging

# Imports
import os
import shutil
import signal
import sys
import time
Expand All @@ -34,7 +35,12 @@
# FOQUS imports
import foqus_lib.version.version as ver # foqus version and other info
from foqus_lib.framework.listen.listen import foqusListener2
from foqus_lib.framework.session.session import *
from foqus_lib.framework.session.session import (
generalSettings,
makeWorkingDirStruct,
makeWorkingDirFiles,
session,
)
from foqus_lib.gui.make_shortcut import makeShortcut

loadGUI = False
Expand Down
2 changes: 1 addition & 1 deletion foqus_lib/framework/foqusOptions/optionList.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
John Eslick, Carnegie Mellon University, 2014
"""

from foqus_lib.framework.foqusOptions.option import *
from foqus_lib.framework.foqusOptions.option import option


class optionList(dict):
Expand Down
11 changes: 4 additions & 7 deletions foqus_lib/framework/optimizer/SM_Optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@

# Check that the required pyomo, pyDOE, and smt packages are available for the surrogate based optimization plugin and import it.
# If not the Surrogate Based Optimization plug-in will not be available.

try:
# add direct imports (in addition to existing wildcard import)
# to make pylint happy without affecting the existing runtime behavior
import pyutilib.subprocess.GlobalData
from pyomo.environ import (
ConstraintList,
Expand All @@ -57,13 +54,13 @@
from pyomo.opt import SolverFactory

pyutilib.subprocess.GlobalData.DEFINE_SIGNAL_HANDLERS_DEFAULT = False
from pyDOE import *
import pyDOE # pylint: disable=unused-import
from smt.sampling_methods import LHS

packages_available = True
except ImportError:
logging.getLogger("foqus." + __name__).info(
"Failed to import the required packages for SM Optimizer solver"
except ImportError as ie:
logging.getLogger("foqus." + __name__).warn(
"Failed to import the required packages for SM Optimizer solver: " + str(ie)
)
packages_available = False

Expand Down
2 changes: 0 additions & 2 deletions foqus_lib/framework/optimizer/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

from foqus_lib.framework.foqusOptions.optionList import optionList

from .problem import *


class optimization(threading.Thread):
"""
Expand Down
2 changes: 1 addition & 1 deletion foqus_lib/framework/pymodel/matlab_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import subprocess
import time

from foqus_lib.framework.pymodel.pymodel import *
from foqus_lib.framework.pymodel.pymodel import pymodel

# Check that the MATLAB engine module is available and import it if possible.
# If not the MATLAB plug-in cannot be used.
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

from foqus_lib.framework.graph.nodeVars import *


class pymodel:
def __init__(self):
Expand Down
4 changes: 2 additions & 2 deletions foqus_lib/unit_test/massBalance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import json
import os
import unittest
import numpy

from foqus_lib.framework.graph.graph import *

from foqus_lib.framework.graph.graph import Graph

class testMassBalance(unittest.TestCase):
def loadGraph(self, fname):
Expand Down
5 changes: 4 additions & 1 deletion foqus_lib/unit_test/nodeVarList_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
#################################################################################
import unittest

from foqus_lib.framework.graph.nodeVars import *
from foqus_lib.framework.graph.nodeVars import (
NodeVarList,
NodeVars,
)


class testNodeVarListSteady(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion foqus_lib/unit_test/nodeVars_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import json
import unittest

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


class testNodeVarsSteady(unittest.TestCase):
Expand Down
3 changes: 0 additions & 3 deletions foqus_lib/unit_test/turbineLite_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@
#################################################################################
import unittest

from foqus_lib.framework.sim.turbineConfiguration import *


class turbineLiteTest(unittest.TestCase):
pass

0 comments on commit 0b912dd

Please sign in to comment.