Filter the Data Collection based on a list of days of the year (as integers).

        Args:
           doys: A List of days of the year [1..365]

        Return:
            A new Data Collection with filtered data
193266
def filter_by_doys(self, doys):
        
        _filt_values = []
        _filt_datetimes = []
        for i, d in enumerate(self.datetimes):
            if d in doys:
                _filt_datetimes.append(d)
                _filt_values.append(self._values[i])
        _filt_header = self.header.duplicate()
        return DailyCollection(_filt_header, _filt_values, _filt_datetimes)
587886
public static Date[] getHolidays(int year) {
		Set<Date> days = getHolidaySet(year);
		Date[] dates = days.toArray(new Date[days.size()]);
		Arrays.sort(dates);
		return dates;
	}
558738
def filter_tzfiles(name_list):
    """"""
    for src_name in name_list:
        # pytz-2012j/pytz/zoneinfo/Indian/Christmas
        parts = src_name.split('/')
        if len(parts) > 3 and parts[2] == 'zoneinfo':
            dst_name = '/'.join(parts[2:])
            yield src_name, dst_name
396968
def __parse_dois(self, x):
        
        # datasetDOI is a string. parse, validate and return a list of DOIs
        if isinstance(x, str):
            # regex cleans string, and returns a list with 1 entry for each regex doi match
            m = clean_doi(x)
            # make sure m is not an empty list
            if m:
                # set list directly into self
                self.doi = m

        # datasetDOI is a list. use regex to validate each doi entry.
        elif isinstance(x, list):
            for entry in x:
                # regex cleans string, and returns a list with 1 entry for each regex doi match
                m = clean_doi(entry)
                # make sure m is not an empty list
                if m:
                    # combine lists with existing self list
                    self.doi += m
        return
958648
def fetch(self, year: int, month: int):
        """"""
        self.raw_data = [self.fetcher.fetch(year, month, self.sid)]
        self.data = self.raw_data[0]['data']
        return self.data
239173
def filter(self, *args, **kwargs) -> "QuerySet":
        
        return self._filter_or_exclude(negate=False, *args, **kwargs)
685153
def date_range_filter(range_name):
    """"""

    filter_days = list(filter(
        lambda time: time["label"] == range_name,
        settings.CUSTOM_SEARCH_TIME_PERIODS))
    num_days = filter_days[0]["days"] if len(filter_days) else None

    if num_days:
        dt = timedelta(num_days)
        start_time = timezone.now() - dt
        return Range(published={"gte": start_time})
    return MatchAll()
1142859
def filter_keys(cls, data):
        
        keys = list(data.keys())
        for pattern in cls.EXCLUDE_PATTERNS:
            for key in keys:
                if re.match(pattern, key):
                    keys.remove(key)
        return dict(filter(lambda x: x[0] in keys, data.items()))
225983
def yeardoy2datetime(yeardate: int,
                     utsec: Union[float, int] = None) -> datetime.datetime:
    
    if isinstance(yeardate, (tuple, list, np.ndarray)):
        if utsec is None:
            return np.asarray([yeardoy2datetime(y) for y in yeardate])
        elif isinstance(utsec, (tuple, list, np.ndarray)):
            return np.asarray([yeardoy2datetime(y, s) for y, s in zip(yeardate, utsec)])

    yeardate = int(yeardate)

    yd = str(yeardate)
    if len(yd) != 7:
        raise ValueError('yyyyddd expected')

    year = int(yd[:4])
    assert 0 < year < 3000, 'year not in expected format'

    dt = datetime.datetime(year, 1, 1) + datetime.timedelta(days=int(yd[4:]) - 1)
    assert isinstance(dt, datetime.datetime)

    if utsec is not None:
        dt += datetime.timedelta(seconds=utsec)

    return dt
1228276
def filter_data(self, data, value=None, args=None):
        """"""
        if args:
            if not args.last:
                return data
        if not value: value = args.last
        # Set the units and number from the option:
        lastunit = value[-1]
        lastnum = value[:-1]
        
        # Set the start time:
        if lastunit == 's':
            starttime = datetime.utcnow() - \
                    timedelta(seconds=int(lastnum))
        if lastunit == 'm':
            starttime = datetime.utcnow() - \
                    timedelta(minutes=int(lastnum))
        if lastunit == 'h':
            starttime = datetime.utcnow() - \
                    timedelta(hours=int(lastnum))
        if lastunit == 'd':
            starttime = datetime.utcnow() - \
                    timedelta(days=int(lastnum))
        ourstart = int(starttime.strftime('%Y%m%d%H%M%S'))
        
        # Pull out the specified time period:
        newdata = {}
        if 'parser' in data.keys():
            newdata['parser'] = data['parser']
            newdata['source_path'] = data['source_path']
            newdata['source_file'] = data['source_file']
            newdata['source_file_mtime'] = data['source_file_mtime']
            newdata['source_file_year'] = data['source_file_year']
        newdata['entries'] = []

        for entry in data['entries']:
            if 'numeric_date_stamp_utc' in entry.keys():
                if '.' in entry['numeric_date_stamp_utc']:
                    dstamp = int(entry['numeric_date_stamp_utc'].split('.')[0])
                else:
                    dstamp = int(entry['numeric_date_stamp_utc'])
                if dstamp >= ourstart: 
                    newdata['entries'].append(entry)

        return newdata
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
1330435
def holidays_set(self, year=None):
        ""
        return set([day for day, label in self.holidays(year)])
460244
def day_of_year(date = self)
      date.month == 1 ? date.day : (DAYS_IN_YEAR[date.month - 2] + date.day)
    end
1176362
def dfilter(self, **kwds):
        
        starting_list = self[:]
        filtered_list = []
        for key, value in six.iteritems(kwds):
            for item in starting_list:
                if self._match(item, key, value):
                    filtered_list.append(item)
            starting_list = filtered_list
            filtered_list = []
        return DictRegister(starting_list)
1229120
def during(self, year, month):
		""""""
		return self.filter(created__year=year, created__month=month)
610037
def _GetNumberOfDaysInCentury(self, year):
    
    if year < 0:
      raise ValueError('Year value out of bounds.')

    year, _ = divmod(year, 100)

    if self._IsLeapYear(year):
      return 36525
    return 36524
953241
def filter_oids(self, oids):
        '''
        
        '''
        oids = set(oids)
        return self[self['_oid'].map(lambda x: x in oids)]