def decode(cls, dct): """Returns a GerritChangeMergedEvent object decoded from ``dct``. Args: dct: Dictionary with all values required to initalise a GerritChangeMergedEvent object. Returns: A fully initialised GerritChangeMergedEvent object. Raises: DecodeError: If ``dct`` does't contain all required keys """ try: return GerritChangeMergedEvent( change=GerritChange.decode(dct["change"]), patch_set=GerritPatchSet.decode(dct["patchSet"]), submitter=GerritAccount.decode(dct["submitter"]), ) except KeyError, ex: raise DecodeError(ex)
def decode(cls, dct): """Returns a GerritCommentAddedEvent object decoded from ``dct``. Args: dct: Dictionary with all values required to initalise a GerritCommentAddedEvent object. Returns: A fully initialised GerritCommentAddedEvent object. Raises: DecodeError: If ``dct`` does't contain all required keys """ try: obj = GerritCommentAddedEvent( approvals=GerritApproval.decode(dct["approvals"]), comment=dct["comment"], change=GerritChange.decode(dct["change"]), author=GerritAccount.decode(dct["author"]), patch_set=GerritPatchSet.decode(dct["patchSet"]), ) return obj except KeyError, ex: raise DecodeError(ex)