Skip to content

Commit 7177985

Browse files
author
Roman
committed
improve docstrings, fix private function usage
1 parent 5feede0 commit 7177985

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

bittensor/core/async_subtensor.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3119,6 +3119,9 @@ async def wait_for_block(self, block: Optional[int] = None):
31193119
bool: True if the target block was reached, False if timeout occurred.
31203120
31213121
Example:
3122+
import bittensor as bt
3123+
subtensor = bt.Subtensor()
3124+
31223125
await subtensor.wait_for_block() # Waits for next block
31233126
await subtensor.wait_for_block(block=1234) # Waits for a specific block
31243127
"""
@@ -4452,7 +4455,7 @@ async def unstake(
44524455
period (Optional[int]): The number of blocks during which the transaction will remain valid after it's submitted. If
44534456
the transaction is not included in a block within that number of blocks, it will expire and be rejected.
44544457
You can think of it as an expiration date for the transaction.
4455-
unstake_all: If true, unstakes all tokens. Default is ``False``.
4458+
unstake_all: If true, unstakes all tokens. Default is ``False``. If `True` amount is ignored.
44564459
44574460
Returns:
44584461
bool: ``True`` if the unstaking process is successful, False otherwise.
@@ -4503,7 +4506,7 @@ async def unstake_multiple(
45034506
period (Optional[int]): The number of blocks during which the transaction will remain valid after it's submitted. If
45044507
the transaction is not included in a block within that number of blocks, it will expire and be rejected.
45054508
You can think of it as an expiration date for the transaction.
4506-
unstake_all: If true, unstakes all tokens. Default is ``False``.
4509+
unstake_all: If true, unstakes all tokens. Default is ``False``. If `True` amounts are ignored.
45074510
45084511
Returns:
45094512
bool: ``True`` if the batch unstaking is successful, False otherwise.

bittensor/core/subtensor.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,8 +2412,11 @@ def wait_for_block(self, block: Optional[int] = None):
24122412
bool: True if the target block was reached, False if timeout occurred.
24132413
24142414
Example:
2415-
>>> subtensor.wait_for_block() # Waits for the next block
2416-
>>> subtensor.wait_for_block(block=1234) # Waits for a specific block
2415+
import bittensor as bt
2416+
subtensor = bt.Subtensor()
2417+
2418+
subtensor.wait_for_block() # Waits for the next block
2419+
subtensor.wait_for_block(block=1234) # Waits for a specific block
24172420
"""
24182421

24192422
def handler(block_data: dict):
@@ -2431,7 +2434,7 @@ def handler(block_data: dict):
24312434
else:
24322435
target_block = current_block["header"]["number"] + 1
24332436

2434-
self.substrate._get_block_handler(
2437+
self.substrate.get_block_handler(
24352438
current_block_hash, header_only=True, subscription_handler=handler
24362439
)
24372440
return True
@@ -3695,7 +3698,7 @@ def unstake(
36953698
period (Optional[int]): The number of blocks during which the transaction will remain valid after it's submitted. If
36963699
the transaction is not included in a block within that number of blocks, it will expire and be rejected.
36973700
You can think of it as an expiration date for the transaction.
3698-
unstake_all: If true, unstakes all tokens. Default is ``False``.
3701+
unstake_all: If true, unstakes all tokens. Default is ``False``. If `True` amount is ignored.
36993702
37003703
Returns:
37013704
bool: ``True`` if the unstaking process is successful, False otherwise.
@@ -3747,7 +3750,7 @@ def unstake_multiple(
37473750
period (Optional[int]): The number of blocks during which the transaction will remain valid after it's submitted. If
37483751
the transaction is not included in a block within that number of blocks, it will expire and be rejected.
37493752
You can think of it as an expiration date for the transaction.
3750-
unstake_all: If true, unstakes all tokens. Default is ``False``.
3753+
unstake_all: If true, unstakes all tokens. Default is ``False``. If `True` amounts are ignored.
37513754
37523755
Returns:
37533756
bool: ``True`` if the batch unstaking is successful, False otherwise.

0 commit comments

Comments
 (0)