Bases: AbstractAnnotation
Source code in library_analyzer/processing/annotations/model/_annotations.py
| @dataclass
class EnumAnnotation(AbstractAnnotation):
enumName: str
pairs: list[EnumPair]
def to_json(self) -> dict:
return {
"target": self.target,
"authors": self.authors,
"reviewers": self.reviewers,
"comment": self.comment,
"reviewResult": self.reviewResult.value,
"enumName": self.enumName,
"pairs": [pair.to_json() for pair in self.pairs],
}
@staticmethod
def from_json(json: Any) -> EnumAnnotation:
annotation = AbstractAnnotation.from_json(json)
pairs = [EnumPair.from_json(enum_pair) for enum_pair in json["pairs"]]
return EnumAnnotation(
annotation.target,
annotation.authors,
annotation.reviewers,
annotation.comment,
annotation.reviewResult,
json["enumName"],
pairs,
)
|
enumName: str
class-attribute
pairs: list[EnumPair]
class-attribute
from_json(json)
staticmethod
Source code in library_analyzer/processing/annotations/model/_annotations.py
| @staticmethod
def from_json(json: Any) -> EnumAnnotation:
annotation = AbstractAnnotation.from_json(json)
pairs = [EnumPair.from_json(enum_pair) for enum_pair in json["pairs"]]
return EnumAnnotation(
annotation.target,
annotation.authors,
annotation.reviewers,
annotation.comment,
annotation.reviewResult,
json["enumName"],
pairs,
)
|
to_json()
Source code in library_analyzer/processing/annotations/model/_annotations.py
| def to_json(self) -> dict:
return {
"target": self.target,
"authors": self.authors,
"reviewers": self.reviewers,
"comment": self.comment,
"reviewResult": self.reviewResult.value,
"enumName": self.enumName,
"pairs": [pair.to_json() for pair in self.pairs],
}
|