get list from QueryDict and remove blank date from list.
960776
def qdict_get_list(qdict, k):
    
    pks = qdict.getlist(k)
    return [e for e in pks if e]
47496
def clean(date, ignore_time=False):
        
        # Return empty input immediately.
        if not date:
            return date

        parts = re.split(r'[\-/. ]', date)

        if (len(parts) == 3) or \
                (len(parts) > 3 and ignore_time) or \
                (len(parts) == 4 and re.match(r'^[0:]*$', parts[3])) or \
                (len(parts) == 5 and re.match(r'^[0:]*$', parts[3]) and re.match(r'^0*$', parts[4])):
            if len(parts[0]) == 4 and len(parts[1]) <= 2 and len(parts[2]) <= 2:
                # Assume date is in  YYYY-MM-DD of YYYY-M-D format.
                return parts[0] + '-' + ('00' + parts[1])[-2:] + '-' + ('00' + parts[2])[-2:]

            if len(parts[0]) <= 2 and len(parts[1]) <= 2 and len(parts[2]) == 4:
                # Assume date is in  DD-MM-YYYY or D-M-YYYY format.
                return parts[2] + '-' + ('00' + parts[1])[-2:] + '-' + ('00' + parts[0])[-2:]

            if len(parts[0]) <= 2 and len(parts[1]) <= 2 and len(parts[2]) == 2:
                # Assume date is in  DD-MM-YY or D-M-YY format.
                year = '19' + parts[2] if parts[2] >= '20' else '20' + parts[2]

                return year + '-' + ('00' + parts[1])[-2:] + '-' + ('00' + parts[0])[-2:]

        # Try DDmonYYYY or DDmonYYYY HH:mm:ss format
        pattern = r'^(\d{2})([a-z]{3})(\d{4})' + ('.*$' if ignore_time else r'(\D(\d{1,2})\D(\d{1,2})\D(\d{1,2}))?$')
        match = re.match(pattern, date.lower())
        if match and match.group(2) in DateCleaner.month_map:
            ret = match.group(3) + '-' + DateCleaner.month_map[match.group(2)] + '-' + match.group(1)
            if len(match.groups()) == 7 and match.group(4):
                ret += 'T' + match.group(5) + ':' + match.group(6) + ':' + match.group(7)
            return ret

        # Try YYYYMMDD format.
        pattern = r'^\d{8}' + ('.*$' if ignore_time else '$')
        match = re.match(pattern, date)
        if match:
            # Assume date is YYYYMMDD format
            return date[0:4] + '-' + date[4:6] + '-' + date[6:8]

        # Format not recognized. Just return the original string.
        return date
661837
def toList(self):
        
        date = self.date()
        sign = '+' if date[0] >= 0 else '-'
        date[0] = abs(date[0])
        return list(sign) + date
113330
def get_dt_list(fn_list):
    
    dt_list = np.array([fn_getdatetime(fn) for fn in fn_list])
    return dt_list
963652
def remove_blank_lines(self):
        """"""
        to_remove = []
        for i, line in enumerate(self):
            ln = line.strip()
            if ln == '':
                to_remove.append(i)
        self.delete_lines(to_remove)
183112
def _record_blank(self, current, dict_obj):
        
        if not self.list_blank:
            return
        if self.list_blank not in current:
            self.blank.append(dict_obj)
1374637
def pastdate(self, prompt, default=None):
        """"""
        prompt = prompt if prompt is not None else "Enter a past date"
        if default is not None:
            prompt += " [" + default.strftime('%d %m %Y') + "]"
        prompt += ': '
        return self.input(curry(filter_pastdate, default=default), prompt)
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)
170335
def _remove_empty_entries(entries):
    """"""
    valid_entries = []
    for entry in set(entries):
        if entry:
            valid_entries.append(entry)
    return sorted(valid_entries)
207470
def from_list(cls, database, key, data, clear=False):
        
        lst = cls(database, key)
        if clear:
            lst.clear()
        lst.extend(data)
        return lst
1353453
private List<O> findByDate(String dateField, Date start, Date end, int numObjects, boolean asc) {
        if (start == null)
            start = new Date(0);
        if (end == null)
            end = new Date();
        return getDatastore().find(clazz).filter(dateField + " >", start).filter(dateField + " <", end).order(asc ? dateField : '-' + dateField).limit(numObjects).asList();
    }
1227825
def remove_null(obj):
    ''' '''
    if isinstance(obj, set):
        try:
            obj.remove(None)
        except:
            pass
    elif isinstance(obj, list):
        for item in obj:
            if not is_not_null(item):
                obj.remove(item)
    return obj
238716
def _strip_datetime(self, sub_line):
        """"""
        try:
            begin = sub_line.index(']')
        except ValueError:
            return sub_line
        else:
            # create a "" in place character for the beginnings..
            # needed when interleaving the lists
            sub = sub_line[begin + 1:]
            return sub
371323
private Date clear() {
    Date date = new Date();
    Long timestamp = date.getTime();
    HashSet<String> idsToBeRemoved = new HashSet<>();
    // check expiration
    Iterator<Entry<String, Long>> expirationVersionEntryIterator = expirationVersion.entrySet().iterator();
    while(expirationVersionEntryIterator.hasNext()) {
      Entry<String, Long> entry = expirationVersionEntryIterator.next();
      if (entry.getValue() < timestamp) {
        String version = entry.getKey();
        if (versionToItem.containsKey(version)) {
          idsToBeRemoved.add(versionToItem.get(version).id);
        } else {
          log.debug("could not remove " + version);
        }
      }
    }
    for (String id : idsToBeRemoved) {
      deleteById(id);
    }
    idsToBeRemoved.clear();
    // check size
    if (expirationVersion.size() > maximumNumber + maximumOverflow) {
      Set<Entry<String, Long>> mapEntries = expirationVersion.entrySet();
      List<Entry<String, Long>> aList = new LinkedList<>(mapEntries);
      Collections.sort(aList,
          (Entry<String, Long> ele1, Entry<String, Long> ele2) -> ele2
              .getValue().compareTo(ele1.getValue()));
      aList.subList(maximumNumber, aList.size()).clear();
      Iterator<Entry<String, MtasSolrCollectionCacheItem>> versionToItemEntryIterator = versionToItem.entrySet().iterator();
      while(versionToItemEntryIterator.hasNext()) {
        Entry<String, MtasSolrCollectionCacheItem> entry = versionToItemEntryIterator.next();
        if (!expirationVersion.containsKey(entry.getKey())) {
          idsToBeRemoved.add(entry.getValue().id);
        }
      }
      for (String id : idsToBeRemoved) {
        deleteById(id);
      }
      idsToBeRemoved.clear();
    }
    return date;
  }
500726
def fill_date_range(start_date, end_date, date_format=None):
    

    if date_format:
        start_date = datetime.strptime(start_date, date_format).date()
        end_date = datetime.strptime(end_date, date_format).date()
    date_list = []
    while start_date <= end_date:
        date_list.append(start_date)
        start_date = start_date + timedelta(days=1)
    return date_list
712041
def ask_list(question: str, default: list = None) -> list:
    """"""
    default_q = " [default: {0}]: ".format(
        ",".join(default)) if default is not None else ""
    answer = input("{0} [{1}]: ".format(question, default_q))

    if answer == "":
        return default
    return [ans.strip() for ans in answer.split(",")]
203446
def cleandata(inputlist):
    
    output = []
    for e in inputlist:
        new = []
        for f in e:
            if f == "--":
                new.append(None)
            else:
                new.append(float(f))
        output.append(new)
    return output