示例#1
0
 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)
示例#2
0
 def decode(cls, dct):
     """Returns a GerritChangeRestoredEvent object decoded from ``dct``.
     
     Args:
         dct: Dictionary with all values required to initalise a
             GerritChangeRestoredEvent object.
     
     Returns:
         A fully initialised GerritChangeRestoredEvent object.
         
     Raises:
         DecodeError: If ``dct`` does't contain all required keys
     """
     try:
         return GerritChangeRestoredEvent(
             change=GerritChange.decode(dct["change"]),
             restorer=GerritAccount.decode(dct["restorer"]),
             reason=dct["reason"],
         )
     except KeyError, ex:
         raise DecodeError(ex)
示例#3
0
 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)