Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/storage.py
Show First 20 Lines • Show All 497 Lines • ▼ Show 20 Lines | def directory_ls(self, directory, recursive=False, db=None, cur=None): | ||||
Args: | Args: | ||||
- directory: the directory to list entries from. | - directory: the directory to list entries from. | ||||
- recursive: if flag on, this list recursively from this directory. | - recursive: if flag on, this list recursively from this directory. | ||||
Returns: | Returns: | ||||
List of entries for such directory. | List of entries for such directory. | ||||
If `recursive=True`, names in the path of a dir/file not at the | |||||
root are concatenated with a slash (`/`). | |||||
""" | """ | ||||
if recursive: | if recursive: | ||||
res_gen = db.directory_walk(directory, cur=cur) | res_gen = db.directory_walk(directory, cur=cur) | ||||
else: | else: | ||||
res_gen = db.directory_walk_one(directory, cur=cur) | res_gen = db.directory_walk_one(directory, cur=cur) | ||||
for line in res_gen: | for line in res_gen: | ||||
yield dict(zip(db.directory_ls_cols, line)) | yield dict(zip(db.directory_ls_cols, line)) | ||||
▲ Show 20 Lines • Show All 962 Lines • Show Last 20 Lines |