Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return TimeResolution.Seconds
elif timestr.count(':') == 1:
#hh:mm
return TimeResolution.Minutes
#Format must be hhmmss, hhmm, or hh
if timestr.find('.') == -1:
#No time fractions
timestrlen = len(timestr)
else:
#The lowest order element is a fraction
timestrlen = len(timestr.split('.')[0])
if timestrlen == 6:
#hhmmss
return TimeResolution.Seconds
elif timestrlen == 4:
#hhmm
return TimeResolution.Minutes
elif timestrlen == 2:
#hh
return TimeResolution.Hours
else:
raise ValueError('String is not a valid ISO 8601 time.')
#hh:mm:ss±hhmm
#hhmmss±hhmm
#hh:mm±hhmm
#hhmm±hhmm
#hh±hhmm
#hh:mm:ss±hh
#hhmmss±hh
#hh:mm±hh
#hhmm±hh
#hh±hh
timestr = _split_tz(isotimestr)[0]
if timestr.count(':') == 2:
#hh:mm:ss
return TimeResolution.Seconds
elif timestr.count(':') == 1:
#hh:mm
return TimeResolution.Minutes
#Format must be hhmmss, hhmm, or hh
if timestr.find('.') == -1:
#No time fractions
timestrlen = len(timestr)
else:
#The lowest order element is a fraction
timestrlen = len(timestr.split('.')[0])
if timestrlen == 6:
#hhmmss
return TimeResolution.Seconds
elif timestrlen == 4:
timestr = isotimestr[0:isotimestr.find('+')]
tzstr = isotimestr[isotimestr.find('+'):]
elif isotimestr.find('-') != -1:
timestr = isotimestr[0:isotimestr.find('-')]
tzstr = isotimestr[isotimestr.find('-'):]
elif isotimestr.endswith('Z'):
timestr = isotimestr[:-1]
tzstr = 'Z'
else:
timestr = isotimestr
tzstr = None
return (timestr, tzstr)
_resolution_map = {
TimeResolution.Hours: _parse_hour,
TimeResolution.Minutes: _parse_minute_time,
TimeResolution.Seconds: _parse_second_time
}
tzstr = isotimestr[isotimestr.find('+'):]
elif isotimestr.find('-') != -1:
timestr = isotimestr[0:isotimestr.find('-')]
tzstr = isotimestr[isotimestr.find('-'):]
elif isotimestr.endswith('Z'):
timestr = isotimestr[:-1]
tzstr = 'Z'
else:
timestr = isotimestr
tzstr = None
return (timestr, tzstr)
_resolution_map = {
TimeResolution.Hours: _parse_hour,
TimeResolution.Minutes: _parse_minute_time,
TimeResolution.Seconds: _parse_second_time
}
if isotimestr.find('+') != -1:
timestr = isotimestr[0:isotimestr.find('+')]
tzstr = isotimestr[isotimestr.find('+'):]
elif isotimestr.find('-') != -1:
timestr = isotimestr[0:isotimestr.find('-')]
tzstr = isotimestr[isotimestr.find('-'):]
elif isotimestr.endswith('Z'):
timestr = isotimestr[:-1]
tzstr = 'Z'
else:
timestr = isotimestr
tzstr = None
return (timestr, tzstr)
_resolution_map = {
TimeResolution.Hours: _parse_hour,
TimeResolution.Minutes: _parse_minute_time,
TimeResolution.Seconds: _parse_second_time
}