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

Method close

xarray/backends/file_manager.py:395–408  ·  view source on GitHub ↗
(self, needs_lock: bool = True)

Source from the content-addressed store, hash-verified

393 yield self._get_unclosed_file()
394
395 def close(self, needs_lock: bool = True) -> None:
396 if not self._closed:
397 file = self._get_unclosed_file()
398 if needs_lock and self._lock:
399 with self._lock:
400 file.close()
401 else:
402 file.close()
403 self._file = None
404 # Remove all references to opener arguments, so they can be garbage
405 # collected.
406 self._args = ()
407 self._mode = _OMIT_MODE
408 self._kwargs = {}
409
410 def __del__(self) -> None:
411 if not self._closed:

Calls 2

_get_unclosed_fileMethod · 0.95
closeMethod · 0.45