woob.capabilities.bank.pfm
¶
- 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.
- Parameters:
new_accounts (iter[
Account
]) – list of freshly fetched, not-matched-yet accountsold_accounts (iter[
Account
]) – list of old, not-matched-yet accounts
- Return type:
iter[
AccountDiff
]
- 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.
- Parameters:
account (
Account
) – fresh account to search forold_accounts (iter[
Account
]) – candidates accounts from previous sync
- Returns:
the corresponding account from old_accounts, or None if none matches
- Return type:
Account