From f977ae25bfdcb4503af1afc3016bb3374a642219 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 31 Dec 2023 12:12:40 +0100 Subject: [PATCH] style: Use f-strings wherever possible --- tests/rules/test_indentation.py | 4 ++-- yamllint/rules/new_lines.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/rules/test_indentation.py b/tests/rules/test_indentation.py index 1c6eddb0..ad1aeaff 100644 --- a/tests/rules/test_indentation.py +++ b/tests/rules/test_indentation.py @@ -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): diff --git a/yamllint/rules/new_lines.py b/yamllint/rules/new_lines.py index b3f018a3..4e3023e4 100644 --- a/yamllint/rules/new_lines.py +++ b/yamllint/rules/new_lines.py @@ -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}')