Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
19 changes: 8 additions & 11 deletions src/ansys/fluent/core/solver/flobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,9 +819,14 @@ def to_python_keys(cls, value: StateT) -> StateT:
"""
return value

def __call__(self) -> StateT:
"""Alias for self.get_state."""
return self.get_state()
def __call__(self, *args, **kwargs):
"""Get or set the state of the object."""
if kwargs:
self.set_state(kwargs)
elif args:
self.set_state(args)
else:
return self.get_state()

def get_state(self) -> StateT:
"""Get the state of the object."""
Expand Down Expand Up @@ -1065,14 +1070,6 @@ def __init__(self, name: str | None = None, parent=None):
cls = self.__class__._child_classes[query]
self._setattr(query, _create_child(cls, None, self))

def __call__(self, *args, **kwargs):
if kwargs:
self.set_state(kwargs)
elif args:
self.set_state(args)
else:
return self.get_state()

@classmethod
def to_scheme_keys(cls, value, root_cls, path: list[str]):
"""Convert value to have keys with scheme names.
Expand Down
50 changes: 25 additions & 25 deletions tests/test_flobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,34 +1223,34 @@ def test_default_argument_names_for_commands(static_mixer_settings_session):
solver = static_mixer_settings_session

if solver.get_fluent_version() >= FluentVersion.v251:
assert set(solver.results.graphics.contour.command_names) == {
"create",
"delete",
"rename",
"list",
"list_properties",
"make_a_copy",
"display",
"add_to_graphics",
"clear_history",
}
assert set(solver.results.graphics.contour.command_names).issuperset(
{
"create",
"delete",
"rename",
"make_a_copy",
"display",
"add_to_graphics",
"clear_history",
}
)
else:
assert set(solver.results.graphics.contour.command_names) == {
"delete",
"rename",
"list",
"list_properties",
"make_a_copy",
"display",
"copy",
"add_to_graphics",
"clear_history",
}
assert set(solver.results.graphics.contour.command_names).issuperset(
{
"delete",
"rename",
"make_a_copy",
"display",
"copy",
"add_to_graphics",
"clear_history",
}
)

assert solver.results.graphics.contour.rename.argument_names == ["new", "old"]
assert set(solver.results.graphics.contour.rename.argument_names).issuperset(
{"new", "old"}
)
assert solver.results.graphics.contour.delete.argument_names == ["name_list"]
# The following is the default behavior when no arguments are associated with the command.
assert solver.results.graphics.contour.list.argument_names == []


@pytest.mark.fluent_version(">=25.1")
Expand Down
Loading