Skip to content

Conversation

@germa89
Copy link
Collaborator

@germa89 germa89 commented May 6, 2025

Proposal.

Summary by Sourcery

Refactor the first-use initialization of plotting settings in the MAPDL visualizer module

Enhancements:

  • Introduce a new BC_plot_settings class for more flexible plot settings configuration
  • Modify the first-use initialization logic to be more modular

Chores:

  • Rename global variable from _FIRST_USE_RUN to _first_use_run to follow Python naming conventions

@germa89 germa89 requested a review from a team as a code owner May 6, 2025 15:47
@germa89 germa89 requested review from clatapie and pyansys-ci-bot and removed request for a team May 6, 2025 15:47
@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

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented May 6, 2025

Reviewer's Guide

This PR refactors the plotting initialization mechanism. It introduces BC_plot_settings, a new callable class responsible for providing DefaultSymbol instances. Accordingly, the _first_use function has been updated to remove the direct instantiation of DefaultSymbol. A global flag, _FIRST_USE_RUN, has also been renamed to _first_use_run for naming consistency.

Class Diagram: Introduced BC_plot_settings Class

classDiagram
    class BC_plot_settings {
        +__call__(name: str) DefaultSymbol
    }
    class DefaultSymbol {
        # External class, details elided
        # Assumed to be the type of the instance returned
    }
    BC_plot_settings ..> DefaultSymbol : "returns instance of"
    note for BC_plot_settings "New callable class. Instances provide DefaultSymbol objects when called."
Loading

File-Level Changes

Change Details Files
Introduced BC_plot_settings class for DefaultSymbol provisioning.
  • Defined BC_plot_settings as a new callable class.
  • Its __call__ method imports and returns a DefaultSymbol instance.
src/ansys/mapdl/core/plotting/visualizer.py
Refactored _first_use function and related global variable.
  • Renamed global variable _FIRST_USE_RUN to _first_use_run.
  • Removed direct instantiation of DefaultSymbol from the _first_use function.
  • Removed the local import of DefaultSymbol from the _first_use function.
src/ansys/mapdl/core/plotting/visualizer.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added the bug Issue, problem or error in PyMAPDL label May 6, 2025
@germa89
Copy link
Collaborator Author

germa89 commented May 6, 2025

Deprecated in favour of #3897

@germa89 germa89 closed this May 6, 2025
@germa89 germa89 deleted the germa89/suggestion branch May 19, 2025 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue, problem or error in PyMAPDL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants