Skip to content

Commit

Permalink
REFACTOR: Cleanup bandit warnings (#4962)
Browse files Browse the repository at this point in the history
Co-authored-by: Maxime Rey <[email protected]>
  • Loading branch information
SMoraisAnsys and MaxJPRey authored Jul 30, 2024
1 parent a6445bb commit a3db880
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
17 changes: 12 additions & 5 deletions pyaedt/modules/PostProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2453,7 +2453,9 @@ def _get_cs_plane_ids(self):
name2refid[cs_id + 1] = name + ":YZ"
name2refid[cs_id + 2] = name + ":XZ"
except Exception:
pass
self.logger.debug(
"Something went wrong with key {} while retrieving coordinate systems plane ids.".format(ds)
) # pragma: no cover
return name2refid

@pyaedt_function_handler()
Expand Down Expand Up @@ -2507,7 +2509,9 @@ def _get_fields_plot(self):
plots[plot_name].MaxArrowSpacing = arrow_setts["MaxArrowSpacing"]
plots[plot_name].GridColor = surf_setts["GridColor"]
except Exception:
pass
self.logger.debug(
"Something went wrong with setup {} while retrieving fields plot.".format(setup)
) # pragma: no cover
return plots

# TODO: define a fields calculator module and make robust !!
Expand Down Expand Up @@ -3245,7 +3249,7 @@ def _create_fieldplot(
try:
self._app.modeler.fit_all()
except Exception:
pass
self.logger.debug("Something went wrong with `fit_all` while creating field plot.") # pragma: no cover
self._desktop.TileWindows(0)
self._app.desktop_class.active_design(self._oproject, self._app.design_name)

Expand Down Expand Up @@ -3305,7 +3309,9 @@ def _create_fieldplot_line_traces(
try:
self._app._modeler.fit_all()
except Exception:
pass
self.logger.debug(
"Something went wrong with `fit_all` while creating field plot with line traces."
) # pragma: no cover
self._desktop.TileWindows(0)
self._app.desktop_class.active_design(self._oproject, self._app.design_name)

Expand Down Expand Up @@ -4289,7 +4295,8 @@ def export_model_obj(self, assignment=None, export_path=None, export_as_single_o
"""
if assignment and not isinstance(assignment, (list, tuple)):
assignment = [assignment]
assert self._app._aedt_version >= "2021.2", self.logger.error("Object is supported from AEDT 2021 R2.")
if self._app._aedt_version < "2021.2":
raise RuntimeError("Object is supported from AEDT 2021 R2.") # pragma: no cover
if not export_path:
export_path = self._app.working_directory
if not assignment:
Expand Down
4 changes: 2 additions & 2 deletions pyaedt/workflows/project/create_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def main(extension_args):
out = report.save_pdf(aedtapp.working_directory, "AEDT_Results.pdf")
aedtapp.logger.info(f"Report Generated. {out}")
if is_windows and not extension_args["is_test"]: # pragma: no cover
try: # nosec
os.startfile(out)
try:
os.startfile(out) # nosec
except Exception: # pragma: no cover
aedtapp.logger.warning(f"Failed to open {out}")

Expand Down

0 comments on commit a3db880

Please sign in to comment.