Skip to content

Commit

Permalink
Parenthesize excepts
Browse files Browse the repository at this point in the history
  • Loading branch information
lawtancool authored Apr 13, 2023
1 parent db41dbe commit 67addd5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions custom_components/control4/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
# Add Control4 controller to device registry
try:
controller_href = (await entry_data[CONF_ACCOUNT].getAccountControllers())["href"]
except client_exceptions.ClientError, asyncio.TimeoutError as exception:
except (client_exceptions.ClientError, asyncio.TimeoutError) as exception:
raise ConfigEntryNotReady(exception) from exception

try:
entry_data[CONF_DIRECTOR_SW_VERSION] = await entry_data[
CONF_ACCOUNT
].getControllerOSVersion(controller_href)
except client_exceptions.ClientError, asyncio.TimeoutError as exception:
except (client_exceptions.ClientError, asyncio.TimeoutError) as exception:
raise ConfigEntryNotReady(exception) from exception

_, model, mac_address = entry_data[CONF_CONTROLLER_UNIQUE_ID].split("_", 3)
Expand All @@ -95,7 +95,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
# Store all items found on controller for platforms to use
try:
director_all_items = await entry_data[CONF_DIRECTOR].getAllItemInfo()
except client_exceptions.ClientError, asyncio.TimeoutError as exception:
except (client_exceptions.ClientError, asyncio.TimeoutError) as exception:
raise ConfigEntryNotReady(exception) from exception
director_all_items = json.loads(director_all_items)
entry_data[CONF_DIRECTOR_ALL_ITEMS] = director_all_items
Expand Down Expand Up @@ -173,15 +173,15 @@ async def refresh_tokens(hass: HomeAssistant, entry: ConfigEntry):
)
try:
await account.getAccountBearerToken()
except client_exceptions.ClientError, asyncio.TimeoutError as exception:
except (client_exceptions.ClientError, asyncio.TimeoutError) as exception:
raise ConfigEntryNotReady(exception) from exception
except BadCredentials as exception:
raise ConfigEntryAuthFailed(exception) from exception

controller_unique_id = config[CONF_CONTROLLER_UNIQUE_ID]
try:
director_token_dict = await account.getDirectorBearerToken(controller_unique_id)
except client_exceptions.ClientError, asyncio.TimeoutError as exception:
except (client_exceptions.ClientError, asyncio.TimeoutError) as exception:
raise ConfigEntryNotReady(exception) from exception
no_verify_ssl_session = aiohttp_client.async_get_clientsession(
hass, verify_ssl=False
Expand Down

0 comments on commit 67addd5

Please sign in to comment.