Skip to content

Add missing use of string formatter in error messages

Bitbucket Importer requested to merge bitbucket/merged-pr-287 into branch/2.5

Created originally on Bitbucket by tehhowch (Benjamin Hauch)

Was already merged in Bitbucket before import, marked as merged by the import user

  • Also added missing / as path separator for test coverage output

I ran some grep regex on the repo and didn’t pick up any other obvious missing string formatters:

grep -nir -P "\\(.*\{0\}" * | fgrep -v "format"
grep -nir -P "\\(.*\{\d\}" * | fgrep -v "format"
grep -nir -P "raise " * | fgrep -v ".format"

It's possible these utility methods should not throw just because they were (range_boundaries & others) or were not (range_to_tuple) given a valid coordinate or range with a sheet name attached. That's a larger design issue that shouldn't hold up this PR.

One blocked use case is sorting a MultiCellRange's ranges via the key function, in order to minimize the changeset if serializing the addresses (e.g. to JSON) or provide some other logical assertions about working with the result.

mcr = get_MultiCellRange_somehow()
ranges = ' '.join(mcr.ranges)).split() # optional
ranges.sort(key=range_to_tuple) # all ranges must be fully qualified
ranges.sort(key=range_boundaries) # no ranges can be fully qualified

It’s still possible to sort, but one has to write their own key function to do it.

Merge request reports