Skip to content

Numeric

Utility functions for working with numbers.

parse_bytes_with_scale

parse_bytes_with_scale(s: str) -> int

Parse a number of bytes, possibly written with a scale suffix and/or a trailing B to indicate bytes. A leading + is acceptable (but a leading - is not -- a negative number of bytes does not make sense in the contexts of use). The number is interpreted as decimal and may use _ , . ' or whitespace as visual separators.