Remove py26 format literals

Resolves #403
This commit is contained in:
Anthony Sottile
2016-09-15 08:17:18 -07:00
parent 26e60fa333
commit b81c9802ae
28 changed files with 58 additions and 58 deletions

View File

@@ -38,7 +38,7 @@ def get_validator(
"""
def validate(filename, load_strategy=yaml.load):
if not os.path.exists(filename):
raise exception_type('File {0} does not exist'.format(filename))
raise exception_type('File {} does not exist'.format(filename))
file_contents = open(filename, 'r').read()
@@ -46,14 +46,14 @@ def get_validator(
obj = load_strategy(file_contents)
except Exception as e:
raise exception_type(
'Invalid yaml: {0}\n{1}'.format(os.path.relpath(filename), e),
'Invalid yaml: {}\n{}'.format(os.path.relpath(filename), e),
)
try:
jsonschema.validate(obj, json_schema)
except jsonschema.exceptions.ValidationError as e:
raise exception_type(
'Invalid content: {0}\n{1}'.format(
'Invalid content: {}\n{}'.format(
os.path.relpath(filename), e
),
)
@@ -75,7 +75,7 @@ def get_run_function(filenames_help, validate_strategy, exception_cls):
parser.add_argument(
'-V', '--version',
action='version',
version='%(prog)s {0}'.format(
version='%(prog)s {}'.format(
pkg_resources.get_distribution('pre-commit').version
)
)

View File

@@ -57,7 +57,7 @@ CONFIG_JSON_SCHEMA = {
def try_regex(repo, hook, value, field_name):
if not is_regex_valid(value):
raise InvalidConfigError(
'Invalid {0} regex at {1}, {2}: {3}'.format(
'Invalid {} regex at {}, {}: {}'.format(
field_name, repo, hook, value,
)
)
@@ -72,7 +72,7 @@ def validate_config_extra(config):
)
elif 'sha' not in repo:
raise InvalidConfigError(
'Missing "sha" field for repository {0}'.format(repo['repo'])
'Missing "sha" field for repository {}'.format(repo['repo'])
)
for hook in repo['hooks']:
try_regex(repo, hook['id'], hook.get('files', ''), 'files')

View File

@@ -55,7 +55,7 @@ MANIFEST_JSON_SCHEMA = {
def validate_languages(hook_config):
if hook_config['language'] not in all_languages:
raise InvalidManifestError(
'Expected language {0} for {1} to be one of {2!r}'.format(
'Expected language {} for {} to be one of {!r}'.format(
hook_config['id'],
hook_config['language'],
all_languages,
@@ -66,14 +66,14 @@ def validate_languages(hook_config):
def validate_files(hook_config):
if not is_regex_valid(hook_config['files']):
raise InvalidManifestError(
'Invalid files regex at {0}: {1}'.format(
'Invalid files regex at {}: {}'.format(
hook_config['id'], hook_config['files'],
)
)
if not is_regex_valid(hook_config.get('exclude', '')):
raise InvalidManifestError(
'Invalid exclude regex at {0}: {1}'.format(
'Invalid exclude regex at {}: {}'.format(
hook_config['id'], hook_config['exclude'],
)
)