Parse a friendly bandwidth option to bytes
The input should be a string containing a (possibly floating point)
number followed by an optional single character unit. Valid units are
'k', 'M', 'G'. Case is ignored.
Valid inputs: 100, 123M, 45.6k, 12.4G, 100K, 786.3, 0 Invalid inputs:
-10, -0.1, 45.6L, 123Mb
Return value will always be an integer
1k = 1024 bytes.
ValueError will be raised if the option couldn't be parsed.
- Parameters:
s - Raw string value to parse.
- Returns:
- Validated native value.
Will raise ValueError if there was a problem parsing the
string. Subclasses should override this.
- Overrides:
Option.parse
|