From 347dca271c6b545eb287a0997326f4761ed505fe Mon Sep 17 00:00:00 2001 From: Maxime Rey <87315832+MaxJPRey@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:27:28 +0000 Subject: [PATCH 1/3] Iterate over the dictionay directly instead of using .keys(). --- src/ansys/mapdl/core/commands.py | 4 ++-- src/ansys/mapdl/core/mapdl_grpc.py | 12 +++++------- src/ansys/mapdl/core/pool.py | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/ansys/mapdl/core/commands.py b/src/ansys/mapdl/core/commands.py index 2f1e3a0eec..989548c9a7 100644 --- a/src/ansys/mapdl/core/commands.py +++ b/src/ansys/mapdl/core/commands.py @@ -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: diff --git a/src/ansys/mapdl/core/mapdl_grpc.py b/src/ansys/mapdl/core/mapdl_grpc.py index 466317f181..121c3b56e2 100644 --- a/src/ansys/mapdl/core/mapdl_grpc.py +++ b/src/ansys/mapdl/core/mapdl_grpc.py @@ -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 @@ -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 @@ -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 @@ -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") @@ -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: diff --git a/src/ansys/mapdl/core/pool.py b/src/ansys/mapdl/core/pool.py index 40e22ae2b1..fdd803e690 100755 --- a/src/ansys/mapdl/core/pool.py +++ b/src/ansys/mapdl/core/pool.py @@ -614,7 +614,7 @@ def run(): try: self._exiting_i += 1 instance.exit() - except Exception as e: + except Exception: LOG.error("Failed to close instance", exc_info=True) self._exiting_i -= 1 From 1f76bdbd30334a0539327e7f43e9d8e7f12cddb2 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:28:57 +0000 Subject: [PATCH 2/3] chore: adding changelog file 3631.added.md [dependabot-skip] --- doc/changelog.d/3631.added.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/3631.added.md diff --git a/doc/changelog.d/3631.added.md b/doc/changelog.d/3631.added.md new file mode 100644 index 0000000000..7b3263fc30 --- /dev/null +++ b/doc/changelog.d/3631.added.md @@ -0,0 +1 @@ +REFACTOR: Iterate over the dictionary directly instead of using .keys(). \ No newline at end of file From 32e50de5b51ac5b2ad212f1f5ff1cc390409482a Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Thu, 26 Dec 2024 16:35:41 +0000 Subject: [PATCH 3/3] chore: adding changelog file 3631.added.md [dependabot-skip] --- doc/changelog.d/3631.added.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changelog.d/3631.added.md b/doc/changelog.d/3631.added.md index 7b3263fc30..58c163cb3c 100644 --- a/doc/changelog.d/3631.added.md +++ b/doc/changelog.d/3631.added.md @@ -1 +1 @@ -REFACTOR: Iterate over the dictionary directly instead of using .keys(). \ No newline at end of file +refactor: Iterate over the dictionary directly instead of using .keys(). \ No newline at end of file