Skip to content

Commit dbca387

Browse files
committed
Reverted _determine_network change.
1 parent a2ac201 commit dbca387

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

bittensor_cli/cli.py

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,35 +1061,32 @@ def initialize_chain(
10611061
"Verify this is intended.",
10621062
)
10631063
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
10761072

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+
)
10831079

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
10931090

10941091
def _run_command(self, cmd: Coroutine, exit_early: bool = True):
10951092
"""
@@ -5058,8 +5055,9 @@ def subnets_price(
50585055
if json_output and html_output:
50595056
print_error("Cannot specify both `--json-output` and `--html`")
50605057
return
5058+
subtensor = self.initialize_chain(network)
50615059
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 + [
50635061
Constants.network_map[x] for x in non_archives
50645062
]:
50655063
err_console.print(
@@ -5099,7 +5097,7 @@ def subnets_price(
50995097

51005098
return self._run_command(
51015099
price.price(
5102-
self.initialize_chain(network),
5100+
subtensor,
51035101
netuids,
51045102
all_netuids,
51055103
interval_hours,

0 commit comments

Comments
 (0)