tron.utils.crontab module

Parse a crontab entry and return a dictionary.

class tron.utils.crontab.FieldParser

Bases: object

Parse and validate a field in a crontab entry.

bounds: Tuple[int, int] = (0, 0)
get_groups(source: str) List[str]
get_match_groups(source: str) dict
get_range(min_value: int, max_value: int, step: int) List[str | int]
get_value_range(match_groups: dict) Tuple[int, int]
get_values(source: str) List[str | int]
name: str = ''
normalize(source: str) str
parse(source: str) List[int] | List[str | int] | None
range_pattern = re.compile('\n        (?P<min>\\d+|\\*)         # Initial value\n        (?:-(?P<max>\\d+))?      # Optional max upper bound\n        (?:/(?P<step>\\d+))?     # Optional step increment\n        ', re.VERBOSE)
validate_bounds(value: str) int
class tron.utils.crontab.HourFieldParser

Bases: FieldParser

bounds: Tuple[int, int] = (0, 24)
name: str = 'hours'
class tron.utils.crontab.MinuteFieldParser

Bases: FieldParser

bounds: Tuple[int, int] = (0, 60)
name: str = 'minutes'
class tron.utils.crontab.MonthFieldParser

Bases: FieldParser

bounds: Tuple[int, int] = (1, 13)
month_names = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
name: str = 'months'
normalize(month: str) str
class tron.utils.crontab.MonthdayFieldParser

Bases: FieldParser

bounds: Tuple[int, int] = (1, 32)
get_values(source: str) List[str | int]
name: str = 'monthdays'
class tron.utils.crontab.WeekdayFieldParser

Bases: FieldParser

bounds: Tuple[int, int] = (0, 7)
day_names = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']
name: str = 'weekdays'
normalize(day_of_week: str) str
tron.utils.crontab.convert_predefined(line: str) str
tron.utils.crontab.parse_crontab(line: str) dict