Skip to content

Commit

Permalink
feat(fileformats): make guess_file_formats compatible with pathlib.Pa…
Browse files Browse the repository at this point in the history
…th objects
  • Loading branch information
ljgray authored and jrs65 committed Oct 14, 2022
1 parent dfb91d4 commit be74d33
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion caput/fileformats.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def guess_file_format(name, default=HDF5):
Parameters
----------
name : str
name : str or pathlib.Path
File name.
default : FileFormat or None
Fallback value if format can't be guessed. Default `fileformats.HDF5`.
Expand All @@ -233,6 +233,9 @@ def guess_file_format(name, default=HDF5):
"""
import pathlib

if isinstance(name, pathlib.Path):
name = str(name)

if name.endswith(".zarr.zip"):
return Zarr
if name.endswith(".zarr") or pathlib.Path(name).is_dir():
Expand Down

0 comments on commit be74d33

Please sign in to comment.