Skip to content

Commit 1a77963

Browse files
committed
Fix: Resolve code style issues using pre-commit hooks
- Ensured all files pass pre-commit checks - Fixed line length violations (E501) in `difference_formatter.py`
1 parent eee1ebc commit 1a77963

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/pendulum/formatting/difference_formatter.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from pendulum.locales.locale import Locale
66

7+
78
DAYS_THRESHOLD_FOR_HALF_WEEK = 3
89
DAYS_THRESHOLD_FOR_HALF_MONTH = 15
910
MONTHS_THRESHOLD_FOR_HALF_YEAR = 6
@@ -56,15 +57,19 @@ def format(
5657

5758
if diff.months > MONTHS_THRESHOLD_FOR_HALF_YEAR:
5859
count += 1
59-
elif (diff.months == MONTHS_IN_NEARLY_A_YEAR
60-
and (diff.weeks * DAYS_OF_WEEK + diff.remaining_days) > DAYS_THRESHOLD_FOR_HALF_MONTH):
60+
elif (diff.months == MONTHS_IN_NEARLY_A_YEAR) and (
61+
(diff.weeks * DAYS_OF_WEEK + diff.remaining_days)
62+
> DAYS_THRESHOLD_FOR_HALF_MONTH
63+
):
6164
unit = "year"
6265
count = 1
6366
elif diff.months > 0:
6467
unit = "month"
6568
count = diff.months
6669

67-
if (diff.weeks * DAYS_OF_WEEK + diff.remaining_days) >= DAYS_IN_NEARLY_A_MONTH:
70+
if (
71+
diff.weeks * DAYS_OF_WEEK + diff.remaining_days
72+
) >= DAYS_IN_NEARLY_A_MONTH:
6873
count += 1
6974
elif diff.weeks > 0:
7075
unit = "week"
@@ -106,7 +111,7 @@ def format(
106111
key += self.KEY_AFTER
107112
else:
108113
key += self.KEY_BEFORE
109-
114+
110115
return t.cast(str, locale.get(key).format(time))
111116
else:
112117
unit = "second"

0 commit comments

Comments
 (0)