Mercurial > pylearn
changeset 1424:84cb96db5673
return the first file in a file that exists in the directory in the PYLEARN_DATA_ROOT.
author | Frederic Bastien <nouiz@nouiz.org> |
---|---|
date | Tue, 08 Feb 2011 11:14:04 -0500 |
parents | ea5d27727869 |
children | 25985fb3bb4f |
files | pylearn/datasets/config.py |
diffstat | 1 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/datasets/config.py Mon Feb 07 17:04:56 2011 -0500 +++ b/pylearn/datasets/config.py Tue Feb 08 11:14:04 2011 -0500 @@ -51,11 +51,15 @@ return roots2 -def get_filepath_in_roots(name): +def get_filepath_in_roots(*names): """Return the full path of name that exist under a directory in the PYLEARN_DATA_ROOT env variable. + + If their is multiple file name, we return the first that exist. + This allow to get one of the file that is there. """ - for root in data_roots(): - path = os.path.join(root,name) - if os.path.exists(path): - return path + for name in names: + for root in data_roots(): + path = os.path.join(root,name) + if os.path.exists(path): + return path