Attachment

class dsviper.Attachment

Bases: object

The declaration binding a concept to a value type.

From it, keys are minted and documents created. It holds no document: a store does, and AttachmentGetting reads one by attachment and key.

Note: Not directly instantiable.

create_document() → Value

Return a new document.

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.

document_type() → Type

Return the type of the document.

documentation() → str

Return the documentation the attachment was created with, empty when none was given.

identifier() → str

Return the identifier, the key type and the name joined by a dot.

App::User.profile, for an attachment named profile on a concept User of namespace App. That is key_type().representation(); type_key().representation() answers the same question with key<App::User>, which is not what goes here.

key_type() → _AbstractionTypes

Return the type of the key.

key_type_name() → TypeName

Return the key’s TypeName.

keys_type() → TypeSet

Return the set<key> type a whole key listing has.

optional_document_type() → TypeOptional

Return the type of the optional document.

representation(*, namespace: NameSpace | None = None) → str

Return the declaration as text, qualified against namespace when one is given.

runtime_id() → ValueUUId

Return the uuid identifying this attachment.

It is computed from what the attachment is, so the same declaration yields the same id in any Definitions. Definitions says what each kind is computed from.

type_key() → TypeKey

Return the type key<element_type>.

type_name() → TypeName

Return the TypeName.