UI
Console class for displaying formatted output using the Rich library.
Attributes:
| Name | Type | Description |
|---|---|---|
console |
Console
|
The RichConsole object used for printing formatted output. |
columns_individual |
list
|
List of tuples representing the columns for individual deals table. |
columns_cumulative |
list
|
List of tuples representing the columns for cumulative deals table. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initializes the Console object with a RichConsole instance and sets the column configurations. |
print |
Prints a message with the specified level of styling. |
_create_table |
Creates a Rich Table object with the specified title and column configurations. |
display_best_individual_deals |
Displays the best individual deals in a formatted table. |
display_best_cumulative_deals |
Displays the best cumulative deals in a formatted table. |
__init__()
Initialize the Console object with a RichConsole instance and sets the column configurations.
display_best_cumulative_deals(best_cumulative_deals, title)
Display the best cumulative deals.
This function takes a list of cumulative deals, sorts them in descending order of value, and prints the top deals to the console.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
best_cumulative_deals |
Iterable[Dict]
|
A list of cumulative deal objects. Each cumulative deal object should have a 'value' attribute. |
required |
title |
str
|
The title of the table. |
required |
display_best_individual_deals(best_individual_deals, title)
Display the best individual deals.
This function takes a list of deals, sorts them in descending order of value, and prints the top deals to the console.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
best_individual_deals |
Iterable[Dict]
|
A list of deal objects. Each Deal object should have a 'value' attribute. |
required |
title |
str
|
The title of the table. |
required |
print(message, level='info')
Print a message with the specified level of styling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message |
str
|
The message to be printed. |
required |
level |
str
|
The level of styling to be applied to the message. |
'info'
|