bittensor.commands.utils#

Attributes#

Classes#

IntListPrompt

Prompt for a list of integers.

DelegatesDetails

Functions#

check_netuid_set(config, subtensor[, allow_none])

check_for_cuda_reg_config(config)

Checks, when CUDA is available, if the user would like to register with their CUDA device.

get_hotkey_wallets_for_wallet(wallet)

get_coldkey_wallets_for_path(path)

get_all_wallets_for_path(path)

filter_netuids_by_registered_hotkeys(cli, subtensor, ...)

normalize_hyperparameters(subnet)

Normalizes the hyperparameters of a subnet.

_get_delegates_details_from_github(requests_get, url)

get_delegates_details(url)

Module Contents#

bittensor.commands.utils.console#
class bittensor.commands.utils.IntListPrompt(prompt='', *, console=None, password=False, choices=None, show_default=True, show_choices=True)[source]#

Bases: rich.prompt.PromptBase

Prompt for a list of integers.

Parameters:
  • prompt (rich.text.TextType)

  • console (Optional[rich.console.Console])

  • password (bool)

  • choices (Optional[List[str]])

  • show_default (bool)

  • show_choices (bool)

check_choice(value)[source]#

Check value is in the list of valid choices.

Parameters:

value (str) – Value entered by user.

Returns:

True if choice was valid, otherwise False.

Return type:

bool

bittensor.commands.utils.check_netuid_set(config, subtensor, allow_none=False)[source]#
Parameters:
bittensor.commands.utils.check_for_cuda_reg_config(config)[source]#

Checks, when CUDA is available, if the user would like to register with their CUDA device.

Parameters:

config (bittensor.config)

Return type:

None

bittensor.commands.utils.get_hotkey_wallets_for_wallet(wallet)[source]#
Return type:

List[bittensor.wallet]

bittensor.commands.utils.get_coldkey_wallets_for_path(path)[source]#
Parameters:

path (str)

Return type:

List[bittensor.wallet]

bittensor.commands.utils.get_all_wallets_for_path(path)[source]#
Parameters:

path (str)

Return type:

List[bittensor.wallet]

bittensor.commands.utils.filter_netuids_by_registered_hotkeys(cli, subtensor, netuids, all_hotkeys)[source]#
Return type:

List[int]

bittensor.commands.utils.normalize_hyperparameters(subnet)[source]#

Normalizes the hyperparameters of a subnet.

Parameters:

subnet (bittensor.SubnetHyperparameters) – The subnet hyperparameters object.

Returns:

A list of tuples containing the parameter name, value, and normalized value.

Return type:

List[Tuple[str, str, str]]

class bittensor.commands.utils.DelegatesDetails[source]#
name: str#
url: str#
description: str#
signature: str#
classmethod from_json(json)[source]#
Parameters:

json (Dict[str, any])

Return type:

DelegatesDetails

bittensor.commands.utils._get_delegates_details_from_github(requests_get, url)[source]#
Parameters:

url (str)

Return type:

Dict[str, DelegatesDetails]

bittensor.commands.utils.get_delegates_details(url)[source]#
Parameters:

url (str)

Return type:

Optional[Dict[str, DelegatesDetails]]