How to use the crontab.crontab.CronSlices function in crontab

To help you get started, we’ve selected a few crontab examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github achaudhry / adhan / crontab / crontab.py View on Github external
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
github achaudhry / adhan / crontab / crontab.py View on Github external
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
github achaudhry / adhan / crontab / crontab.py View on Github external
def __eq__(self, arg):
        return self.render() == CronSlices(arg).render()
github achaudhry / adhan / crontab / crontab.py View on Github external
def is_self_valid(self, *args):
        """Object version of is_valid"""
        args = args or (self,)
        return CronSlices.is_valid(*args)
github achaudhry / adhan / crontab / crontab.py View on Github external
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