mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-04-07 08:03:40 +00:00
refactor(sensor): replace redundant pass-through lambdas with direct references
PLW0108: Three lambdas were simple pass-throughs that added no value: lambda data: aggregate_level_data(data) → aggregate_level_data lambda: lifecycle_calculator.get_lifecycle_state() → lifecycle_calculator.get_lifecycle_state Affected files: sensor/calculators/rolling_hour.py (line 115) sensor/helpers.py (line 139) sensor/value_getters.py (line 220) Impact: No behaviour change. Linter now passes with zero warnings.
This commit is contained in:
parent
5411a75b79
commit
636bd7a797
3 changed files with 3 additions and 3 deletions
|
|
@ -112,7 +112,7 @@ class TibberPricesRollingHourCalculator(TibberPricesBaseCalculator):
|
|||
|
||||
# Map other value types to aggregation functions
|
||||
aggregators = {
|
||||
"level": lambda data: aggregate_level_data(data),
|
||||
"level": aggregate_level_data,
|
||||
"rating": lambda data: aggregate_rating_data(data, threshold_low, threshold_high),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ def aggregate_window_data(
|
|||
# Map value types to aggregation functions
|
||||
aggregators: dict[str, Callable] = {
|
||||
"price": lambda data: aggregate_average_data(data, config_entry)[0], # Use only average from tuple
|
||||
"level": lambda data: aggregate_level_data(data),
|
||||
"level": aggregate_level_data,
|
||||
"rating": lambda data: aggregate_rating_data(data, threshold_low, threshold_high),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ def get_value_getter_mapping( # noqa: PLR0913 - needs all calculators as parame
|
|||
# Diagnostic sensors
|
||||
"data_timestamp": get_data_timestamp,
|
||||
# Data lifecycle status sensor
|
||||
"data_lifecycle_status": lambda: lifecycle_calculator.get_lifecycle_state(),
|
||||
"data_lifecycle_status": lifecycle_calculator.get_lifecycle_state,
|
||||
# Home metadata sensors (via MetadataCalculator)
|
||||
"home_type": lambda: metadata_calculator.get_home_metadata_value("type"),
|
||||
"home_size": lambda: metadata_calculator.get_home_metadata_value("size"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue