-
Notifications
You must be signed in to change notification settings - Fork 74
chore: Unify schema attrs in flobject.py #5256
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
bc7ee0a
25c7fab
46c28ae
21abe00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Unify schema attrs in flobject.py |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
@@ -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,) | ||
|
|
@@ -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 | ||
|
|
@@ -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", []) | ||
| if allowed_values: | ||
| for allowed_value in allowed_values: | ||
| setattr( | ||
|
|
@@ -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) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Please also note: https://github.com/ansys-internal/ansys-api-fluent/issues/121
prmukherj marked this conversation as resolved.
Outdated
|
||
| if has_migration_adapter: | ||
| cls._has_migration_adapter = True | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.