TypeConcept

class dsviper.TypeConcept

Bases: Type

A concept type: a kind of thing the model names, whose instances keys address and attachments file documents under.

A concept holds no data itself; what an instance carries is in the documents its attachments hold. A concept may specialise a parent, and a key of the child then widens to a key of the parent. Definitions.create_concept makes one.

Note: Not directly instantiable.

static cast(type: Type) → TypeConcept

Return type as a TypeConcept, or raise if it is not one.

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

Return the same as representation(): the declared name, qualified against namespace.

documentation() → str

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

is_member(type_concept: TypeConcept) → bool

Return True if type_concept is this concept or one of its ancestors.

Following parent() upwards from this concept reaches type_concept. TypeClub.is_member asks another question: whether the argument is listed in members(), where a concept specialising a member is not.

parent() → TypeConcept | None

Return the parent concept or None.

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

Return the name the type was declared under, qualified against namespace - the global namespace when it is None.

runtime_id() → ValueUUId

Return the uuid identifying this type.

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

type_code() → str

Return the code naming this kind of type, such as “int32”, “struct” or “vector”.

type_name() → TypeName

Return the TypeName: the namespace and the name the type was declared under.