Upgrade Python syntax with pyupgrade

https://github.com/asottile/pyupgrade
pull/152/head
Hugo 6 years ago committed by Adrien Vergé
parent 5852566ff0
commit f4c56b8216

@ -51,7 +51,7 @@ class IndentationStackTestCase(RuleTestCase):
.replace('Mapping', 'Map'))
if token_type in ('StreamStart', 'StreamEnd'):
continue
output += '%9s %s\n' % (token_type,
output += '{:>9} {}\n'.format(token_type,
self.format_stack(context['stack']))
return output

@ -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?

@ -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:

Loading…
Cancel
Save