bittensor.utils.formatting#

Functions#

get_human_readable(num[, suffix])

millify(n)

convert_blocks_to_time(blocks[, block_time])

Converts number of blocks into number of hours, minutes, seconds.

float_to_u16(value)

u16_to_float(value)

float_to_u64(value)

u64_to_float(value)

normalize_u64_values(values)

Normalize a list of u64 values so that their sum equals u64::MAX (2^64 - 1).

Module Contents#

bittensor.utils.formatting.get_human_readable(num, suffix='H')[source]#
bittensor.utils.formatting.millify(n)[source]#
Parameters:

n (int)

bittensor.utils.formatting.convert_blocks_to_time(blocks, block_time=12)[source]#

Converts number of blocks into number of hours, minutes, seconds. :param blocks: number of blocks :param block_time: time per block, by default this is 12 :return: tuple containing number of hours, number of minutes, number of seconds

Parameters:
  • blocks (int)

  • block_time (int)

Return type:

tuple[int, int, int]

bittensor.utils.formatting.float_to_u16(value)[source]#
Parameters:

value (float)

Return type:

int

bittensor.utils.formatting.u16_to_float(value)[source]#
Parameters:

value (int)

Return type:

float

bittensor.utils.formatting.float_to_u64(value)[source]#
Parameters:

value (float)

Return type:

int

bittensor.utils.formatting.u64_to_float(value)[source]#
Parameters:

value (int)

Return type:

float

bittensor.utils.formatting.normalize_u64_values(values)[source]#

Normalize a list of u64 values so that their sum equals u64::MAX (2^64 - 1).

Parameters:

values (List[int])

Return type:

List[int]