Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
The new metadata value for the given clusters.
add_to_stack : boolean
Whether this metadata change should be recorded in the undo stack.
Returns
-------
up : UpdateInfo instance
"""
# Add the field if it doesn't exist.
if field not in self._fields:
self.add_field(field)
assert field in self._fields
clusters = _as_list(clusters)
for cluster in clusters:
if cluster not in self._data:
self._data[cluster] = {}
self._data[cluster][field] = value
up = UpdateInfo(description='metadata_' + field,
metadata_changed=clusters,
metadata_value=value,
)
undo_state = emit('request_undo_state', self, up)
if add_to_stack:
self._undo_stack.add((clusters, field, value, up, undo_state))
emit('cluster', self, up)
return up