Filters the model items queryset based on start and end date.
342791
def filter_model_items(index_instance, model_items, model_name, start_date, end_date):
    ''' '''
    if index_instance.updated_field is None:
        logger.warning("No updated date field found for {} - not restricting with start and end date".format(model_name))
    else:
        if start_date:
            model_items = model_items.filter(**{'{}__gte'.format(index_instance.updated_field): __str_to_tzdate__(start_date)})
        if end_date:
            model_items = model_items.filter(**{'{}__lte'.format(index_instance.updated_field): __str_to_tzdate__(end_date)})

    return model_items
1295177
def reports(from_id, start_date = nil, end_date = nil)
      params = []

      if from_id
        params << "from_id=#{from_id}"
      end

      if start_date and not end_date
        raise 'must include both start_date and end_date'
      end
      if end_date and not start_date
        raise 'must include both start_date and end_date'
      end

      if start_date and end_date
        params << "start_date=#{start_date.strftime('%FT%T.%L%z')}"
        params << "end_date=#{end_date.strftime('%FT%T.%L%z')}"
      end

      query = "#{@endpoint}?"

      if params.size > 0
        query << params.join('&')
      end

      get query
    end
1325983
def filter_collections(self, model, context=None):
        
        if model is None:
            return

        for property_name in self.collections:
            prop = self.collections[property_name]
            collection = self.get(model, property_name)
            filtered_value = prop.filter(
                value=collection,
                model=model,
                context=context
            )
            self.set(model, property_name, filtered_value)

            prop.filter_with_schema(
                collection,
                context if prop.use_context else None
            )
958240
def build_dated_queryset(self):
        
        qs = self.get_dated_queryset()
        days = self.get_date_list(qs, date_type='day')
        [self.build_day(dt) for dt in days]
1211811
def find(self, start, end, limit=50, *args, **kwargs):
        
        # check if spec has been specified, build on top of it
        fc = kwargs.get('spec', dict())

        # filter _id on start and end dates
        fc['_id'] = {'$gte': ObjectId.from_datetime(start),
                     '$lte': ObjectId.from_datetime(end)}

        if not self.collection:
            collection_name = kwargs.get('collection_name',
                             MONGODB_DEFAULT_COLLECTION)
            self.set_collection(collection_name)

        return self.collection.find(fc, limit=limit)
1275428
function filterDay(arr, year, month, disabledDateObj) {
  const minDateTime = new Date(year, month, 1).getTime();
  const maxDateTime = new Date(year, month + 1, 0).getTime();
  const dayRangeArr = getDateRangeArr(disabledDateObj, minDateTime, maxDateTime);
  const dayArr = [];
  dayRangeArr.forEach((item) => {
    let { start, end } = item;
    start = new Date(start).getDate();
    end = new Date(end).getDate();
    for (let i = start; i <= end; i++) {
      dayArr.push(i);
    }
  });
  return arr.filter((item) => {
    const day = item.value;
    return dayArr.indexOf(day) === -1;
  });
}
607421
def filter(cls, start_position="", max_results="", qb=None, **kwargs):
        
        return cls.where(build_where_clause(**kwargs),
                         start_position=start_position, max_results=max_results, qb=qb)
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
328280
def _effective_view_filter(self):
        """"""
        if self._effective_view == EFFECTIVE:
            now = datetime.datetime.utcnow()
            return {'startDate': {'$$lte': now}, 'endDate': {'$$gte': now}}
        return {}
182960
def started_during(self, year, month):
		""""""
		return self.exclude(status="trialing").filter(start__year=year, start__month=month)
239173
def filter(self, *args, **kwargs) -> "QuerySet":
        
        return self._filter_or_exclude(negate=False, *args, **kwargs)
696541
def filter_queryset(self, request, queryset, view):
        "
        self.ordering_param = view.SORT

        ordering = self.get_ordering(request, queryset, view)
        if ordering:
            return queryset.order_by(*ordering)

        return queryset
704556
def query_filter_date(start, end):
    
    sdate = datetime.datetime.strptime(start, "%Y-%m-%d")
    edate = datetime.datetime.strptime(end, "%Y-%m-%d")
    startdate = "%s/%s/%s" % (sdate.month, sdate.day, sdate.year)
    enddate = "%s/%s/%s" % (edate.month, edate.day, edate.year)
    return {
        'operation': 'betweenDate',
        'options': [
            {'name': 'startDate', 'value': [startdate + ' 0:0:0']},
            {'name': 'endDate', 'value': [enddate + ' 0:0:0']}
        ]
    }
470568
def filter_by(self, **filters):
        ''' '''
        for name, value in filters.items():
            self.filter(resolve_name(self.type, name) == value)
        return self
1029413
def filter(self, table, mappings, filter_string):
        """"""
        q = filter_string.lower()
        return [mapping for mapping in mappings
                if q in mapping.ud.lower()]
745881
def filter_filenames_by_info(self, filename_items):
        
        for filename, filename_info in filename_items:
            fend = filename_info.get('end_time')
            fstart = filename_info.setdefault('start_time', fend)
            if fend and fend < fstart:
                # correct for filenames with 1 date and 2 times
                fend = fend.replace(year=fstart.year,
                                    month=fstart.month,
                                    day=fstart.day)
                filename_info['end_time'] = fend
            if self.metadata_matches(filename_info):
                yield filename, filename_info
413652
def get_queryset(self):
        
        kwargs = {}
        if self.ends_at:
            kwargs.update({'%s__lt' % self.date_field: self.ends_at})
        return super(BeforeMixin, self).get_queryset().filter(**kwargs)