Skip to content

Commit

Permalink
Replace UTC with use of timezone.utc for compatibility
Browse files Browse the repository at this point in the history
datetime.UTC  was introduced only in 3.11, so type checking which uses 3.9
ATM fails rightfully, as unittesting on 3.9 and 3.10
  • Loading branch information
yarikoptic committed Jan 29, 2025
1 parent 6bb3146 commit 8b3f546
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dandi/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from collections import Counter, deque
from collections.abc import Callable, Iterable, Iterator, Sequence
from dataclasses import InitVar, dataclass, field
from datetime import UTC, datetime
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from enum import Enum
from functools import partial
Expand Down Expand Up @@ -1129,7 +1129,7 @@ def _check_if_more_attempts_allowed(
# we could parse it and calculate how long to sleep
try:
retry_after_date = parsedate_to_datetime(retry_after)
current_date = datetime.now(UTC)
current_date = datetime.now(timezone.utc)
difference = retry_after_date - current_date
sleep_amount = int(difference.total_seconds())
if sleep_amount < 0:
Expand Down

0 comments on commit 8b3f546

Please sign in to comment.