From f438f97571566dfcc0c47fbf23d2f1f57d21e543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Wed, 8 Mar 2023 18:37:11 +0800 Subject: [PATCH] Revised the styles of the f-strings in the Period utility. --- src/accounting/report/period.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/accounting/report/period.py b/src/accounting/report/period.py index e04116e..e9e69d5 100644 --- a/src/accounting/report/period.py +++ b/src/accounting/report/period.py @@ -244,7 +244,7 @@ class Period: :param date: The date. :return: The formatted date. """ - return F"{date.year}/{date.month}/{date.day}" + return f"{date.year}/{date.month}/{date.day}" @staticmethod def __format_month(month: datetime.date) -> str: @@ -253,7 +253,7 @@ class Period: :param month: The month. :return: The formatted month. """ - return F"{month.year}/{month.month}" + return f"{month.year}/{month.month}" def __get_year_desc(self) -> str: """Returns the description as a year range. @@ -278,14 +278,14 @@ class Period: """ if self.start.day != 1 or self.end != _month_end(self.end): raise ValueError - start: str = F"{self.start.year}/{self.start.month}" + start: str = f"{self.start.year}/{self.start.month}" if self.start.year == self.end.year \ and self.start.month == self.end.month: return gettext("in %(period)s", period=start) if self.start.year == self.end.year: end_month: str = str(self.end.month) return gettext("in %(start)s-%(end)s", start=start, end=end_month) - end: str = F"{self.end.year}/{self.end.month}" + end: str = f"{self.end.year}/{self.end.month}" return gettext("in %(start)s-%(end)s", start=start, end=end) def __get_day_desc(self) -> str: @@ -294,7 +294,7 @@ class Period: :return: The description as a day range. :raise ValueError: The period is a month or year range. """ - start: str = F"{self.start.year}/{self.start.month}/{self.start.day}" + start: str = f"{self.start.year}/{self.start.month}/{self.start.day}" if self.start == self.end: return gettext("in %(period)s", period=start) if self.start.year == self.end.year \ @@ -302,10 +302,10 @@ class Period: end_day: str = str(self.end.day) return gettext("in %(start)s-%(end)s", start=start, end=end_day) if self.start.year == self.end.year: - end_month_day: str = F"{self.end.month}/{self.end.day}" + end_month_day: str = f"{self.end.month}/{self.end.day}" return gettext("in %(start)s-%(end)s", start=start, end=end_month_day) - end: str = F"{self.end.year}/{self.end.month}/{self.end.day}" + end: str = f"{self.end.year}/{self.end.month}/{self.end.day}" return gettext("in %(start)s-%(end)s", start=start, end=end) def is_year(self, year: int) -> bool: