Skip to content

Commit 149d533

Browse files
committed
Upgrade ruff hook and fix lint issues
1 parent 51db040 commit 149d533

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
- id: debug-statements
1313

1414
- repo: https://github.com/astral-sh/ruff-pre-commit
15-
rev: v0.11.2
15+
rev: v0.14.11
1616
hooks:
1717
- id: ruff
1818
- id: ruff-format

clock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ translations = {{}}
192192
for k, v in d.items():
193193
v = (
194194
self.format_dict(v, tab + 1)
195-
if isinstance(v, dict | LocaleDataDict)
195+
if isinstance(v, (dict, LocaleDataDict))
196196
else repr(v)
197197
)
198198

src/pendulum/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ def _safe_timezone(
9090
Creates a timezone instance
9191
from a string, Timezone, TimezoneInfo or integer offset.
9292
"""
93-
if isinstance(obj, Timezone | FixedTimezone):
93+
if isinstance(obj, (Timezone, FixedTimezone)):
9494
return obj
9595

9696
if obj is None or obj == "local":
9797
return local_timezone()
9898

99-
if isinstance(obj, int | float):
99+
if isinstance(obj, (int, float)):
100100
obj = int(obj * 60 * 60)
101101
elif isinstance(obj, _datetime.tzinfo):
102102
# zoneinfo
@@ -225,7 +225,7 @@ def instance(
225225
"""
226226
Create a DateTime/Date/Time instance from a datetime/date/time native one.
227227
"""
228-
if isinstance(obj, DateTime | Date | Time):
228+
if isinstance(obj, (DateTime, Date, Time)):
229229
return obj
230230

231231
if isinstance(obj, _datetime.date) and not isinstance(obj, _datetime.datetime):

src/pendulum/datetime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def offset_hours(self) -> float | None:
268268

269269
@property
270270
def timezone(self) -> Timezone | FixedTimezone | None:
271-
if not isinstance(self.tzinfo, Timezone | FixedTimezone):
271+
if not isinstance(self.tzinfo, (Timezone, FixedTimezone)):
272272
return None
273273

274274
return self.tzinfo

src/pendulum/duration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def __floordiv__(self, other: timedelta) -> int: ...
381381
def __floordiv__(self, other: int) -> Self: ...
382382

383383
def __floordiv__(self, other: int | timedelta) -> int | Duration:
384-
if not isinstance(other, int | timedelta):
384+
if not isinstance(other, (int, timedelta)):
385385
return NotImplemented
386386

387387
usec = self._to_microseconds()
@@ -407,7 +407,7 @@ def __truediv__(self, other: timedelta) -> float: ...
407407
def __truediv__(self, other: float) -> Self: ...
408408

409409
def __truediv__(self, other: int | float | timedelta) -> Self | float:
410-
if not isinstance(other, int | float | timedelta):
410+
if not isinstance(other, (int, float, timedelta)):
411411
return NotImplemented
412412

413413
usec = self._to_microseconds()

src/pendulum/time.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def __sub__(self, other: time) -> pendulum.Duration: ...
174174
def __sub__(self, other: datetime.timedelta) -> Time: ...
175175

176176
def __sub__(self, other: time | datetime.timedelta) -> pendulum.Duration | Time:
177-
if not isinstance(other, Time | time | timedelta):
177+
if not isinstance(other, (Time, time, timedelta)):
178178
return NotImplemented
179179

180180
if isinstance(other, timedelta):
@@ -197,7 +197,7 @@ def __rsub__(self, other: time) -> pendulum.Duration: ...
197197
def __rsub__(self, other: datetime.timedelta) -> Time: ...
198198

199199
def __rsub__(self, other: time | datetime.timedelta) -> pendulum.Duration | Time:
200-
if not isinstance(other, Time | time):
200+
if not isinstance(other, (Time, time)):
201201
return NotImplemented
202202

203203
if isinstance(other, time):

0 commit comments

Comments
 (0)