Slot

class slot.Slot(key: str, value: Any, slot_type: str)[source]

Represents a slot in GnuCash.

class slot.SlottableObject(slots: list[Slot] | None = None)[source]

Class used to consolidate storing and retrieving slot values.

get_slot_value(key: str) Any[source]

Retrieves the value of the slot given a certain key.

Parameters:

key (str) – Name of the slot

Returns:

Slot value

Return type:

Any

set_slot_value(key: str, value: Any, slot_type: str) None[source]

Sets the value of the slot given a certain key and slot type.

Parameters:
  • key (str) – Name of the slot

  • value (Any) – New value of the slot

  • slot_type (str) – Type of slot

set_slot_value_bool(key: str, value: str | bool, slot_type: str) None[source]

Helper function for slots that expect “true” or “false” GnuCash-side.

Converts “true” (case insensitive) and True to “true”. Converts “false” (case insensitive) and False to “false”.

Parameters:
  • key (str)

  • value (bool|str) – New value of the slot

  • slot_type (str) – Type of slot