Skip to content

Commit 8840afb

Browse files
feat: Add _has_migration_adapter bool to flobject classes (#4397)
Corresponding Fluent PR - 615951 When `_has_migration_adapter` is true for a setting object, we shall skip type-checking within set-state (not added in this PR). --------- Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent abc92ba commit 8840afb

File tree

5 files changed

+11
-2
lines changed

5 files changed

+11
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ permissions:
2222
issues: write
2323

2424
env:
25-
API_CODE_CACHE: 5
25+
API_CODE_CACHE: 6
2626
DOCUMENTATION_CNAME: "fluent.docs.pyansys.com"
2727
PACKAGE_NAME: "ansys-fluent-core"
2828
PACKAGE_NAMESPACE: "ansys.fluent.core"

doc/changelog.d/4397.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add _has_migration_adapter bool to flobject classes

src/ansys/fluent/core/codegen/settingsgen.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ def _populate_data(cls, api_tree: dict, version: str) -> dict:
153153
else:
154154
data["child_object_type"] = None
155155
data["allowed_values"] = getattr(cls, "_allowed_values", [])
156+
data["has_migration_adapter"] = getattr(cls, "_has_migration_adapter", False)
156157
return data
157158

158159

@@ -319,6 +320,9 @@ def _write_data(cls_name: str, python_name: str, data: dict, f: IO, f_stub: IO |
319320
if data["allowed_values"]:
320321
s.write(f" _allowed_values = {data['allowed_values']!r}\n")
321322
s_stub.write(" _allowed_values: list[str]\n")
323+
if data["has_migration_adapter"]:
324+
s.write(" _has_migration_adapter = True\n")
325+
s_stub.write(" _has_migration_adapter: bool\n")
322326
s.write("\n")
323327
s_stub.write("\n")
324328
for name, (python_name, data, hash_, should_write_stub) in classes_to_write.items():

src/ansys/fluent/core/services/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def get_static_info(self) -> dict[str, Any]:
335335
"""
336336
request = SettingsModule.GetStaticInfoRequest()
337337
request.root = "fluent"
338-
request.optional_attrs.append("allowed-values")
338+
request.optional_attrs.extend(["allowed-values", "has-migration-adapter?"])
339339
response = self._service_impl.get_static_info(request)
340340
# The RPC calls no longer raise an exception. Force an exception if
341341
# type is empty

src/ansys/fluent/core/solver/flobject.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,6 +2282,10 @@ def _process_cls_names(info_dict, names, write_doc=False):
22822282
)
22832283
cls._allowed_values = allowed_values
22842284

2285+
has_migration_adapter = info.get("has-migration-adapter?", False)
2286+
if has_migration_adapter:
2287+
cls._has_migration_adapter = True
2288+
22852289
except Exception:
22862290
print(
22872291
f"Unable to construct class for '{name}' of "

0 commit comments

Comments
 (0)