finalynx.budget._review

This module contains the logic for reviewing the expenses. It is only used internally by the Budget class.

The _review() method of the Budget class will display the list of pending expenses in a nice rich table and ask the user to review them one by one.

Module Contents

Functions

_render_mini_expenses_table

Render a mini table with the current expense in focus and a few surrounding expenses. This is used to display the current expense in context when asking the user to review it.

_ask

Ask the user to input a value. The input will be validated with the is_valid function.

_set_field

Ask the user to set a field of the expense. The input will be validated with the is_valid function. If the input is not valid, the user will be asked to try again. If the input is valid, the apply function will be called with the input as argument. If the input is empty, the default value will be used instead.

_i_paid

Ask the user to set the amount they paid for the expense.

_payback

Ask the user to set the payback for the expense (who also paid for this).

_constraint

Ask the user to set the constraint for the expense.

_period

_comment

_status

Data

N_CONTEXT_ITEMS

API

finalynx.budget._review.N_CONTEXT_ITEMS

3

finalynx.budget._review._render_mini_expenses_table(expenses: List[finalynx.budget.expense.Expense], i_focus: int) rich.table.Table[source]

Render a mini table with the current expense in focus and a few surrounding expenses. This is used to display the current expense in context when asking the user to review it.

finalynx.budget._review._ask(expenses: List[finalynx.budget.expense.Expense], i_expense: int, message: str, is_valid: Callable[[str], bool], current: Optional[str] = None, default: Optional[str] = None) str[source]

Ask the user to input a value. The input will be validated with the is_valid function.

  • If the input is not valid, the user will be asked to try again.

  • If the input is valid, it will be returned.

  • If the input is empty, the default value will be returned.

finalynx.budget._review._set_field(expenses: List[finalynx.budget.expense.Expense], i_expense: int, question: str, options: str, is_valid: Callable[[str], bool], apply: Callable[[str], bool], current: Optional[str] = None, default: Optional[str] = None) Optional[bool][source]

Ask the user to set a field of the expense. The input will be validated with the is_valid function. If the input is not valid, the user will be asked to try again. If the input is valid, the apply function will be called with the input as argument. If the input is empty, the default value will be used instead.

finalynx.budget._review._i_paid(expenses: List[finalynx.budget.expense.Expense], i_expense: int) Optional[bool][source]

Ask the user to set the amount they paid for the expense.

finalynx.budget._review._payback(expenses: List[finalynx.budget.expense.Expense], i_expense: int) Optional[bool][source]

Ask the user to set the payback for the expense (who also paid for this).

finalynx.budget._review._constraint(expenses: List[finalynx.budget.expense.Expense], i_expense: int) Optional[bool][source]

Ask the user to set the constraint for the expense.

finalynx.budget._review._period(expenses: List[finalynx.budget.expense.Expense], i_expense: int) Optional[bool][source]
finalynx.budget._review._comment(expenses: List[finalynx.budget.expense.Expense], i_expense: int) Optional[bool][source]
finalynx.budget._review._status(expenses: List[finalynx.budget.expense.Expense], i_expense: int) Optional[bool][source]