Package yum :: Module config :: Class SecondsOption
[hide private]
[frames] | no frames]

Class SecondsOption

source code


An option representing an integer value of seconds, or a human readable variation specifying days, hours, minutes or seconds until something happens. Works like BytesOption. Note that due to historical president -1 means "never", so this accepts that and allows the word never too.

Valid inputs: 100, 1.5m, 90s, 1.2d, 1d, 0xF, 0.1, -1, never Invalid inputs: -10, -0.1, 45.6Z, 1d6h, 1day, 1y

Return value will always be an integer

Instance Methods [hide private]
 
parse(self, s)
Parse the string value to the Option's native value.
source code

Inherited from Option: __get__, __init__, __set__, clone, setup, tostring

Inherited from Option (private): _setattrname

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  MULTS = {'d': 86400, 'h': 3600, 'm': 60, 's': 1}

Inherited from Option: __slotnames__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

parse(self, s)

source code 

Parse the string value to the Option's native value.

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
(inherited documentation)