diff --git a/lib/cli.py b/lib/cli.py index 826000e..170763d 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -73,7 +73,7 @@ def get_slice_repr(lst): def fold(lst, obj): return lst + [obj - sum(lst)] plus_lst = functools.reduce(fold, lst[1:], lst[:1]) - return '+'.join(map(str, plus_lst)) + return str.join('+', map(str, plus_lst)) class intact(object): @@ -344,11 +344,11 @@ def dump_options(o, multipage=False): method_name = o.method.name if o.params: method_name += ' ' - method_name += ' '.join( + method_name += str.join(' ', ( '{0}={1}'.format(pname, pvalue) for pname, pvalue in sorted(o.params.iteritems()) - ) + )) yield ('method', method_name) if multipage: yield ('pages-per-dict', o.pages_per_dict) diff --git a/lib/djvu_support.py b/lib/djvu_support.py index d32573b..1f82f7e 100644 --- a/lib/djvu_support.py +++ b/lib/djvu_support.py @@ -89,7 +89,7 @@ def photo_to_djvu(image, dpi=100, slices=IW44_SLICES_DEFAULT, gamma=2.2, mask_im args = [ 'c44', '-dpi', str(dpi), - '-slice', ','.join(map(str, slices)), + '-slice', str.join(',', map(str, slices)), '-gamma', '{0:.1f}'.format(gamma), '-crcb{0}'.format(crcb), ] diff --git a/lib/ipc.py b/lib/ipc.py index 7f897fd..d24d6ed 100644 --- a/lib/ipc.py +++ b/lib/ipc.py @@ -70,7 +70,7 @@ def __str__(self): # ========== def shell_escape(commandline): - return ' '.join(map(pipes.quote, commandline)) + return str.join(' ', map(pipes.quote, commandline)) class Subprocess(subprocess.Popen): diff --git a/tests/test_cli.py b/tests/test_cli.py index 6ab1fb1..0ba6226 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -193,7 +193,7 @@ def test_no_args(self): assert_multi_line_equal( stderr.getvalue(), 'usage: didjvu [-h] [--version] {{{actions}}} ...\n' - 'didjvu: error: too few arguments\n'.format(actions=','.join(self.anames)) + 'didjvu: error: too few arguments\n'.format(actions=str.join(',', self.anames)) ) def _test_action_no_args(self, action): diff --git a/tests/test_ipc.py b/tests/test_ipc.py index a154cff..b125a97 100644 --- a/tests/test_ipc.py +++ b/tests/test_ipc.py @@ -158,7 +158,7 @@ def _test_locale(self): if utf8_locale is None: raise SkipTest( 'UTF-8 locale missing ' - '({0})'.format(' or '.join(utf8_locale_candidates)) + '({0})'.format(str.join(' or ', utf8_locale_candidates)) ) assert_equal(value, utf8_locale) elif key == 'LANG': diff --git a/tests/tools.py b/tests/tools.py index 6dae01a..a4ab5d0 100644 --- a/tests/tools.py +++ b/tests/tools.py @@ -135,7 +135,7 @@ def wrapper(*args, **kwargs): except Exception: exctp, exc, tb = sys.exc_info() s = traceback.format_exception(exctp, exc, tb, _n_relevant_tb_levels(tb)) - s = ''.join(s) + s = str.join('', s) del tb with os.fdopen(writefd, 'wb') as fp: fp.write(s)