Skip to content

Commit 93a89fd

Browse files
committed
Use fstrings and .format
1 parent c870678 commit 93a89fd

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

curtsies/formatstringarray.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,18 +210,18 @@ def __setitem__(self, slicetuple, value):
210210
+ self.rows[rowslice.stop :]
211211
)
212212
msg = (
213-
"You are trying to fit this value {0} into the region {1}: {2}".format(
213+
"You are trying to fit this value {} into the region {}: {}".format(
214214
fmtstr("".join(value), bg="cyan"),
215215
fmtstr("").join(grid_value),
216216
"\n ".join(grid_fsarray[x] for x in range(len(self.rows))),
217217
)
218218
)
219219
raise ValueError(
220-
"""Error you are trying to replace a region of {0} rows by {1}
221-
columns for and area of {2} with a value of len {3}. The value
220+
"""Error you are trying to replace a region of {} rows by {}
221+
columns for and area of {} with a value of len {}. The value
222222
used to replace the region must equal the area of the region
223223
replace.
224-
{4}""".format(
224+
{}""".format(
225225
rowslice.stop - rowslice.start,
226226
colslice.stop - colslice.start,
227227
area,
@@ -253,11 +253,11 @@ def diff(cls, a, b, ignore_formatting=False):
253253

254254
def underline(x):
255255
# type: (Text) -> Text
256-
return "\x1b[4m%s\x1b[0m" % (x,)
256+
return f"\x1b[4m{x}\x1b[0m"
257257

258258
def blink(x):
259259
# type: (Text) -> Text
260-
return "\x1b[5m%s\x1b[0m" % (x,)
260+
return f"\x1b[5m{x}\x1b[0m"
261261

262262
a_rows = []
263263
b_rows = []
@@ -308,13 +308,13 @@ def assertFSArraysEqual(self, a, b):
308308
self.assertEqual(
309309
(a.width, b.height),
310310
(a.width, b.height),
311-
"fsarray dimensions do not match: %s %s" % (a.shape, b.shape),
311+
f"fsarray dimensions do not match: {a.shape} {b.shape}",
312312
)
313313
for i, (a_row, b_row) in enumerate(zip(a, b)):
314314
self.assertEqual(
315315
a_row,
316316
b_row,
317-
"FSArrays differ first on line %s:\n%s" % (i, FSArray.diff(a, b)),
317+
"FSArrays differ first on line {}:\n{}".format(i, FSArray.diff(a, b)),
318318
)
319319

320320
def assertFSArraysEqualIgnoringFormatting(self, a, b):

0 commit comments

Comments
 (0)