Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions bittensor/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def strtobool(val: str) -> Union[bool, Literal["==SUPRESS=="]]:

def _get_explorer_root_url_by_network_from_map(
network: str, network_map: dict[str, dict[str, str]]
) -> Optional[dict[str, str]]:
) -> dict[str, str]:
"""
Returns the explorer root url for the given network name from the given network map.

Expand All @@ -151,7 +151,7 @@ def _get_explorer_root_url_by_network_from_map(
Returns:
The explorer url for the given network. Or None if the network is not in the network map.
"""
explorer_urls: Optional[dict[str, str]] = {}
explorer_urls: dict[str, str] = {}
for entity_nm, entity_network_map in network_map.items():
if network in entity_network_map:
explorer_urls[entity_nm] = entity_network_map[network]
Expand All @@ -161,7 +161,7 @@ def _get_explorer_root_url_by_network_from_map(

def get_explorer_url_for_network(
network: str, block_hash: str, network_map: dict[str, dict[str, str]]
) -> Optional[dict[str, str]]:
) -> dict[str, str]:
"""
Returns the explorer url for the given block hash and network.

Expand All @@ -174,10 +174,10 @@ def get_explorer_url_for_network(
The explorer url for the given block hash and network. Or None if the network is not known.
"""

explorer_urls: Optional[dict[str, str]] = {}
# Will be None if the network is not known. i.e. not in network_map
explorer_root_urls: Optional[dict[str, str]] = (
_get_explorer_root_url_by_network_from_map(network, network_map)
explorer_urls: dict[str, str] = {}

explorer_root_urls: dict[str, str] = _get_explorer_root_url_by_network_from_map(
network, network_map
)

if explorer_root_urls != {}:
Expand Down