MCPcopy Index your code
hub / github.com/pydata/xarray / close_on_error

Function close_on_error

xarray/core/utils.py:715–723  ·  view source on GitHub ↗

Context manager to ensure that a file opened by xarray is closed if an exception is raised before the user sees the file object.

(f)

Source from the content-addressed store, hash-verified

713
714@contextlib.contextmanager
715def close_on_error(f):
716 """Context manager to ensure that a file opened by xarray is closed if an
717 exception is raised before the user sees the file object.
718 """
719 try:
720 yield
721 except Exception:
722 f.close()
723 raise
724
725
726def is_remote_uri(path: str) -> bool:

Callers 8

open_datasetMethod · 0.90
open_groups_as_dictMethod · 0.90
open_datasetMethod · 0.90
open_groups_as_dictMethod · 0.90
open_groups_as_dictMethod · 0.90
open_datasetMethod · 0.90
open_groups_as_dictMethod · 0.90
open_datasetMethod · 0.90

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…