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)
| 4 | # Helper functions |
| 5 | |
| 6 | def 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 | |
| 23 | def splitall(path): |
no outgoing calls
no test coverage detected