<commit_before>from typing import Callable, Optional, List, TypeVar  # noqa: F401
from datetime import timedelta, datetime
from collections import namedtuple

Time = namedtuple("Time", ['hour', 'minute', 'second'])


class Schedule:
    """
    A schedule stores the relative time for something to happen.

    It can be used to compute when the next instance of an event
    should occur.
    """

    def __init__(self) -> None:
        self._days = 0
        self._at: Optional[Time] = None
        self._hours = 0
        self._minutes = 0
        self._seconds = 0

    def every(self) -> 'Schedule':
        """
        Syntatic sugar to allow the declaration of schedules to be more
        like an English sentence.

        ::

            schedule = Schedule().every().day()
        """
        return self

    def day(self) -> 'Schedule':
        """
        Adds a day to the relative time till the next event

        ::

            schedule = Schedule().every().day()
        """
        return self.days(1)

    def days(self, value: int) -> 'Schedule':
        """
        Adds the specified number of days to the relative time till the next
        event.
        ::

            schedule = Schedule().every().days(2)

        :param value: The number of days to wait between events
        """
        self._days = value
        return self

    def at(self, hour: int, minute: int, second: int = 0) -> 'Schedule':
        """
        Specifies the time of day the next occurnce will happen.
        NOTE: 'at' can only be used with :meth:`day`.
        ::

            schedule = Schedule().every().day().at(12,00)

        :param hour: The hour of day the next event should happen,
                     when combined with the minute
        :param minute: The minute of day the next event should happen,
                       when combined with the hour
        :param second: The second of day the next event should
                       happen, when combined with the hour and
                       minute.

                       Defaults to 0
        """
        if self._hours or self._minutes:
            raise Exception("'at' can only be used on day(s)")
        if not self._days:
            raise Exception("'at' can only be used on day(s)")
        if self._at:
            raise Exception("'at' can only be set once")
        self._at = Time(hour, minute, second)
        return self<commit_msg>Make Time named tuple private<commit_after>from typing import Callable, Optional, List, TypeVar  # noqa: F401
from datetime import timedelta, datetime
from collections import namedtuple


class _Time(namedtuple("Time", ['hour', 'minute', 'second'])):
    """ Represents a time of day.

    .. py:attribute:: hour

        The hour of day.

    .. py:attribute:: minute

        The minute of the hour.

    .. py:attribute:: second

        The second of the minute.

    """


class Schedule:
    """
    A schedule stores the relative time for something to happen.

    It can be used to compute when the next instance of an event
    should occur.
    """

    def __init__(self) -> None:
        self._days = 0
        self._at: Optional[Time] = None
        self._hours = 0
        self._minutes = 0
        self._seconds = 0

    def every(self) -> 'Schedule':
        """
        Syntatic sugar to allow the declaration of schedules to be more
        like an English sentence.

        ::

            schedule = Schedule().every().day()
        """
        return self

    def day(self) -> 'Schedule':
        """
        Adds a day to the relative time till the next event.

        ::

            schedule = Schedule().every().day()
        """
        return self.days(1)

    def days(self, value: int) -> 'Schedule':
        """
        Adds the specified number of days to the relative time till the next
        event.
        ::

            schedule = Schedule().every().days(2)

        :param value: The number of days to wait between events
        """
        self._days = value
        return self

    def at(self, hour: int, minute: int, second: int = 0) -> 'Schedule':
        """
        Specifies the time of day the next occurnce will happen.
        NOTE: 'at' can only be used with :meth:`day`.
        ::

            schedule = Schedule().every().day().at(12,00)

        :param hour: The hour of day the next event should happen,
                     when combined with the minute
        :param minute: The minute of day the next event should happen,
                       when combined with the hour
        :param second: The second of day the next event should
                       happen, when combined with the hour and
                       minute.
                       Defaults to 0
        """
        if self._hours or self._minutes:
            raise Exception("'at' can only be used on day(s)")
        if not self._days:
            raise Exception("'at' can only be used on day(s)")
        if self._at:
            raise Exception("'at' can only be set once")
        self._at = _Time(hour, minute, second)
        return self
{'fraction_non_alphanumeric': 0.09304143862392494, 'fraction_numerical': 0.005863956215793589, 'mean_word_length': 1.765945945945946, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5067013', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1271, 'n_words': 548}