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 1 commit
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,11 @@
name2refid[cs_id + 1] = name + ":YZ"
name2refid[cs_id + 2] = name + ":XZ"
except Exception:
pass
self.logger.debug(
"Something went wrong when with key {} while retrieving coordinate systems plane ids.".format(
ds
)
)
return name2refid

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

# TODO: define a fields calculator module and make robust !!
Expand Down Expand Up @@ -3247,7 +3253,7 @@
try:
self._app.modeler.fit_all()
except Exception:
pass
self.logger.debug("Something went wrong with `fit_all` while creating field plot.")

Check warning on line 3256 in pyaedt/modules/PostProcessor.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/modules/PostProcessor.py#L3256

Added line #L3256 was not covered by tests
self._desktop.TileWindows(0)
self._app.desktop_class.active_design(self._oproject, self._app.design_name)

Expand Down Expand Up @@ -3307,7 +3313,7 @@
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.")

Check warning on line 3316 in pyaedt/modules/PostProcessor.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/modules/PostProcessor.py#L3316

Added line #L3316 was not covered by tests
self._desktop.TileWindows(0)
self._app.desktop_class.active_design(self._oproject, self._app.design_name)

Expand Down Expand Up @@ -4291,7 +4297,8 @@
"""
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.")

Check warning on line 4301 in pyaedt/modules/PostProcessor.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/modules/PostProcessor.py#L4301

Added line #L4301 was not covered by tests
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