Thanks to @JimmyHoffa for his suggestions!
First things first, you should really only accept known prefixes, that is either 'H' or 'h'. If you *have* to accept both, you should perform some operation to make it consistent to save room in your map.
In python you could create a dictionary.
EXTRACTION_MAP = {
'S': ExtractSecond,
'ms': ExtractMillisecond,
'm': ExtractMinute,
'H': ExtractHour,
'd': ExtractDay,
'w': ExtractWeek
}
Then we want the method to use this:
def parseTimeValue(sValue)
ending = ''.join([i for i in sValue if not i.isdigit()])
return EXTRACTION_MAP[ending](sValue).invoke()
Should have a better cyclomatic complexity.