Skip to content

Commit

Permalink
Consider-using-with
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Jul 26, 2021
1 parent 18a57d3 commit 53e267c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion homeassistant/components/telegram_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ def load_data(
_LOGGER.warning("Can't load data in %s after %s retries", url, retry_num)
elif filepath is not None:
if hass.config.is_allowed_path(filepath):
return open(filepath, "rb") # pylint: disable=consider-using-with
with open(filepath, "rb") as fp:
return fp

_LOGGER.warning("'%s' are not secure to load data from!", filepath)
else:
Expand Down

0 comments on commit 53e267c

Please sign in to comment.