8000 Remove redundant rcParam-lookup in patches by oscargus · Pull Request #22511 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Remove redundant rcParam-lookup in patches #22511

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

Merged
merged 1 commit into from
Mar 6, 2022

Conversation

oscargus
Copy link
Member

Some minor fixes for patches.

  • No need to lookup rcParam fallback in init as it is
    done in the set-methods and not used before calling set-methods.
  • patch.linewidth is a float, so represent default as float.

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

* No need to lookup rcParam fallback in __init__ as it is
done in the set-methods and not used before calling set-methods.
* patch.linewidth is a float, so represent default as float.
@@ -405,8 +401,6 @@ def set_linewidth(self, w):
"""
if w is None:
w = mpl.rcParams['patch.linewidth']
if w is None:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot really see this happening as mpl.rcParams['patch.linewidth'] should never return None. Or have I missed sometihng?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct; the validator says that it must be a float.

@oscargus oscargus changed the title Remove redundant rcParam-lookup Remove redundant rcParam-lookup in patches Feb 19, 2022
@@ -405,8 +401,6 @@ def set_linewidth(self, w):
"""
if w is None:
w = mpl.rcParams['patch.linewidth']
if w is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct; the validator says that it must be a float.

@oscargus oscargus added this to the v3.6.0 milestone Feb 27, 2022
@timhoffm timhoffm merged commit 73db9bf into matplotlib:main Mar 6, 2022
@oscargus oscargus deleted the patchpatching branch March 6, 2022 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0