def __init__( self, *, follow_task_ids_if_true: Union[str, Iterable[str]], follow_task_ids_if_false: Union[str, Iterable[str]], week_day: Union[str, Iterable[str]], use_task_execution_day: bool = False, **kwargs, ) -> None: super().__init__(**kwargs) self.follow_task_ids_if_true = follow_task_ids_if_true self.follow_task_ids_if_false = follow_task_ids_if_false self.week_day = week_day self.use_task_execution_day = use_task_execution_day self._week_day_num = None if isinstance(self.week_day, str): self._week_day_num = { WeekDay.get_weekday_number(week_day_str=self.week_day) } elif isinstance(self.week_day, WeekDay): self._week_day_num = {self.week_day} elif isinstance(self.week_day, set): if all(isinstance(day, str) for day in self.week_day): self._week_day_num = { WeekDay.get_weekday_number(day) for day in week_day } elif all(isinstance(day, WeekDay) for day in self.week_day): self._week_day_num = self.week_day else: raise TypeError( 'Unsupported Type for week_day parameter: {}. It should be one of str' ', set or Weekday enum type'.format(type(week_day)))
def __init__(self, week_day, use_task_execution_day=False, *args, **kwargs): super().__init__(*args, **kwargs) self.week_day = week_day self.use_task_execution_day = use_task_execution_day if isinstance(self.week_day, str): self._week_day_num = {WeekDay.get_weekday_number(week_day_str=self.week_day)} elif isinstance(self.week_day, WeekDay): self._week_day_num = {self.week_day} elif isinstance(self.week_day, set): if all(isinstance(day, str) for day in self.week_day): self._week_day_num = {WeekDay.get_weekday_number(day) for day in week_day} elif all(isinstance(day, WeekDay) for day in self.week_day): self._week_day_num = self.week_day else: raise TypeError( 'Unsupported Type for week_day parameter: {}. It should be one of str' ', set or Weekday enum type'.format(type(week_day)))