Conversation
Refactor indentation for readability Adjusted indentation in `stake.py` to maintain consistent code formatting. This change addresses alignment issues in functions, argument lists, and block structures, enhancing the readability and maintainability of the code.
Corrected indentation across multiple functions in stake.py to maintain code consistency and readability. These changes ensure proper alignment as per Python syntax, improving maintainability and reducing potential bugs.
Corrected inconsistent indentation in multiple sections of stake.py, ensuring proper alignment for readability and code functionality. This change addresses formatting glitches without altering the core logic.
Add an `all_netuids` parameter to allow fetching children from all subnets. Also, enhance prompts and options for better user experience. Adjust command usage examples accordingly.
Corrected the indentation of the `stake_get_children` method in `bittensor_cli/cli.py` for better readability and code consistency. This change does not modify functionality but improves code structure.
Refactor `netuid` parameter to be an optional string, and add logic to treat "all" as a special case by setting `netuid` to `None`. This improves the flexibility and user input handling in the staking command.
| network: Optional[str] = Options.network, | ||
| chain: Optional[str] = Options.chain, | ||
| netuid: int = Options.netuid, | ||
| netuid: Optional[str] = typer.Option( |
There was a problem hiding this comment.
This is not Options.netuid because if --all flag is entered we dont want to prompt the user for netuid. (set prompt to false)
There was a problem hiding this comment.
netuid should be an Optional[int] not str
thewhaleking
left a comment
There was a problem hiding this comment.
Also please run ruff.
| network: Optional[str] = Options.network, | ||
| chain: Optional[str] = Options.chain, | ||
| netuid: int = Options.netuid, | ||
| netuid: Optional[str] = typer.Option( |
There was a problem hiding this comment.
netuid should be an Optional[int] not str
| netuid = None | ||
| elif not netuid: | ||
| netuid = Prompt.ask("Netuid") | ||
| if netuid and netuid.lower() == "all": |
There was a problem hiding this comment.
This will not work, because netuid should be an int (consistent and also what get_children expects), so does not have the attribute lower.
| if all_netuids: | ||
| netuid = None | ||
| elif not netuid: | ||
| netuid = Prompt.ask("Netuid") |
There was a problem hiding this comment.
For all of the netuid(int) questions here,
If you do not enter netuid in the args, it will prompt you for netuid.
If you enter 'all' it should behave as if you entered the --all flag to get the children from all subnets.
Updated the input prompt for netuid to use IntPrompt, ensuring integer input. Additionally, added a check to prevent specifying both netuid and all_netuids options simultaneously, exiting with an error message if both are given.
Updated the input prompt for netuid to use IntPrompt, ensuring integer input. Additionally, added a check to prevent specifying both netuid and all_netuids options simultaneously, exiting with an error message if both are given.
Refactor indentation for readability
Adjusted indentation in
stake.pyto maintain consistent code formatting. This change addresses alignment issues in functions, argument lists, and block structures, enhancing the readability and maintainability of the code.