MCPcopy Create free account
hub / github.com/pydata/xarray / acquire_context

Method acquire_context

xarray/backends/file_manager.py:42–51  ·  view source on GitHub ↗

Context manager for acquiring a file. Yields a file object. The context manager unwinds any actions taken as part of acquisition (i.e., removes it from any cache) if an exception is raised from the context. It *does not* automatically close the file.

(
        self, needs_lock: bool = True
    )

Source from the content-addressed store, hash-verified

40 raise NotImplementedError()
41
42 def acquire_context(
43 self, needs_lock: bool = True
44 ) -> AbstractContextManager[T_File]:
45 """Context manager for acquiring a file. Yields a file object.
46
47 The context manager unwinds any actions taken as part of acquisition
48 (i.e., removes it from any cache) if an exception is raised from the
49 context. It *does not* automatically close the file.
50 """
51 raise NotImplementedError()
52
53 def close(self, needs_lock: bool = True) -> None:
54 """Close the file object associated with this manager, if needed."""

Callers 2

_acquireMethod · 0.45
_acquireMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected