tables
DataTable row builders and sort helpers.
Classes¶
CompletionRow ¶
FailedRow ¶
IncompleteRow ¶
PendingRow ¶
RunningRow ¶
Bases: NamedTuple
One row of the running-jobs table.
Fields mirror what _build_running_job_data returns for each job so that
callers can convert the existing data-source tuples with zero additional
computation.
Source code in snakesee/tui/tables.py
StatsRow ¶
Bases: NamedTuple
One row of the rule-statistics panel.
rule_display is the rule name for the first thread-count sub-row and
an empty string for subsequent sub-rows (visual grouping). threads
is the thread-count string shown in the Thr column ("-" when unknown).
stats holds the per-thread (or aggregate) timing data.
Source code in snakesee/tui/tables.py
Functions:¶
completion_rows ¶
completion_rows(jobs: list[JobInfo], failed_job_ids: set[int]) -> list[CompletionRow]
Build completion rows from a sorted list of completed/failed jobs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
jobs
|
list[JobInfo]
|
Ordered list of completed (and failed) jobs as returned by
:meth: |
required |
failed_job_ids
|
set[int]
|
Set of |
required |
Returns:
| Type | Description |
|---|---|
list[CompletionRow]
|
List of :class: |
Source code in snakesee/tui/tables.py
failed_rows ¶
failed_rows(progress: WorkflowProgress) -> list[FailedRow]
Build failed-job rows from workflow progress.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress
|
WorkflowProgress
|
Current :class: |
required |
Returns:
| Type | Description |
|---|---|
list[FailedRow]
|
List of :class: |
list[FailedRow]
|
|
Source code in snakesee/tui/tables.py
incomplete_rows ¶
incomplete_rows(progress: WorkflowProgress) -> list[IncompleteRow]
Build incomplete-job rows from workflow progress.
Each row's display_path is the output file path relative to the
workflow directory when possible, the absolute path otherwise, or the
string "unknown" when no output file is recorded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress
|
WorkflowProgress
|
Current :class: |
required |
Returns:
| Type | Description |
|---|---|
list[IncompleteRow]
|
List of :class: |
list[IncompleteRow]
|
|
Source code in snakesee/tui/tables.py
pending_rows ¶
pending_rows(pending_rules: dict[str, int]) -> list[PendingRow]
Build pending rows from the inferred pending-rule counts.
The default ordering (count descending) is applied here; callers may
re-sort via :func:sort_rows if custom sorting is active.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pending_rules
|
dict[str, int]
|
Mapping from rule name to estimated pending count, as
returned by
:meth: |
required |
Returns:
| Type | Description |
|---|---|
list[PendingRow]
|
List of :class: |
Source code in snakesee/tui/tables.py
running_rows ¶
running_rows(job_data: list[tuple[JobInfo, float | None, float | None, float | None, ToolProgress | None]]) -> list[RunningRow]
Convert raw running-job data tuples to typed :class:RunningRow objects.
The raw tuples are produced by
:meth:~snakesee.tui.data_source.WorkflowDataSource._build_running_job_data,
which already computes elapsed, remaining, start_time, and tool_progress.
This function is a thin adapter so that consumers hold typed data rather
than anonymous tuples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_data
|
list[tuple[JobInfo, float | None, float | None, float | None, ToolProgress | None]]
|
List of |
required |
Returns:
| Type | Description |
|---|---|
list[RunningRow]
|
Equivalent list of :class: |
Source code in snakesee/tui/tables.py
sort_rows ¶
Sort rows by the value at column index, in-place, and return them.
Works on any :class:NamedTuple because named tuples support integer
indexing. None values sort last regardless of direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rows
|
list[_R]
|
List of row tuples to sort. |
required |
column
|
int
|
Zero-based column index to use as the sort key. |
required |
ascending
|
bool
|
When |
required |
Returns:
| Type | Description |
|---|---|
list[_R]
|
The same list, sorted in-place and returned for convenience. |
Source code in snakesee/tui/tables.py
sort_stats_rows ¶
Sort stats rows by a visible column index, mapped to the right StatsRow field.
Unlike :func:sort_rows, this does not index the tuple positionally — the stats
table's visible columns don't line up with the StatsRow shape (see
_STATS_SORT_KEYS). An unrecognized column leaves the rows untouched.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rows
|
list[StatsRow]
|
List of :class: |
required |
column
|
int
|
Zero-based visible column index (0=Rule, 1=Thr, 2=Count, 3=Avg). |
required |
ascending
|
bool
|
When |
required |
Returns:
| Type | Description |
|---|---|
list[StatsRow]
|
A new sorted list, or the input list unchanged for an unknown column. |
Source code in snakesee/tui/tables.py
stats_rows ¶
stats_rows(stats_list: list[RuleTimingStats], thread_stats_dict: dict[str, ThreadTimingStats]) -> list[StatsRow]
Build flattened stats rows for the rule-statistics panel.
Rules with per-thread timing data are expanded into one sub-row per
thread count, with the rule name shown only on the first sub-row. Rules
without thread data get a single row with "-" in the Thr column.
The default ordering (count descending) should be applied by the caller before calling this function so that the thread expansion preserves the sorted order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stats_list
|
list[RuleTimingStats]
|
Ordered list of :class: |
required |
thread_stats_dict
|
dict[str, ThreadTimingStats]
|
Mapping from rule name to
:class: |
required |
Returns:
| Type | Description |
|---|---|
list[StatsRow]
|
Flat list of :class: |