From f4c56b82167f879781bec128addabff88e385b91 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sun, 25 Nov 2018 11:36:03 +0200 Subject: [PATCH] Upgrade Python syntax with pyupgrade https://github.com/asottile/pyupgrade --- tests/rules/test_indentation.py | 4 ++-- yamllint/cli.py | 2 +- yamllint/linter.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/rules/test_indentation.py b/tests/rules/test_indentation.py index 3632a25..6fc68aa 100644 --- a/tests/rules/test_indentation.py +++ b/tests/rules/test_indentation.py @@ -51,8 +51,8 @@ class IndentationStackTestCase(RuleTestCase): .replace('Mapping', 'Map')) if token_type in ('StreamStart', 'StreamEnd'): continue - output += '%9s %s\n' % (token_type, - self.format_stack(context['stack'])) + output += '{:>9} {}\n'.format(token_type, + self.format_stack(context['stack'])) return output def test_simple_mapping(self): diff --git a/yamllint/cli.py b/yamllint/cli.py index 5cb84fc..8529fb7 100644 --- a/yamllint/cli.py +++ b/yamllint/cli.py @@ -103,7 +103,7 @@ def run(argv=None): help='return non-zero exit code on warnings ' 'as well as errors') parser.add_argument('-v', '--version', action='version', - version='%s %s' % (APP_NAME, APP_VERSION)) + version='{} {}'.format(APP_NAME, APP_VERSION)) # TODO: read from stdin when no filename? diff --git a/yamllint/linter.py b/yamllint/linter.py index 9ee40a0..ab46dca 100644 --- a/yamllint/linter.py +++ b/yamllint/linter.py @@ -47,7 +47,7 @@ class LintProblem(object): @property def message(self): if self.rule is not None: - return '%s (%s)' % (self.desc, self.rule) + return '{} ({})'.format(self.desc, self.rule) return self.desc def __eq__(self, other): @@ -78,7 +78,7 @@ def get_cosmetic_problems(buffer, conf, filepath): class DisableDirective: def __init__(self): self.rules = set() - self.all_rules = set([r.ID for r in rules]) + self.all_rules = {r.ID for r in rules} def process_comment(self, comment): try: