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: Iterate over the dictionary directly instead of using .keys(). #3631

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions doc/changelog.d/3631.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
refactor: Iterate over the dictionary directly instead of using .keys().
4 changes: 2 additions & 2 deletions src/ansys/mapdl/core/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,8 +845,8 @@ def bc_colnames(self) -> Optional[List[str]]:

title = self._get_body()[0]

_bcType = [i for i in bc_type.keys() if i in title]
_entity = [i for i in entity.keys() if i in title]
_bcType = [i for i in bc_type if i in title]
_entity = [i for i in entity if i in title]

if _bcType and _entity:

Expand Down
12 changes: 5 additions & 7 deletions src/ansys/mapdl/core/mapdl_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2941,7 +2941,7 @@ def _mat_data(self, pname, raw=False):

@property
def locked(self):
"""Instance is in use within a pool"""
"""Instance is in use within a pool."""
return self._locked

@locked.setter
Expand Down Expand Up @@ -2987,7 +2987,7 @@ def _generate_iges(self):

@property
def _distributed_result_file(self):
"""Path of the distributed result file"""
"""Path of the distributed result file."""
if not self._distributed:
return

Expand Down Expand Up @@ -3022,7 +3022,7 @@ def _distributed_result_file(self):

@property
def thermal_result(self):
"""The thermal result object"""
"""The thermal result object."""
self._prioritize_thermal = True
result = self.result
self._prioritize_thermal = False
Expand All @@ -3045,7 +3045,7 @@ def list_error_file(self):
return open(os.path.join(self.directory, error_file)).read()
elif self._exited:
raise MapdlExitedError(
"Cannot list error file when MAPDL Service has " "exited"
"Cannot list error file when MAPDL Service has exited"
)

return self._download_as_raw(error_file).decode("latin-1")
Expand All @@ -3060,9 +3060,7 @@ def cmatrix(
capname="",
**kwargs,
):
"""Run CMATRIX in non-interactive mode and return the response
from file.
"""
"""Run CMATRIX in non-interactive mode and return the response from file."""

# The CMATRIX command needs to run in non-interactive mode
if not self._store_commands:
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/mapdl/core/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@
try:
self._exiting_i += 1
instance.exit()
except Exception as e:
except Exception:

Check warning on line 617 in src/ansys/mapdl/core/pool.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/mapdl/core/pool.py#L617

Added line #L617 was not covered by tests
LOG.error("Failed to close instance", exc_info=True)
self._exiting_i -= 1

Expand Down
Loading