Skip to content

Commit

Permalink
Merge pull request #994 from CoffeaTeam/filter-files-nitpick
Browse files Browse the repository at this point in the history
chore: better typing in manipulations
  • Loading branch information
lgray authored Jan 16, 2024
2 parents dae0f1f + f313670 commit ac3b00a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/coffea/dataset_tools/manipulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,25 @@ def slice_files(fileset: FilesetSpec, theslice: Any = slice(None)) -> FilesetSpe
return out


def _default_filter(name_and_file):
name, a_file = name_and_file
thesteps = a_file["steps"]
def _default_filter(name_and_spec):
name, spec = name_and_spec
thesteps = spec["steps"]
return thesteps is not None and (
len(thesteps) > 1 or (thesteps[0][1] - thesteps[0][0]) != 0
)


def filter_files(
fileset: FilesetSpec,
thefilter: Callable[[str, CoffeaFileSpec], bool] = _default_filter,
thefilter: Callable[[tuple[str, CoffeaFileSpec]], bool] = _default_filter,
) -> FilesetSpec:
"""
Modify the input dataset so that only the files of each dataset that pass the filter remain.
Parameters
----------
fileset: FilesetSpec
The set of datasets to be sliced.
thefilter: Callable[[CoffeaFileSpec], bool], default filters empty files
thefilter: Callable[[tuple[str, CoffeaFileSpec]], bool], default filters empty files
How to filter the files in the each dataset.
Returns
Expand Down

0 comments on commit ac3b00a

Please sign in to comment.