Refactor retrieve_file_paths and get_elements functions
This commit is contained in:
parent
8139b743c2
commit
8751249fe4
1 changed files with 2 additions and 7 deletions
|
|
@ -55,9 +55,7 @@ def retrieve_file_paths(
|
||||||
|
|
||||||
glob = "**/*" if recursive else "*"
|
glob = "**/*" if recursive else "*"
|
||||||
paths = walk_level(path_obj, depth) if depth else path_obj.glob(glob)
|
paths = walk_level(path_obj, depth) if depth else path_obj.glob(glob)
|
||||||
file_paths = [
|
file_paths = [Text(p) for p in paths if p.is_file() and match_types(p) and is_not_hidden(p)]
|
||||||
Text(p) for p in paths if p.is_file() and match_types(p) and is_not_hidden(p)
|
|
||||||
]
|
|
||||||
|
|
||||||
return file_paths
|
return file_paths
|
||||||
|
|
||||||
|
|
@ -125,10 +123,7 @@ def get_elements(
|
||||||
if use_multithreading:
|
if use_multithreading:
|
||||||
records = parallel_load_records(file_paths, silent_errors, max_concurrency)
|
records = parallel_load_records(file_paths, silent_errors, max_concurrency)
|
||||||
else:
|
else:
|
||||||
records = [
|
records = [partition_file_to_record(file_path, silent_errors) for file_path in file_paths]
|
||||||
partition_file_to_record(file_path, silent_errors)
|
|
||||||
for file_path in file_paths
|
|
||||||
]
|
|
||||||
records = list(filter(None, records))
|
records = list(filter(None, records))
|
||||||
return records
|
return records
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue