class CapBankMatching[source]

Bases: CapBank

Capability for matching data between synchronisations.

This is mostly useful for PFM which have to compare states across time. For example, a PFM has to compare accounts freshly returned to accounts returned in a previous sync.

diff_accounts(new_accounts, old_accounts)[source]

Compute difference between 2 states of accounts lists.

This function will remove elements from new_accounts and old_accounts as they are matched and put in the resulting AccountDiff object.

Limitations may apply to the fields of old_accounts objects, see documentation of.

  • new_accounts (iter[Account]) – list of freshly fetched, not-matched-yet accounts

  • old_accounts (iter[Account]) – list of old, not-matched-yet accounts

Return type:


match_account(account, old_accounts)[source]

Search an account in old_accounts corresponding to account.

old_accounts is a list of accounts found in a previous synchronisation. However, they may not be the exact same objects but only reconstructed objects with the same data, although even it could be partial. For example, they may have been marshalled, sometimes loosely, thus some attributes may be missing (like _private attributes) or unset (some PFM may choose not to even save all attributes). Also, old_accounts may not contain all accounts from previous state, but only accounts which have not been matched yet.

  • account (Account) – fresh account to search for

  • old_accounts (iter[Account]) – candidates accounts from previous sync


the corresponding account from old_accounts, or None if none matches

Return type:


class AccountDiff[source]

Bases: object

Difference between 2 accounts lists


List of new-old account pairs matching together


Accounts from the previous state that are not present in the latest state


Accounts from the latest state that are not present in the previous state