##| Copyright: (C) 2019-2020 Kevin Larke ##| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file. import json class Result(object): def __init__( self, value=None, msg=None ): self.value = value self.msg = msg self.resultL = [] def set_error( self, msg ): if self.msg is None: self.msg = "" self.msg += " " + msg def print(self): if value: print(value) if msg: print(msg) if resultL: print(resultL) def __bool__( self ): return self.msg is None def __iadd__( self, b ): if self.value is None and self.msg is None: self = b else: self.resultL.append(b) return self