it has the on_parse_error and _allow_empty keywords. But I think both should error, so we won't add them to the signature and the method should look something like:
def find_single_file(self, keys=None, **keys_kwargs):
fc = self.full.find(
keys=keys, on_parse_error="raise", _allow_empty=False, **keys_kwargs
)
if len(fc) > 1:
raise ValueError(
"More than one file found - please adapt your query or use `find_files`")
A pattern I often do is:
It would be nice to move this functionality into filefinder itself. Either using a keyword (but what?) or a separate method. How about:
?
find_files
looks like:https://github.com/mathause/filefinder/blob/dc449bd57d0d2ad084ac42f37830a0dabeedd65d/filefinder/_filefinder.py#L386-L388
it has the
on_parse_error
and_allow_empty
keywords. But I think both should error, so we won't add them to the signature and the method should look something like:cc @veni-vidi-vici-dormivi