MCPcopy
hub / github.com/arrowtype/recursive / getFiles

Function getFiles

mastering/utils.py:6–20  ·  view source on GitHub ↗

Walks down all directories starting at *path* looking for files ending with *extension*. Knows that UFOs are directories and stops the walk for any found UFO.

(path, extension)

Source from the content-addressed store, hash-verified

4# Helper functions
5
6def getFiles(path, extension):
7 """
8 Walks down all directories starting at *path* looking for files
9 ending with *extension*. Knows that UFOs are directories and stops
10 the walk for any found UFO.
11 """
12 if not extension.startswith('.'):
13 extension = '.' + extension
14 if extension == '.ufo':
15 return [dir for (dir, dirs, files) in os.walk(path)
16 if dir[-len(extension):] == extension]
17 else:
18 return [os.sep.join((dir, file)) for (dir, dirs, files)
19 in os.walk(path) for file in files if
20 file[-len(extension):] == extension]
21
22
23def splitall(path):

Callers 7

buildTTFfilesFunction · 0.90
buildInstancesFunction · 0.90
makeSFNTFunction · 0.90
build.pyFile · 0.90
buildFeaturesFunction · 0.90
batchCheckOutlinesFunction · 0.85
utils.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected