Stop using str.format

On Python 2.6, it requires the format placeholder to have explicit index
of argument, so using % formatting is easier.

There are a couple places where the method is still used because the
same argument is used twice.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-05-25 13:37:39 +02:00
parent b55f8abd29
commit b634a18a7f
14 changed files with 110 additions and 106 deletions

View file

@ -456,10 +456,10 @@ def find_old_compose(old_compose_dirs, release_short, release_version,
def process_args(fmt, args):
"""Given a list of arguments, format each value with the format string.
>>> process_args('--opt={}', ['foo', 'bar'])
>>> process_args('--opt=%s', ['foo', 'bar'])
['--opt=foo', '--opt=bar']
"""
return [fmt.format(val) for val in force_list(args or [])]
return [fmt % val for val in force_list(args or [])]
@contextlib.contextmanager