MCPcopy Create free account
hub / github.com/LabPy/lantz / update_async

Method update_async

lantz/driver.py:383–404  ·  view source on GitHub ↗

Asynchronous update driver. :param newstate: driver state. :type newstate: dict. :param force: apply change even when the cache says it is not necessary. :type force: boolean. :param callback: Called when the update finishes. :type callback: callable.

(self, newstate=None, *, force=False, callback=None, **kwargs)

Source from the content-addressed store, hash-verified

381 self._lantz_features[key].set(self, value, force)
382
383 def update_async(self, newstate=None, *, force=False, callback=None, **kwargs):
384 """Asynchronous update driver.
385
386 :param newstate: driver state.
387 :type newstate: dict.
388 :param force: apply change even when the cache says it is not necessary.
389 :type force: boolean.
390 :param callback: Called when the update finishes.
391 :type callback: callable.
392
393 :return type: concurrent.future
394
395 :raises: ValueError if called with an empty dictionary.
396 """
397 newstate = _merge_dicts(newstate, kwargs)
398 if not newstate:
399 raise ValueError("update() called with an empty dictionary")
400
401 fut = self._submit(self.update, newstate, force=force)
402 if not callback is None:
403 fut.add_done_callback(callback)
404 return fut
405
406 def refresh(self, keys=None):
407 """Refresh cache by reading values from the instrument.

Callers 3

test_update_async_kwMethod · 0.80

Calls 1

_merge_dictsFunction · 0.85

Tested by 3

test_update_async_kwMethod · 0.64