Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 08:39:01

0001 """
0002 Class to represent the result of the Adder operation
0003 
0004 """
0005 
0006 class AdderResult:
0007     """
0008     Class to represent the result of the Adder operation.
0009     """
0010     # slot
0011     __slot__ = ("statusCode", "transferringFiles")
0012 
0013     # return code
0014     rc_succeeded = 0
0015     rc_temporary = 1
0016     rc_fatal = 2
0017 
0018     # constructor
0019     def __init__(self) -> None:
0020         """
0021         Initialize the AdderResult with default values.
0022         """
0023         # result of interactions with data management system (DMS)
0024         self.status_code = None
0025 
0026         # list of files which are being transferred by DMS
0027         self.transferring_files = []
0028 
0029         # list of files which are being merged
0030         self.merging_files = []
0031 
0032     # succeeded
0033     def set_succeeded(self):
0034         """
0035         Set the status to succeeded.
0036         """
0037         self.status_code = self.rc_succeeded
0038 
0039     # temporary error to retry later
0040     def set_temporary(self):
0041         """
0042         Set the status to temporary error.
0043         """
0044         self.status_code = self.rc_temporary
0045 
0046     # fatal error
0047     def set_fatal(self):
0048         """
0049         Set the status to fatal.
0050         """
0051         self.status_code = self.rc_fatal
0052 
0053     # check if succeeded
0054     def is_succeeded(self):
0055         """
0056         Check if the status is 'succeeded'.
0057         True if status is 'succeeded', False otherwise.
0058         """
0059         return self.status_code == self.rc_succeeded
0060 
0061     # check if temporary
0062     def is_temporary(self):
0063         """
0064         Check if the status is 'temporary'.
0065         True if status is 'temporary', False otherwise.
0066         """
0067         return self.status_code == self.rc_temporary
0068 
0069     # check if fatal error
0070     def is_fatal(self):
0071         """
0072         Check if the status is 'fatal'.
0073         True if status is 'fatal', False otherwise.
0074         """
0075         return self.status_code == self.rc_fatal