Skip to content

Commit ff0ddf5

Browse files
author
Roman
committed
rename argument
1 parent 8f9623e commit ff0ddf5

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

bittensor/core/subtensor_api/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SubtensorApi:
2626
config: Bittensor configuration object. Defaults to `None`.
2727
log_verbose: If `True`, sets the subtensor to log verbosely. Defaults to `False`.
2828
async_subtensor: If `True`, uses the async subtensor to create the connection. Defaults to `False`.
29-
subtensor_fields: If `True`, all methods from the Subtensor class will be added to the root level of this class.
29+
backward_compatibility: If `True`, all methods from the Subtensor class will be added to the root level of this class.
3030
3131
Example:
3232
# sync version
@@ -46,10 +46,10 @@ class SubtensorApi:
4646
print(await subtensor.delegates.get_delegate_identities())
4747
print(await subtensor.chain.tx_rate_limit())
4848
49-
# using `subtensor_fields`
49+
# using `backward_compatibility`
5050
import bittensor as bt
5151
52-
subtensor = bt.SubtensorApi(subtensor_fields=True)
52+
subtensor = bt.SubtensorApi(backward_compatibility=True)
5353
print(subtensor.bonds(0))
5454
"""
5555

@@ -59,7 +59,7 @@ def __init__(
5959
config: Optional["Config"] = None,
6060
log_verbose: bool = False,
6161
async_subtensor: bool = False,
62-
subtensor_fields: bool = False,
62+
backward_compatibility: bool = False,
6363
_mock: bool = False,
6464
):
6565
self.network = network
@@ -88,7 +88,9 @@ def __init__(
8888
self.sign_and_send_extrinsic = self._subtensor.sign_and_send_extrinsic
8989
self.start_call = self._subtensor.start_call
9090
self.wait_for_block = self._subtensor.wait_for_block
91-
if subtensor_fields:
91+
92+
# adds all Subtensor methods into main level os SubtensorApi class
93+
if backward_compatibility:
9294
_add_classic_fields(self)
9395

9496
def _get_subtensor(self) -> Union["_Subtensor", "_AsyncSubtensor"]:

tests/unit_tests/test_subtensor_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ def test_properties_methods_comparable(other_class: "Subtensor" = None):
5757
)
5858

5959

60-
def test__methods_comparable_with_passed_subtensor_fields(
60+
def test__methods_comparable_with_passed_backward_compatibility(
6161
other_class: "Subtensor" = None,
6262
):
63-
"""Verifies that methods in SubtensorApi contains all Subtensors methods if `subtensor_fields=True` is passed."""
63+
"""Verifies that methods in SubtensorApi contains all Subtensors methods if `backward_compatibility=True` is passed."""
6464
# Preps
6565
subtensor = other_class(_mock=True) if other_class else Subtensor(_mock=True)
66-
subtensor_api = SubtensorApi(_mock=True, subtensor_fields=True)
66+
subtensor_api = SubtensorApi(_mock=True, backward_compatibility=True)
6767

6868
subtensor_methods = [m for m in dir(subtensor) if not m.startswith("_")]
6969
subtensor_api_methods = [m for m in dir(subtensor_api) if not m.startswith("_")]

0 commit comments

Comments
 (0)