snekuity.api

The primary module in snekuity.

Attributes

logger

Functions

siblings_of(split)

Given a split, returns other splits from the same transaction.

accounts_equal(account_1, account_2)

Returns True if given accounts are equal, False otherwise.

format_xact(xact)

Returns a string representation of the given split.

format_split(split[, include_xact])

Returns a string representation of the given split.

incomplete_xacts(…)

Yields all incomplete transactions of a given base account.

Module Contents

snekuity.api.logger
snekuity.api.siblings_of(split)

Given a split, returns other splits from the same transaction.

Returns:

a list of all splits in the same transaction that are not equal to the given split.

Parameters:

split (gnucash.Split)

Return type:

list[gnucash.Split]

snekuity.api.accounts_equal(account_1, account_2)

Returns True if given accounts are equal, False otherwise.

Shallow comparison to determine whether the two given accounts are equal in type, name, code, description, commodity, and GUID.

Weaker than account_1.Equal(account_2, check_guids=True) but still useful because it suppresses logging.

Parameters:
  • account_1 (gnucash.Account)

  • account_2 (gnucash.Account)

Return type:

bool

snekuity.api.format_xact(xact)

Returns a string representation of the given split.

Parameters:

xact (gnucash.Transaction)

Return type:

str

snekuity.api.format_split(split, include_xact=True)

Returns a string representation of the given split.

Parameters:
  • split (gnucash.Split)

  • include_xact (bool)

Return type:

str

snekuity.api.incomplete_xacts(base: gnucash.Account, imbalance: gnucash.Account) collections.abc.Iterator[tuple[gnucash.Transaction, gnucash.Split, gnucash.Split]]
snekuity.api.incomplete_xacts(base: str, imbalance: str, session: gnucash.Session) collections.abc.Iterator[tuple[gnucash.Transaction, gnucash.Split, gnucash.Split]]

Yields all incomplete transactions of a given base account.

Parameters:
  • base – the account whose splits are to be iterated.

  • imbalance – a reference account for comparison. Can be obtained e.g. by calling: root.lookup_by_full_name('Imbalance-EUR')

  • session – GnuCash session. Used for looking up accounts by name. Mandatory if one or both of base and imbalance are strings.

Returns:

an iterator that yields triples of transaction, base split, and incomplete split.