Skip to content

Commit

Permalink
simplify _fsspec_safe_open
Browse files Browse the repository at this point in the history
  • Loading branch information
rabernat committed Mar 24, 2021
1 parent 400b53a commit cb99e39
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pangeo_forge/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,8 @@ def _fsspec_safe_open(fname, **kwargs):
# workaround for inconsistent behavior of fsspec.open
# https://github.com/intake/filesystem_spec/issues/579
with fsspec.open(fname, **kwargs) as fp:
if isinstance(fp, fsspec.implementations.local.LocalFileOpener):
with fp as fp2:
yield fp2
else:
yield fp
with fp as fp2:
yield fp2


# Notes about dataclasses:
Expand Down

0 comments on commit cb99e39

Please sign in to comment.