DefinitionsInspector¶
- class dsviper.DefinitionsInspector(definitions)¶
Bases:
objectRetrieves registered types by TypeName, and attachments by identifier.
An index taken at construction over definitions, which hold lists and no maps. A type registered afterwards is NOT in it: query_* answers None and check_* raises for a type that exists. Build a new inspector: even when the DefinitionsConst it reads is live, this index is not. It also knows which short names are ambiguous, which is what representation() answers with: the shortest spelling that still names one type.
Look a type up with TypeName(name_space, name), or take one from concept_type_names(), structure_type_names(), enumeration_type_names() or club_type_names(). An attachment takes its identifier as a str.
- attachment_identifiers() set[str]¶
Return the set of identifiers for all attachments.
- check_attachment(identifier: str) Attachment¶
Return the attachment whose identifier is identifier, or raise if none is.
- check_concept(type_name: TypeName) TypeConcept¶
Return the concept named type_name, or raise if none is.
- check_enumeration(type_name: TypeName) TypeEnumeration¶
Return the enum named type_name, or raise if none is.
- check_structure(type_name: TypeName) TypeStructure¶
Return the struct named type_name, or raise if none is.
- is_ambiguous(attachment: Attachment) bool¶
Return whether attachment needs its key concept qualified.
True when another attachment of the same namespace carries the same name over a key concept of the same SHORT name - two User concepts of different namespaces, each with a profile. A name built from the short form would then name both, which is what DefinitionsConst.inject asks this before it prefixes the namespace.
- query_attachment(identifier: str) Attachment | None¶
Return the attachment whose identifier is identifier, or None if none is.
- query_club(type_name: TypeName) TypeClub | None¶
Return the club named type_name, or None if none is.
- query_concept(type_name: TypeName) TypeConcept | None¶
Return the concept named type_name, or None if none is.
- query_enumeration(type_name: TypeName) TypeEnumeration | None¶
Return the enum named type_name, or None if none is.
- query_structure(type_name: TypeName) TypeStructure | None¶
Return the struct named type_name, or None if none is.