Jill
John
"""
- lines = ['%s %s' % (copyright_year_string, authors[0])]
+ lines = ['{} {}'.format(copyright_year_string, authors[0])]
for author in authors[1:]:
lines.append(' '*(len(copyright_year_string)+1) + author)
return lines
... authors=['Jack', 'Jill', 'John']*5))
Copyright (C) 1990-2010 Jack, Jill, John, Jack, Jill, John, Jack, Jill, John, Jack, Jill, John, Jack, Jill, John
"""
- blurb = '%s %s' % (copyright_year_string, ', '.join(authors))
+ blurb = '{} {}'.format(copyright_year_string, ', '.join(authors))
return [blurb]
def copyright_string(original_year, final_year, authors, text, info={},
BLURB
>>> print(copyright_string(original_year=2005, final_year=2005,
... authors=['A <a@a.com>', 'B <b@b.edu>'],
- ... text=['This file is part of %(program)s.',],
+ ... text=['This file is part of {program}.',],
... author_format_fn=short_author_formatter,
... info={'program':'update-copyright'},
... width=25,
update-copyright.
>>> print(copyright_string(original_year=2005, final_year=2005,
... authors=['A <a@a.com>', 'B <b@b.edu>'],
- ... text=[('This file is part of %(program)s. '*3
+ ... text=[('This file is part of {program}. '*3
... ).strip(),],
... info={'program':'update-copyright'},
... author_format_fn=short_author_formatter,
wrap_kwargs[key] = prefix[1]
if original_year == final_year:
- date_range = '%s' % original_year
+ date_range = str(original_year)
else:
- date_range = '%s-%s' % (original_year, final_year)
- copyright_year_string = 'Copyright (C) %s' % date_range
+ date_range = '{}-{}'.format(original_year, final_year)
+ copyright_year_string = 'Copyright (C) {}'.format(date_range)
lines = author_format_fn(copyright_year_string, authors,
**formatter_kwargs)
for i,paragraph in enumerate(text):
try:
- text[i] = paragraph % info
+ text[i] = paragraph.format(info)
except ValueError as e:
_LOG.error(
"{}: can't format {} with {}".format(e, paragraph, info))