Attachment¶
- class dsviper.Attachment¶
Bases:
objectBinds a key type - a concept, a club or any_concept - to a document type, registered in a Definitions.
From it, keys are minted and documents created. It holds no document: a store does, and AttachmentGetting reads one by attachment and key.
An attachment compares, orders and hashes by its runtime_id, which its definition determines: two declaring the same namespace, name, key type and document type are equal however they were obtained, so one can key a dict, join a set or be sorted.
Note: Not directly instantiable.
- create_key(instance_id: ValueUUId | None = None) ValueKey¶
Return a key for this attachment, naming the instance instance_id, or a fresh instance when it is None.
- create_structure(initial_value: dict[str, _InputValues] | None = None) ValueStructure¶
Return a new document of this attachment’s document type.
initial_value fills it in; raise if it does not fit the type.
- description(*, namespace: NameSpace | None = None) str¶
Return the attachment rendered for display.
With namespace, every name is written relative to it. Without, the key and document types are written relative to the attachment’s own namespace, and the attachment’s name in full.
- documentation() str¶
Return the documentation the attachment was created with, empty when none was given.
- identifier() str¶
Return the identifier, unique among the attachments: the attachment’s namespace, its key type written relative to that namespace, and its name. App::User.profile for an attachment profile of namespace App on a concept User of App; App::Lib::User.profile when the concept is Lib’s; App::any_concept.tag for a key any_concept.
- key_type() _AbstractionTypes¶
Return the type of the key.
- optional_document_type() TypeOptional¶
Return optional<document_type>: the type of what get() answers.
- representation(*, namespace: NameSpace | None = None) str¶
Return the declaration as text, qualified against namespace when one is given.