8000 Delete some `if __name__ == "__main__"` clauses. by anntzer · Pull Request #12717 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Delete some if __name__ == "__main__" clauses. #12717

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
Nov 4, 2018

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Nov 2, 2018

In offsetbox and mpl_axes, they are just examples (mpl_axes doesn't even
call show()); if anything the examples belong in the examples/
directory but they don't look particularly worth moving there either.

In rcsetup, the clause is checking that the defaults in rcParams don't
get modified by the validators. If anything this should be a test, but
it doesn't look like it mattered. I did fix text.latex.preamble,
pgf.preamble, and keymap.fullscreen to be idempotent under the
validator; now the only rcParam that gets changed is savefig.bbox (due
to the presence of the "standard" / None synonym) but again this isn't a
problem.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

In offsetbox and mpl_axes, they are just examples (mpl_axes doesn't even
call `show()`); if anything the examples belong in the examples/
directory but they don't look particularly worth moving there either.

In rcsetup, the clause is checking that the defaults in rcParams don't
get modified by the validators.  If anything this should be a test, but
it doesn't look like it mattered.  I did fix `text.latex.preamble`,
`pgf.preamble`, and `keymap.fullscreen` to be idempotent under the
validator; now the only rcParam that gets changed is `savefig.bbox` (due
to the presence of the "standard" / None synonym) but again this isn't a
problem.
@anntzer anntzer added this to the v3.1 milestone Nov 2, 2018
@@ -1115,7 +1115,7 @@ def _validate_linestyle(ls):
'text.color': ['black', validate_color],
'text.usetex': [False, validate_bool],
'text.latex.unicode': [True, validate_bool],
'text.latex.preamble': [[''], validate_stringlist],
'text.latex.preamble': [[], validate_stringlist],
Copy link
Member

Choose a reason for hiding this comment

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

This change appears unrelated.

Copy link
Contributor Author
@anntzer anntzer Nov 2, 2018

Choose a reason for hiding this comment

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

That's because matplotlib.rcsetup.validate_stringlist([""]) == [] (i.e. the default is actually stored as [], not [""]) so the code I deleted complained that the validator was not idempotent here.

@tacaswell tacaswell merged commit 9406ff0 into matplotlib:master Nov 4, 2018
@anntzer anntzer deleted the ifmain branch November 4, 2018 09:23
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.

4 participants
0