Remove unnecessary try-else (3) (#86160)
This commit is contained in:
parent
bc115634d1
commit
141acba40d
6 changed files with 35 additions and 37 deletions
|
@ -145,7 +145,7 @@ class DataUpdateCoordinatorMixin:
|
|||
await client.set_setting_values(module_id, value)
|
||||
except ApiException:
|
||||
return False
|
||||
else:
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ class MediaExtractor:
|
|||
except MEQueryException:
|
||||
_LOGGER.error("Wrong query format: %s", stream_query)
|
||||
return
|
||||
else:
|
||||
|
||||
data = {k: v for k, v in self.call_data.items() if k != ATTR_ENTITY_ID}
|
||||
data[ATTR_MEDIA_CONTENT_ID] = stream_url
|
||||
|
||||
|
@ -148,9 +148,7 @@ class MediaExtractor:
|
|||
data[ATTR_ENTITY_ID] = entity_id
|
||||
|
||||
self.hass.async_create_task(
|
||||
self.hass.services.async_call(
|
||||
MEDIA_PLAYER_DOMAIN, SERVICE_PLAY_MEDIA, data
|
||||
)
|
||||
self.hass.services.async_call(MEDIA_PLAYER_DOMAIN, SERVICE_PLAY_MEDIA, data)
|
||||
)
|
||||
|
||||
def get_stream_query_for_entity(self, entity_id):
|
||||
|
|
|
@ -35,7 +35,7 @@ def fetch_data(connection: datapoint.Manager, site: Site, mode: str) -> MetOffic
|
|||
except (ValueError, datapoint.exceptions.APIException) as err:
|
||||
_LOGGER.error("Check Met Office connection: %s", err.args)
|
||||
raise UpdateFailed from err
|
||||
else:
|
||||
|
||||
time_now = utcnow()
|
||||
return MetOfficeData(
|
||||
now=forecast.now(),
|
||||
|
|
|
@ -371,7 +371,7 @@ class ModbusHub:
|
|||
except ModbusException as exception_error:
|
||||
self._log_error(str(exception_error), error_state=False)
|
||||
return False
|
||||
else:
|
||||
|
||||
message = f"modbus {self.name} communication open"
|
||||
_LOGGER.info(message)
|
||||
return True
|
||||
|
|
|
@ -111,5 +111,5 @@ class PhoneModemFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
await api.test(dev_path)
|
||||
except EXCEPTIONS:
|
||||
return {"base": "cannot_connect"}
|
||||
else:
|
||||
|
||||
return None
|
||||
|
|
|
@ -71,7 +71,7 @@ class DataUpdateCoordinatorMotionBlinds(DataUpdateCoordinator):
|
|||
except (timeout, ParseException):
|
||||
# let the error be logged and handled by the motionblinds library
|
||||
return {ATTR_AVAILABLE: False}
|
||||
else:
|
||||
|
||||
return {ATTR_AVAILABLE: True}
|
||||
|
||||
def update_blind(self, blind):
|
||||
|
@ -84,7 +84,7 @@ class DataUpdateCoordinatorMotionBlinds(DataUpdateCoordinator):
|
|||
except (timeout, ParseException):
|
||||
# let the error be logged and handled by the motionblinds library
|
||||
return {ATTR_AVAILABLE: False}
|
||||
else:
|
||||
|
||||
return {ATTR_AVAILABLE: True}
|
||||
|
||||
async def _async_update_data(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue