bittensor.utils#
Subpackages#
Submodules#
Attributes#
Exceptions#
Exception raised for errors in the version check process. |
Functions#
Force the use of torch over numpy for certain operations. |
|
|
Deprecated, kept for backwards compatibility. Use check_version() instead. |
|
Check if the current version of Bittensor is up-to-date with the latest version on PyPi. |
|
|
|
Converts a string to a boolean value. |
|
Returns the explorer root url for the given network name from the given network map. |
|
Returns the explorer url for the given block hash and network. |
|
Converts a ss58 address to a bytes object. |
|
|
|
Formats an error message from the Subtensor error information for use in extrinsics. |
|
Checks if the given address is a valid ss58 address. |
|
Checks if the given public_key is a valid ed25519 key. |
Checks if the given address is a valid destination address. |
Package Contents#
- bittensor.utils.SS58_FORMAT = 42#
- bittensor.utils.logging#
- bittensor.utils.torch#
- bittensor.utils.use_torch()[source]#
Force the use of torch over numpy for certain operations.
- Return type:
- bittensor.utils.version_checking(timeout=15)[source]#
Deprecated, kept for backwards compatibility. Use check_version() instead.
- Parameters:
timeout (int) – The timeout for calling :func:
check_version
function. Default is15
.
- bittensor.utils.check_version(timeout=15)[source]#
Check if the current version of Bittensor is up-to-date with the latest version on PyPi. Raises a VersionCheckError if the version check fails.
- Parameters:
timeout (int) – The timeout for the request to PyPI in seconds. Default is
15
.
- exception bittensor.utils.VersionCheckError[source]#
Bases:
Exception
Exception raised for errors in the version check process.
Initialize self. See help(type(self)) for accurate signature.
- bittensor.utils.RAOPERTAO = 1000000000.0#
- bittensor.utils.U16_MAX = 65535#
- bittensor.utils.U64_MAX = 18446744073709551615#
- bittensor.utils.strtobool(val)[source]#
Converts a string to a boolean value.
truth-y values are ‘y’, ‘yes’, ‘t’, ‘true’, ‘on’, and ‘1’; false-y values are ‘n’, ‘no’, ‘f’, ‘false’, ‘off’, and ‘0’.
Raises ValueError if ‘val’ is anything else.
- bittensor.utils._get_explorer_root_url_by_network_from_map(network, network_map)[source]#
Returns the explorer root url for the given network name from the given network map.
- bittensor.utils.get_explorer_url_for_network(network, block_hash, network_map)[source]#
Returns the explorer url for the given block hash and network.
- Parameters:
- Returns:
The explorer url for the given block hash and network. Or None if the network is not known.
- Return type:
- bittensor.utils.ss58_address_to_bytes(ss58_address)[source]#
Converts a ss58 address to a bytes object.
- bittensor.utils.format_error_message(error_message, substrate=None)[source]#
Formats an error message from the Subtensor error information for use in extrinsics.
- bittensor.utils.is_valid_ss58_address(address)[source]#
Checks if the given address is a valid ss58 address.