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

fix: Remove _get_child_object_display_names which is via get_specs #3430

Merged
merged 3 commits into from
Oct 29, 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
21 changes: 12 additions & 9 deletions src/ansys/fluent/core/services/datamodel_se.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand All @@ -1538,15 +1541,15 @@ 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__}")(
self.service, self.rules, child_path
)

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__}")(
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/utils/networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/fluent/core/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down