Skip to content

BUG: Fix formatting error in GridSpec.__repr__ #17131

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 14, 2020

Conversation

lpsinger
Copy link
Contributor

Fix this error in GridSpec.__repr__ when formatting the
width_ratios or height_ratios arguments:

TypeError: not all arguments converted during string formatting

Fix this error in `GridSpec.__repr__` when formatting the
`width_ratios` or `height_ratios` arguments:

    TypeError: not all arguments converted during string formatting
@tacaswell
Copy link
Member

Thanks! What input reproduces this? It would be good to get a test so it does not come back.

@QuLogic
Copy link
Member

QuLogic commented Apr 14, 2020

Looks like you just need to specify one of the args, i.e., in a REPL:

>>> import matplotlib.pyplot as plt
>>> plt.GridSpec(2, 2, height_ratios=(1, 2))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "lib/matplotlib/gridspec.py", line 52, in __repr__
    if self._row_height_ratios is not None else '')
TypeError: not all arguments converted during string formatting

Copy link
Contributor

@anntzer anntzer left a comment

Choose a reason for hiding this comment

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

... or we can just fstringify this and the trap won't exist anymore...

@tacaswell tacaswell added this to the v3.2.2 milestone Apr 14, 2020
Copy link
Contributor

@anntzer anntzer left a comment

Choose a reason for hiding this comment

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

can be merged postci

@jklymak jklymak merged commit 7c2057b into matplotlib:master Apr 14, 2020
@lumberbot-app
Copy link

lumberbot-app bot commented Apr 14, 2020

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.2.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 7c2057b7647648388b923af3a4568700fcd10395
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #17131: BUG: Fix formatting error in GridSpec.__repr__'
  1. Push to a named branch :
git push YOURFORK v3.2.x:auto-backport-of-pr-17131-on-v3.2.x
  1. Create a PR against branch v3.2.x, I would have named this PR:

"Backport PR #17131 on branch v3.2.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

@lpsinger lpsinger deleted the fix-gridspec-format-error branch April 14, 2020 15:35
@tacaswell
Copy link
Member

Looks like this never worked with the ratios back to when it came in for 3.0.

timhoffm pushed a commit to timhoffm/matplotlib that referenced this pull request Apr 18, 2020
QuLogic added a commit that referenced this pull request Apr 22, 2020
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.

6 participants