Skip to content

Commit b30aea0

Browse files
committed
Python 3.9 compatibility
1 parent a641141 commit b30aea0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

bittensor/core/async_subtensor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import asyncio
22
import copy
3-
from datetime import datetime, UTC
3+
from datetime import datetime, timezone
44
import ssl
55
from functools import partial
66
from typing import Optional, Any, Union, Iterable, TYPE_CHECKING
@@ -2773,7 +2773,7 @@ async def get_timestamp(
27732773
reuse_block=reuse_block,
27742774
)
27752775
).value
2776-
return datetime.fromtimestamp(unix / 1000, tz=UTC)
2776+
return datetime.fromtimestamp(unix / 1000, tz=timezone.utc)
27772777

27782778
# Extrinsics helper ================================================================================================
27792779

bittensor/core/subtensor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import copy
2-
from datetime import datetime, UTC
2+
from datetime import datetime, timezone
3+
34
from functools import lru_cache
45
from typing import TYPE_CHECKING, Any, Iterable, Optional, Union, cast
56

@@ -2082,7 +2083,7 @@ def get_timestamp(self, block: Optional[int] = None) -> datetime:
20822083
datetime object for the timestamp of the block
20832084
"""
20842085
unix = self.query_module("Timestamp", "Now", block=block).value
2085-
return datetime.fromtimestamp(unix / 1000, tz=UTC)
2086+
return datetime.fromtimestamp(unix / 1000, tz=timezone.utc)
20862087

20872088
# Extrinsics helper ================================================================================================
20882089

0 commit comments

Comments
 (0)