Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,9 @@ export function TableRenderer(props: TableRendererProps) {
true,
)}
>
{t('Subtotal')}
{t('Subvalue (%(aggregatorName)s)', {
aggregatorName: t(aggregatorName),
})}
</th>,
);
}
Expand Down Expand Up @@ -1333,7 +1335,9 @@ export function TableRenderer(props: TableRendererProps) {
true,
)}
>
{t('Subtotal')}
{t('Subvalue (%(aggregatorName)s)', {
aggregatorName: t(aggregatorName),
})}
</th>
) : null;

Expand Down
12 changes: 10 additions & 2 deletions superset/charts/client_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ def pivot_df( # pylint: disable=too-many-locals, too-many-arguments, too-many-s
slice_ = df.columns.get_loc(subgroup)
subtotal = pivot_v2_aggfunc_map[aggfunc](df.iloc[:, slice_], axis=1)
depth = df.columns.nlevels - len(subgroup) - 1
total = metric_name if level == 0 else __("Subtotal")
total = (
metric_name
if level == 0
else __("Subvalue (%(aggfunc)s)", aggfunc=aggfunc)
)
subtotal_name = tuple([*subgroup, total, *([""] * depth)]) # noqa: C409
# insert column after subgroup
df.insert(int(slice_.stop), subtotal_name, subtotal)
Expand All @@ -202,7 +206,11 @@ def pivot_df( # pylint: disable=too-many-locals, too-many-arguments, too-many-s
df.iloc[slice_, :].apply(pd.to_numeric, errors="coerce"), axis=0
)
depth = groups.nlevels - len(subgroup) - 1
total = metric_name if level == 0 else __("Subtotal")
total = (
metric_name
if level == 0
else __("Subvalue (%(aggfunc)s)", aggfunc=aggfunc)
)
Comment on lines +209 to +213

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Add an explicit type annotation to the newly introduced local variable so the added logic complies with the type-hint requirement for annotatable variables. [custom_rule]

Severity Level: Minor ⚠️

Why it matters? 🤔

The added local variable total is introduced in modified Python code and is clearly annotatable as a string, but it has no explicit type hint. This matches the rule requiring type hints on annotatable variables in new or modified Python code.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset/charts/client_processing.py
**Line:** 209:213
**Comment:**
	*Custom Rule: Add an explicit type annotation to the newly introduced local variable so the added logic complies with the type-hint requirement for annotatable variables.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

subtotal.name = tuple([*subgroup, total, *([""] * depth)]) # noqa: C409
# insert row after subgroup
df = pd.concat(
Expand Down
Loading
Loading