Skip to content

Commit

Permalink
Update comments and remove unnecessary flag from method
Browse files Browse the repository at this point in the history
  • Loading branch information
tsole0 committed Jun 24, 2024
1 parent 54a8aaf commit 2b71022
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/sas/qtgui/Utilities/TabbedModelEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def loadFile(self, filename):

# Check the validity of loaded model if the model is python
if self.is_python:
error_line = self.checkModel(plugin_text, run_unit_test=False)
error_line = self.checkModel(plugin_text)
if error_line > 0:
# select bad line
cursor = QtGui.QTextCursor(self.editor_widget.txtEditor.document().findBlockByLineNumber(error_line-1))
Expand Down Expand Up @@ -353,20 +353,19 @@ def updateFromPlugin(self):
self.parent.communicate.statusBarUpdateSignal.emit(msg)
logging.info(msg)

def checkModel(self, full_path, run_unit_test=True):
def checkModel(self, full_path):
"""
Run the ast check
and return True if the model is good.
False otherwise.
Run ast and model checks
Attempt to return the line number of the error if any
:param full_path: full path to the model file
"""
# successfulCheck = True
error_line = 0
try:
with open(full_path, 'r', encoding="utf-8") as plugin:
model_str = plugin.read()
ast.parse(model_str)
if run_unit_test:
model_check = GuiUtils.checkModel(full_path)
GuiUtils.checkModel(full_path)

except Exception as ex:
msg = "Error building model: " + str(ex)
Expand Down

0 comments on commit 2b71022

Please sign in to comment.