From 3d8e0d1aecaa458a11513ce5404bf6ad1fb95d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=20=D0=94=D0=B7=D1=8E=D0=B1=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Wed, 22 Sep 2021 12:43:01 +0300 Subject: [PATCH] fixed reduce funcs --- pym/calculate/lib/utils/files.py | 4 ++-- pym/calculate/lib/utils/mount.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pym/calculate/lib/utils/files.py b/pym/calculate/lib/utils/files.py index 9df430c..6fe39af 100644 --- a/pym/calculate/lib/utils/files.py +++ b/pym/calculate/lib/utils/files.py @@ -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): diff --git a/pym/calculate/lib/utils/mount.py b/pym/calculate/lib/utils/mount.py index 06dac9a..66b13a1 100644 --- a/pym/calculate/lib/utils/mount.py +++ b/pym/calculate/lib/utils/mount.py @@ -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