From 8fcfc8f34ffa541de4579c6e74da1a3b8cb9905e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 06:46:28 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- khal/configwizard.py | 14 ++++++-------- khal/khalendar/backend.py | 4 ++-- khal/khalendar/event.py | 4 +--- khal/ui/__init__.py | 6 +----- khal/utils.py | 7 +------ 5 files changed, 11 insertions(+), 24 deletions(-) diff --git a/khal/configwizard.py b/khal/configwizard.py index 7590f81ba..bfa203cf5 100644 --- a/khal/configwizard.py +++ b/khal/configwizard.py @@ -355,14 +355,12 @@ def create_config(vdirs, dateformat, timeformat, default_calendar=None): config.append(f'type = {type_}') config.append('\n[locale]') - config.append('timeformat = {timeformat}\n' - 'dateformat = {dateformat}\n' - 'longdateformat = {longdateformat}\n' - 'datetimeformat = {dateformat} {timeformat}\n' - 'longdatetimeformat = {longdateformat} {timeformat}\n' - .format(timeformat=timeformat, - dateformat=dateformat, - longdateformat=dateformat)) + config.append(f'timeformat = {timeformat}\n' + f'dateformat = {dateformat}\n' + f'longdateformat = {dateformat}\n' + f'datetimeformat = {dateformat} {timeformat}\n' + f'longdatetimeformat = {dateformat} {timeformat}\n' + ) if default_calendar: config.append('[default]') config.append(f'default_calendar = {default_calendar}\n') diff --git a/khal/khalendar/backend.py b/khal/khalendar/backend.py index 4ef898d83..68bd6041e 100644 --- a/khal/khalendar/backend.py +++ b/khal/khalendar/backend.py @@ -329,8 +329,8 @@ def update_vcf_dates(self, vevent_str: str, href: str, etag: str='', self.sql_ex(sql_s, stuple) except sqlite3.IntegrityError as error: raise UpdateFailed('Database integrity error creating birthday event ' - 'on {} for contact {} (UID: {}): ' - '{}'.format(date, name, uuid, error)) + f'on {date} for contact {name} (UID: {uuid}): ' + f'{error}') def _update_impl(self, vevent: icalendar.cal.Event, href: str, calendar: str) -> None: """insert `vevent` into the database diff --git a/khal/khalendar/event.py b/khal/khalendar/event.py index a653f94f7..58b1499ac 100644 --- a/khal/khalendar/event.py +++ b/khal/khalendar/event.py @@ -426,9 +426,7 @@ def summary(self) -> str: suffix = 'rd' else: suffix = 'th' - return '{name}\'s {number}{suffix} {desc}{leap}'.format( - name=name, number=number, suffix=suffix, desc=description, leap=leap, - ) + return f'{name}\'s {number}{suffix} {description}{leap}' else: return self._vevents[self.ref].get('SUMMARY', '') diff --git a/khal/ui/__init__.py b/khal/ui/__init__.py index 5f5df56b2..78892f9a0 100644 --- a/khal/ui/__init__.py +++ b/khal/ui/__init__.py @@ -138,11 +138,7 @@ def relative_day(self, day: dt.date, dtformat: str) -> str: approx_delta = utils.relative_timedelta_str(day) - return '{weekday}, {day} ({approx_delta})'.format( - weekday=weekday, - approx_delta=approx_delta, - day=daystr, - ) + return f'{weekday}, {daystr} ({approx_delta})' def keypress(self, _, key: str) -> str: binds = self._conf['keybindings'] diff --git a/khal/utils.py b/khal/utils.py index 30ba2125e..ef13edd58 100644 --- a/khal/utils.py +++ b/khal/utils.py @@ -174,12 +174,7 @@ def relative_timedelta_str(day: dt.date) -> str: if count > 1: unit += 's' - return '{approx}{count} {unit} {direction}'.format( - approx=approx, - count=count, - unit=unit, - direction=direction, - ) + return f'{approx}{count} {unit} {direction}' def get_wrapped_text(widget):