Skip to content

Conversation

@koubaa
Copy link
Contributor

@koubaa koubaa commented May 6, 2025

Summary by Sourcery

Modify the visualizer to hold BC (boundary condition) settings per plotter instance instead of using a global variable

Enhancements:

  • Refactor BC plot settings to be instance-specific instead of global
  • Add a lazy-loaded bc_settings property to the visualizer class

@koubaa koubaa requested a review from a team as a code owner May 6, 2025 15:55
@koubaa koubaa requested review from clatapie and germa89 and removed request for a team May 6, 2025 15:55
@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 pull request refactors boundary condition (BC) plot settings to be instance-specific rather than global. It introduces a _bc_settings attribute and a bc_settings property within the plotter class, which lazily initializes these settings using a new _make_bc_settings method. All previous usages of the global BC_plot_settings have been updated to use self.bc_settings.

File-Level Changes

Change Details Files
Replaced global BC plot settings with instance-specific, lazily-initialized settings in the plotter class.
  • Removed the global BC_plot_settings variable and its initialization logic from the _first_use() function.
  • Added a _bc_settings attribute to the plotter class, initialized to None.
  • Introduced a bc_settings property that initializes _bc_settings on first access by calling a new _make_bc_settings() method.
  • Moved the DefaultSymbol import from _first_use() to the new _make_bc_settings() method.
  • Updated methods within the plotter class (e.g., bc_nodes_plot) to use self.bc_settings for accessing BC plot configurations.
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

@germa89 germa89 mentioned this pull request May 6, 2025
@koubaa koubaa merged commit caacb20 into check-installed-without-import May 6, 2025
31 of 34 checks passed
@koubaa koubaa deleted the bc-settings-per-plotter branch May 6, 2025 16:02
@codecov
Copy link

codecov bot commented May 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.28%. Comparing base (240c3b8) to head (1ebc17b).
Report is 1 commits behind head on check-installed-without-import.

Additional details and impacted files
@@                        Coverage Diff                         @@
##           check-installed-without-import    #3897      +/-   ##
==================================================================
- Coverage                           88.28%   88.28%   -0.01%     
==================================================================
  Files                                 187      187              
  Lines                               14823    14830       +7     
==================================================================
+ Hits                                13087    13092       +5     
- Misses                               1736     1738       +2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

koubaa added a commit that referenced this pull request May 7, 2025
…ing ansys.mapdl.core (#3887)

* change how the install check works

* chore: adding changelog file 3887.miscellaneous.md [dependabot-skip]

* chore: adding changelog file 3887.added.md [dependabot-skip]

* don't expect requests to be loaded on import

* only set the default theme once

* use default symbol

* Don't import plotter from visualizer by default

Don't import plotter from post module

* ci: auto fixes from pre-commit.com hooks.

for more information, see https://pre-commit.ci

* remove global import of Plotter

* chore: adding changelog file 3887.added.md [dependabot-skip]

* cicd: empty commit to retrigger CICD

* fix ci

* update

* fix autodoc

* hold the bc settings per plotter instance (#3897)

* hold the bc settings per plotter instance

* ci: auto fixes from pre-commit.com hooks.

for more information, see https://pre-commit.ci

* chore: adding changelog file 3897.miscellaneous.md [dependabot-skip]

---------

Co-authored-by: Mohamed Koubaa <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: pyansys-ci-bot <[email protected]>

* add docstring

* type hint

---------

Co-authored-by: Mohamed Koubaa <[email protected]>
Co-authored-by: pyansys-ci-bot <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: German <[email protected]>
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