Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
goodwanghan authored Apr 25, 2024
1 parent 77c4075 commit b196488
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions fugue_dask/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from triad.collections.dict import ParamDict
from triad.collections.schema import Schema
from triad.utils.assertion import assert_or_throw
from triad.utils.io import join, makedirs, url_to_fs
from triad.utils.io import isfile, join, makedirs, url_to_fs

from fugue._utils.io import FileParser, _get_single_files
from fugue_dask.dataframe import DaskDataFrame
Expand Down Expand Up @@ -100,9 +100,11 @@ def _save_csv(df: DaskDataFrame, p: FileParser, **kwargs: Any) -> None:


def _safe_load_csv(path: str, **kwargs: Any) -> dd.DataFrame:
if not isfile(path):
return dd.read_csv(join(path, "*.csv"), **kwargs)
try:
return dd.read_csv(path, **kwargs)
except (IsADirectoryError, PermissionError):
except (IsADirectoryError, PermissionError): # pragma: no cover
return dd.read_csv(join(path, "*.csv"), **kwargs)


Expand Down Expand Up @@ -148,11 +150,12 @@ def _save_json(df: DaskDataFrame, p: FileParser, **kwargs: Any) -> None:


def _safe_load_json(path: str, **kwargs: Any) -> dd.DataFrame:
if not isfile(path):
return dd.read_json(join(path, "*.json"), **kwargs)
try:
return dd.read_json(path, **kwargs)
except (IsADirectoryError, PermissionError):
x = dd.read_json(join(path, "*.json"), **kwargs)
return x
except (IsADirectoryError, PermissionError): # pragma: no cover
return dd.read_json(join(path, "*.json"), **kwargs)


def _load_json(
Expand Down

0 comments on commit b196488

Please sign in to comment.