Skip to content

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

Closed

Conversation

anur7
Copy link
Contributor

@anur7 anur7 commented Apr 15, 2025

Description

In this PR "analyze" argument has been deleted from the methods launching an warning message that this argument will be deprecated soon.

Checklist

  • I have tested my changes locally.
  • I have added necessary documentation or updated existing documentation.
  • I have followed the coding style guidelines of this project.
  • I have added appropriate tests (unit, integration, system).
  • I have reviewed my changes before submitting this pull request.
  • I have linked the issue or issues that are solved by the PR if any.
  • I have agreed with the Contributor License Agreement (CLA).

@anur7 anur7 self-assigned this Apr 15, 2025
@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@anur7 anur7 linked an issue Apr 15, 2025 that may be closed by this pull request
Copy link

codecov bot commented Apr 15, 2025

Codecov Report

Attention: Patch coverage is 7.69231% with 24 lines in your changes missing coverage. Please review.

Project coverage is 18.16%. Comparing base (979f6c2) to head (72395fb).
Report is 24 commits behind head on main.

❌ 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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@anur7
Copy link
Contributor Author

anur7 commented Apr 15, 2025

@gmalinve
analyze()

@gmalinve
Copy link
Contributor

@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?

Copy link
Contributor

@gmalinve gmalinve left a 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

@gmalinve
Copy link
Contributor

closing as per duplicate of #6086.

@gmalinve gmalinve closed this Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants