hydra.annotations module
Utilities for reading and writing type and term annotations.
- hydra.annotations.aggregate_annotations(get_value: Callable[[T0], object], get_x: Callable[[T1], T0], get_anns: Callable[[T1], Mapping[T2, T3]], t: T0) Mapping[T2, T3]
Aggregate annotations from nested structures.
- hydra.annotations.comments_from_binding(cx: T0, g: Graph, b: Binding) object
Extract comments/description from a Binding.
- hydra.annotations.comments_from_field_type(cx: T0, g: Graph, ft: FieldType) object
Extract comments/description from a FieldType.
- hydra.annotations.get_annotation_map(t: Term) Mapping[Name, Term]
Project a Map<Name, Term> out of an annotation Term. For a TermMap with TermVariable-shaped keys (or, transitionally, TermWrap-encoded Name keys), returns those (Name, value) entries; for any other shape, returns the empty map.
- hydra.annotations.get_description(cx: T0, graph: Graph, anns: Mapping[Name, Term]) object
Get description from annotations map (Either version).
- hydra.annotations.get_term_description(cx: T0, graph: Graph, term: Term) object
Get term description (Either version).
- hydra.annotations.get_type(graph: Graph, anns: Mapping[Name, Term]) object
Get type from annotations.
- hydra.annotations.get_type_classes(cx: T0, graph: Graph, term: Term) object
Get type classes from term. Each Set Name contains bare class identifiers (#275).
- hydra.annotations.get_type_description(cx: T0, graph: Graph, typ: Type) object
Get type description (Either version).
- hydra.annotations.has_description(anns: Mapping[Name, T0]) bool
Check if annotations contain description.
- hydra.annotations.is_native_type(el: Binding) bool
For a typed term, decide whether a coder should encode it as a native type expression, or as a Hydra type expression.
- hydra.annotations.set_annotation(key: T0, val: object, m: Mapping[T0, T1]) Mapping[T0, T1]
Set annotation in map.
- hydra.annotations.set_description(d: object, v1: Mapping[Name, Term]) Mapping[Name, Term]
Set description in annotations.
- hydra.annotations.set_term_annotation(key: Name, val: object, term: Term) Term
Set term annotation.
- hydra.annotations.set_type(mt: object, v1: Mapping[Name, Term]) Mapping[Name, Term]
Set type in annotations.
- hydra.annotations.set_type_classes(m: Mapping[Name, Set[Name]], term: Term) Term
Set type classes on term. The Set Name carries bare class identifiers (#275).
- hydra.annotations.term_annotation_internal(term: Term) Mapping[Name, Term]
Get internal term annotations.