def collect_files(args): collected = [] for f in args: if os.path.isfile(f): if Sampler.is_filetype_supported(f): collected.append(f) elif os.path.isdir(f): collected.extend(collect_dir(f)) else: raise IOError("File not found: " + repr(f)) return collected
def collect_files(args): collected = [] for f in args: if os.path.isfile(f): if Sampler.is_filetype_supported(f): collected.append(f) elif os.path.isdir(f): collected.extend(collect_dir(f)) else: raise IOError("File not found: " + repr(f)) return collected
def collect_dir(args): for root, dir, files in os.walk(args): for found in files: if Sampler.is_filetype_supported(found): yield os.path.join(root, found)
def collect_dir(args): for root, dir, files in os.walk(args): for found in files: if Sampler.is_filetype_supported(found): yield os.path.join(root, found)