Skip to content
Back to top
View this page

# DefinitionsConst

class dsviper.DefinitionsConst

  Bases: `object`

  A class used to retreive registered concepts, clubs, enumerations, structures and attachments.

  Note: Not directly instantiable.

  attachment_runtime_ids() → set[ValueUUId]

    Return the set of runtime ID for all attachments.

  attachments() → list[Attachment]

    Return the list of attachments.

  check_attachment(attachment_runtime_id: ValueUUId) → Attachment

    Return the attachment or raise.

  check_club(runtime_id: ValueUUId) → TypeClub

    Return the club or raise.

  check_concept(runtime_id: ValueUUId) → TypeConcept

    Return the concept or raise.

  check_enumeration(runtime_id: ValueUUId) → TypeEnumeration

    Return the enum or raise.

  check_structure(runtime_id: ValueUUId) → TypeStructure

    Return a struct or raise.

  check_type(runtime_id: ValueUUId) → Type

    Return the type or raise.

  club_runtime_ids() → set[ValueUUId]

    Return the set of runtime ID for all clubs.

  clubs() → list[TypeClub]

    Return the list of clubs.

  collector() → DefinitionsCollector

    Return a collector.

  concept_members(type_concept: TypeConcept) → list[TypeConcept]

    Return the list of related concepts.

  concept_runtime_ids() → set[ValueUUId]

    Return the set of runtime ID for all concepts.

  concepts() → list[TypeConcept]

    Return the list of concepts.

  contains(definitions: DefinitionsConst) → bool

    return True if the types and attachments of the definitions are known.

  copy() → Definitions

    Return a copy immutable of the definitions.

  discard(namespace: dict | None = None) → None

    Remove injected constants from a namespace. If namespace is None, the __main__ module is used.

  encode(*, stream_codec_instancing: StreamCodecInstancing | None = None) → ValueBlob

    Return the blob that encodes the definitions with a StreamTokenBinaryCodec if not specified.

  enumeration_runtime_ids() → set[ValueUUId]

    Return the set of runtime ID for all enums.

  enumerations() → list[TypeEnumeration]

    Return the list of enums.

  extract(definitions_collector: DefinitionsCollector) → Definitions

    Create and return a new Definitions from the collected types.

  hexdigest() → str

    Return the hexdigest.

  inject(namespace: dict | None = None) → None

    Fill a namespace with constants for all definitions. If namespace is None, the __main__ module is used. When using an embedded editor, pass globals() as namespace. <namespace>_T_<name> for a concept or a club. <namespace>_K_<name> for a key of a concept or a club. <namespace>_S_<name> for a structure. <namespace>_E_<name> for a enumeration. <namespace>_P_<name>_… is the path for a property of the structure. <namespace>_A_<key.name>_<name> for an attachment.

  is_equal(definitions: DefinitionsConst) → bool

    Return True if self and definitions are equals.

  query_attachment(attachment_runtime_id: ValueUUId) → Attachment | None

    Return the attachment or None.

  query_club(runtime_id: ValueUUId) → TypeClub | None

    Return the club or None.

  query_concept(runtime_id: ValueUUId) → TypeConcept | None

    Return the concept or None.

  query_enumeration(runtime_id: ValueUUId) → TypeEnumeration | None

    Return the enum or None.

  query_structure(runtime_id: ValueUUId) → TypeStructure | None

    Return a struct or None.

  query_type(runtime_id: ValueUUId) → Type | None

    Return the type or None.

  query_types(name: str) → list[Type]

    Return the list of types.

  runtime_ids() → set[ValueUUId]

    Return the set of runtime ID for all registered types.

  structure_runtime_ids() → set[ValueUUId]

    Return the set of runtime ID for all structs.

  structures() → list[TypeStructure]

    Return the list of structs.

  to_dsm_definitions() → DSMDefinitions

    Convert and return a DSMDefinition.

  types() → list[Type]

    Return the topologically sorted list of types.

  write(stream_writing: StreamWriting) → None

    Write to a stream.