Skip to content

Python 2.6 string format syntax errors in matplotlib 1.4.3 #5703

Closed

Description

@jayvdb

There are quite a few Python 2.6 string format syntax errors in 1.4.3. I found them using https://github.com/xZise/flake8-string-format (and git grep {} due to xZise/flake8-string-format#10).

Some have already been fixed by @montefra in 1.5.x:

I've submitted two PRs to fix other related issues:

matplotlib 1.4.x supposedly supports Python 2.6, but the 1.4.3 release indicates that it is the last patch release, and there is no 1.4.x branch that I can submit PRs to.
Ironically, this means that 1.5.x supports Python 2.6 better than the 1.4.x series.

I've packaged five commits ready to be merged into 1.4.x, if desired.
https://github.com/jayvdb/matplotlib/tree/v1.4.3-py26-str.format

Activity

  1. tacaswell commented on Dec 20, 2015

    @tacaswell
    Member

    Thanks for taking the time to look into this.

    Unfortunately, we no longer support the 1.4.x series.

    The 1.5 series does not 'officially' support 2.6, but we are still testing it against 2.6 and if you put in a PR to 1.5.x to fix these formatting issues I will merge it.

    Going forward we will not support py2.6 at all (there is 2.6 incompatible code currently on both the 2.x and master branches).

  2. jayvdb commented on Dec 21, 2015

    @jayvdb
    ContributorAuthor

    @tacaswell, much appreciated, especially for backporting those changes to 1.5.x.

    There are quite a few more uses of {} on the 1.5.x branch (see below). The py26 tests must not be covering those lines. Are you interested in having those fixed? I'll be happy to send through PRs for them.

    Would you be interested in a patch that implements https://github.com/xZise/flake8-string-format checking on the 1.5.x branch, to catch possible string format 2.6 bugs early ?
    If there is an aversion to using flake8, that checker can be run without flake8 already.

    [v1.5.x]$ find . -name '*.py' | grep -v axes_zoom_effect | grep -v threading_test | xargs python3.4 -m flake8_string_format 
    ./examples/api/filled_step.py:45:42: P202 format call uses missing keyword ('h', 'v')
    ./lib/mpl_toolkits/axes_grid1/axes_rgb.py:207:30: P101 format string does contain unindexed parameters
    ./lib/matplotlib/figure.py:494:0: P102 docstring does contain unindexed parameters
    ./lib/matplotlib/tests/test_mathtext.py:61:5: P103 other string does contain unindexed parameters
    ./lib/matplotlib/tests/test_mathtext.py:195:10: P103 other string does contain unindexed parameters
    ./lib/matplotlib/tests/test_mathtext.py:198:10: P103 other string does contain unindexed parameters
    ./lib/matplotlib/tests/test_mathtext.py:200:10: P103 other string does contain unindexed parameters
    ./lib/matplotlib/tests/test_mathtext.py:202:10: P103 other string does contain unindexed parameters
    ./lib/matplotlib/tests/test_mathtext.py:204:10: P103 other string does contain unindexed parameters
    ./lib/matplotlib/tests/test_mathtext.py:208:10: P103 other string does contain unindexed parameters
    ./lib/matplotlib/tests/test_ticker.py:71:0: P102 docstring does contain unindexed parameters
    ./lib/matplotlib/table.py:347:0: P102 docstring does contain unindexed parameters
    ./lib/matplotlib/artist.py:999:26: P101 format string does contain unindexed parameters
    ./lib/matplotlib/ticker.py:831:17: P101 format string does contain unindexed parameters
    ./lib/matplotlib/ticker.py:834:21: P101 format string does contain unindexed parameters
    ./lib/matplotlib/ticker.py:836:21: P101 format string does contain unindexed parameters
    ./lib/matplotlib/ticker.py:839:21: P101 format string does contain unindexed parameters
    ./lib/matplotlib/ticker.py:841:21: P101 format string does contain unindexed parameters
    ./lib/matplotlib/afm.py:333:0: P102 docstring does contain unindexed parameters
    ./lib/matplotlib/type1font.py:142:28: P103 other string does contain unindexed parameters
    ./lib/matplotlib/axes/_base.py:3596:0: P102 docstring does contain unindexed parameters
    ./lib/matplotlib/mathtext.py:2222:35: P103 other string does contain unindexed parameters
    ./lib/matplotlib/patches.py:144:0: P102 docstring does contain unindexed parameters
    ./lib/matplotlib/lines.py:1050:35: P101 format string does contain unindexed parameters
    ./lib/matplotlib/dates.py:710:29: P103 other string does contain unindexed parameters
    ./versioneer.py:932:0: P103 other string does contain unindexed parameters
    

    (many of those are false positives; I'll find a way to fix or whitelist those lines which are not actually a problem.)

    It could also be useful on master, to catch problems like the first one in the list above, which is PR #5707.

  3. Zac-HD commented on Jan 8, 2018

    @Zac-HD
    Contributor

    Ping @tacaswell; this can probably be closed now.

  4. efiring commented on Jan 8, 2018

    @efiring
    Member

    Good point. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions