Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_cronvalue(value, enums):
"""Returns a value as int (pass-through) or a special enum value"""
if isinstance(value, int):
return value
elif str(value).isdigit():
return int(str(value))
if not enums:
raise KeyError("No enumeration allowed")
return CronValue(str(value), enums)
def __init__(self, vslice, *vrange):
# holds an extra dangling entry, for example sundays.
self.dangling = None
self.slice = vslice
self.cron = None
self.seq = 1
if not vrange:
self.all()
elif isinstance(vrange[0], basestring):
self.parse(vrange[0])
elif isinstance(vrange[0], int) or isinstance(vrange[0], CronValue):
if len(vrange) == 2:
(self.vfrom, self.vto) = vrange
else:
self.seq = vrange[0]
self.all()