Skip to content

Commit ebb33e6

Browse files
edit docstrings
1 parent e25d10e commit ebb33e6

File tree

1 file changed

+51
-52
lines changed

1 file changed

+51
-52
lines changed

bittensor/core/subtensor.py

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,7 +2379,7 @@ def get_vote_data(
23792379
block: The blockchain block number for the query.
23802380
23812381
Returns:
2382-
An object containing the proposal's voting data, or `None` if not found.
2382+
An object containing the proposal's voting data, or ``None`` if not found.
23832383
23842384
This function is important for tracking and understanding the decision-making processes within the Bittensor
23852385
network, particularly how proposals are received and acted upon by the governing body.
@@ -2502,17 +2502,17 @@ def is_fast_blocks(self):
25022502
def is_hotkey_delegate(self, hotkey_ss58: str, block: Optional[int] = None) -> bool:
25032503
"""
25042504
Determines whether a given hotkey (public key) is a delegate on the Bittensor network. This function checks if
2505-
the neuron associated with the hotkey is part of the network's delegation system.
2505+
the neuron associated with the hotkey is part of the network's delegation system.
25062506
25072507
Arguments:
2508-
hotkey_ss58 (str): The SS58 address of the neuron's hotkey.
2509-
block (Optional[int]): The blockchain block number for the query.
2508+
hotkey_ss58: The SS58 address of the neuron's hotkey.
2509+
block: The blockchain block number for the query.
25102510
25112511
Returns:
2512-
`True` if the hotkey is a delegate, `False` otherwise.
2512+
``True`` if the hotkey is a delegate, ``False`` otherwise.
25132513
25142514
Being a delegate is a significant status within the Bittensor network, indicating a neuron's involvement in
2515-
consensus and governance processes.
2515+
consensus and governance processes.
25162516
"""
25172517
delegates = self.get_delegates(block)
25182518
return hotkey_ss58 in [info.hotkey_ss58 for info in delegates]
@@ -2525,23 +2525,22 @@ def is_hotkey_registered(
25252525
) -> bool:
25262526
"""
25272527
Determines whether a given hotkey (public key) is registered in the Bittensor network, either globally across
2528-
any subnet or specifically on a specified subnet. This function checks the registration status of a neuron
2529-
identified by its hotkey, which is crucial for validating its participation and activities within the
2530-
network.
2528+
any subnet or specifically on a specified subnet. This function checks the registration status of a neuron
2529+
identified by its hotkey, which is crucial for validating its participation and activities within the network.
25312530
25322531
Arguments:
25332532
hotkey_ss58: The SS58 address of the neuron's hotkey.
2534-
netuid: The unique identifier of the subnet to check the registration. If `None`, the
2533+
netuid: The unique identifier of the subnet to check the registration. If ``None``, the
25352534
registration is checked across all subnets.
25362535
block: The blockchain block number at which to perform the query.
25372536
25382537
Returns:
2539-
bool: `True` if the hotkey is registered in the specified context (either any subnet or a specific subnet),
2540-
`False` otherwise.
2538+
bool: ``True`` if the hotkey is registered in the specified context (either any subnet or a specific subnet),
2539+
``False`` otherwise.
25412540
25422541
This function is important for verifying the active status of neurons in the Bittensor network. It aids in
2543-
understanding whether a neuron is eligible to participate in network processes such as consensus,
2544-
validation, and incentive distribution based on its registration status.
2542+
understanding whether a neuron is eligible to participate in network processes such as consensus, validation,
2543+
and incentive distribution based on its registration status.
25452544
"""
25462545
if netuid is None:
25472546
return self.is_hotkey_registered_any(hotkey_ss58, block)
@@ -2557,11 +2556,11 @@ def is_hotkey_registered_any(
25572556
Checks if a neuron's hotkey is registered on any subnet within the Bittensor network.
25582557
25592558
Arguments:
2560-
hotkey_ss58 (str): The ``SS58`` address of the neuron's hotkey.
2561-
block (Optional[int]): The blockchain block number for the query.
2559+
hotkey_ss58: The ``SS58`` address of the neuron's hotkey.
2560+
block: The blockchain block number for the query.
25622561
25632562
Returns:
2564-
bool: ``True`` if the hotkey is registered on any subnet, False otherwise.
2563+
bool: ``True`` if the hotkey is registered on any subnet, ``False`` otherwise.
25652564
25662565
This function is essential for determining the network-wide presence and participation of a neuron.
25672566
"""
@@ -2585,9 +2584,9 @@ def is_subnet_active(self, netuid: int, block: Optional[int] = None) -> bool:
25852584
block: The blockchain block number for the query.
25862585
25872586
Returns:
2588-
True if subnet is active, False otherwise.
2587+
``True`` if subnet is active, ``False`` otherwise.
25892588
2590-
This means whether the `start_call` was initiated or not.
2589+
Note: This means whether the ``start_call`` was initiated or not.
25912590
"""
25922591
query = self.query_subtensor(
25932592
name="FirstEmissionBlockNumber",
@@ -2665,19 +2664,19 @@ def neuron_for_uid(
26652664
) -> "NeuronInfo":
26662665
"""
26672666
Retrieves detailed information about a specific neuron identified by its unique identifier (UID) within a
2668-
specified subnet (netuid) of the Bittensor network. This function provides a comprehensive view of a
2669-
neuron's attributes, including its stake, rank, and operational status.
2667+
specified subnet (netuid) of the Bittensor network. This function provides a comprehensive view of a
2668+
neuron's attributes, including its stake, rank, and operational status.
26702669
26712670
Arguments:
2672-
uid (int): The unique identifier of the neuron.
2673-
netuid (int): The unique identifier of the subnet.
2674-
block (Optional[int]): The blockchain block number for the query.
2671+
uid: The unique identifier of the neuron.
2672+
netuid: The unique identifier of the subnet.
2673+
block: The blockchain block number for the query.
26752674
26762675
Returns:
26772676
Detailed information about the neuron if found, a null neuron otherwise
26782677
26792678
This function is crucial for analyzing individual neurons' contributions and status within a specific subnet,
2680-
offering insights into their roles in the network's consensus and validation mechanisms.
2679+
offering insights into their roles in the network's consensus and validation mechanisms.
26812680
"""
26822681
if uid is None:
26832682
return NeuronInfo.get_null_neuron()
@@ -2698,17 +2697,17 @@ def neurons(self, netuid: int, block: Optional[int] = None) -> list["NeuronInfo"
26982697
"""
26992698
Retrieves a list of all neurons within a specified subnet of the Bittensor network.
27002699
This function provides a snapshot of the subnet's neuron population, including each neuron's attributes and
2701-
network interactions.
2700+
network interactions.
27022701
27032702
Arguments:
2704-
netuid (int): The unique identifier of the subnet.
2705-
block (Optional[int]): The blockchain block number for the query.
2703+
netuid: The unique identifier of the subnet.
2704+
block: The blockchain block number for the query.
27062705
27072706
Returns:
27082707
A list of NeuronInfo objects detailing each neuron's characteristics in the subnet.
27092708
27102709
Understanding the distribution and status of neurons within a subnet is key to comprehending the network's
2711-
decentralized structure and the dynamics of its consensus and governance processes.
2710+
decentralized structure and the dynamics of its consensus and governance processes.
27122711
"""
27132712
result = self.query_runtime_api(
27142713
runtime_api="NeuronInfoRuntimeApi",
@@ -2728,17 +2727,17 @@ def neurons_lite(
27282727
"""
27292728
Retrieves a list of neurons in a 'lite' format from a specific subnet of the Bittensor network.
27302729
This function provides a streamlined view of the neurons, focusing on key attributes such as stake and network
2731-
participation.
2730+
participation.
27322731
27332732
Arguments:
2734-
netuid (int): The unique identifier of the subnet.
2735-
block (Optional[int]): The blockchain block number for the query.
2733+
netuid: The unique identifier of the subnet.
2734+
block: The blockchain block number for the query.
27362735
27372736
Returns:
27382737
A list of simplified neuron information for the subnet.
27392738
27402739
This function offers a quick overview of the neuron population within a subnet, facilitating efficient analysis
2741-
of the network's decentralized structure and neuron dynamics.
2740+
of the network's decentralized structure and neuron dynamics.
27422741
"""
27432742
result = self.query_runtime_api(
27442743
runtime_api="NeuronInfoRuntimeApi",
@@ -2757,23 +2756,23 @@ def query_identity(
27572756
) -> Optional[ChainIdentity]:
27582757
"""
27592758
Queries the identity of a neuron on the Bittensor blockchain using the given key. This function retrieves
2760-
detailed identity information about a specific neuron, which is a crucial aspect of the network's
2761-
decentralized identity and governance system.
2759+
detailed identity information about a specific neuron, which is a crucial aspect of the network's
2760+
decentralized identity and governance system.
27622761
27632762
Arguments:
2764-
coldkey_ss58 (str): The coldkey used to query the neuron's identity (technically the neuron's coldkey SS58
2763+
coldkey_ss58: The coldkey used to query the neuron's identity (technically the neuron's coldkey SS58
27652764
address).
2766-
block (Optional[int]): The blockchain block number for the query.
2765+
block: The blockchain block number for the query.
27672766
27682767
Returns:
27692768
An object containing the identity information of the neuron if found, ``None`` otherwise.
27702769
27712770
The identity information can include various attributes such as the neuron's stake, rank, and other
2772-
network-specific details, providing insights into the neuron's role and status within the Bittensor network.
2771+
network-specific details, providing insights into the neuron's role and status within the Bittensor network.
27732772
27742773
Note:
27752774
See the `Bittensor CLI documentation <https://docs.bittensor.com/reference/btcli>`_ for supported identity
2776-
parameters.
2775+
parameters.
27772776
"""
27782777
identity_info = cast(
27792778
dict,
@@ -2798,7 +2797,7 @@ def query_identity(
27982797
def recycle(self, netuid: int, block: Optional[int] = None) -> Optional[Balance]:
27992798
"""
28002799
Retrieves the 'Burn' hyperparameter for a specified subnet. The 'Burn' parameter represents the amount of Tao
2801-
that is effectively recycled within the Bittensor network.
2800+
that is effectively recycled within the Bittensor network.
28022801
28032802
Arguments:
28042803
netuid: The unique identifier of the subnet.
@@ -2808,7 +2807,7 @@ def recycle(self, netuid: int, block: Optional[int] = None) -> Optional[Balance]
28082807
Optional[Balance]: The value of the 'Burn' hyperparameter if the subnet exists, None otherwise.
28092808
28102809
Understanding the 'Burn' rate is essential for analyzing the network registration usage, particularly how it is
2811-
correlated with user activity and the overall cost of participation in a given subnet.
2810+
correlated with user activity and the overall cost of participation in a given subnet.
28122811
"""
28132812
call = self.get_hyperparameter(param_name="Burn", netuid=netuid, block=block)
28142813
return None if call is None else Balance.from_rao(int(call))
@@ -2888,11 +2887,11 @@ def subnet_exists(self, netuid: int, block: Optional[int] = None) -> bool:
28882887
Checks if a subnet with the specified unique identifier (netuid) exists within the Bittensor network.
28892888
28902889
Arguments:
2891-
netuid (int): The unique identifier of the subnet.
2892-
block (Optional[int]): The blockchain block number for the query.
2890+
netuid: The unique identifier of the subnet.
2891+
block: The blockchain block number for the query.
28932892
28942893
Returns:
2895-
`True` if the subnet exists, `False` otherwise.
2894+
``True`` if the subnet exists, ``False`` otherwise.
28962895
28972896
This function is critical for verifying the presence of specific subnets in the network,
28982897
enabling a deeper understanding of the network's structure and composition.
@@ -3029,8 +3028,8 @@ def weights_rate_limit(
30293028
Returns network WeightsSetRateLimit hyperparameter.
30303029
30313030
Arguments:
3032-
netuid (int): The unique identifier of the subnetwork.
3033-
block (Optional[int]): The blockchain block number for the query.
3031+
netuid: The unique identifier of the subnetwork.
3032+
block: The blockchain block number for the query.
30343033
30353034
Returns:
30363035
Optional[int]: The value of the WeightsSetRateLimit hyperparameter, or ``None`` if the subnetwork does not
@@ -3194,8 +3193,8 @@ def add_stake(
31943193
) -> bool:
31953194
"""
31963195
Adds a stake from the specified wallet to the neuron identified by the SS58 address of its hotkey in specified
3197-
subnet. Staking is a fundamental process in the Bittensor network that enables neurons to participate
3198-
actively and earn incentives.
3196+
subnet. Staking is a fundamental process in the Bittensor network that enables neurons to participate
3197+
actively and earn incentives.
31993198
32003199
Arguments:
32013200
wallet: The wallet to be used for staking.
@@ -3217,12 +3216,12 @@ def add_stake(
32173216
can think of it as an expiration date for the transaction. Defaults to ``None``.
32183217
32193218
Returns:
3220-
bool: True if the staking is successful, False otherwise.
3219+
bool: ``True`` if the staking is successful, ``False`` otherwise.
32213220
32223221
This function enables neurons to increase their stake in the network, enhancing their influence and potential
3223-
rewards in line with Bittensor's consensus and reward mechanisms.
3224-
When safe_staking is enabled, it provides protection against price fluctuations during the time stake is
3225-
executed and the time it is actually processed by the chain.
3222+
rewards in line with Bittensor's consensus and reward mechanisms.
3223+
When safe_staking is enabled, it provides protection against price fluctuations during the time stake is
3224+
executed and the time it is actually processed by the chain.
32263225
"""
32273226
amount = check_and_convert_to_balance(amount)
32283227
return add_stake_extrinsic(

0 commit comments

Comments
 (0)