List of middle day of each month, used by Linke turbidity lookup
420653
def _calendar_month_middles(year):
    """"""
    # remove mdays[0] since January starts at mdays[1]
    # make local copy of mdays since we need to change
    # February for leap years
    mdays = np.array(calendar.mdays[1:])
    ydays = 365
    # handle leap years
    if calendar.isleap(year):
        mdays[1] = mdays[1] + 1
        ydays = 366
    middles = np.concatenate(
        [[-calendar.mdays[-1] / 2.0],  # Dec last year
         np.cumsum(mdays) - np.array(mdays) / 2.,  # this year
         [ydays + calendar.mdays[1] / 2.0]])  # Jan next year
    return middles
318754
def month_crumb(date):
    
    year = date.strftime('%Y')
    month = date.strftime('%m')
    month_text = DateFormat(date).format('F').capitalize()
    return Crumb(month_text, reverse('zinnia:entry_archive_month',
                                     args=[year, month]))
1138525
def date_tuple(ovls):
    

    day = month = year = 0
    for o in ovls:
        if 'day' in o.props:
            day = o.value

        if 'month' in o.props:
            month = o.value

        if 'year' in o.props:
            year = o.value

        if 'date' in o.props:
            day, month, year = [(o or n) for o, n in zip((day, month,
                                                          year), o.value)]

    return (day, month, year)
510791
function listPasses (data, cb) {
  var index = 0
  var passes = data.passes
  var newpasses = ''
  if (passes.length === 0) {
    newpasses += ':( No results found for **' + data.location.name + '**'
  } else {
    passes.map(function (obj) {
      if (index === 0) {
        newpasses += '**' + data.location.name + '** (' + obj.timezone + ')\n'
      }
      var dateFormat = 'YYYYMMDDHHmmss'
      var newDateFormat = 'ddd MMM Do, hh:mma'
      var begin = moment(obj.begin, dateFormat).format(newDateFormat)
      var duration = moment.utc(moment(obj.end, dateFormat).diff(moment(obj.begin, dateFormat))).format('m\\m s\\s')
      newpasses += begin + ' (' + duration + ')\n'
      index++
    })
  }
  newpasses += ':satellite:'
  cb(false, newpasses)
}
1073645
public List<Rc> getMostRecentChanges(int days, int rcLimit) throws Exception {
    Date today = new Date();
    Calendar cal = new GregorianCalendar();
    cal.setTime(today);
    cal.add(Calendar.DAY_OF_MONTH, -days);
    Date date30daysbefore = cal.getTime();
    String rcstart = dateToMWTimeStamp(today);
    String rcend = dateToMWTimeStamp(date30daysbefore);
    List<Rc> rcList = this.getRecentChanges(rcstart, rcend, rcLimit);
    List<Rc> result = this.sortByTitleAndFilterDoubles(rcList);
    return result;
  }
242351
def args_as_tuple(self):
        """"""
        result = ("currentdate", )
        result += (
            ":zone",
            self.extra_arguments["zone"].strip('"'),
            self.arguments["match-type"],
        )
        if self.arguments["match-type"] in [":count", ":value"]:
            result += (self.extra_arguments["match-type"].strip('"'), )
        result += (self.arguments["date-part"].strip('"'), )
        value = self.arguments["key-list"]
        if isinstance(value, list):
            # FIXME
            value = "[{}]".format(
                ",".join('"{}"'.format(item) for item in value))
        if value.startswith("["):
            result = result + tuple(tools.to_list(value))
        else:
            result = result + (value.strip('"'),)
        return result
79639
def activity_list(date, sort, limit)
      date_param = format_date(date)
      if sort == "asc"
        date_param = "afterDate=#{date_param}"
      elsif sort == "desc"
        date_param = "beforeDate=#{date_param}"
      else
        raise FitgemOauth2::InvalidArgumentError, "sort can either be asc or desc"
      end
      get_call("user/#{user_id}/activities/list.json?offset=0&limit=#{limit}&sort=#{sort}&#{date_param}")
    end
176602
def _get_datetimes(self, timestep=1):
        """"""
        start_moy = DateTime(self._month, self._day_of_month).moy
        if timestep == 1:
            start_moy = start_moy + 30
        num_moys = 24 * timestep
        return tuple(
            DateTime.from_moy(start_moy + (i * (1 / timestep) * 60))
            for i in xrange(num_moys)
        )
1000010
private void getMonthlyDates(Calendar calendar, int frequency, List<Date> dates)
   {
      if (m_relative)
      {
         getMonthlyRelativeDates(calendar, frequency, dates);
      }
      else
      {
         getMonthlyAbsoluteDates(calendar, frequency, dates);
      }
   }
174593
def days(self):
        
        if self._days is None:
            self._days = DayList(self._version, resource_type=self._solution['resource_type'], )
        return self._days
1117774
private static Map<String, Integer> daysOfWeekMapping() {
        final Map<String, Integer> stringMapping = new HashMap<>();
        stringMapping.put("MON", 1);
        stringMapping.put("TUE", 2);
        stringMapping.put("WED", 3);
        stringMapping.put("THU", 4);
        stringMapping.put("FRI", 5);
        stringMapping.put("SAT", 6);
        stringMapping.put("SUN", 7);
        return stringMapping;
    }
286778
def get_all_days():
    
    weekly = get_weekly()
    daily = get_daily()

    return [w * (d / 100.0) for w in weekly for d in daily]
1291004
private Variants parseDayPeriods(JsonObject calendar, String group) {
    JsonObject node = resolve(calendar, "dayPeriods", group);

    JsonObject abbr = resolve(node, "abbreviated");
    JsonObject narrow = resolve(node, "narrow");
    JsonObject wide = resolve(node, "wide");

    return new Variants(
        new String[] { string(abbr, "am"), string(abbr, "pm") },
        new String[] { string(narrow, "am"), string(narrow, "pm") },
        new String[] { },
        new String[] { string(wide, "am"), string(wide, "pm") });
  }
561305
public static function monthListBetweenDate($startDate, $endDate)
    {
		$output = [];
		$time   = strtotime($startDate);
		$last   = date('m-Y', strtotime($endDate));

		do {
		    $month = date('m-Y', $time);
		    $total = date('t', $time);

		    $output[] = [
		        'month' => $month,
		        'total' => $total,
		    ];

		    $time = strtotime('+1 month', $time);
		} while ($month != $last);
    }
750871
def median_date(dt_list):
    
    #dt_list_sort = sorted(dt_list)
    idx = len(dt_list)/2
    if len(dt_list) % 2 == 0:
        md = mean_date([dt_list[idx-1], dt_list[idx]])
    else:
        md = dt_list[idx]
    return md
1047505
function getDays(start, end = moment().startOf('day')) {
  let cursor = moment(start);
  let days = [];
  while (cursor.isBefore(end)) {
    days.push(cursor.format('YYYY-MM-DD'));
    cursor = cursor.add(1, 'd');
  }
  return days;
}
441005
public static List<CPDefinition> findByLtD_S(Date displayDate, int status) {
		return getPersistence().findByLtD_S(displayDate, status);
	}