tfchain/TFChainWallet.py
def balance_add(self, other):
        """
        Merge the content of the other balance into this balance.
        If other is None, this call results in a no-op.

        Always assign the result, as it could other than self,
        should the class type be changed in order to add all content correctly.
        """
        if other is None:
            return self
        if isinstance(other, (WalletsBalance, MultiSigWalletBalance)):
            return WalletsBalance().balance_add(self).balance_add(other)
        if not isinstance(other, WalletBalance):
            raise TypeError("other balance has to be of type wallet balance")
        # another balance is defined, create a new balance that will contain our merge
        # merge the chain info
        if self.chain_height >= other.chain_height:
            if self.chain_time < other.chain_time:
                raise ValueError("chain time and chain height of balances do not match")
        else:
            if self.chain_time >= other.chain_time:
                raise ValueError("chain time and chain height of balances do not match")
            self.chain_time = other.chain_time
            self.chain_height = other.chain_height
            self.chain_blockid = other.chain_blockid
        # merge the outputs
        for attr in ['_outputs', '_outputs_spent', '_outputs_unconfirmed', '_outputs_unconfirmed_spent']:
            d = getattr(self, attr, {})
            for id, output in getattr(other, attr, {}).items():
                d[id] = output
        # merge the addresses
        self._addresses |= other._addresses
        # return the modified self
        return self

        Merge the content of the other balance into this balance.
        If other is None, this call results in a no-op.

        Always assign the result, as it could other than self,
        should the class type be changed in order to add all content correctly.
        
Merge the content of the other balance into this balance.
If other is None, this call results in a no-op.

Always assign the result, as it could other than self,
should the class type be changed in order to add all content correctly.
Merge the content of the other balance into this balance . If other is None this call results in a no - op . Always assign the result as it could other than self should the class type be changed in order to add all content correctly .
def balance_add(self, other):
        if other is None:
            return self
        if isinstance(other, (WalletsBalance, MultiSigWalletBalance)):
            return WalletsBalance().balance_add(self).balance_add(other)
        if not isinstance(other, WalletBalance):
            raise TypeError("other balance has to be of type wallet balance")
        if self.chain_height >= other.chain_height:
            if self.chain_time < other.chain_time:
                raise ValueError("chain time and chain height of balances do not match")
        else:
            if self.chain_time >= other.chain_time:
                raise ValueError("chain time and chain height of balances do not match")
            self.chain_time = other.chain_time
            self.chain_height = other.chain_height
            self.chain_blockid = other.chain_blockid
        for attr in ['_outputs', '_outputs_spent', '_outputs_unconfirmed', '_outputs_unconfirmed_spent']:
            d = getattr(self, attr, {})
            for id, output in getattr(other, attr, {}).items():
                d[id] = output
        self._addresses |= other._addresses
        return self
def balance_add ( self , other ) : if other is None : return self if isinstance ( other , ( WalletsBalance , MultiSigWalletBalance ) ) : return WalletsBalance ( ) . balance_add ( self ) . balance_add ( other ) if not isinstance ( other , WalletBalance ) : raise TypeError ( "other balance has to be of type wallet balance" ) if self . chain_height >= other . chain_height : if self . chain_time < other . chain_time : raise ValueError ( "chain time and chain height of balances do not match" ) else : if self . chain_time >= other . chain_time : raise ValueError ( "chain time and chain height of balances do not match" ) self . chain_time = other . chain_time self . chain_height = other . chain_height self . chain_blockid = other . chain_blockid for attr in [ '_outputs' , '_outputs_spent' , '_outputs_unconfirmed' , '_outputs_unconfirmed_spent' ] : d = getattr ( self , attr , { } ) for id , output in getattr ( other , attr , { } ) . items ( ) : d [ id ] = output self . _addresses |= other . _addresses return self
Merge the content of the other balance into this balance.
Merge the content of the other balance into this balance .
"""
        Merge the content of the other balance into this balance.
        If other is None, this call results in a no-op.

        Always assign the result, as it could other than self,
        should the class type be changed in order to add all content correctly.
        """ # another balance is defined, create a new balance that will contain our merge # merge the chain info # merge the outputs # merge the addresses # return the modified self
self
other