AttachmentGetting¶
- class dsviper.AttachmentGetting¶
Bases:
objectRead access to the documents attached to a set of keys.
keys, has, get, enumerate, and diff_keys against another state.
Note: Not directly instantiable.
- attachment(attachment_runtime_id: ValueUUId) Attachment¶
Return the attachment attachment_runtime_id names, or raise if the definitions hold none.
- definitions() DefinitionsConst¶
Return the Definitions every value reachable here is typed by.
- static diff_keys(current_attachment_getting: AttachmentGetting, other_attachment_getting: AttachmentGetting, attachment: Attachment) tuple[ValueSet, ValueSet, ValueSet, ValueSet]¶
Return the tuple (added_keys, removed_keys, different_keys, same_keys).
Computed for attachment, between current_attachment_getting and other_attachment_getting.
added_keys: keys present in ‘other’ and not in ‘current’.
removed_keys: keys present in ‘current’ and not in ‘other’.
different_keys: documents present in both but not equal.
same_keys: documents present in both and equal.
- enumerate(attachment: Attachment, *, encoded: Literal[True] = True) list[tuple[ValueKey, _OutputValues]]¶
Return every (key, document) pair attachment holds.
encoded=False returns each document as a Value rather than a native object.
- get(attachment: Attachment, key: ValueKey) ValueOptional¶
Return a ValueOptional over the document attachment holds at key.
Always a ValueOptional, never None: ask is_nil() whether it holds anything, and unwrap() for the document itself.
An absent document answers a nil ValueOptional; a key of another concept than the one attachment files raises, so is_nil() reports absence and never a mismatched key.
The document comes back as a copy; mutating it does not reach what is stored.
- has(attachment: Attachment, key: ValueKey) bool¶
Return True if attachment holds a document at key.
- keys(attachment: Attachment) ValueSet¶
Return every key attachment holds a document for.
The set is taken now: a later write does not reach it.