From 08dd8fecf4395d8cfb67a37ba5ccf42fb4994a18 Mon Sep 17 00:00:00 2001 From: Simon Hansen <67142049+DurgNomis-drol@users.noreply.github.com> Date: Wed, 22 Sep 2021 17:12:58 +0200 Subject: [PATCH] Use f-string instead. Needed for #61 (#64) --- mytoyota/controller.py | 6 ++---- mytoyota/statistics.py | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/mytoyota/controller.py b/mytoyota/controller.py index 9c7e5416..3ce159f1 100644 --- a/mytoyota/controller.py +++ b/mytoyota/controller.py @@ -100,7 +100,7 @@ async def _update_token(self) -> None: self._token_expiration = datetime.now() else: raise ToyotaLoginError( - "Login failed, check your credentials! {}".format(response.text) + f"Login failed, check your credentials! {response.text}" ) async def _is_token_valid(self) -> bool: @@ -118,9 +118,7 @@ async def _is_token_valid(self) -> bool: return True return False - raise ToyotaLoginError( - "Error when trying to check token: {}".format(response.text) - ) + raise ToyotaLoginError(f"Error when trying to check token: {response.text}") async def request( # pylint: disable=too-many-arguments self, diff --git a/mytoyota/statistics.py b/mytoyota/statistics.py index 0dc73557..039b7634 100644 --- a/mytoyota/statistics.py +++ b/mytoyota/statistics.py @@ -116,9 +116,9 @@ def _add_bucket(self, data: dict, interval: str) -> list: day[BUCKET].update( { UNIT: METRIC, - DATE: self._now.strptime( - "{} {}".format(dayofyear, year), "%j %Y" - ).format(DATE_FORMAT), + DATE: self._now.strptime(f"{dayofyear} {year}", "%j %Y").format( + DATE_FORMAT + ), } ) return data[HISTOGRAM]