proxystore.utils.data¶
Utilities for interacting with data.
chunk_bytes
¶
Yield chunks of binary data.
Parameters:
Returns:
Source code in proxystore/utils/data.py
bytes_to_readable
¶
Convert bytes to human readable value.
Note
This method uses base-10 values for KB, MB, GB, etc. instead of base-2 values (i.e., KiB, MiB, GiB, etc.).
Parameters:
Returns:
-
str
–String with human readable number of bytes.
Raises:
-
ValueError
–If size is negative.
Source code in proxystore/utils/data.py
readable_to_bytes
¶
Convert string with bytes units to the integer value of bytes.
Parameters:
-
size
(str
) –String to parse for bytes size.
Returns:
-
int
–Integer number of bytes parsed from the string.
Raises:
-
ValueError
–If the input string contains more than two parts (i.e., a value and a unit).
-
ValueError
–If the unit is not one of KB, MB, GB, TB, KiB, MiB, GiB, or TiB.
-
ValueError
–If the value cannot be cast to a float.