Skip to content

Commit 18e5490

Browse files
committed
Ruff
1 parent 5c43053 commit 18e5490

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

bittensor_cli/src/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Constants:
1717
"archive": archive_entrypoint,
1818
"local": local_entrypoint,
1919
"dev": dev_entrypoint,
20-
"rao": rao_entrypoint
20+
"rao": rao_entrypoint,
2121
}
2222
delegates_detail_url = "https://raw.githubusercontent.com/opentensor/bittensor-delegates/main/public/delegates.json"
2323

bittensor_cli/src/bittensor/async_substrate_interface.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,7 @@ async def init_runtime(
897897
898898
:returns: Runtime object
899899
"""
900+
900901
async def get_runtime(block_hash, block_id) -> Runtime:
901902
# Check if runtime state already set to current block
902903
if (block_hash and block_hash == self.last_block_hash) or (
@@ -2193,20 +2194,16 @@ async def runtime_call(
21932194
params = {}
21942195

21952196
try:
2196-
runtime_call_def = self.runtime_config.type_registry["runtime_api"][
2197-
api
2198-
]["methods"][method]
2197+
runtime_call_def = self.runtime_config.type_registry["runtime_api"][api][
2198+
"methods"
2199+
][method]
21992200
runtime_api_types = self.runtime_config.type_registry["runtime_api"][
22002201
api
22012202
].get("types", {})
22022203
except KeyError:
2203-
raise ValueError(
2204-
f"Runtime API Call '{api}.{method}' not found in registry"
2205-
)
2204+
raise ValueError(f"Runtime API Call '{api}.{method}' not found in registry")
22062205

2207-
if isinstance(params, list) and len(params) != len(
2208-
runtime_call_def["params"]
2209-
):
2206+
if isinstance(params, list) and len(params) != len(runtime_call_def["params"]):
22102207
raise ValueError(
22112208
f"Number of parameter provided ({len(params)}) does not "
22122209
f"match definition {len(runtime_call_def['params'])}"

bittensor_cli/src/bittensor/chain_data.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,11 @@ def list_from_vec_u8(cls, vec_u8: bytes) -> list["SubnetInfo"]:
571571
)
572572
return result
573573

574+
574575
@dataclass
575576
class SubnetInfoV2:
576577
"""Dataclass for subnet info."""
578+
577579
netuid: int
578580
owner_ss58: str
579581
max_allowed_validators: int
@@ -776,7 +778,7 @@ def list_from_vec_u8(cls, vec_u8: bytes) -> List["SubnetInfoV2"]:
776778
["arbitration_block", "Compact<u64>"],
777779
],
778780
},
779-
"SubnetState": {
781+
"SubnetState": {
780782
"type": "struct",
781783
"type_mapping": [
782784
["netuid", "Compact<u16>"],

bittensor_cli/src/commands/root.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -719,21 +719,22 @@ async def _get_list() -> tuple:
719719
)
720720
return sm, rn, di, ts
721721

722-
723722
with console.status(
724723
f":satellite: Syncing with chain: [white]{subtensor}[/white] ...",
725724
spinner="aesthetic",
726725
):
727-
728726
senate_members, root_neurons, delegate_info, total_stakes = await _get_list()
729-
total_tao = sum(float(Balance.from_rao(total_stakes[neuron.hotkey])) for neuron in root_neurons)
727+
total_tao = sum(
728+
float(Balance.from_rao(total_stakes[neuron.hotkey]))
729+
for neuron in root_neurons
730+
)
730731

731732
table = Table(
732733
Column(
733734
"[bold white]UID",
734735
style="dark_orange",
735736
no_wrap=True,
736-
footer=f"[bold]{len(root_neurons)}[/bold]"
737+
footer=f"[bold]{len(root_neurons)}[/bold]",
737738
),
738739
Column(
739740
"[bold white]NAME",
@@ -750,7 +751,7 @@ async def _get_list() -> tuple:
750751
justify="right",
751752
style="light_goldenrod2",
752753
no_wrap=True,
753-
footer=f"{total_tao:.2f} (\u03c4) "
754+
footer=f"{total_tao:.2f} (\u03c4) ",
754755
),
755756
Column(
756757
"[bold white]SENATOR",
@@ -770,7 +771,7 @@ async def _get_list() -> tuple:
770771
f"[red]Error: No neurons detected on the network:[/red] [white]{subtensor}"
771772
)
772773
raise typer.Exit()
773-
774+
774775
sorted_root_neurons = sorted(
775776
root_neurons,
776777
key=lambda neuron: float(Balance.from_rao(total_stakes[neuron.hotkey])),

0 commit comments

Comments
 (0)