-
Notifications
You must be signed in to change notification settings - Fork 150
REFACTOR: deprecate all methods that wrap analyze() #6050
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
Conversation
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (7.69%) is below the target coverage (85.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #6050 +/- ##
===========================================
- Coverage 85.13% 18.16% -66.98%
===========================================
Files 167 167
Lines 63042 63067 +25
===========================================
- Hits 53672 11454 -42218
- Misses 9370 51613 +42243 🚀 New features to boost your workflow:
|
@Samuelopez-ansys in emit che get_revision embedd the analyze without exposing any argument in the method. Should we remove this check if revisions == 0 then analyze? |
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.
@Alberto-DM @SMoraisAnsys @Samuelopez-ansys blocking this one. These methods + export_results() in analysis.py must have a decorator to handle analyze depreacation:
import functools
import inspect
import warnings
def deprecate_argument(arg_name: str, message: str = None):
"""
Decorator to deprecate a specific argument (positional or keyword) in a function.
Parameters:
arg_name (str): The name of the deprecated argument.
message (str, optional): Custom deprecation message.
"""
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
sig = inspect.signature(func)
try:
bound_args = sig.bind_partial(*args, **kwargs)
bound_args.apply_defaults()
except TypeError:
# In case of incomplete binding (e.g. missing required args), skip
return func(*args, **kwargs)
if arg_name in bound_args.arguments:
warn_msg = message or f"Argument '{arg_name}' is deprecated and will be removed in a future version."
warnings.warn(warn_msg, DeprecationWarning, stacklevel=2)
return func(*args, **kwargs)
return wrapper
return decorator
closing as per duplicate of #6086. |
Description
In this PR "analyze" argument has been deleted from the methods launching an warning message that this argument will be deprecated soon.
Checklist