Skip to content

AbstractAnnotation

Bases: ABC

Source code in library_analyzer/processing/annotations/model/_annotations.py
@dataclass
class AbstractAnnotation(ABC):
    target: str
    authors: list[str]
    reviewers: list[str]
    comment: str
    reviewResult: EnumReviewResult

    def to_json(self) -> dict:
        return asdict(self, dict_factory=EnumReviewResult.to_json)

    @staticmethod
    def from_json(json: Any) -> AbstractAnnotation:
        review_result = EnumReviewResult(json.get("reviewResult", ""))

        return AbstractAnnotation(
            json["target"],
            json["authors"],
            json["reviewers"],
            json.get("comment", ""),
            review_result,
        )

authors: list[str] class-attribute

comment: str class-attribute

reviewResult: EnumReviewResult class-attribute

reviewers: list[str] class-attribute

target: str class-attribute

from_json(json) staticmethod

Source code in library_analyzer/processing/annotations/model/_annotations.py
@staticmethod
def from_json(json: Any) -> AbstractAnnotation:
    review_result = EnumReviewResult(json.get("reviewResult", ""))

    return AbstractAnnotation(
        json["target"],
        json["authors"],
        json["reviewers"],
        json.get("comment", ""),
        review_result,
    )

to_json()

Source code in library_analyzer/processing/annotations/model/_annotations.py
def to_json(self) -> dict:
    return asdict(self, dict_factory=EnumReviewResult.to_json)