Bases: AbstractAnnotation
Source code in src/library_analyzer/processing/annotations/model/_annotations.py
| @dataclass
class EnumAnnotation(AbstractAnnotation):
enumName: str # noqa: N815
pairs: list[EnumPair]
@staticmethod
def from_dict(d: dict[str, Any]) -> EnumAnnotation:
annotation = AbstractAnnotation.from_dict(d)
pairs = [EnumPair.from_dict(enum_pair) for enum_pair in d["pairs"]]
return EnumAnnotation(
annotation.target,
annotation.authors,
annotation.reviewers,
annotation.comment,
annotation.reviewResult,
d["enumName"],
pairs,
)
def to_dict(self) -> dict[str, Any]:
return {
"target": self.target,
"authors": self.authors,
"reviewers": self.reviewers,
"comment": self.comment,
"reviewResult": self.reviewResult.value,
"enumName": self.enumName,
"pairs": [pair.to_dict() for pair in self.pairs],
}
|
enumName: str
instance-attribute
pairs: list[EnumPair]
instance-attribute
__init__(target, authors, reviewers, comment, reviewResult, enumName, pairs)
from_dict(d)
staticmethod
Source code in src/library_analyzer/processing/annotations/model/_annotations.py
| @staticmethod
def from_dict(d: dict[str, Any]) -> EnumAnnotation:
annotation = AbstractAnnotation.from_dict(d)
pairs = [EnumPair.from_dict(enum_pair) for enum_pair in d["pairs"]]
return EnumAnnotation(
annotation.target,
annotation.authors,
annotation.reviewers,
annotation.comment,
annotation.reviewResult,
d["enumName"],
pairs,
)
|
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,
"enumName": self.enumName,
"pairs": [pair.to_dict() for pair in self.pairs],
}
|