Skip to content

Commit

Permalink
Fix non standard English double-colons (#1719)
Browse files Browse the repository at this point in the history
Signed-off-by: Douglas Samuel Gonçalves <[email protected]>
  • Loading branch information
DouSam committed Jul 26, 2024
1 parent fc9b567 commit 159e142
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions plugins/slicer/MONAILabel/MONAILabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ def invalidateConfigTable(self, selection=-1, name=-1):
v.insert(0, value)
value = v

logging.info(f"Invalidate:: {section} => {name} => {key} => {value} => {type(v)}")
logging.info(f"Invalidate: {section} => {name} => {key} => {value} => {type(v)}")
self.info.get(section, {}).get(name, {}).get("config", {})[key] = value

def updateConfigTable(self, refresh=True):
Expand Down Expand Up @@ -1091,7 +1091,7 @@ def fetchInfo(self, showInfo=False):
)
return
except BaseException as e:
msg = f"Message:: {e.msg}" if hasattr(e, "msg") else ""
msg = f"Message: {e.msg}" if hasattr(e, "msg") else ""
slicer.util.errorDisplay(
_(
"Failed to fetch models from remote server. "
Expand Down Expand Up @@ -1165,7 +1165,7 @@ def onTraining(self):
time.sleep(1)
self.updateGUIFromParameterNode()
except BaseException as e:
msg = f"Message:: {e.msg}" if hasattr(e, "msg") else ""
msg = f"Message: {e.msg}" if hasattr(e, "msg") else ""
slicer.util.errorDisplay(
_("Failed to run training in MONAI Label Server.\n{message}").format(message=msg),
detailedText=traceback.format_exc(),
Expand Down Expand Up @@ -1197,7 +1197,7 @@ def onStopTraining(self):
self.updateServerSettings()
status = self.logic.train_stop()
except BaseException as e:
msg = f"Message:: {e.msg}" if hasattr(e, "msg") else ""
msg = f"Message: {e.msg}" if hasattr(e, "msg") else ""
slicer.util.errorDisplay(
_("Failed to stop Training Task.\n{message}").format(message=msg),
detailedText=traceback.format_exc(),
Expand Down Expand Up @@ -1313,7 +1313,7 @@ def onNextSampleButton(self):
self.initSample(sample)

except BaseException as e:
msg = f"Message:: {e.msg}" if hasattr(e, "msg") else ""
msg = f"Message: {e.msg}" if hasattr(e, "msg") else ""
slicer.util.errorDisplay(
_("Failed to fetch Sample from MONAI Label Server.\n{message}").format(message=msg),
detailedText=traceback.format_exc(),
Expand Down Expand Up @@ -1401,12 +1401,12 @@ def onUploadImage(self, init_sample=True, session=False):
self.updateGUIFromParameterNode()
return True
except BaseException as e:
msg = f"Message:: {e.msg}" if hasattr(e, "msg") else ""
msg = f"Message: {e.msg}" if hasattr(e, "msg") else ""
self.reportProgress(100)
qt.QApplication.restoreOverrideCursor()
if session:
slicer.util.errorDisplay(
_("Server Error:: Session creation Failed\nPlease upgrade to latest monailabel version (> 0.2.0)"),
_("Server Error: Session creation Failed\nPlease upgrade to latest monailabel version (> 0.2.0)"),
detailedText=traceback.format_exc(),
)
self.current_sample["session"] = None
Expand Down Expand Up @@ -1496,7 +1496,7 @@ def onSaveLabel(self):
logging.info("Failed to stop training; or already stopped")
self.onTraining()
except BaseException as e:
msg = f"Message:: {e.msg}" if hasattr(e, "msg") else ""
msg = f"Message: {e.msg}" if hasattr(e, "msg") else ""
slicer.util.errorDisplay(
_("Failed to save Label to MONAI Label Server.\n{message}").format(message=msg),
detailedText=traceback.format_exc(),
Expand Down Expand Up @@ -1552,7 +1552,7 @@ def onClickSegmentation(self):
labels = [k for k, _ in sorted(labels.items(), key=lambda item: item[1])]
self.updateSegmentationMask(result_file, labels)
except BaseException as e:
msg = f"Message:: {e.msg}" if hasattr(e, "msg") else ""
msg = f"Message: {e.msg}" if hasattr(e, "msg") else ""
slicer.util.errorDisplay(
_("Failed to run inference in MONAI Label Server.\n{message}").format(message=msg),
detailedText=traceback.format_exc(),
Expand Down Expand Up @@ -1667,7 +1667,7 @@ def onClickDeepgrow(self, current_point, skip_infer=False):
freeze = label if self.ui.freezeUpdateCheckBox.checked else None
self.updateSegmentationMask(result_file, labels, None if deepgrow_3d else sliceIndex, freeze=freeze)
except BaseException as e:
msg = f"Message:: {e.msg}" if hasattr(e, "msg") else ""
msg = f"Message: {e.msg}" if hasattr(e, "msg") else ""
slicer.util.errorDisplay(
operationDescription + f" - unexpected error.\n{msg}",
detailedText=traceback.format_exc(),
Expand Down Expand Up @@ -1708,7 +1708,7 @@ def getLabelColor(self, name):
return [c / 255.0 for c in color] if color else None

def updateSegmentationMask(self, in_file, labels, sliceIndex=None, freeze=None):
# TODO:: Add ROI Node (for Bounding Box if provided in the result)
# TODO: Add ROI Node (for Bounding Box if provided in the result)
start = time.time()
logging.debug(f"Update Segmentation Mask from: {in_file}")
if in_file and not os.path.exists(in_file):
Expand Down Expand Up @@ -1974,7 +1974,7 @@ def onUpdateScribbles(self):
self.reportProgress(90)
self.updateSegmentationMask(result_file, [selected_label_name])
except BaseException as e:
msg = f"Message:: {e.msg}" if hasattr(e, "msg") else ""
msg = f"Message: {e.msg}" if hasattr(e, "msg") else ""
slicer.util.errorDisplay(
_("Failed to post process label on MONAI Label Server using {scribbles_method}.\n{message}").format(
scribbles_method=scribblesMethod, message=msg
Expand Down Expand Up @@ -2272,7 +2272,7 @@ def _client(self):
if self.auth_token:
mc.update_auth(self.auth_token)

# TODO:: JWT token can be validated (with additional py dependencies) to avoid further calls to server
# TODO: JWT token can be validated (with additional py dependencies) to avoid further calls to server
if not self.auth_token or not mc.auth_valid_token():
try:
print(f"Fetching new Token for: {self.username}")
Expand Down

0 comments on commit 159e142

Please sign in to comment.