How to use the crontab._crontab._Matcher 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 josiahcarlson / parse-crontab / crontab / _crontab.py View on Github external
def _make_matchers(self, crontab):
        '''
        This constructs the full matcher struct.
        '''
        crontab = _aliases.get(crontab, crontab)
        ct = crontab.split()
        if len(ct) == 5:
            ct.insert(0, '0')
            ct.append('*')
        elif len(ct) == 6:
            ct.insert(0, '0')
        _assert(len(ct) == 7,
            "improper number of cron entries specified; got %i need 5 to 7"%(len(ct,)))

        matchers = [_Matcher(which, entry) for which, entry in enumerate(ct)]

        return Matcher(*matchers)