-
tensorstore.KvStore.Spec.update(self, *, unbind_context: bool | None =
None
, strip_context: bool | None =None
, context: Context | None =None
) None Modifies a spec.
Example
>>> spec = ts.KvStore.Spec({ ... 'driver': 'memory', ... 'path': 'abc/', ... 'memory_key_value_store': 'memory_key_value_store#a' ... }) >>> spec.update(context=ts.Context({'memory_key_value_store#a': {}})) >>> spec KvStore.Spec({ 'context': {'memory_key_value_store#a': {}}, 'driver': 'memory', 'memory_key_value_store': ['memory_key_value_store#a'], 'path': 'abc/', }) >>> spec.update(unbind_context=True) >>> spec KvStore.Spec({ 'context': {'memory_key_value_store#a': {}}, 'driver': 'memory', 'memory_key_value_store': 'memory_key_value_store#a', 'path': 'abc/', }) >>> spec.update(strip_context=True) >>> spec KvStore.Spec({'driver': 'memory', 'path': 'abc/'})
- Parameters:¶
- unbind_context: bool | None =
None
¶ Convert any bound context resources to context resource specs that fully capture the graph of shared context resources and interdependencies.
Re-binding/re-opening the resultant spec will result in a new graph of new context resources that is isomorphic to the original graph of context resources. The resultant spec will not refer to any external context resources; consequently, binding it to any specific context will have the same effect as binding it to a default context.
Specifying a value of
False
has no effect.- strip_context: bool | None =
None
¶ Replace any bound context resources and unbound context resource specs by default context resource specs.
If the resultant
Spec
is re-opened with, or re-bound to, a new context, it will use the default context resources specified by that context.Specifying a value of
False
has no effect.- context: Context | None =
None
¶ Bind any context resource specs using the specified shared resource context.
Any already-bound context resources remain unchanged. Additionally, any context resources specified by a nested
KvStore.context
spec will be created as specified, but won’t be overridden bycontext
.
- unbind_context: bool | None =