KeyNamer

class dsviper.KeyNamer(definitions)

Bases: object

Finds a display name for a key among the attachments that carry one.

An attachment carries one when it is called name and holds a string, or when its document is a structure with a string field called name. When several are keyed on one concept, the one read is the first by runtime_id, not by the order they were declared in.

name(key: ValueKey, attachment_getting: AttachmentGetting) → str | None

Return the display name of key, read through attachment_getting, or None if no attachment carries one.

smart_name(key: ValueKey, attachment_getting: AttachmentGetting) → str | None

Return the display name of key, falling back to what the surrounding attachments reachable through attachment_getting can spell out, or None.