Skip to content

Commit

Permalink
chore: Run pyupgrade --py38-plus **/*.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Oct 3, 2023
1 parent 9b7daa5 commit 9375e0d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion agate/mapped_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __unicode__(self):
if len(self) > 5:
sample = '%s, ...' % sample

return '<agate.{}: ({})>'.format(type(self).__name__, sample)
return f'<agate.{type(self).__name__}: ({sample})>'

def __str__(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion agate/table/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def __init__(self, rows, column_names=None, column_types=None, row_names=None, _
try:
row_values.append(cast_funcs[j](d))
except CastError as e:
raise CastError(str(e) + ' Error at row {} column {}.'.format(i, self._column_names[j]))
raise CastError(str(e) + f' Error at row {i} column {self._column_names[j]}.')

new_rows.append(Row(row_values, self._column_names))
else:
Expand Down
2 changes: 1 addition & 1 deletion agate/table/bins.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def name_bin(i, j, first_exclusive=True, last_exclusive=False):
exclusive = format_decimal(j, format=break_formatter)

output = '[' if first_exclusive else '('
output += '{} - {}'.format(inclusive, exclusive)
output += f'{inclusive} - {exclusive}'
output += ']' if last_exclusive else ')'

return output
Expand Down
4 changes: 2 additions & 2 deletions agate/table/print_bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def write(line):
output.write(line + '\n')

# Chart top
top_line = '{} {}'.format(y_label.ljust(max_label_width), x_label.rjust(max_value_width))
top_line = f'{y_label.ljust(max_label_width)} {x_label.rjust(max_value_width)}'
write(top_line)

# Bars
Expand Down Expand Up @@ -210,7 +210,7 @@ def write(line):

bar = bar.ljust(plot_width)

write('{} {} {}'.format(label_text, value_text, bar))
write(f'{label_text} {value_text} {bar}')

# Axis & ticks
axis = horizontal_line * plot_width
Expand Down
2 changes: 1 addition & 1 deletion agate/table/print_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def write_row(formatted_row):

text = v_line.join(row_output)

write('{}{}{}'.format(v_line, text, v_line))
write(f'{v_line}{text}{v_line}')

divider = '{v_line} {columns} {v_line}'.format(
v_line=v_line,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,5 @@ def test_sniffer(self):
actual = csv_py3.Sniffer().sniff(contents).__dict__
expected = csv.Sniffer().sniff(contents).__dict__

self.assertEqual(direct, expected, '{!r} != {!r}'.format(direct, expected))
self.assertEqual(actual, expected, '{!r} != {!r}'.format(actual, expected))
self.assertEqual(direct, expected, f'{direct!r} != {expected!r}')
self.assertEqual(actual, expected, f'{actual!r} != {expected!r}')

0 comments on commit 9375e0d

Please sign in to comment.