Skip to content
Draft
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
1 change: 1 addition & 0 deletions doc/changelog.d/5256.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unify schema attrs in flobject.py
28 changes: 11 additions & 17 deletions src/ansys/fluent/core/solver/flobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -2450,12 +2450,8 @@ def get_cls(name, info, parent=None, version=None, parent_taboo=None):
else:
dct["__doc__"] = f"'{pname.strip('_')}' child."

include_child_named_objects = info.get(
"include-child-named-objects?", False
) or info.get("include_child_named_objects", False)
user_creatable = info.get("user-creatable?", False) or info.get(
"user_creatable", False
)
include_child_named_objects = info.get("include_child_named_objects", False)
user_creatable = info.get("user_creatable", False)

if version == "222":
user_creatable = True
Expand All @@ -2470,7 +2466,7 @@ def get_cls(name, info, parent=None, version=None, parent_taboo=None):
bases = bases + (CreatableNamedObjectMixin,)
elif obj_type == "named-object":
bases = bases + (_NonCreatableNamedObjectMixin,)
elif info.get("has-allowed-values"):
elif info.get("has_allowed_values"):
bases += (AllowedValuesMixin,)
elif info.get("file_purpose") == "input":
bases += (_InputFile,)
Expand Down Expand Up @@ -2583,23 +2579,21 @@ def _process_cls_names(info_dict, names, write_doc=False):
if version < "242":
cls.return_type = "object"
else:
return_type = info.get("return-type") or info.get("return_type")
return_type = info.get("return_type")
if return_type:
cls.return_type = return_type

object_type = info.get("object-type", False) or info.get("object_type", False)
object_type = info.get("object_type", False)
if object_type:
cls.child_object_type, _ = get_cls(
"child-object-type", object_type, cls, version=version
)
cls.child_object_type.get_name = lambda self: self._name

child_aliases = info.get("child-aliases") or info.get("child_aliases", {})
command_aliases = info.get("command-aliases") or info.get("command_aliases", {})
query_aliases = info.get("query-aliases") or info.get("query_aliases", {})
arguments_aliases = info.get("arguments-aliases") or info.get(
"arguments_aliases", {}
)
child_aliases = info.get("child_aliases", {})
command_aliases = info.get("command_aliases", {})
query_aliases = info.get("query_aliases", {})
arguments_aliases = info.get("arguments_aliases", {})
if child_aliases or command_aliases or query_aliases or arguments_aliases:
cls._child_aliases = {}
# No need to differentiate in the Python implementation
Expand All @@ -2615,7 +2609,7 @@ def _process_cls_names(info_dict, names, write_doc=False):
k,
)

allowed_values = info.get("allowed-values") or info.get("allowed_values", [])
allowed_values = info.get("allowed_values", [])
Comment thread
prmukherj marked this conversation as resolved.
Outdated
if allowed_values:
for allowed_value in allowed_values:
setattr(
Expand All @@ -2625,7 +2619,7 @@ def _process_cls_names(info_dict, names, write_doc=False):
)
cls._allowed_values = allowed_values

has_migration_adapter = info.get("has-migration-adapter?", False)
has_migration_adapter = info.get("has_migration_adapter", False)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only this we need to add. I am not sure how it was getting propagated from settings side as I could not find this attribute in the schema (proto of in the server code.)
@mkundu1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prmukherj Please see https://github.com/ansys-internal/ansys-api-fluent/pull/180/changes how the settings schema can be restructured to avoid the dynamic attrs and the scheme names like has-migration-adapter? etc.

Please also note: https://github.com/ansys-internal/ansys-api-fluent/issues/121

Comment thread
prmukherj marked this conversation as resolved.
Outdated
if has_migration_adapter:
cls._has_migration_adapter = True

Expand Down
Loading