To check the structure of the HolidayClass

        :param list times: years or months or days or number week
        :rtype: None or Exception
        :return: in the case of exception returns the exception
492915
def _check_holiday_structure(self, times):
        

        if not isinstance(times, list):
            raise TypeError("an list is required")

        for time in times:
            if not isinstance(time, tuple):
                raise TypeError("a tuple is required")
            if len(time) > 5:
                raise TypeError("Target time takes at most 5 arguments"
                                " ('%d' given)" % len(time))
            if len(time) < 5:
                raise TypeError("Required argument '%s' (pos '%d')"
                                " not found" % (TIME_LABEL[len(time)], len(time)))

            self._check_time_format(TIME_LABEL, time)
1196057
def _read_holidays(self, filename):
		
		cal = Calendar.from_ical(open(filename, 'rb').read())
		holidays = []

		for component in cal.walk('VEVENT'):
			start = component.decoded('DTSTART')
			try:
				end = component.decoded('DTEND')
			except KeyError:
				# RFC allows DTEND to be missing
				if isinstance(start, datetime):
					# For DATETIME instances, the event ends immediately.
					end = start
				elif isinstance(start, date):
					# For DATE instances, the event ends tomorrow
					end = start + timedelta(days=1)
				else:
					raise KeyError, 'DTEND is missing and DTSTART is not of DATE or DATETIME type'

			if isinstance(start, date) and not isinstance(start, datetime):
				assert (isinstance(end, date) and not isinstance(end, datetime)), \
					'DTSTART is of DATE type but DTEND is not of DATE type (got %r instead)' % type(end)
				# All-day event, set times to midnight local time
				start = datetime.combine(start, time.min)
				end = datetime.combine(end, time.min)

			# check for TZ data
			if start.tzinfo is None or end.tzinfo is None:
				# One of them is missing tzinfo, replace both with this office's
				# local time.  Assume standard time if ambiguous.
				start = self.tz.localize(start, is_dst=False)
				end = self.tz.localize(end, is_dst=False)

			yield (start, end)
896855
def get_holidays_for_year(self, types=None):
        
        # Filter any non-related holidays depending on Israel/Diaspora only
        holidays_list = [
            holiday for holiday in htables.HOLIDAYS if
            (holiday.israel_diaspora == "") or
            (holiday.israel_diaspora == "ISRAEL" and not self.diaspora) or
            (holiday.israel_diaspora == "DIASPORA" and self.diaspora)]

        if types:
            # Filter non-matching holiday types.
            holidays_list = [
                holiday for holiday in holidays_list if
                holiday.type in types
            ]

        # Filter any special cases defined by True/False functions
        holidays_list = [
            holiday for holiday in holidays_list if
            all(func(self) for func in holiday.date_functions_list)]

        def holiday_dates_cross_product(holiday):
            """Given a (days, months) pair, compute the cross product.

            If days and/or months are singletons, they are converted to a list.
            """
            return product(*([x] if isinstance(x, int) else x
                             for x in holiday.date))

        # Compute out every actual Hebrew date on which a holiday falls for
        # this year by exploding out the possible days for each holiday.
        holidays_list = [
            (holiday, HDate(
                heb_date=HebrewDate(self.hdate.year, date_instance[1],
                                    date_instance[0]),
                diaspora=self.diaspora,
                hebrew=self.hebrew))
            for holiday in holidays_list
            for date_instance in holiday_dates_cross_product(holiday)
            if len(holiday.date) >= 2
        ]
        return holidays_list
1043985
private void readRecurringData(ProjectCalendarException bce, Project.Calendars.Calendar.Exceptions.Exception exception)
   {
      RecurrenceType rt = getRecurrenceType(NumberHelper.getInt(exception.getType()));
      if (rt != null)
      {
         RecurringData rd = new RecurringData();
         rd.setStartDate(bce.getFromDate());
         rd.setFinishDate(bce.getToDate());
         rd.setRecurrenceType(rt);
         rd.setRelative(getRelative(NumberHelper.getInt(exception.getType())));
         rd.setOccurrences(NumberHelper.getInteger(exception.getOccurrences()));

         switch (rd.getRecurrenceType())
         {
            case DAILY:
            {
               rd.setFrequency(getFrequency(exception));
               break;
            }

            case WEEKLY:
            {
               rd.setWeeklyDaysFromBitmap(NumberHelper.getInteger(exception.getDaysOfWeek()), DAY_MASKS);
               rd.setFrequency(getFrequency(exception));
               break;
            }

            case MONTHLY:
            {
               if (rd.getRelative())
               {
                  rd.setDayOfWeek(Day.getInstance(NumberHelper.getInt(exception.getMonthItem()) - 2));
                  rd.setDayNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonthPosition()) + 1));
               }
               else
               {
                  rd.setDayNumber(NumberHelper.getInteger(exception.getMonthDay()));
               }
               rd.setFrequency(getFrequency(exception));
               break;
            }

            case YEARLY:
            {
               if (rd.getRelative())
               {
                  rd.setDayOfWeek(Day.getInstance(NumberHelper.getInt(exception.getMonthItem()) - 2));
                  rd.setDayNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonthPosition()) + 1));
               }
               else
               {
                  rd.setDayNumber(NumberHelper.getInteger(exception.getMonthDay()));
               }
               rd.setMonthNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonth()) + 1));
               break;
            }
         }

         if (rd.getRecurrenceType() != RecurrenceType.DAILY || rd.getDates().length > 1)
         {
            bce.setRecurring(rd);
         }
      }
   }
491510
private void parseCalendarList(final StreamTokenizer tokeniser, Reader in, 
            final ContentHandler handler) throws IOException, ParseException,
            URISyntaxException, ParserException {

        // BEGIN:VCALENDAR
        int ntok = assertToken(tokeniser, in, Calendar.BEGIN, false, true);
        while (ntok != StreamTokenizer.TT_EOF) {
            parseCalendar(tokeniser, in, handler);
            ntok = absorbWhitespace(tokeniser, in, true);
        }
    }
952797
def next_non_holiday_weekday(holidays, dt):
    
    day_of_week = dt.weekday()

    if day_of_week == SUNDAY:
        while is_holiday_or_weekend(holidays, dt):
            dt += timedelta(1)

    return dt
113755
@Override public void normalise(ProjectCalendar calendar, LinkedList<TimephasedCost> list)
   {
      if (!list.isEmpty())
      {
         //dumpList(list);
         splitDays(calendar, list);
         //dumpList(list);
         mergeSameDay(list);
         //dumpList(list);
         mergeSameCost(list);
         //dumpList(list);
      }
   }
1067993
def is_holiday_or_weekend(holidays, dt):
    
    one_day = timedelta(days=1)

    for h in holidays:
        if dt in h.dates(dt - one_day, dt + one_day) or \
                dt.weekday() in WEEKENDS:
            return True

    return False
861959
def dates_in_range(start_date, end_date):
    
    return [
        start_date + timedelta(n)
        for n in range(int((end_date - start_date).days))
    ]
849105
def get_dated_items(self):
        
        self.date_list, self.object_list, extra_context = super(
            EntryWeek, self).get_dated_items()
        self.date_list = self.get_date_list(self.object_list, 'day')
        extra_context['week_end_day'] = extra_context[
            'week'] + datetime.timedelta(days=6)
        return self.date_list, self.object_list, extra_context
704968
def scheduled_special_times(calendar, start, end, time, tz):
    
    days = calendar.holidays(start, end)
    return pd.Series(
        index=pd.DatetimeIndex(days, tz=UTC),
        data=days_at_time(days, time, tz=tz),
    )
991048
def get_times(self):
        
        if not self.n:
            return list()

        ret = list()

        for item in self._event_times:
            ret += list(self.__dict__[item])

        return ret + list(matrix(ret) - 1e-6)
31006
def dictlist_convert_to_datetime(dict_list: Iterable[Dict],
                                 key: str,
                                 datetime_format_string: str) -> None:
    
    for d in dict_list:
        d[key] = datetime.datetime.strptime(d[key], datetime_format_string)
521955
def missing_datetimes(self, finite_datetimes):
        
        return [d for d in finite_datetimes if not self._instantiate_task_cls(self.datetime_to_parameter(d)).complete()]
1136665
def _times(t0, hours):
		
		if not isinstance(hours, Iterable):
			return Tide._times(t0, [hours])[0]
		elif not isinstance(hours[0], datetime):
			return np.array([t0 + timedelta(hours=h) for h in hours])
		else:
			return np.array(hours)
150441
def calculated_intervals(self, value):
        
        if not value:
            self._calculated_intervals = TimeIntervals()
            return

        if isinstance(value, TimeInterval):
            value = TimeIntervals([value])
        elif isinstance(value, TimeIntervals):
            pass
        elif isinstance(value, list):
            value = TimeIntervals(value)
        else:
            raise TypeError("Expected list/TimeInterval/TimeIntervals, got {}".format(type(value)))

        for interval in value:
            if interval.end > utcnow():
                raise ValueError("Calculated intervals should not be in the future")

        self._calculated_intervals = value
674604
private void processCalendars() throws Exception
   {
      List<Row> rows = getRows("select * from zcalendar where zproject=?", m_projectID);
      for (Row row : rows)
      {
         ProjectCalendar calendar = m_project.addCalendar();
         calendar.setUniqueID(row.getInteger("Z_PK"));
         calendar.setName(row.getString("ZTITLE"));
         processDays(calendar);
         processExceptions(calendar);
         m_eventManager.fireCalendarReadEvent(calendar);
      }
   }