11import copy
2- import importlib
32import os
43import pickle
54import typing
@@ -764,7 +763,7 @@ def _set_metagraph_attributes(self, block: int):
764763 )
765764 self .axons = [n .axon_info for n in self .neurons ]
766765
767- def save (self , root_dir : Optional [list [str ]] = None ) -> "AsyncMetagraph " :
766+ def save (self , root_dir : Optional [list [str ]] = None ) -> "MetagraphMixin " :
768767 """
769768 Saves the current state of the metagraph to a file on disk. This function is crucial for persisting the current
770769 state of the network's metagraph, which can later be reloaded or analyzed. The save operation includes all
@@ -1022,7 +1021,7 @@ def __init__(
10221021 self .axons : list ["AxonInfo" ] = []
10231022 self .total_stake : list ["Balance" ] = []
10241023
1025- def load_from_path (self , dir_path : str ) -> "AsyncMetagraph " :
1024+ def load_from_path (self , dir_path : str ) -> "MetagraphMixin " :
10261025 """
10271026 Loads the metagraph state from a specified directory path.
10281027
@@ -1152,7 +1151,7 @@ def __init__(
11521151 self .axons : list ["AxonInfo" ] = []
11531152 self .total_stake : list ["Balance" ] = []
11541153
1155- def load_from_path (self , dir_path : str ) -> "AsyncMetagraph " :
1154+ def load_from_path (self , dir_path : str ) -> "MetagraphMixin " :
11561155 """
11571156 Loads the state of the Metagraph from a specified directory path.
11581157
@@ -1356,10 +1355,7 @@ async def _initialize_subtensor(
13561355 subtensor = self .subtensor
13571356 if not subtensor :
13581357 # Lazy import due to circular import (subtensor -> metagraph, metagraph -> subtensor)
1359- AsyncSubtensor = getattr (
1360- importlib .import_module ("bittensor.core.async_subtensor" ),
1361- "AsyncSubtensor" ,
1362- )
1358+ from bittensor .core .async_subtensor import AsyncSubtensor
13631359
13641360 async with AsyncSubtensor (network = self .chain_endpoint ) as subtensor :
13651361 self .subtensor = subtensor
@@ -1592,7 +1588,7 @@ def sync(
15921588 """
15931589
15941590 # Initialize subtensor
1595- subtensor = self ._initialize_subtensor (subtensor )
1591+ subtensor = self ._initialize_subtensor (subtensor = subtensor )
15961592
15971593 if (
15981594 subtensor .chain_endpoint != settings .ARCHIVE_ENTRYPOINT
@@ -1632,11 +1628,11 @@ def _initialize_subtensor(self, subtensor: "Subtensor") -> "Subtensor":
16321628 according to the current network settings.
16331629
16341630 Args:
1635- subtensor (bittensor.core.async_subtensor.AsyncSubtensor ): The subtensor instance provided for
1631+ subtensor (bittensor.core.subtensor.Subtensor ): The subtensor instance provided for
16361632 initialization. If ``None``, a new subtensor instance is created using the current network configuration.
16371633
16381634 Returns:
1639- subtensor (bittensor.core.async_subtensor.AsyncSubtensor ): The initialized subtensor instance, ready to be
1635+ subtensor (bittensor.core.subtensor.Subtensor ): The initialized subtensor instance, ready to be
16401636 used for syncing the metagraph.
16411637
16421638 Internal Usage:
@@ -1650,9 +1646,8 @@ def _initialize_subtensor(self, subtensor: "Subtensor") -> "Subtensor":
16501646 subtensor = self .subtensor
16511647 if not subtensor :
16521648 # Lazy import due to circular import (subtensor -> metagraph, metagraph -> subtensor)
1653- Subtensor = getattr (
1654- importlib .import_module ("bittensor.core.subtensor" ), "Subtensor"
1655- )
1649+ from bittensor .core .subtensor import Subtensor
1650+
16561651 subtensor = Subtensor (network = self .chain_endpoint )
16571652
16581653 self .subtensor = subtensor
0 commit comments