fixed reduce funcs

master 3.7.1.11
parent 4f32a9c3cd
commit 3d8e0d1aec

@ -745,9 +745,9 @@ def pathJoin(*paths):
"""Складывает пути, в отличии от os.path.join, складывает абсолютные пути"""
if len(paths) == 1:
return paths[0]
return reduce(path.join, (x for x
return reduce(path.join, [x for x
in (y.startswith("/") and y[1:] or y for y
in paths[1:]) if x and x != "/"), paths[0])
in paths[1:]) if x and x != "/"], paths[0])
def listDirectory(directory, fullPath=False, onlyDir=False):

@ -219,8 +219,8 @@ def childMounts(pathname):
return ""
with open(mtabFile) as f:
return reduce(lambda x, y: x + [y],
(x for x in ([y[0], y[1]] for y in (z.split(" ") for z in f))
if commonPath(absPath, x[0]) == absPath or commonPath(absPath, x[1]) == absPath), [])
[x for x in ([y[0], y[1]] for y in (z.split(" ") for z in f))
if commonPath(absPath, x[0]) == absPath or commonPath(absPath, x[1]) == absPath], [])
class MountError(Exception):
pass

Loading…
Cancel
Save