def scan(root_dir: str) -> list: """ Finds all "collections" under a given directory. Note: A collection is defined as a flat folder (IE, no sub-folders) with image contents. Any non-image files will be ignored. So long as a folder contains one or more images and has no sub-directories, it will be treated as a collection. :param root_dir: path to directory to recursively scan through. :return: list of Collection objects. """ collection_list = [] for dir_tuple in (x for x in walk(root_dir)): if is_collection(dir_tuple): collection_list.append(Collection.from_dir_tuple(dir_tuple)) return collection_list