Skip to content

Commit ec4df59

Browse files
Run formatting
1 parent 7f400e4 commit ec4df59

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

custom_components/powercalc/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
65
import logging
6+
from typing import Optional
77

88
from homeassistant.helpers.typing import HomeAssistantType
99

@@ -46,7 +46,11 @@ def __init__(self, hass: HomeAssistantType) -> None:
4646
self._lut_registry = LutRegistry()
4747

4848
def create(
49-
self, config: dict, mode: str, light_model: Optional[LightModel], entity_domain: str
49+
self,
50+
config: dict,
51+
mode: str,
52+
light_model: Optional[LightModel],
53+
entity_domain: str,
5054
) -> PowerCalculationStrategyInterface:
5155
"""Create instance of calculation strategy based on configuration"""
5256
if mode == MODE_LINEAR:
@@ -96,8 +100,7 @@ def _create_fixed(self, config: dict, light_model: LightModel) -> FixedStrategy:
96100
fixed_config = {CONF_POWER: config.get(CONF_WATT)}
97101

98102
return FixedStrategy(
99-
fixed_config.get(CONF_POWER),
100-
fixed_config.get(CONF_STATES_POWER)
103+
fixed_config.get(CONF_POWER), fixed_config.get(CONF_STATES_POWER)
101104
)
102105

103106
def _create_lut(self, light_model: LightModel) -> LutStrategy:

custom_components/powercalc/sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
)
5656
from .errors import ModelNotSupported, StrategyConfigurationError, UnsupportedMode
5757
from .light_model import LightModel
58-
from .strategy_interface import PowerCalculationStrategyInterface
5958
from .strategy_fixed import CONFIG_SCHEMA as FIXED_SCHEMA
59+
from .strategy_interface import PowerCalculationStrategyInterface
6060
from .strategy_linear import CONFIG_SCHEMA as LINEAR_SCHEMA
6161

6262
_LOGGER = logging.getLogger(__name__)

custom_components/powercalc/strategy_fixed.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,19 @@
55
import voluptuous as vol
66
from homeassistant.core import State
77

8-
from .const import (
9-
CONF_POWER,
10-
CONF_STATES_POWER
11-
)
8+
from .const import CONF_POWER, CONF_STATES_POWER
129
from .strategy_interface import PowerCalculationStrategyInterface
1310

1411
CONFIG_SCHEMA = vol.Schema(
1512
{
1613
vol.Optional(CONF_POWER): vol.Coerce(float),
1714
vol.Optional(CONF_STATES_POWER, default={}): vol.Schema(
18-
{
19-
cv.string: vol.Coerce(float)
20-
}
21-
)
15+
{cv.string: vol.Coerce(float)}
16+
),
2217
}
2318
)
2419

20+
2521
class FixedStrategy(PowerCalculationStrategyInterface):
2622
def __init__(
2723
self, power: Optional[float], per_state_power: Optional[dict[str, float]]

custom_components/powercalc/strategy_linear.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@
1212
from homeassistant.core import State
1313
from homeassistant.helpers.config_validation import entity_domain
1414

15-
from .const import (
16-
CONF_CALIBRATE,
17-
CONF_MAX_POWER,
18-
CONF_MIN_POWER
19-
)
15+
from .const import CONF_CALIBRATE, CONF_MAX_POWER, CONF_MIN_POWER
2016
from .errors import StrategyConfigurationError
2117
from .strategy_interface import PowerCalculationStrategyInterface
2218

0 commit comments

Comments
 (0)