Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, *args):
super(CronSlices, self).__init__([CronSlice(info) for info in S_INFO])
self.special = None
if args and not self.setall(*args):
raise ValueError("Can't set cron value to: %s" % str(args))
self.is_valid = self.is_self_valid
def __init__(self, line=None, command='', comment='', user=None, cron=None):
self.cron = cron
self.user = user
self.valid = False
self.enabled = True
self.special = False
self.comment = None
self.command = None
self.last_run = None
self._log = None
# Initalise five cron slices using static info.
self.slices = CronSlices()
self.set_comment(comment)
if line and line.strip():
self.parse(line.strip())
elif command:
self.set_command(command)
self.valid = True
def __eq__(self, arg):
return self.render() == CronSlices(arg).render()
def is_self_valid(self, *args):
"""Object version of is_valid"""
args = args or (self,)
return CronSlices.is_valid(*args)
def find_time(self, *args):
"""Return an iter of jobs that match this time pattern"""
for job in self.crons:
if job.slices == CronSlices(*args):
yield job