From 0ae1c319ac4164b989730c73bde3d85aa2d91243 Mon Sep 17 00:00:00 2001 From: Olexandr88 Date: Mon, 5 Jan 2026 11:48:08 +0200 Subject: [PATCH 1/2] chore: fix incorrect Optional type annotation in utils --- bittensor/utils/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bittensor/utils/__init__.py b/bittensor/utils/__init__.py index 419e00b79b..9d10f1f956 100644 --- a/bittensor/utils/__init__.py +++ b/bittensor/utils/__init__.py @@ -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. @@ -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] @@ -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. @@ -174,9 +174,9 @@ 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]] = ( + explorer_urls: dict[str, str] = {} + + explorer_root_urls: dict[str, str] = ( _get_explorer_root_url_by_network_from_map(network, network_map) ) From 72994b612001c2de68d1769ab8d2fdc120dcda73 Mon Sep 17 00:00:00 2001 From: Olexandr88 Date: Thu, 8 Jan 2026 09:26:05 +0200 Subject: [PATCH 2/2] chore: run make check --- bittensor/utils/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bittensor/utils/__init__.py b/bittensor/utils/__init__.py index 9d10f1f956..1dd9fd205c 100644 --- a/bittensor/utils/__init__.py +++ b/bittensor/utils/__init__.py @@ -176,8 +176,8 @@ def get_explorer_url_for_network( explorer_urls: dict[str, str] = {} - explorer_root_urls: dict[str, str] = ( - _get_explorer_root_url_by_network_from_map(network, network_map) + explorer_root_urls: dict[str, str] = _get_explorer_root_url_by_network_from_map( + network, network_map ) if explorer_root_urls != {}: