Skip to content

Commit

Permalink
style: Use f-strings wherever possible
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos authored and adrienverge committed Jan 4, 2024
1 parent cebc9c1 commit f977ae2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/rules/test_indentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def full_stack(self, source):
.replace('Mapping', 'Map'))
if token_type in ('StreamStart', 'StreamEnd'):
continue
output += '{:>9} {}\n'.format(token_type,
self.format_stack(context['stack']))
stack = self.format_stack(context['stack'])
output += f'{token_type:>9} {stack}\n'
return output

def test_simple_mapping(self):
Expand Down
4 changes: 2 additions & 2 deletions yamllint/rules/new_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ def check(conf, line):

if line.start == 0 and len(line.buffer) > line.end:
if line.buffer[line.end:line.end + len(newline_char)] != newline_char:
c = repr(newline_char).strip('\'')
yield LintProblem(1, line.end - line.start + 1,
'wrong new line character: expected {}'
.format(repr(newline_char).strip('\'')))
f'wrong new line character: expected {c}')

0 comments on commit f977ae2

Please sign in to comment.