[Enhancement] Enhance recursively find (#69)

pull/68/head^2
Zaida Zhou 2021-07-24 15:07:54 +08:00 committed by GitHub
parent 27fad951d0
commit 34e0d56e75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -379,12 +379,10 @@ def recursively_find(root: str, base_name: str) -> list:
Return:
Files with given base_name.
"""
results = list(os.walk(root))
files = []
for tup in results:
root = tup[0]
if base_name in tup[2]:
files.append(osp.join(root, base_name))
for _root, _, _files in os.walk(root):
if base_name in _files:
files.append(osp.join(_root, base_name))
return files