Skip to content

Commit 841313d

Browse files
MaxJPReypyansys-ci-botgerma89pre-commit-ci[bot]
authored
refactor: Iterate over the dictionary directly instead of using .keys(). (#3631)
* Iterate over the dictionay directly instead of using .keys(). * chore: adding changelog file 3631.added.md [dependabot-skip] * chore: adding changelog file 3631.added.md [dependabot-skip] * chore: update src/ansys/mapdl/core/pool.py * ci: auto fixes from pre-commit.com hooks. for more information, see https://pre-commit.ci * ci: auto fixes from pre-commit.com hooks. for more information, see https://pre-commit.ci * chore: empty commit to trigger CICD --------- Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: German <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 38d51a1 commit 841313d

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

doc/changelog.d/3631.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
refactor: Iterate over the dictionary directly instead of using .keys().

src/ansys/mapdl/core/commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,8 @@ def bc_colnames(self) -> Optional[List[str]]:
845845

846846
title = self._get_body()[0]
847847

848-
_bcType = [i for i in bc_type.keys() if i in title]
849-
_entity = [i for i in entity.keys() if i in title]
848+
_bcType = [i for i in bc_type if i in title]
849+
_entity = [i for i in entity if i in title]
850850

851851
if _bcType and _entity:
852852

src/ansys/mapdl/core/mapdl_grpc.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2941,7 +2941,7 @@ def _mat_data(self, pname, raw=False):
29412941

29422942
@property
29432943
def locked(self):
2944-
"""Instance is in use within a pool"""
2944+
"""Instance is in use within a pool."""
29452945
return self._locked
29462946

29472947
@locked.setter
@@ -2987,7 +2987,7 @@ def _generate_iges(self):
29872987

29882988
@property
29892989
def _distributed_result_file(self):
2990-
"""Path of the distributed result file"""
2990+
"""Path of the distributed result file."""
29912991
if not self._distributed:
29922992
return
29932993

@@ -3022,7 +3022,7 @@ def _distributed_result_file(self):
30223022

30233023
@property
30243024
def thermal_result(self):
3025-
"""The thermal result object"""
3025+
"""The thermal result object."""
30263026
self._prioritize_thermal = True
30273027
result = self.result
30283028
self._prioritize_thermal = False
@@ -3045,7 +3045,7 @@ def list_error_file(self):
30453045
return open(os.path.join(self.directory, error_file)).read()
30463046
elif self._exited:
30473047
raise MapdlExitedError(
3048-
"Cannot list error file when MAPDL Service has " "exited"
3048+
"Cannot list error file when MAPDL Service has exited"
30493049
)
30503050

30513051
return self._download_as_raw(error_file).decode("latin-1")
@@ -3060,9 +3060,7 @@ def cmatrix(
30603060
capname="",
30613061
**kwargs,
30623062
):
3063-
"""Run CMATRIX in non-interactive mode and return the response
3064-
from file.
3065-
"""
3063+
"""Run CMATRIX in non-interactive mode and return the response from file."""
30663064

30673065
# The CMATRIX command needs to run in non-interactive mode
30683066
if not self._store_commands:

src/ansys/mapdl/core/pool.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,10 @@ def run():
614614
try:
615615
self._exiting_i += 1
616616
instance.exit()
617-
except Exception as e:
618-
LOG.error("Failed to close instance", exc_info=True)
617+
except Exception:
618+
LOG.error(
619+
f"Failed to close instance due to:\n{e}", exc_info=True
620+
)
619621
self._exiting_i -= 1
620622

621623
else:

0 commit comments

Comments
 (0)