Skip to content

Commit b0f928d

Browse files
committed
linter fixes
1 parent b0aeb53 commit b0f928d

File tree

16 files changed

+89
-89
lines changed

16 files changed

+89
-89
lines changed

poetry.lock

Lines changed: 28 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ tox = "^4.0.0"
8080

8181
# [tool.poetry.group.benchmark.dependencies]
8282
# pytest-codspeed = "^1.2.2"
83+
ruff = "^0.7.3"
8384

8485
[tool.poetry.group.build.dependencies]
8586
maturin = ">=1.0,<2.0"

src/pendulum/__init__.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,15 @@
5959

6060

6161
@overload
62-
def timezone(name: int) -> FixedTimezone:
63-
...
62+
def timezone(name: int) -> FixedTimezone: ...
6463

6564

6665
@overload
67-
def timezone(name: str) -> Timezone:
68-
...
66+
def timezone(name: str) -> Timezone: ...
6967

7068

7169
@overload
72-
def timezone(name: str | int) -> Timezone | FixedTimezone:
73-
...
70+
def timezone(name: str | int) -> Timezone | FixedTimezone: ...
7471

7572

7673
def timezone(name: str | int) -> Timezone | FixedTimezone:
@@ -205,24 +202,21 @@ def time(hour: int, minute: int = 0, second: int = 0, microsecond: int = 0) -> T
205202
def instance(
206203
obj: _datetime.datetime,
207204
tz: str | Timezone | FixedTimezone | _datetime.tzinfo | None = UTC,
208-
) -> DateTime:
209-
...
205+
) -> DateTime: ...
210206

211207

212208
@overload
213209
def instance(
214210
obj: _datetime.date,
215211
tz: str | Timezone | FixedTimezone | _datetime.tzinfo | None = UTC,
216-
) -> Date:
217-
...
212+
) -> Date: ...
218213

219214

220215
@overload
221216
def instance(
222217
obj: _datetime.time,
223218
tz: str | Timezone | FixedTimezone | _datetime.tzinfo | None = UTC,
224-
) -> Time:
225-
...
219+
) -> Time: ...
226220

227221

228222
def instance(

src/pendulum/date.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,13 @@ def __add__(self, other: timedelta) -> Self:
257257
return self._add_timedelta(other)
258258

259259
@overload # type: ignore[override] # this is only needed because of Python 3.7
260-
def __sub__(self, __delta: timedelta) -> Self:
261-
...
260+
def __sub__(self, __delta: timedelta) -> Self: ...
262261

263262
@overload
264-
def __sub__(self, __dt: datetime) -> NoReturn:
265-
...
263+
def __sub__(self, __dt: datetime) -> NoReturn: ...
266264

267265
@overload
268-
def __sub__(self, __dt: Self) -> Interval:
269-
...
266+
def __sub__(self, __dt: Self) -> Interval: ...
270267

271268
def __sub__(self, other: timedelta | date) -> Self | Interval:
272269
if isinstance(other, timedelta):

src/pendulum/datetime.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,11 @@ def instance(
146146

147147
@overload
148148
@classmethod
149-
def now(cls, tz: datetime.tzinfo | None = None) -> Self:
150-
...
149+
def now(cls, tz: datetime.tzinfo | None = None) -> Self: ...
151150

152151
@overload
153152
@classmethod
154-
def now(cls, tz: str | Timezone | FixedTimezone | None = None) -> Self:
155-
...
153+
def now(cls, tz: str | Timezone | FixedTimezone | None = None) -> Self: ...
156154

157155
@classmethod
158156
def now(
@@ -1186,12 +1184,10 @@ def average( # type: ignore[override]
11861184
)
11871185

11881186
@overload # type: ignore[override]
1189-
def __sub__(self, other: datetime.timedelta) -> Self:
1190-
...
1187+
def __sub__(self, other: datetime.timedelta) -> Self: ...
11911188

11921189
@overload
1193-
def __sub__(self, other: DateTime) -> Interval:
1194-
...
1190+
def __sub__(self, other: DateTime) -> Interval: ...
11951191

11961192
def __sub__(self, other: datetime.datetime | datetime.timedelta) -> Self | Interval:
11971193
if isinstance(other, datetime.timedelta):

src/pendulum/duration.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,10 @@ def __mul__(self, other: int | float) -> Self:
375375
__rmul__ = __mul__
376376

377377
@overload
378-
def __floordiv__(self, other: timedelta) -> int:
379-
...
378+
def __floordiv__(self, other: timedelta) -> int: ...
380379

381380
@overload
382-
def __floordiv__(self, other: int) -> Self:
383-
...
381+
def __floordiv__(self, other: int) -> Self: ...
384382

385383
def __floordiv__(self, other: int | timedelta) -> int | Duration:
386384
if not isinstance(other, (int, timedelta)):
@@ -389,7 +387,8 @@ def __floordiv__(self, other: int | timedelta) -> int | Duration:
389387
usec = self._to_microseconds()
390388
if isinstance(other, timedelta):
391389
return cast(
392-
int, usec // other._to_microseconds() # type: ignore[attr-defined]
390+
int,
391+
usec // other._to_microseconds(), # type: ignore[attr-defined]
393392
)
394393

395394
if isinstance(other, int):
@@ -402,12 +401,10 @@ def __floordiv__(self, other: int | timedelta) -> int | Duration:
402401
)
403402

404403
@overload
405-
def __truediv__(self, other: timedelta) -> float:
406-
...
404+
def __truediv__(self, other: timedelta) -> float: ...
407405

408406
@overload
409-
def __truediv__(self, other: float) -> Self:
410-
...
407+
def __truediv__(self, other: float) -> Self: ...
411408

412409
def __truediv__(self, other: int | float | timedelta) -> Self | float:
413410
if not isinstance(other, (int, float, timedelta)):
@@ -416,7 +413,8 @@ def __truediv__(self, other: int | float | timedelta) -> Self | float:
416413
usec = self._to_microseconds()
417414
if isinstance(other, timedelta):
418415
return cast(
419-
float, usec / other._to_microseconds() # type: ignore[attr-defined]
416+
float,
417+
usec / other._to_microseconds(), # type: ignore[attr-defined]
420418
)
421419

422420
if isinstance(other, int):
@@ -443,7 +441,7 @@ def __truediv__(self, other: int | float | timedelta) -> Self | float:
443441

444442
def __mod__(self, other: timedelta) -> Self:
445443
if isinstance(other, timedelta):
446-
r = self._to_microseconds() % other._to_microseconds() # type: ignore[attr-defined] # noqa: E501
444+
r = self._to_microseconds() % other._to_microseconds() # type: ignore[attr-defined]
447445

448446
return self.__class__(0, 0, r)
449447

src/pendulum/formatting/formatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
_MATCH_TIMESTAMP = r"[+-]?\d+(\.\d{1,6})?"
3939
_MATCH_WORD = (
4040
"(?i)[0-9]*"
41-
"['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+"
41+
"['a-z\u00a0-\u05ff\u0700-\ud7ff\uf900-\ufdcf\ufdf0-\uffef]+"
4242
r"|[\u0600-\u06FF/]+(\s*?[\u0600-\u06FF]+){1,2}"
4343
)
4444
_MATCH_TIMEZONE = "[A-Za-z0-9-+]+(/[A-Za-z0-9-+_]+)?"

src/pendulum/helpers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ def add_duration(
6262
minutes: int = 0,
6363
seconds: float = 0,
6464
microseconds: int = 0,
65-
) -> _DT:
66-
...
65+
) -> _DT: ...
6766

6867

6968
@overload

src/pendulum/interval.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,15 @@ def __new__(
3737
start: pendulum.DateTime | datetime,
3838
end: pendulum.DateTime | datetime,
3939
absolute: bool = False,
40-
) -> Self:
41-
...
40+
) -> Self: ...
4241

4342
@overload
4443
def __new__(
4544
cls,
4645
start: pendulum.Date | date,
4746
end: pendulum.Date | date,
4847
absolute: bool = False,
49-
) -> Self:
50-
...
48+
) -> Self: ...
5149

5250
def __new__(
5351
cls,
@@ -351,25 +349,21 @@ def __mul__(self, other: int | float) -> Duration: # type: ignore[override]
351349
__rmul__ = __mul__ # type: ignore[assignment]
352350

353351
@overload # type: ignore[override]
354-
def __floordiv__(self, other: timedelta) -> int:
355-
...
352+
def __floordiv__(self, other: timedelta) -> int: ...
356353

357354
@overload
358-
def __floordiv__(self, other: int) -> Duration:
359-
...
355+
def __floordiv__(self, other: int) -> Duration: ...
360356

361357
def __floordiv__(self, other: int | timedelta) -> int | Duration:
362358
return self.as_duration().__floordiv__(other)
363359

364360
__div__ = __floordiv__ # type: ignore[assignment]
365361

366362
@overload # type: ignore[override]
367-
def __truediv__(self, other: timedelta) -> float:
368-
...
363+
def __truediv__(self, other: timedelta) -> float: ...
369364

370365
@overload
371-
def __truediv__(self, other: float) -> Duration:
372-
...
366+
def __truediv__(self, other: float) -> Duration: ...
373367

374368
def __truediv__(self, other: float | timedelta) -> Duration | float:
375369
return self.as_duration().__truediv__(other)

src/pendulum/parsing/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
" )"
4545
")?"
4646
# Time (optional) # noqa: ERA001
47-
"(?P<time>" r" (?P<timesep>\ )?" # Separator (space)
47+
"(?P<time>"
48+
r" (?P<timesep>\ )?" # Separator (space)
4849
# HH:mm:ss (optional mm and ss)
4950
r" (?P<hour>\d{1,2}):(?P<minute>\d{1,2})?(?::(?P<second>\d{1,2}))?"
5051
# Subsecond part (optional)

0 commit comments

Comments
 (0)