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 in modules #4969

Merged
merged 2 commits into from
Jul 31, 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
5 changes: 3 additions & 2 deletions pyaedt/modules/MaterialLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def _get_surface_materials(self):
material_update=False,
)
except Exception:
pass
self.logger.debug("An error occurred while accessing surface materials.") # pragma: no cover
return mats

@pyaedt_function_handler(mat="material")
Expand Down Expand Up @@ -412,7 +412,8 @@ def _create_mat_project_vars(self, matlist):
if a < tol:
del matprop[prop]
except Exception:
pass
self.logger.debug("An error occurred while creating material property.") # pragma: no cover

return matprop

@pyaedt_function_handler(materials_list="assignment", material_name="name")
Expand Down
9 changes: 5 additions & 4 deletions pyaedt/modules/Mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def update_assignment(self):
try:
pr.append(self._app.modeler[el].name)
except (KeyError, AttributeError):
pass
self.logger.debug("An error occurred while updating the boundary assignment.") # pragma: no cover
out += ["Objects:=", pr]

if len(out) == 1:
Expand Down Expand Up @@ -503,7 +503,7 @@ def _get_design_global_mesh(self):
"MeshSettings"
]
except Exception:
pass
self.logger.debug("An error occurred while accessing design global mesh.") # pragma: no cover
if os.path.exists(temp_proj):
os.remove(temp_proj)
if os.path.exists(temp_proj + "results"):
Expand Down Expand Up @@ -557,7 +557,7 @@ def _get_design_mesh_operations(self):

meshops.append(MeshOperation(self, ds, props, props["Type"]))
except Exception:
pass
self.logger.debug("An error occurred while accessing design mesh operations.") # pragma: no cover
return meshops

@pyaedt_function_handler(names="assignment", meshop_name="name")
Expand Down Expand Up @@ -816,7 +816,8 @@ def assign_initial_mesh_from_slider(
mesh_methods = ["Auto", "AnsoftClassic"]
else:
mesh_methods = ["Auto", "AnsoftTAU", "AnsoftClassic"]
assert method in mesh_methods
if method not in mesh_methods:
raise RuntimeError("Invalid mesh method {}".format(method)) # pragma: no cover

modelres = ["NAME:GlobalModelRes", "UseAutoLength:=", automodelresolution]
if not automodelresolution:
Expand Down
2 changes: 1 addition & 1 deletion pyaedt/modules/Mesh3DLayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def _get_design_mesh_operations(self):
props = self._app.design_properties["Setup"]["Data"][ds]["MeshOps"][ops]
meshops.append(Mesh3DOperation(self, ds, ops, props))
except Exception:
pass
self.logger.debug("An error occurred while accessing design mesh operations.") # pragma: no cover
return meshops

@pyaedt_function_handler(
Expand Down
3 changes: 2 additions & 1 deletion pyaedt/modules/MeshIcepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,8 @@ def __init__(self, app):
self._odesign = self._app._odesign
self.modeler = self._app.modeler
design_type = self._odesign.GetDesignType()
assert design_type in meshers, "Invalid design type {}".format(design_type)
if design_type not in meshers:
raise RuntimeError("Invalid design type {}".format(design_type)) # pragma: no cover
self.id = 0
self._oeditor = self.modeler.oeditor
self._model_units = self.modeler.model_units
Expand Down
Loading