def __init__(self, location, title, repeat_rule): """Create a new representation of a Google Calendar event. Arguments: title -- a string with the event's title repeat_rule -- a Recurrence object containing a possible repeat rule """ self.title = title self.location = location self.repeat_rule = RepeatRule(repeat_rule, location)
class BaseEvent(object): """A single Google Calendar event.""" def __init__(self, location, title, repeat_rule): """Create a new representation of a Google Calendar event. Arguments: title -- a string with the event's title repeat_rule -- a Recurrence object containing a possible repeat rule """ self.title = title self.location = location self.repeat_rule = RepeatRule(repeat_rule, location) def verbose_start(self): """A verbose, readable rendition of the event's start.""" raise NotImplementedError def verbose_end(self): """A verbose, readable rendition of the event's end.""" raise NotImplementedError def verbose_repeat_rule(self): """A verbose, readable rendition of the repeat rule.""" return self.repeat_rule.verbose_rule() @property def is_repeating(self): """True if the event has a repeat rule applied to it.""" return bool(self.repeat_rule)
def _repeating_event_in_hour(self, event): """Return True if the event indicated falls within this list's hour.""" repeat_rule = RepeatRule(event.recurrence, self.location) return repeat_rule.repeats_between_times(self.hour, datetime.time(hour=self.hour.hour + 1))