sha: str
description: str
nominated: bool
- nomination_type: typing.Optional[int]
+ nomination_type: int
resolution: typing.Optional[int]
main_sha: typing.Optional[str]
because_sha: typing.Optional[str]
CC = 0
FIXES = 1
REVERT = 2
+ NONE = 3
@enum.unique
sha: str = attr.ib()
description: str = attr.ib()
nominated: bool = attr.ib(False)
- nomination_type: typing.Optional[NominationType] = attr.ib(None)
+ nomination_type: NominationType = attr.ib(NominationType.NONE)
resolution: Resolution = attr.ib(Resolution.UNRESOLVED)
main_sha: typing.Optional[str] = attr.ib(None)
because_sha: typing.Optional[str] = attr.ib(None)
def to_json(self) -> 'CommitDict':
d: typing.Dict[str, typing.Any] = attr.asdict(self)
- if self.nomination_type is not None:
- d['nomination_type'] = self.nomination_type.value
+ d['nomination_type'] = self.nomination_type.value
if self.resolution is not None:
d['resolution'] = self.resolution.value
return typing.cast('CommitDict', d)
@classmethod
def from_json(cls, data: 'CommitDict') -> 'Commit':
c = cls(data['sha'], data['description'], data['nominated'], main_sha=data['main_sha'], because_sha=data['because_sha'])
- if data['nomination_type'] is not None:
- c.nomination_type = NominationType(data['nomination_type'])
+ c.nomination_type = NominationType(data['nomination_type'])
if data['resolution'] is not None:
c.resolution = Resolution(data['resolution'])
return c