GitHub

API reference for Die.

Attributes

AttributeTypeDescription
defectBaseException
annotationsAnnotations = field(default=_NO_ANNOTATIONS, hash=False, repr=False, kw_only=True)

Functions

__init__

__init__(defect, *, annotations=_NO_ANNOTATIONS) -> None
ParameterTypeDescription
defectBaseException
annotationsAnnotations = _NO_ANNOTATIONS

annotate

annotate(annotations, *, overwrite=False) -> Self

A copy carrying annotations too. Keys it already has keep their value unless overwrite; with nothing new, self.

ParameterTypeDescription
annotationsContext
overwritebool = False

Returns Self

def annotate(self, annotations: Context, *, overwrite: bool = False) -> Self:
    """A copy carrying ``annotations`` too. Keys it already has keep
    their value unless ``overwrite``; with nothing new, ``self``."""
    merged = _merge_annotations(self.annotations, annotations.unsafe_map, overwrite)
    return self if merged is None else replace(self, annotations=merged)  # pyright: ignore[reportArgumentType, reportUnknownVariableType]