replaced % operator with .format()

This commit is contained in:
Darko Poljak 2014-01-28 12:51:51 +01:00
parent ef57c4a04d
commit a3acd60556
1 changed files with 4 additions and 4 deletions

View File

@ -108,7 +108,7 @@ def mv_file_dups(topdirs=['./'], hashalg='md5', block_size=4096,
if not os.path.exists(dest_dir): if not os.path.exists(dest_dir):
os.mkdir(dest_dir) os.mkdir(dest_dir)
if not os.path.isdir(dest_dir): if not os.path.isdir(dest_dir):
raise OSError('%s is not a directory' % dest_dir) raise OSError('{} is not a directory'.format(dest_dir))
import shutil import shutil
for files in do_with_file_dups(topdirs, hashalg, block_size): for files in do_with_file_dups(topdirs, hashalg, block_size):
for i, f in enumerate(files): for i, f in enumerate(files):
@ -147,11 +147,11 @@ def main():
bs = int(args['--block-size']) bs = int(args['--block-size'])
args['--block-size'] = bs args['--block-size'] = bs
except ValueError: except ValueError:
print('Invalid block size "%s"' % args['--block-size']) print('Invalid block size "{}"'.format(args['--block-size']))
sys.exit(1) sys.exit(1)
if args['--version']: if args['--version']:
print("sweeper %s" % __version__) print("sweeper {}".format(__version__))
return return
if action == 'print' or action == 'pprint': if action == 'print' or action == 'pprint':
@ -171,7 +171,7 @@ def main():
elif action == 'remove': elif action == 'remove':
rm_file_dups(topdirs, args['--digest-alg'], args['--block-size']) rm_file_dups(topdirs, args['--digest-alg'], args['--block-size'])
else: else:
print('Invalid action "%s"' % action) print('Invalid action "{}"'.format(action))
# if used as script call main function # if used as script call main function