Skip to content

Commit 4a8f274

Browse files
committed
autoformat with ruff
1 parent a1a422d commit 4a8f274

6 files changed

Lines changed: 8 additions & 14 deletions

File tree

pysrc/whenever/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
34
# Almost everything is lazily imported, to speed up initial import time.
45
def __getattr__(name: str) -> object:
56
# When any name from a group is first accessed, the whole module is loaded
@@ -33,11 +34,7 @@ def __getattr__(name: str) -> object:
3334
# Ensures not-yet-imported names are still included in dir() output
3435
def __dir__() -> list[str]:
3536
return sorted(
36-
(
37-
globals().keys()
38-
| _LAZY_NAMES.keys()
39-
| {"TZPATH", "AnyDelta"}
40-
)
37+
(globals().keys() | _LAZY_NAMES.keys() | {"TZPATH", "AnyDelta"})
4138
- {"_LAZY_MODULES", "_LAZY_NAMES"}
4239
)
4340

pysrc/whenever/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,4 +2098,5 @@ class PotentialDstBugWarning(UserWarning): ...
20982098
class DaysAssumed24HoursWarning(PotentialDstBugWarning): ...
20992099
class StaleOffsetWarning(PotentialDstBugWarning): ...
21002100
class NaiveArithmeticWarning(PotentialDstBugWarning): ...
2101+
21012102
AnyDelta: TypeAlias = TimeDelta | ItemizedDelta | ItemizedDateDelta

pysrc/whenever/_deltas.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ def _check_bound(i: int | None, max_value: int) -> int | None:
197197

198198

199199
def _check_component(
200-
value: int, sign: Sign, max_value: int # may also be UNSET
200+
value: int,
201+
sign: Sign,
202+
max_value: int, # may also be UNSET
201203
) -> tuple[int | None, Sign]:
202204
if value is UNSET:
203205
return None, sign
@@ -444,7 +446,6 @@ def keys(self) -> KeysView:
444446
# documented here for the API docs.
445447
if not TYPE_CHECKING: # pragma: no cover
446448
if SPHINX_RUNNING:
447-
448449
# FUTURE: an optimized ValuesView class that defers to the internal
449450
# fields directly instead of going through __getitem__
450451
def values(self) -> ValuesView[int]:
@@ -1621,7 +1622,6 @@ def parse_iso(cls, s: str, /) -> ItemizedDateDelta:
16211622
# documented here for the API docs.
16221623
if not TYPE_CHECKING: # pragma: no cover
16231624
if SPHINX_RUNNING:
1624-
16251625
# FUTURE: an optimized ValuesView class that defers to the internal
16261626
# fields directly instead of going through __getitem__
16271627
def values(self) -> ValuesView[int]:

tests/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"--P2D",
2424
"++P2D",
2525
"1P2",
26-
f"P{MAX_I64+2}Y",
27-
f"P-{MAX_I64+2}Y",
26+
f"P{MAX_I64 + 2}Y",
27+
f"P-{MAX_I64 + 2}Y",
2828
"P3R", # invalid unit
2929
"PT3M", # time component
3030
"P3.4Y", # decimal

tests/test_date.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from typing import Literal
77

88
import pytest
9-
109
from whenever import (
1110
Date,
1211
IsoWeekDate,
@@ -18,8 +17,6 @@
1817
YearMonth,
1918
)
2019

21-
from tests.test_date_delta import make_ddelta
22-
2320
from .common import (
2421
AlwaysEqual,
2522
AlwaysLarger,

tests/test_plain_datetime.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,6 @@ def test_until_in_units(self):
753753

754754

755755
class TestShiftOperators:
756-
757756
def test_timedelta(self):
758757
d = PlainDateTime(2020, 8, 15, 23, 12, 9, nanosecond=987_654)
759758
with suppress(NaiveArithmeticWarning):

0 commit comments

Comments
 (0)