Skip to content

Commit a7bd521

Browse files
authored
Remove temporary variable from supported_features (home-assistant#42685)
* Remove temporary variable from supported_features * Revert removing temp variable for supported features hunterdouglas
1 parent b45fa29 commit a7bd521

File tree

9 files changed

+18
-30
lines changed

9 files changed

+18
-30
lines changed

homeassistant/components/ads/light.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ def brightness(self):
6868
@property
6969
def supported_features(self):
7070
"""Flag supported features."""
71-
support = 0
7271
if self._ads_var_brightness is not None:
73-
support = SUPPORT_BRIGHTNESS
74-
return support
72+
return SUPPORT_BRIGHTNESS
73+
return 0
7574

7675
@property
7776
def is_on(self):

homeassistant/components/bond/light.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,9 @@ def _apply_state(self, state: dict):
6868
@property
6969
def supported_features(self) -> Optional[int]:
7070
"""Flag supported features."""
71-
features = 0
7271
if self._device.supports_set_brightness():
73-
features |= SUPPORT_BRIGHTNESS
74-
75-
return features
72+
return SUPPORT_BRIGHTNESS
73+
return 0
7674

7775
@property
7876
def is_on(self) -> bool:

homeassistant/components/control4/light.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,9 @@ def brightness(self):
187187
@property
188188
def supported_features(self) -> int:
189189
"""Flag supported features."""
190-
flags = 0
191190
if self._is_dimmer:
192-
flags |= SUPPORT_BRIGHTNESS | SUPPORT_TRANSITION
193-
return flags
191+
return SUPPORT_BRIGHTNESS | SUPPORT_TRANSITION
192+
return 0
194193

195194
async def async_turn_on(self, **kwargs) -> None:
196195
"""Turn the entity on."""

homeassistant/components/lcn/light.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,9 @@ async def async_added_to_hass(self):
7171
@property
7272
def supported_features(self):
7373
"""Flag supported features."""
74-
features = SUPPORT_TRANSITION
7574
if self.dimmable:
76-
features |= SUPPORT_BRIGHTNESS
77-
return features
75+
return SUPPORT_TRANSITION | SUPPORT_BRIGHTNESS
76+
return SUPPORT_TRANSITION
7877

7978
@property
8079
def brightness(self):

homeassistant/components/nest/camera_sdm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ def model(self):
8484
@property
8585
def supported_features(self):
8686
"""Flag supported features."""
87-
features = 0
8887
if CameraLiveStreamTrait.NAME in self._device.traits:
89-
features = features | SUPPORT_STREAM
90-
return features
88+
return SUPPORT_STREAM
89+
return 0
9190

9291
async def stream_source(self):
9392
"""Return the source of the stream."""

homeassistant/components/spider/climate.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,9 @@ def __init__(self, api, thermostat):
4444
@property
4545
def supported_features(self):
4646
"""Return the list of supported features."""
47-
supports = SUPPORT_TARGET_TEMPERATURE
48-
4947
if self.thermostat.has_fan_mode:
50-
supports |= SUPPORT_FAN_MODE
51-
52-
return supports
48+
return SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE
49+
return SUPPORT_TARGET_TEMPERATURE
5350

5451
@property
5552
def unique_id(self):

homeassistant/components/tuya/cover.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ def __init__(self, tuya, platform):
6868
@property
6969
def supported_features(self):
7070
"""Flag supported features."""
71-
supported_features = SUPPORT_OPEN | SUPPORT_CLOSE
7271
if self._tuya.support_stop():
73-
supported_features |= SUPPORT_STOP
74-
return supported_features
72+
return SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP
73+
return SUPPORT_OPEN | SUPPORT_CLOSE
7574

7675
@property
7776
def is_opening(self):

homeassistant/components/tuya/fan.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ def speed_list(self) -> list:
119119
@property
120120
def supported_features(self) -> int:
121121
"""Flag supported features."""
122-
supports = SUPPORT_SET_SPEED
123122
if self._tuya.support_oscillate():
124-
supports = supports | SUPPORT_OSCILLATE
125-
return supports
123+
return SUPPORT_SET_SPEED | SUPPORT_OSCILLATE
124+
return SUPPORT_SET_SPEED

homeassistant/components/xbox/media_player.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,9 @@ def state(self):
111111
@property
112112
def supported_features(self):
113113
"""Flag media player features that are supported."""
114-
active_support = SUPPORT_XBOX
115114
if self.state not in [STATE_PLAYING, STATE_PAUSED]:
116-
active_support &= ~SUPPORT_NEXT_TRACK & ~SUPPORT_PREVIOUS_TRACK
117-
return active_support
115+
return SUPPORT_XBOX & ~SUPPORT_NEXT_TRACK & ~SUPPORT_PREVIOUS_TRACK
116+
return SUPPORT_XBOX
118117

119118
@property
120119
def media_content_type(self):

0 commit comments

Comments
 (0)