Refactor FSTree to not use reduce as it is not present in Python-3

I.e. it is not builtin and requires heavy variant with trying to import it from
functools.
This commit is contained in:
ZyX 2015-01-07 19:06:08 +03:00
parent a90b080328
commit 347f20d4be
1 changed files with 7 additions and 4 deletions

View File

@ -5,8 +5,8 @@ import os
import json
from subprocess import check_call
from operator import add
from shutil import rmtree
from itertools import chain
from powerline import Powerline
@ -64,9 +64,12 @@ class FSTree(object):
)
if os.environ.get('POWERLINE_RUN_LINT_DURING_TESTS'):
try:
check_call(['scripts/powerline-lint'] + reduce(add, (
['-p', d] for d in self.p.get_config_paths()
)))
check_call(chain(['scripts/powerline-lint'], *[
('-p', d) for d in (
self.p.get_config_paths() if self.p
else self.get_config_paths(self.root)
)
]))
except:
self.__exit__()
raise