Skip to content

Fix two undefined names #10938

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 2 commits into from
Apr 2, 2018
Merged

Conversation

cclauss
Copy link

@cclauss cclauss commented Apr 1, 2018

PR Summary

Fix two undefined names:

  • import inspect in decorators.py
  • Change ret --> __ret in pyplot.py

The pyplot.py change is probably not useful as this is generated code but it does highlight a bug in the code generator.

Fixes:

$ python3 -m flake8 . --count --select=E9,F821,F822,F823 --show-source --statistics
./lib/matplotlib/pyplot.py:2837:19: F821 undefined name 'ret'
    if isinstance(ret, cm.ScalarMappable): sci(__ret)
                  ^
./lib/matplotlib/testing/decorators.py:88:12: F821 undefined name 'inspect'
        if inspect.isgeneratorfunction(func):
           ^
2     F821 undefined name 'ret'

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 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

@anntzer
Copy link
Contributor

anntzer commented Apr 1, 2018

The bug is in tools/boilerplate.py (in the cmappable dict); do you mind editing it there as well? Thanks!

A more permanent fix to the undefined name issue.
@timhoffm timhoffm merged commit cc44f57 into matplotlib:master Apr 2, 2018
@QuLogic QuLogic added this to the v3.0 milestone Apr 2, 2018
@cclauss cclauss deleted the fix-undefined-names branch April 2, 2018 04:58
@cclauss
Copy link
Author

cclauss commented Apr 2, 2018

Thanks for this. I would like to add python3 -m flake8 . --count --select=E9,F821,F822,F823 --show-source --statistics to the matplotlib testing so that we do not have any backsliding on undefined names (F821 and F822) that other linters do not seem to cover. In which file would you advise that I try adding that test?

cclauss pushed a commit to cclauss/matplotlib that referenced this pull request Apr 2, 2018
As discussed at matplotlib#10938 (comment) _undefined names_ have [occurred often in the past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed) and this change would help to avoid recurrence in the future.
cclauss pushed a commit to cclauss/matplotlib that referenced this pull request Apr 2, 2018
As discussed at matplotlib#10938 (comment) _undefined names_ have [occurred often in the past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed) and this change would help to avoid recurrence in the future.
cclauss pushed a commit to cclauss/matplotlib that referenced this pull request Apr 2, 2018
As discussed at matplotlib#10938 (comment) _undefined names_ have [occurred often in the past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed) and this change would help to avoid recurrence in the future.
cclauss pushed a commit to cclauss/matplotlib that referenced this pull request Apr 3, 2018
As discussed at matplotlib#10938 (comment) _undefined names_ have [occurred often in the past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed) and this change would help to avoid recurrence in the future.
cclauss pushed a commit to cclauss/matplotlib that referenced this pull request Apr 3, 2018
As discussed at matplotlib#10938 (comment) _undefined names_ have [occurred often in the past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed) and this change would help to avoid recurrence in the future.
cclauss pushed a commit to cclauss/matplotlib that referenced this pull request Apr 5, 2018
As discussed at matplotlib#10938 (comment) _undefined names_ have [occurred often in the past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed) and this change would help to avoid recurrence in the future.
cclauss pushed a commit to cclauss/matplotlib that referenced this pull request May 8, 2018
As discussed at matplotlib#10938 (comment) _undefined names_ have [occurred often in the past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed) and this change would help to avoid recurrence in the future.
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jun 22, 2018
As discussed at
matplotlib#10938 (comment)
_undefined names_ have [occurred often in the
past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed)
and this change would help to avoid recurrence in the future.
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jun 22, 2018
As discussed at
matplotlib#10938 (comment)
_undefined names_ have [occurred often in the
past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed)
and this change would help to avoid recurrence in the future.
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jun 23, 2018
As discussed at
matplotlib#10938 (comment)
_undefined names_ have [occurred often in the
past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed)
and this change would help to avoid recurrence in the future.
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jun 29, 2018
As discussed at
matplotlib#10938 (comment)
_undefined names_ have [occurred often in the
past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed)
and this change would help to avoid recurrence in the future.
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jul 7, 2018
As discussed at
matplotlib#10938 (comment)
_undefined names_ have [occurred often in the
past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed)
and this change would help to avoid recurrence in the future.
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jul 7, 2018
As discussed at
matplotlib#10938 (comment)
_undefined names_ have [occurred often in the
past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed)
and this change would help to avoid recurrence in the future.
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jul 7, 2018
As discussed at
matplotlib#10938 (comment)
_undefined names_ have [occurred often in the
past](https://github.com/matplotlib/matplotlib/pulls?q=is%3Apr+author%3Acclauss+is%3Aclosed)
and this change would help to avoid recurrence in the future.
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