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

Function acquire

xarray/backends/locks.py:192–207  ·  view source on GitHub ↗

Acquire a lock, possibly in a non-blocking fashion. Includes backwards compatibility hacks for old versions of Python, dask and dask-distributed.

(lock, blocking=True)

Source from the content-addressed store, hash-verified

190
191
192def acquire(lock, blocking=True):
193 """Acquire a lock, possibly in a non-blocking fashion.
194
195 Includes backwards compatibility hacks for old versions of Python, dask
196 and dask-distributed.
197 """
198 if blocking:
199 # no arguments needed
200 return lock.acquire()
201 else:
202 # "blocking" keyword argument not supported for:
203 # - threading.Lock on Python 2.
204 # - dask.SerializableLock with dask v1.0.0 or earlier.
205 # - multiprocessing.Lock calls the argument "block" instead.
206 # - dask.distributed.Lock uses the blocking argument as the first one
207 return lock.acquire(blocking)
208
209
210class CombinedLock(Lock):

Callers 2

__del__Method · 0.90
acquireMethod · 0.85

Calls 1

acquireMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…