Skip to content

RequiredAnnotation

Bases: ValueAnnotation

Source code in src/library_analyzer/processing/annotations/model/_annotations.py
@dataclass
class RequiredAnnotation(ValueAnnotation):
    variant = ValueAnnotation.Variant.REQUIRED

    @staticmethod
    def from_dict(d: dict[str, Any]) -> RequiredAnnotation:
        annotation = AbstractAnnotation.from_dict(d)
        return RequiredAnnotation(
            annotation.target,
            annotation.authors,
            annotation.reviewers,
            annotation.comment,
            annotation.reviewResult,
        )

    def to_dict(self) -> dict[str, Any]:
        return {
            "target": self.target,
            "authors": self.authors,
            "reviewers": self.reviewers,
            "comment": self.comment,
            "reviewResult": self.reviewResult.value,
            "variant": self.variant.value,
        }

variant = ValueAnnotation.Variant.REQUIRED class-attribute instance-attribute

__init__(target, authors, reviewers, comment, reviewResult)

from_dict(d) staticmethod

Source code in src/library_analyzer/processing/annotations/model/_annotations.py
@staticmethod
def from_dict(d: dict[str, Any]) -> RequiredAnnotation:
    annotation = AbstractAnnotation.from_dict(d)
    return RequiredAnnotation(
        annotation.target,
        annotation.authors,
        annotation.reviewers,
        annotation.comment,
        annotation.reviewResult,
    )

to_dict()

Source code in src/library_analyzer/processing/annotations/model/_annotations.py
def to_dict(self) -> dict[str, Any]:
    return {
        "target": self.target,
        "authors": self.authors,
        "reviewers": self.reviewers,
        "comment": self.comment,
        "reviewResult": self.reviewResult.value,
        "variant": self.variant.value,
    }