* [PATCH 1/2] perf treport: Initialize the subtitle in the constructor
2026-10-23 13:20 [PATCH 0/2] perf python: Fix pylint warnings without Textual Leo Yan
@ 2026-10-23 13:20 ` Leo Yan
2026-10-23 13:20 ` [PATCH 2/2] perf timechart: Initialize Textual attributes in constructors Leo Yan
2026-11-04 21:16 ` [PATCH 0/2] perf python: Fix pylint warnings without Textual Arnaldo Carvalho de Melo
2 siblings, 0 replies; 4+ messages in thread
From: Leo Yan @ 2026-10-23 13:20 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Alice Rogers, Aishwarya TCV
Cc: Arnaldo Carvalho de Melo, linux-perf-users, linux-kernel, Leo Yan
For Arm64 cross build without Textual, assignments outside __init__()
trigger pylint warning:
************* Module treport
python/treport.py:625:8: W0201: Attribute 'sub_title' defined outside __init__ (attribute-defined-outside-init)
python/treport.py:629:12: W0201: Attribute 'sub_title' defined outside __init__ (attribute-defined-outside-init)
python/treport.py:668:8: W0201: Attribute 'sub_title' defined outside __init__ (attribute-defined-outside-init)
python/treport.py:675:8: W0201: Attribute 'sub_title' defined outside __init__ (attribute-defined-outside-init)
------------------------------------------------------------------
Your code has been rated at 9.91/10 (previous run: 9.91/10, +0.00)
Move the initial subtitle assignment from on_mount() to
ReportApp.__init__() so pylint can see the attribute initialization
without resolving the Textual base class.
Fixes: b379b70b7b7b ("perf treport: Show the profile while it loads")
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/perf/python/treport.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/python/treport.py b/tools/perf/python/treport.py
index e021214753707780343e79dfc6964b9c69698197..f8c95ac1c6e067e8291eed59530f31c77886df68 100755
--- a/tools/perf/python/treport.py
+++ b/tools/perf/python/treport.py
@@ -602,6 +602,7 @@ class ReportApp(App):
"""
super().__init__()
self.input_file = input_file
+ self.sub_title = input_file
self.root = root if root else ProfileNode("root", parent=None)
self.loaded = root is not None
# Held when reading or changing the profile, which is built in a
@@ -622,7 +623,6 @@ class ReportApp(App):
def on_mount(self) -> None:
"""Start loading the profile unless it was given."""
- self.sub_title = self.input_file
if self.loaded:
self.update_views()
else:
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] perf timechart: Initialize Textual attributes in constructors
2026-10-23 13:20 [PATCH 0/2] perf python: Fix pylint warnings without Textual Leo Yan
2026-10-23 13:20 ` [PATCH 1/2] perf treport: Initialize the subtitle in the constructor Leo Yan
@ 2026-10-23 13:20 ` Leo Yan
2026-11-04 21:16 ` [PATCH 0/2] perf python: Fix pylint warnings without Textual Arnaldo Carvalho de Melo
2 siblings, 0 replies; 4+ messages in thread
From: Leo Yan @ 2026-10-23 13:20 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Alice Rogers, Aishwarya TCV
Cc: Arnaldo Carvalho de Melo, linux-perf-users, linux-kernel, Leo Yan
When Textual is unavailable, pylint cannot resolve the inherited
virtual_size and sub_title attributes, which triggers pylint warnings
and caused arm64 cross build failure:
************* Module ttimechart
python/ttimechart.py:1086:8: W0201: Attribute 'virtual_size' defined outside __init__ (attribute-defined-outside-init)
python/ttimechart.py:1422:12: W0201: Attribute 'sub_title' defined outside __init__ (attribute-defined-outside-init)
python/ttimechart.py:1496:8: W0201: Attribute 'sub_title' defined outside __init__ (attribute-defined-outside-init)
python/ttimechart.py:1510:8: W0201: Attribute 'sub_title' defined outside __init__ (attribute-defined-outside-init)
Initialize both attributes in their respective constructors. Use
Textual's default empty virtual size, with the actual geometry
computed when the timeline mounts or resizes.
Fixes: e7a72d691980 ("perf timechart: Add an interactive --tui mode")
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/perf/python/ttimechart.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/python/ttimechart.py b/tools/perf/python/ttimechart.py
index 34ecf84e68c1db7f542070dde608ac09d662a1b2..16d2bbbdd98b23d64ab42643db42686cad98f0f0 100755
--- a/tools/perf/python/ttimechart.py
+++ b/tools/perf/python/ttimechart.py
@@ -1065,6 +1065,7 @@ class TimelineView(ScrollView):
self.can_focus = True
self.data = data
self.rows = rows
+ self.virtual_size = Size(0, 0)
self.cache: Dict[int, List[Cell]] = {}
self.cache_key: Tuple[float, float, int, Optional[ThemeColors]] = (0.0, 0.0, 0, None)
self.label_style = Style()
@@ -1332,6 +1333,7 @@ class TimechartApp(App):
"""
super().__init__()
self.input_name = input_name
+ self.sub_title = input_name
self.power_only = power_only
self.tasks_only = tasks_only
self.filters = filters
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 0/2] perf python: Fix pylint warnings without Textual
2026-10-23 13:20 [PATCH 0/2] perf python: Fix pylint warnings without Textual Leo Yan
2026-10-23 13:20 ` [PATCH 1/2] perf treport: Initialize the subtitle in the constructor Leo Yan
2026-10-23 13:20 ` [PATCH 2/2] perf timechart: Initialize Textual attributes in constructors Leo Yan
@ 2026-11-04 21:16 ` Arnaldo Carvalho de Melo
2 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-11-04 21:16 UTC (permalink / raw)
To: Leo Yan
Cc: Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, James Clark, Alice Rogers,
Aishwarya TCV, Arnaldo Carvalho de Melo, linux-perf-users,
linux-kernel
On Fri, Oct 23, 2026 at 02:20:23PM +0100, Leo Yan wrote:
> An arm64 cross build without Textual on the host reports W0201 warnings
> in treport.py and ttimechart.py, causing the build to fail.
>
> Initialize the inherited attributes in their constructors so pylint can
> recognize them without resolving the Textual base classes.
Seems simple enough, applying for v7.4.
- Arnaldo
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
> Leo Yan (2):
> perf treport: Initialize the subtitle in the constructor
> perf timechart: Initialize Textual attributes in constructors
>
> tools/perf/python/treport.py | 2 +-
> tools/perf/python/ttimechart.py | 2 ++
> 2 files changed, 3 insertions(+), 1 deletion(-)
> ---
> base-commit: 1c90f0a3c8a1c4e38f9edd97af9e20848805a7fb
> change-id: 20261023-perf_fix_pylint_warning-58408f0b6c91
>
> Best regards,
> --
> Leo Yan <leo.yan@arm.com>
>
^ permalink raw reply [flat|nested] 4+ messages in thread