Upgrade Python syntax with pyupgrade
https://github.com/asottile/pyupgrade
This commit is contained in:
@@ -51,7 +51,7 @@ class IndentationStackTestCase(RuleTestCase):
|
|||||||
.replace('Mapping', 'Map'))
|
.replace('Mapping', 'Map'))
|
||||||
if token_type in ('StreamStart', 'StreamEnd'):
|
if token_type in ('StreamStart', 'StreamEnd'):
|
||||||
continue
|
continue
|
||||||
output += '%9s %s\n' % (token_type,
|
output += '{:>9} {}\n'.format(token_type,
|
||||||
self.format_stack(context['stack']))
|
self.format_stack(context['stack']))
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ def run(argv=None):
|
|||||||
help='return non-zero exit code on warnings '
|
help='return non-zero exit code on warnings '
|
||||||
'as well as errors')
|
'as well as errors')
|
||||||
parser.add_argument('-v', '--version', action='version',
|
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?
|
# TODO: read from stdin when no filename?
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class LintProblem(object):
|
|||||||
@property
|
@property
|
||||||
def message(self):
|
def message(self):
|
||||||
if self.rule is not None:
|
if self.rule is not None:
|
||||||
return '%s (%s)' % (self.desc, self.rule)
|
return '{} ({})'.format(self.desc, self.rule)
|
||||||
return self.desc
|
return self.desc
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
@@ -78,7 +78,7 @@ def get_cosmetic_problems(buffer, conf, filepath):
|
|||||||
class DisableDirective:
|
class DisableDirective:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.rules = set()
|
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):
|
def process_comment(self, comment):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user