Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused argument in _get_data_files_patterns #6343

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/datasets/data_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,7 @@ def _is_unrequested_hidden_file_or_is_inside_unrequested_hidden_dir(matched_rel_
return len(hidden_directories_in_path) != len(hidden_directories_in_pattern)


def _get_data_files_patterns(
pattern_resolver: Callable[[str], List[str]], base_path: str = ""
) -> Dict[str, List[str]]:
def _get_data_files_patterns(pattern_resolver: Callable[[str], List[str]]) -> Dict[str, List[str]]:
"""
Get the default pattern from a directory or repository by testing all the supported patterns.
The first patterns to return a non-empty list of data files is returned.
Expand Down Expand Up @@ -467,7 +465,7 @@ def get_data_patterns(base_path: str, download_config: Optional[DownloadConfig]
"""
resolver = partial(resolve_pattern, base_path=base_path, download_config=download_config)
try:
return _get_data_files_patterns(resolver, base_path=base_path)
return _get_data_files_patterns(resolver)
except FileNotFoundError:
raise EmptyDatasetError(f"The directory at {base_path} doesn't contain any data files") from None

Expand Down
2 changes: 1 addition & 1 deletion tests/test_data_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ def resolver(pattern):
if fs.isfile(file_path)
]

patterns_per_split = _get_data_files_patterns(resolver, base_path=base_path)
patterns_per_split = _get_data_files_patterns(resolver)
assert list(patterns_per_split.keys()) == list(data_file_per_split.keys()) # Test split order with list()
for split, patterns in patterns_per_split.items():
matched = [file_path for pattern in patterns for file_path in resolver(pattern)]
Expand Down
Loading