@@ -1061,32 +1061,35 @@ def initialize_chain(
1061
1061
"Verify this is intended." ,
1062
1062
)
1063
1063
if not self .subtensor :
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
1072
-
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
- )
1064
+ self .subtensor = SubtensorInterface (self ._determine_network (network ))
1065
+ return self .subtensor
1079
1066
1080
- self . subtensor = SubtensorInterface ( network_ )
1081
- elif self . config [ " network" ] :
1082
- self . subtensor = SubtensorInterface ( self . config [ "network" ])
1083
- console . print (
1084
- f"Using the specified network [ { COLORS . G . LINKS } ] { self . config [ 'network' ] } "
1085
- f"[/ { COLORS . G . LINKS } ] from config"
1086
- )
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
1087
1074
else :
1088
- self .subtensor = SubtensorInterface (defaults .subtensor .network )
1089
- return self .subtensor
1075
+ network_ = item
1076
+
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
+ )
1083
+
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
1090
1093
1091
1094
def _run_command (self , cmd : Coroutine , exit_early : bool = True ):
1092
1095
"""
0 commit comments