Skip to content

Fix two undefined names - #10938

Merged
timhoffm merged 2 commits into
matplotlib:masterfrom
cclauss:fix-undefined-names
Apr 2, 2018
Merged

timhoffm merged 2 commits into
matplotlib:masterfrom
cclauss:fix-undefined-names

Conversation

@cclauss

@cclauss cclauss commented Apr 1, 2018

Copy link
Copy Markdown

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

anntzer commented Apr 1, 2018

Copy link
Copy Markdown
Contributor

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

cclauss commented Apr 2, 2018

Copy link
Copy Markdown
Author

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
cclauss pushed a commit to cclauss/matplotlib that referenced this pull request Apr 2, 2018
cclauss pushed a commit to cclauss/matplotlib that referenced this pull request Apr 2, 2018
cclauss pushed a commit to cclauss/matplotlib that referenced this pull request Apr 3, 2018
cclauss pushed a commit to cclauss/matplotlib that referenced this pull request Apr 3, 2018
cclauss pushed a commit to cclauss/matplotlib that referenced this pull request Apr 5, 2018
cclauss pushed a commit to cclauss/matplotlib that referenced this pull request May 8, 2018
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jun 22, 2018
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jun 22, 2018
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jun 23, 2018
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jun 29, 2018
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jul 7, 2018
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jul 7, 2018
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Jul 7, 2018
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