Get a throttle option.
Input may either be a percentage or a "friendly bandwidth
value" as accepted by the BytesOption.
Valid inputs: 100, 50%, 80.5%, 123M, 45.6k, 12.4G, 100K, 786.0, 0
Invalid inputs: 100.1%, -4%, -500
Return value will be a int if a bandwidth value was specified or a
float if a percentage was given.
ValueError will be raised if input 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
|