Refactor retrieve_file_paths and get_elements functions

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-08 23:41:46 -03:00
commit 8751249fe4

View file

@ -55,9 +55,7 @@ def retrieve_file_paths(
glob = "**/*" if recursive else "*"
paths = walk_level(path_obj, depth) if depth else path_obj.glob(glob)
file_paths = [
Text(p) for p in paths if p.is_file() and match_types(p) and is_not_hidden(p)
]
file_paths = [Text(p) for p in paths if p.is_file() and match_types(p) and is_not_hidden(p)]
return file_paths
@ -125,10 +123,7 @@ def get_elements(
if use_multithreading:
records = parallel_load_records(file_paths, silent_errors, max_concurrency)
else:
records = [
partition_file_to_record(file_path, silent_errors)
for file_path in file_paths
]
records = [partition_file_to_record(file_path, silent_errors) for file_path in file_paths]
records = list(filter(None, records))
return records