Skip to content

Commit 5b47ec4

Browse files
committed
Format with black
1 parent e014199 commit 5b47ec4

File tree

5 files changed

+23
-27
lines changed

5 files changed

+23
-27
lines changed

pendulum/__init__.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@
6161
_formatter = Formatter()
6262

6363

64-
def _safe_timezone(
65-
obj: str | float | _datetime.tzinfo | Timezone | None
66-
) -> Timezone:
64+
def _safe_timezone(obj: str | float | _datetime.tzinfo | Timezone | None) -> Timezone:
6765
"""
6866
Creates a timezone instance
6967
from a string, Timezone, TimezoneInfo or integer offset.
@@ -170,9 +168,7 @@ def time(hour: int, minute: int = 0, second: int = 0, microsecond: int = 0) -> T
170168
return Time(hour, minute, second, microsecond)
171169

172170

173-
def instance(
174-
dt: _datetime.datetime, tz: str | Timezone | None = UTC
175-
) -> DateTime:
171+
def instance(dt: _datetime.datetime, tz: str | Timezone | None = UTC) -> DateTime:
176172
"""
177173
Create a DateTime instance from a datetime one.
178174
"""
@@ -244,9 +240,7 @@ def from_format(
244240
return datetime(**parts)
245241

246242

247-
def from_timestamp(
248-
timestamp: int | float, tz: str | Timezone = UTC
249-
) -> DateTime:
243+
def from_timestamp(timestamp: int | float, tz: str | Timezone = UTC) -> DateTime:
250244
"""
251245
Create a DateTime instance from a timestamp.
252246
"""

pendulum/datetime.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -890,9 +890,7 @@ def _end_of_week(self) -> DateTime:
890890

891891
return dt.end_of("day")
892892

893-
def next(
894-
self, day_of_week: int | None = None, keep_time: bool = False
895-
) -> DateTime:
893+
def next(self, day_of_week: int | None = None, keep_time: bool = False) -> DateTime:
896894
"""
897895
Modify to the next occurrence of a given day of the week.
898896
If no day_of_week is provided, modify to the next occurrence
@@ -1080,9 +1078,7 @@ def _last_of_quarter(self, day_of_week: int | None = None) -> DateTime:
10801078
"""
10811079
return self.on(self.year, self.quarter * 3, 1).last_of("month", day_of_week)
10821080

1083-
def _nth_of_quarter(
1084-
self, nth: int, day_of_week: int | None = None
1085-
) -> DateTime:
1081+
def _nth_of_quarter(self, nth: int, day_of_week: int | None = None) -> DateTime:
10861082
"""
10871083
Modify to the given occurrence of a given day of the week
10881084
in the current quarter. If the calculated occurrence is outside,
@@ -1234,9 +1230,7 @@ def __radd__(self, other: datetime.timedelta) -> DateTime:
12341230
# Native methods override
12351231

12361232
@classmethod
1237-
def fromtimestamp(
1238-
cls, t: float, tz: datetime.tzinfo | None = None
1239-
) -> DateTime:
1233+
def fromtimestamp(cls, t: float, tz: datetime.tzinfo | None = None) -> DateTime:
12401234
return pendulum.instance(datetime.datetime.fromtimestamp(t, tz=tz), tz=tz)
12411235

12421236
@classmethod

pendulum/formatting/difference_formatter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ def __init__(self, locale="en"):
1616
self._locale = Locale.load(locale)
1717

1818
def format(
19-
self, diff: pendulum.Period, is_now: bool = True, absolute: bool = False, locale: str | None = None
19+
self,
20+
diff: pendulum.Period,
21+
is_now: bool = True,
22+
absolute: bool = False,
23+
locale: str | None = None,
2024
) -> str:
2125
"""
2226
Formats a difference.

pendulum/formatting/formatter.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,7 @@ def format(
260260

261261
return result
262262

263-
def _format_token(
264-
self, dt: pendulum.DateTime, token: str, locale: Locale
265-
) -> str:
263+
def _format_token(self, dt: pendulum.DateTime, token: str, locale: Locale) -> str:
266264
"""
267265
Formats a DateTime instance with a given token and locale.
268266
@@ -537,7 +535,11 @@ def _check_parsed(
537535
return validated
538536

539537
def _get_parsed_values(
540-
self, m: typing.Match[str], parsed: dict[str, typing.Any], locale: Locale, now: pendulum.DateTime
538+
self,
539+
m: typing.Match[str],
540+
parsed: dict[str, typing.Any],
541+
locale: Locale,
542+
now: pendulum.DateTime,
541543
) -> None:
542544
for token, index in m.re.groupindex.items():
543545
if token in self._LOCALIZABLE_TOKENS:
@@ -546,7 +548,11 @@ def _get_parsed_values(
546548
self._get_parsed_value(token, m.group(index), parsed, now)
547549

548550
def _get_parsed_value(
549-
self, token: str, value: str, parsed: dict[str, typing.Any], now: pendulum.DateTime
551+
self,
552+
token: str,
553+
value: str,
554+
parsed: dict[str, typing.Any],
555+
now: pendulum.DateTime,
550556
) -> None:
551557
parsed_token = self._PARSE_TOKENS[token](value)
552558

pendulum/parser.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
CDuration = None
2121

2222

23-
def parse(
24-
text: str, **options: typing.Any
25-
) -> Date | Time | DateTime | Duration:
23+
def parse(text: str, **options: typing.Any) -> Date | Time | DateTime | Duration:
2624
# Use the mock now value if it exists
2725
options["now"] = options.get("now", pendulum.get_test_now())
2826

0 commit comments

Comments
 (0)