MCPcopy
hub / github.com/eudicots/Cactus / fileList

Function fileList

cactus/utils/filesystem.py:12–37  ·  view source on GitHub ↗

Generate a recursive list of files from a given path.

(paths, relative=False, folders=False)

Source from the content-addressed store, hash-verified

10 return tempfile.mkdtemp(dir=os.environ.get("TEMPDIR"))
11
12def fileList(paths, relative=False, folders=False):
13 """
14 Generate a recursive list of files from a given path.
15 """
16
17 if not isinstance(paths, list):
18 paths = [paths]
19
20 files = []
21
22 def append(directory, name):
23 if not name.startswith('.'):
24 path = os.path.join(directory, name)
25 files.append(path)
26
27 for path in paths:
28 for directory, dirnames, filenames in os.walk(path, followlinks=True):
29 if folders:
30 for dirname in dirnames:
31 append(directory, dirname)
32 for filename in filenames:
33 append(directory, filename)
34 if relative:
35 files = map_apply(lambda x: x[len(path) + 1:], files)
36
37 return files
38
39
40@contextmanager

Callers 15

staticMethod · 0.90
pagesMethod · 0.90
loadMethod · 0.90
test_bootstrapMethod · 0.90
test_bootstrapMethod · 0.90
test_fileMethod · 0.90
test_urlMethod · 0.90
make_archiveMethod · 0.90
make_archiveMethod · 0.90
testBuildMethod · 0.90
test_create_and_buildMethod · 0.90
preBuildFunction · 0.90

Calls 2

map_applyFunction · 0.90
appendFunction · 0.85

Tested by 8

test_bootstrapMethod · 0.72
test_bootstrapMethod · 0.72
test_fileMethod · 0.72
test_urlMethod · 0.72
make_archiveMethod · 0.72
make_archiveMethod · 0.72
testBuildMethod · 0.72
test_create_and_buildMethod · 0.72