Feedback
Bases: ABC
Base class for feedback during install/upgrade operations.
This class provides methods for progress reporting and cancellation handling. Subclasses should implement the abstract methods to provide custom feedback mechanisms.
Source code in pum/feedback.py
__init__
cancel
Cancel the operation.
Note: This will have no effect if cancellation has been locked (after commit).
get_progress
Get the current progress.
Returns:
| Type | Description |
|---|---|
tuple[int, int]
|
A tuple of (current_step, total_steps). |
increment_step
is_cancelled
Check if the operation has been cancelled.
Returns:
| Type | Description |
|---|---|
bool
|
True if the operation should be cancelled, False otherwise. |
bool
|
Always returns False if cancellation has been locked (after commit). |
Source code in pum/feedback.py
lock_cancellation
Lock cancellation to prevent it after a commit.
Once locked, is_cancelled() will always return False and cancel() will have no effect. This should be called immediately before committing database changes.
Source code in pum/feedback.py
report_progress
abstractmethod
Report progress during an operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
A message describing the current operation. |
required |
current
|
int
|
The current progress value (e.g., changelog number). |
0
|
total
|
int
|
The total number of steps. |
0
|
Source code in pum/feedback.py
reset
set_total_steps
Set the total number of steps for the operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
total
|
int
|
The total number of steps. |
required |