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

Removing all wildcard imports #1252

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

ksbeattie
Copy link
Member

@ksbeattie ksbeattie commented Nov 20, 2024

Fixes/Addresses:

The next step in #1162: this PR removes all wildcard imports as reported by pylint and adds that check to GHA.

Summary/Motivation:

Clean up the code

Changes proposed in this PR:

  • Tons

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the copyright and license terms described in the LICENSE.md file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@ksbeattie ksbeattie self-assigned this Nov 20, 2024
@ksbeattie ksbeattie added the Priority:Normal Normal Priority Issue or PR label Nov 20, 2024
@ksbeattie ksbeattie changed the title Removing wildcard imports [WIP] Removing wildcard imports Nov 20, 2024
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 14 lines in your changes missing coverage. Please review.

Project coverage is 38.49%. Comparing base (62534b8) to head (0e1a49c).

Files with missing lines Patch % Lines
foqus_lib/gui/sdoe/sdoeSetupFrame.py 60.00% 8 Missing ⚠️
foqus_lib/framework/pymodel/heat_integration.py 0.00% 2 Missing ⚠️
foqus_lib/framework/pymodel/steam_cycle.py 0.00% 2 Missing ⚠️
foqus_lib/framework/optimizer/SM_Optimizer.py 66.66% 1 Missing ⚠️
...qus_lib/framework/solventfit/SolventFit_testing.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1252      +/-   ##
==========================================
+ Coverage   38.47%   38.49%   +0.01%     
==========================================
  Files         164      164              
  Lines       37020    37029       +9     
  Branches     5728     5728              
==========================================
+ Hits        14243    14253      +10     
+ Misses      21650    21649       -1     
  Partials     1127     1127              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ksbeattie ksbeattie marked this pull request as ready for review November 21, 2024 06:58
@ksbeattie ksbeattie changed the title [WIP] Removing wildcard imports Removing all wildcard imports Nov 21, 2024
Copy link
Contributor

@bpaul4 bpaul4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ksbeattie for doing this, I see that there was a significant amount of nested wildcard importing going on. I have a few questions but overall this looks nice.

foqus_lib/framework/graph/OptGraphOptim.py Show resolved Hide resolved
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like this import is covered, or necessary. Can this be removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is a tricky one. I left it in and added the pylint disable because I believe that Anuja (who wrote this code) was using it to detect if the SM Opt "plugin" was available or not. I actually couldn't find where else it is used. I would like to get @anujad95 to review and test this part directly, if possible.

foqus_lib/framework/optimizer/optimization.py Show resolved Hide resolved
Comment on lines +22 to +23
from foqus_lib.framework.graph.nodeVars import NodeVars
from foqus_lib.framework.pymodel.pymodel import pymodel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Digging a bit into the files, the coverage issue is because this file is never executed directly:

# def test_load_and_run_heatintegration(self, active_session, simnode):

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is related to the whole plugin management problem (described in #1085) but shelved due to lack of time. If we could get it into the CI somehow, that would be great.

foqus_lib/framework/pymodel/pymodel.py Show resolved Hide resolved
foqus_lib/gui/ouu/nodeToUQModel.py Show resolved Hide resolved
foqus_lib/gui/sdoe/sdoeSetupFrame.py Show resolved Hide resolved
@@ -1561,8 +1567,8 @@ def updateOutputValues(self):
runState = data.getRunState()

if len(outputData) == 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also not covered by the tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for adding more test coverage, I was just concentrating on removing all the wildcard-imports for this PR.

foqus_lib/unit_test/turbineLite_test.py Show resolved Hide resolved
foqus_lib/version/version.template Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:Normal Normal Priority Issue or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants