diff --git a/src/ansys/fluent/core/services/datamodel_se.py b/src/ansys/fluent/core/services/datamodel_se.py index 09329129cb2..e32aad024ef 100644 --- a/src/ansys/fluent/core/services/datamodel_se.py +++ b/src/ansys/fluent/core/services/datamodel_se.py @@ -1514,9 +1514,12 @@ def _get_child_object_display_names(self) -> list[str]: def get_object_names(self) -> Any: """Displays the name of objects within a container.""" - return self.service.get_object_names( - self.rules, convert_path_to_se_path(self.path) - ) + if self.service.version <= FluentVersion.v241: + return self._get_child_object_display_names() + else: + return self.service.get_object_names( + self.rules, convert_path_to_se_path(self.path) + ) getChildObjectDisplayNames = get_object_names @@ -1528,7 +1531,7 @@ def __len__(self) -> int: int Count of child objects. """ - return len(self._get_child_object_display_names()) + return len(self.get_object_names()) def __iter__(self) -> Iterator[PyMenu]: """Return the next child object. @@ -1538,7 +1541,7 @@ def __iter__(self) -> Iterator[PyMenu]: Iterator[PyMenu] Iterator of child objects. """ - for name in self._get_child_object_display_names(): + for name in self.get_object_names(): child_path = self.path[:-1] child_path.append((self.path[-1][0], name)) yield getattr(self.__class__, f"_{self.__class__.__name__}")( @@ -1546,7 +1549,7 @@ def __iter__(self) -> Iterator[PyMenu]: ) def _get_item(self, key: str) -> PyMenu: - if key in self._get_child_object_display_names(): + if key in self.get_object_names(): child_path = self.path[:-1] child_path.append((self.path[-1][0], key)) return getattr(self.__class__, f"_{self.__class__.__name__}")( @@ -1558,7 +1561,7 @@ def _get_item(self, key: str) -> PyMenu: ) def _del_item(self, key: str) -> None: - if key in self._get_child_object_display_names(): + if key in self.get_object_names(): child_path = self.path[:-1] child_path.append((self.path[-1][0], key)) se_path = convert_path_to_se_path(child_path) @@ -2231,13 +2234,13 @@ class PyNamedObjectContainerGeneric(PyNamedObjectContainer): available.""" def __iter__(self) -> Iterator[PyMenuGeneric]: - for name in self._get_child_object_display_names(): + for name in self.get_object_names(): child_path = self.path[:-1] child_path.append((self.path[-1][0], name)) yield PyMenuGeneric(self.service, self.rules, child_path) def _get_item(self, key: str) -> PyMenuGeneric: - if key in self._get_child_object_display_names(): + if key in self.get_object_names(): child_path = self.path[:-1] child_path.append((self.path[-1][0], key)) return PyMenuGeneric(self.service, self.rules, child_path) diff --git a/src/ansys/fluent/core/utils/networking.py b/src/ansys/fluent/core/utils/networking.py index 9161f61e3df..003e1713808 100644 --- a/src/ansys/fluent/core/utils/networking.py +++ b/src/ansys/fluent/core/utils/networking.py @@ -4,7 +4,7 @@ import logging import socket from typing import Any -import urllib +import urllib.request import grpc from grpc_health.v1 import health_pb2, health_pb2_grpc diff --git a/src/ansys/fluent/core/workflow.py b/src/ansys/fluent/core/workflow.py index 9e65cb5a847..8f1c19c443b 100644 --- a/src/ansys/fluent/core/workflow.py +++ b/src/ansys/fluent/core/workflow.py @@ -631,7 +631,7 @@ def __iter__(self) -> Iterator[BaseTask]: Iterator[BaseTask] Iterator of child objects. """ - for name in self._get_child_object_display_names(): + for name in self.get_object_names(): yield self[name] def __getitem__(self, name):