Skip to content

Commit

Permalink
Removed the obsolete timedelta_seconds function
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Nov 24, 2024
1 parent 9483bb4 commit 40431e5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/apscheduler/schedulers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
asint,
astimezone,
maybe_ref,
timedelta_seconds,
undefined,
)

Expand Down Expand Up @@ -1151,7 +1150,7 @@ def _process_jobs(self):
else:
now = datetime.now(self.timezone)
wait_seconds = min(
max(timedelta_seconds(next_wakeup_time - now), 0), TIMEOUT_MAX
max((next_wakeup_time - now).total_seconds(), 0), TIMEOUT_MAX
)
self._logger.debug(
"Next wakeup is due at %s (in %f seconds)",
Expand Down
5 changes: 2 additions & 3 deletions src/apscheduler/triggers/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
astimezone,
convert_to_datetime,
datetime_repr,
timedelta_seconds,
)


Expand Down Expand Up @@ -53,7 +52,7 @@ def __init__(
self.interval = timedelta(
weeks=weeks, days=days, hours=hours, minutes=minutes, seconds=seconds
)
self.interval_length = timedelta_seconds(self.interval)
self.interval_length = self.interval.total_seconds()
if self.interval_length == 0:
self.interval = timedelta(seconds=1)
self.interval_length = 1
Expand Down Expand Up @@ -116,7 +115,7 @@ def __setstate__(self, state):
self.start_date = state["start_date"]
self.end_date = state["end_date"]
self.interval = state["interval"]
self.interval_length = timedelta_seconds(self.interval)
self.interval_length = self.interval.total_seconds()
self.jitter = state.get("jitter")

def __str__(self):
Expand Down
1 change: 0 additions & 1 deletion src/apscheduler/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"convert_to_datetime",
"datetime_to_utc_timestamp",
"utc_timestamp_to_datetime",
"timedelta_seconds",
"datetime_ceil",
"get_callable_name",
"obj_to_ref",
Expand Down
7 changes: 0 additions & 7 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
maybe_ref,
obj_to_ref,
ref_to_obj,
timedelta_seconds,
utc_timestamp_to_datetime,
)

Expand Down Expand Up @@ -207,12 +206,6 @@ def test_datetime_to_utc_timestamp(timezone):
assert dt2 == dt


def test_timedelta_seconds():
delta = timedelta(minutes=2, seconds=30)
seconds = timedelta_seconds(delta)
assert seconds == 150


@pytest.mark.parametrize(
"input,expected",
[
Expand Down

0 comments on commit 40431e5

Please sign in to comment.