This needs to be called from a derived class clean().
        :param source_invoice:
        :param settled_invoice:
        :param account:
        :return: None
178536
def clean_entries(self, source_invoice: Invoice or None, settled_invoice: Invoice or None, account: Account, **kw):
        
        for form in self.forms:
            obj = form.instance
            assert isinstance(obj, AccountEntry)
            obj.account = account
            obj.source_invoice = source_invoice
            obj.settled_invoice = settled_invoice
            if obj.parent:
                if obj.amount is None:
                    obj.amount = obj.parent.amount
                if obj.type is None:
                    obj.type = obj.parent.type
                if obj.amount > obj.parent.amount > Decimal(0) or obj.amount < obj.parent.amount < Decimal(0):
                    raise ValidationError(_('Derived account entry amount cannot be larger than original'))
            for k, v in kw.items():
                setattr(obj, k, v)
188032
def from_xdr_object(cls, op_xdr_object):
        
        if not op_xdr_object.sourceAccount:
            source = None
        else:
            source = encode_check(
                'account', op_xdr_object.sourceAccount[0].ed25519).decode()
        return cls(source=source)
416276
@Override
    public void cleanupTransactionBacklogOnRepair() {
        if (m_isLeader && m_sendToHSIds.length > 0) {
            m_mailbox.send(m_sendToHSIds, new MPBacklogFlushMessage());
        }
        Iterator<Entry<Long, TransactionState>> iter = m_outstandingTxns.entrySet().iterator();
        while (iter.hasNext()) {
            Entry<Long, TransactionState> entry = iter.next();
            TransactionState txnState = entry.getValue();
            if (TxnEgo.getPartitionId(entry.getKey()) == MpInitiator.MP_INIT_PID ) {
                if (txnState.isReadOnly()) {
                    txnState.setDone();
                    m_duplicateCounters.entrySet().removeIf((e) -> e.getKey().m_txnId == entry.getKey());
                    iter.remove();
                }
            }
        }

        // flush all RO transactions out of backlog
        m_pendingTasks.removeMPReadTransactions();
    }
361004
private void createCleaner() {
        if (cleanerThread == null) {
            int interval = getPropIntValue
                    (DB_DATASOURCE_CLEAN_INTERNAL_NAME,
                            DB_DATASOURCE_CLEAN_INTERNAL_DEFAULT_VALUE);


            //this runnable
            this.datasourceCleaner = new PooledDataSourceCleaner(this, interval);
            //submit it to the thread to run
            this.cleanerThread = new Thread(datasourceCleaner);
            this.cleanerThread.setDaemon(true);
            this.cleanerThread.start();
        }
    }
228306
def clean(source):
    

    if isinstance(source, dict):
        for key, value in source.items():
            if key == "Fn::Join":
                return convert_join(value)
            else:
                source[key] = clean(value)

    elif isinstance(source, list):
        return [clean(item) for item in source]

    return source
353104
private static BigDecimal computeInvoiceAmountAdjustedForAccountCredit(final Currency currency, final Iterable<InvoiceItem> invoiceItems) {
        BigDecimal amountAdjusted = BigDecimal.ZERO;
        if (invoiceItems == null || !invoiceItems.iterator().hasNext()) {
            return KillBillMoney.of(amountAdjusted, currency);
        }

        for (final InvoiceItem invoiceItem : invoiceItems) {
            final Iterable<InvoiceItem> otherInvoiceItems = Iterables.filter(invoiceItems, new Predicate<InvoiceItem>() {
                @Override
                public boolean apply(final InvoiceItem input) {
                    return !input.getId().equals(invoiceItem.getId());
                }
            });

            if (InvoiceItemType.CREDIT_ADJ.equals(invoiceItem.getInvoiceItemType()) &&
                (Iterables.size(otherInvoiceItems) == 1 &&
                 InvoiceItemType.CBA_ADJ.equals(otherInvoiceItems.iterator().next().getInvoiceItemType()) &&
                 otherInvoiceItems.iterator().next().getInvoiceId().equals(invoiceItem.getInvoiceId()) &&
                 otherInvoiceItems.iterator().next().getAmount().compareTo(invoiceItem.getAmount().negate()) == 0)) {
                amountAdjusted = amountAdjusted.add(invoiceItem.getAmount());
            }
        }

        return KillBillMoney.of(amountAdjusted, currency);
    }
476925
def post(self, amount, other_account, description, self_memo="", other_memo="", datetime=None):
        

        #Note: debits are always positive, credits are always negative.  They should be negated before displaying
        #(expense and liability?) accounts
        tx = self._new_transaction()

        if datetime:
            tx.t_stamp = datetime
        #else now()

        tx.description = description
        tx.save()

        a1 = self._make_ae(self._DEBIT_IN_DB() * amount, self_memo, tx)
        a1.save()
        a2 = other_account._make_ae(-self._DEBIT_IN_DB() * amount, other_memo, tx)
        a2.save()

        return (a1, a2)
538419
def remove(self):
		

		# First, wipe default source on all customers that use this card.
		Customer.objects.filter(default_source=self.id).update(default_source=None)

		try:
			self._api_delete()
		except InvalidRequestError as exc:
			if "No such source:" in str(exc) or "No such customer:" in str(exc):
				# The exception was thrown because the stripe customer or card was already
				# deleted on the stripe side, ignore the exception
				pass
			else:
				# The exception was raised for another reason, re-raise it
				raise

		self.delete()
806336
def settle(ctx, symbol, amount, account):
    
    print_tx(ctx.bitshares.asset_settle(Amount(amount, symbol), account=account))
278601
def invoice_paid?(invoicenumber)
      # Find invoice
      invoice = Twinfield::Process.new(@session).
        request(:process_xml_document, get_dimension_xml(@company, { invoicenumber: invoicenumber })).
        body[:process_xml_document_response][:process_xml_document_result]

      # Find corresponding transaction
      transaction = find_transaction(invoice[:salesinvoice][:financials][:number])

      begin
        if transaction && transaction[:transaction][:lines][:line].first[:matchstatus] == 'matched'
          true
        else
          false
        end
      rescue
        false
      end
    end
1256340
def from_xdr_object(cls, op_xdr_object):
        
        if not op_xdr_object.sourceAccount:
            source = None
        else:
            source = encode_check(
                'account', op_xdr_object.sourceAccount[0].ed25519).decode()

        destination = encode_check(
            'account',
            op_xdr_object.body.createAccountOp.destination.ed25519).decode()
        starting_balance = Operation.from_xdr_amount(
            op_xdr_object.body.createAccountOp.startingBalance)

        return cls(
            source=source,
            destination=destination,
            starting_balance=starting_balance,
        )
369705
def delete(self, invoice_id, **kwargs):
        "
        url = "{}/{}".format(self.base_url, invoice_id)
        return self.delete_url(url, {}, **kwargs)
1034474
def retry(self):
		

		if not self.paid and not self.forgiven and not self.closed:
			stripe_invoice = self.api_retrieve()
			updated_stripe_invoice = (
				stripe_invoice.pay()
			)  # pay() throws an exception if the charge is not successful.
			type(self).sync_from_stripe_data(updated_stripe_invoice)
			return True
		return False
461878
public void billingAccount_DELETE(String billingAccount, String details, OvhTerminationReasonEnum reason) throws IOException {
		String qPath = "/telephony/{billingAccount}";
		StringBuilder sb = path(qPath, billingAccount);
		query(sb, "details", details);
		query(sb, "reason", reason);
		exec(qPath, "DELETE", sb.toString(), null);
	}
7257
def to_xdr_object(self):
        
        source_account = account_xdr_object(self.source)
        memo = self.memo.to_xdr_object()
        operations = [o.to_xdr_object() for o in self.operations]
        ext = Xdr.nullclass()
        ext.v = 0
        return Xdr.types.Transaction(source_account, self.fee, self.sequence,
                                     self.time_bounds, memo, operations, ext)
442282
def get_entries(self, acc: Account, cls=AccountEntry) -> QuerySet:
        
        return cls.objects.filter(Q(account=acc) & (Q(source_invoice=self) | Q(settled_invoice=self))) if acc else cls.objects.none()
431298
def invoice!(attrs={})
      InvoiceCollection.from_response API.post(invoices.uri, attrs.empty? ? nil : Invoice.to_xml(attrs))
    rescue Recurly::API::UnprocessableEntity => e
      raise Invalid, e.message
    end