-
Notifications
You must be signed in to change notification settings - Fork 49
chore: Perform deprecation call from generated data. #4162
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?
Conversation
deprecated_class_version.update({cls_name: deprecated}) | ||
release_version = "20" + cls._deprecated_version.replace(".", "R") | ||
r.write(f".. deprecated:: Ansys {release_version}\n\n") | ||
deprecated_class_version.update({cls_name: release_version}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prmukherj
This function is getting increasingly complex and hard to follow, especially with the addition of edge-case handling like the if deprecated:
block. A few concerns:
-
It’s now doing too much. We should consider decomposing it into smaller, well-named helper functions for clarity and testability.
-
The magic string logic for converting versions (e.g.,
replace(".", "R")
) is brittle and obscure. This logic belongs in theFluentVersion
class, where it can be centrally maintained and tested. -
Some parts (e.g.,
cls_orig_name == "root"
and hardcoded RST section generation) would benefit from explanatory comments. -
As the doc generation grows, we need to ensure we’re not making the code harder for others (or future us) to safely maintain.
Could we take a moment to refactor this function as part of this PR, or otherwise track it for near-term cleanup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly agree with all your points and we had a discussion regarding this as well with @mkundu1. Actually it was an already existing code and as part of this PR we just moved it. There will be another part to this PR that will contain some refactoring changes, for which @mkundu1 has already created a task. I'll address this as well then.
Thank you for your suggestions.
"""Whether the object is deprecated in a specific Fluent version.""" | ||
deprecated_version = getattr(obj, "_deprecated_version", None) | ||
return deprecated_version and ( | ||
float(deprecated_version) <= 22.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prmukherj Should this comparison go via the FluentVersion
class? Is it possible? (It might require FluentVersion
to be updated methinks.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, possible. Will do it.
Perform deprecation call from generated data.