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

REFACTOR: Cleanup bandit warnings #4962

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions pyaedt/modules/PostProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2455,7 +2455,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 @@ -2509,7 +2511,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 @@ -3247,7 +3251,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 @@ -3307,7 +3311,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 @@ -4291,7 +4297,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
Loading