toil.lib.humanize

Attributes

logger

Functions

b2h(n)

Return a binary value as a human readable string with units.

h2b(string)

Given a string representation of some memory (i.e. '1024 Mib'), return the

bytes2human(n)

Convert n bytes into a human readable string.

human2bytes(s)

Attempts to guess the string format based on default symbols

Module Contents

toil.lib.humanize.b2h(n)

Return a binary value as a human readable string with units.

Parameters:

n (SupportsInt)

Return type:

str

toil.lib.humanize.h2b(string)

Given a string representation of some memory (i.e. ‘1024 Mib’), return the integer number of bytes.

Parameters:

string (str)

Return type:

int

toil.lib.humanize.logger
toil.lib.humanize.bytes2human(n)[source]

Convert n bytes into a human readable string.

Parameters:

n (SupportsInt)

Return type:

str

toil.lib.humanize.human2bytes(s)[source]

Attempts to guess the string format based on default symbols set and return the corresponding bytes as an integer.

When unable to recognize the format ValueError is raised.

Parameters:

s (str)

Return type:

int