# Path: src/apscheduler/validators.py
# def as_int(value) -> int | None:
#     """Convert the value into an integer."""
#     if value is None:
#         return None
# 
#     return int(value)


import re
from calendar import monthrange
from datetime import datetime
from ...validators import as_int
"""This module contains the expressions applicable for CronTrigger's fields."""
from __future__ import annotations



WEEKDAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
MONTHS = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']


def get_weekday_index(weekday: str) -> int:
    try:
        return WEEKDAYS.index(weekday.lower())
    except ValueError:
        raise ValueError(f'Invalid weekday name {weekday!r}') from None


class AllExpression:
    __slots__ = 'step'

    value_re = re.compile(r'\*(?:/(?P<step>\d+))?$')

    def __init__(self, step: str | int | None = None):

# Path: src/apscheduler/validators.py
# def as_int(value) -> int | None:
#     """Convert the value into an integer."""
#     if value is None:
#         return None
# 
#     return int(value)


# Path: src/apscheduler/triggers/cron/expressions.py
import re
from calendar import monthrange
from datetime import datetime
from ...validators import as_int

"""This module contains the expressions applicable for CronTrigger's fields."""
from __future__ import annotations



WEEKDAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
MONTHS = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']


def get_weekday_index(weekday: str) -> int:
    try:
        return WEEKDAYS.index(weekday.lower())
    except ValueError:
        raise ValueError(f'Invalid weekday name {weekday!r}') from None


class AllExpression:
    __slots__ = 'step'

    value_re = re.compile(r'\*(?:/(?P<step>\d+))?$')

    def __init__(self, step: str | int | None = None):

        self.step = as_int(step)