Skip to content

Commit 76ba7c7

Browse files
committed
refactor: Improve clarity
Sourcery suggested: In stats_collectors, using collectors.extend(generator) works but is less self-documenting than a direct list comprehension; consider assigning collectors = [collector(...) for collector in ...] to match the declared return type and improve readability.
1 parent 6ddc335 commit 76ba7c7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

shell_logger/stats_collector.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,15 @@ def stats_collectors(**kwargs) -> list[StatsCollector]:
3939
Returns:
4040
A collection of instances of :class:`StatsCollector` subclasses.
4141
"""
42-
collectors = []
4342
if "measure" in kwargs:
4443
interval = kwargs.get("interval", 1.0)
4544
manager = Manager()
46-
collectors.extend(
45+
return [
4746
collector(interval, manager)
4847
for collector in StatsCollector.subclasses
4948
if collector.stat_name in kwargs["measure"]
50-
)
51-
return collectors
49+
]
50+
return []
5251

5352

5453
class StatsCollector:

0 commit comments

Comments
 (0)