@@ -1061,35 +1061,32 @@ def initialize_chain(
1061
1061
"Verify this is intended." ,
1062
1062
)
1063
1063
if not self .subtensor :
1064
- self .subtensor = SubtensorInterface (self ._determine_network (network ))
1065
- return self .subtensor
1066
-
1067
- def _determine_network (self , network : Optional [list [str ]] = None ):
1068
- if network :
1069
- network_ = None
1070
- for item in network :
1071
- if item .startswith ("ws" ):
1072
- network_ = item
1073
- break
1074
- else :
1075
- network_ = item
1064
+ if network :
1065
+ network_ = None
1066
+ for item in network :
1067
+ if item .startswith ("ws" ):
1068
+ network_ = item
1069
+ break
1070
+ else :
1071
+ network_ = item
1076
1072
1077
- not_selected_networks = [net for net in network if net != network_ ]
1078
- if not_selected_networks :
1079
- console .print (
1080
- f"Networks not selected: "
1081
- f"[{ COLORS .G .ARG } ]{ ', ' .join (not_selected_networks )} [/{ COLORS .G .ARG } ]"
1082
- )
1073
+ not_selected_networks = [net for net in network if net != network_ ]
1074
+ if not_selected_networks :
1075
+ console .print (
1076
+ f"Networks not selected: "
1077
+ f"[{ COLORS .G .ARG } ]{ ', ' .join (not_selected_networks )} [/{ COLORS .G .ARG } ]"
1078
+ )
1083
1079
1084
- return network_
1085
- elif self .config ["network" ]:
1086
- console .print (
1087
- f"Using the specified network [{ COLORS .G .LINKS } ]{ self .config ['network' ]} "
1088
- f"[/{ COLORS .G .LINKS } ] from config"
1089
- )
1090
- return self .config ["network" ]
1091
- else :
1092
- return defaults .subtensor .network
1080
+ self .subtensor = network_
1081
+ elif self .config ["network" ]:
1082
+ console .print (
1083
+ f"Using the specified network [{ COLORS .G .LINKS } ]{ self .config ['network' ]} "
1084
+ f"[/{ COLORS .G .LINKS } ] from config"
1085
+ )
1086
+ self .subtensor = self .config ["network" ]
1087
+ else :
1088
+ self .subtensor = defaults .subtensor .network
1089
+ return self .subtensor
1093
1090
1094
1091
def _run_command (self , cmd : Coroutine , exit_early : bool = True ):
1095
1092
"""
@@ -5058,8 +5055,9 @@ def subnets_price(
5058
5055
if json_output and html_output :
5059
5056
print_error ("Cannot specify both `--json-output` and `--html`" )
5060
5057
return
5058
+ subtensor = self .initialize_chain (network )
5061
5059
non_archives = ["finney" , "latent-lite" , "subvortex" ]
5062
- if not current_only and self . _determine_network ( network ) in non_archives + [
5060
+ if not current_only and subtensor . network in non_archives + [
5063
5061
Constants .network_map [x ] for x in non_archives
5064
5062
]:
5065
5063
err_console .print (
@@ -5099,7 +5097,7 @@ def subnets_price(
5099
5097
5100
5098
return self ._run_command (
5101
5099
price .price (
5102
- self . initialize_chain ( network ) ,
5100
+ subtensor ,
5103
5101
netuids ,
5104
5102
all_netuids ,
5105
5103
interval_hours ,
0 commit comments