Label to translate the cron schedule to human readable format.
963607
private void createMaintenanceScheduleTranslatorControl() {
        scheduleTranslator = new LabelBuilder().id(UIComponentIdProvider.MAINTENANCE_WINDOW_SCHEDULE_TRANSLATOR_ID)
                .name(i18n.getMessage(CRON_VALIDATION_ERROR)).buildLabel();
        scheduleTranslator.addStyleName(ValoTheme.LABEL_TINY);
    }
70259
def toTag(self, output):
        ''' 
        '''
        feed = output.createElement('feed')
        feed.setAttribute('name', self.name)
        feed.setAttribute('priority', str(self.priority))

        # schedule
        schedule = output.createElement('schedule')
        schedule.setAttribute('dayOfMonth', self.dayOfMonth)
        schedule.setAttribute('dayOfWeek', self.dayOfWeek)
        schedule.setAttribute('hour', self.hour)
        schedule.setAttribute('minute', self.minute)
        if self.retry:
            schedule.setAttribute('retry', self.retry)
        feed.appendChild(schedule)

        # url
        url = output.createElement('url')
        url.appendChild(output.createTextNode(self.url))
        feed.appendChild(url)

        # source
        if self.source:
            source = output.createElement('source')
            source.appendChild(output.createTextNode(self.source))
            feed.appendChild(source)
        return feed
1027784
private String toLabel(final TimeUnit unit) {
      switch(unit) {
         case DAYS: return "day";
         case HOURS: return "hour";
         case MINUTES: return "minute";
         case SECONDS: return "second";
         case MILLISECONDS: return "ms";
         case MICROSECONDS: return "us";
         case NANOSECONDS: return "ns";
         default: return "";
      }
   }
954099
def humanize_timedelta(td):
    """"""
    secs = int(td.total_seconds())
    hours, secs = divmod(secs, 60 * 60)
    mins, secs = divmod(secs, 60)
    if hours:
        return '%dh %dm' % (hours, mins)
    if mins:
        return '%dm' % mins
    return '%ds' % secs
637196
def humanize_timedelta(seconds):
    """"""
    hours, remainder = divmod(seconds, 3600)
    days, hours = divmod(hours, 24)
    minutes, seconds = divmod(remainder, 60)

    if days:
        result = '{}d'.format(days)
        if hours:
            result += ' {}h'.format(hours)
        if minutes:
            result += ' {}m'.format(minutes)
        return result

    if hours:
        result = '{}h'.format(hours)
        if minutes:
            result += ' {}m'.format(minutes)
        return result

    if minutes:
        result = '{}m'.format(minutes)
        if seconds:
            result += ' {}s'.format(seconds)
        return result

    return '{}s'.format(seconds)
983424
def human(self):
        """"""
        # get timezone offset
        delta_sec = time.timezone
        m, s = divmod(delta_sec, 60)
        h, m = divmod(m, 60)
        # create output
        format_string = "%Y-%m-%d %H:%M:%S"
        out = self.datetime.strftime(format_string)
        return out
806453
def rem2ics():
    """"""
    # pylint: disable=maybe-no-member
    from argparse import ArgumentParser, FileType
    from dateutil.parser import parse
    from sys import stdin, stdout

    parser = ArgumentParser(description='Converter from Remind to iCalendar syntax.')
    parser.add_argument('-s', '--startdate', type=lambda s: parse(s).date(),
                        default=date.today() - timedelta(weeks=12),
                        help='Start offset for remind call (default: -12 weeks)')
    parser.add_argument('-m', '--month', type=int, default=15,
                        help='Number of month to generate calendar beginning wit startdate (default: 15)')
    parser.add_argument('-a', '--alarm', type=int, default=-10,
                        help='Trigger time for the alarm before the event in minutes (default: -10)')
    parser.add_argument('-z', '--zone',
                        help='Timezone of Remind file (default: local timezone)')
    parser.add_argument('infile', nargs='?', default=expanduser('~/.reminders'),
                        help='The Remind file to process (default: ~/.reminders)')
    parser.add_argument('outfile', nargs='?', type=FileType('w'), default=stdout,
                        help='Output iCalendar file (default: stdout)')
    args = parser.parse_args()

    zone = timezone(args.zone) if args.zone else None

    if args.infile == '-':
        remind = Remind(args.infile, zone, args.startdate, args.month, timedelta(minutes=args.alarm))
        vobject = remind.stdin_to_vobject(stdin.read())
        if vobject:
            args.outfile.write(vobject.serialize())
    else:
        remind = Remind(args.infile, zone, args.startdate, args.month, timedelta(minutes=args.alarm))
        args.outfile.write(remind.to_vobject().serialize())
711431
def _render_tab(lst):
    '''
    
    '''
    ret = []
    for pre in lst['pre']:
        ret.append('{0}\n'.format(pre))
    if ret:
        if ret[-1] != TAG:
            ret.append(TAG)
    else:
        ret.append(TAG)
    for env in lst['env']:
        if (env['value'] is None) or (env['value'] == ""):
            ret.append('{0}=""\n'.format(env['name']))
        else:
            ret.append('{0}={1}\n'.format(env['name'], env['value']))
    for cron in lst['crons']:
        if cron['comment'] is not None or cron['identifier'] is not None:
            comment = '#'
            if cron['comment']:
                comment += ' {0}'.format(
                    cron['comment'].replace('\n', '\n# '))
            if cron['identifier']:
                comment += ' {0}:{1}'.format(SALT_CRON_IDENTIFIER,
                                             cron['identifier'])

            comment += '\n'
            ret.append(comment)
        ret.append('{0}{1} {2} {3} {4} {5} {6}\n'.format(
                            cron['commented'] is True and '#DISABLED#' or '',
                            cron['minute'],
                            cron['hour'],
                            cron['daymonth'],
                            cron['month'],
                            cron['dayweek'],
                            cron['cmd']
                            )
                   )
    for cron in lst['special']:
        if cron['comment'] is not None or cron['identifier'] is not None:
            comment = '#'
            if cron['comment']:
                comment += ' {0}'.format(
                    cron['comment'].rstrip().replace('\n', '\n# '))
            if cron['identifier']:
                comment += ' {0}:{1}'.format(SALT_CRON_IDENTIFIER,
                                             cron['identifier'])

            comment += '\n'
            ret.append(comment)
        ret.append('{0}{1} {2}\n'.format(
                            cron['commented'] is True and '#DISABLED#' or '',
                            cron['spec'],
                            cron['cmd']
                            )
                  )
    return ret
775192
function label(label) {
    return function(s) {
      var delta = s.length - label.length;
      return strRepeat (' ', Math.floor (delta / 2)) + label +
             strRepeat (' ', Math.ceil (delta / 2));
    };
  }
1371728
def parse_schedules(username, password, importer, progress, utc_start=None, 
                    utc_stop=None):
    """"""

    file_obj = get_file_object(username, password, utc_start, utc_stop)
    process_file_object(file_obj, importer, progress)
1146526
function drawHourLabels() {
            let hourLabelsGroup = svg.select('.hour-labels-group');

            hourLabels = svg.select('.hour-labels-group').selectAll('.hour-label')
                .data(hoursHuman);

            hourLabels.enter()
              .append('text')
                .text((label) => label)
                .attr('y', 0)
                .attr('x', (d, i) => i * boxSize)
                .style('text-anchor', 'middle')
                .style('dominant-baseline', 'central')
                .attr('class', 'hour-label');

            hourLabelsGroup.attr('transform', `translate(${boxSize / 2}, -${hourLabelHeight})`);
        }
1368180
def pprint_label(self):
        ""
        unit = ('' if self.unit is None
                else type(self.unit)(self.unit_format).format(unit=self.unit))
        return bytes_to_unicode(self.label) + bytes_to_unicode(unit)
288106
def make_label(loss, key):
    ''''''
    algo, rate, mu, half, reg = key
    slots, args = ['{:.3f}', '{}', 'm={:.3f}'], [loss, algo, mu]
    if algo in 'SGD NAG RMSProp Adam ESGD'.split():
        slots.append('lr={:.2e}')
        args.append(rate)
    if algo in 'RMSProp ADADELTA ESGD'.split():
        slots.append('rmsh={}')
        args.append(half)
        slots.append('rmsr={:.2e}')
        args.append(reg)
    return ' '.join(slots).format(*args)
1015208
function Seeker(cron, now) {
  if (cron.parts === null) {
    throw new Error('No schedule found');
  }
  var date;
  if (cron.options.timezone) {
    date = moment.tz(now, cron.options.timezone);
  } else {
    date = moment(now);
  }
  if (!date.isValid()) {
    throw new Error('Invalid date provided');
  }
  if (date.seconds() > 0) {
    // Add a minute to the date to prevent returning dates in the past
    date.add(1, 'minute');
  }
  this.cron = cron;
  this.now = date;
  this.date = date;
  this.pristine = true;
}
529520
def time_description(self):
        """"""

        tc = [t for t in self._p.time_coverage if t]

        if not tc:
            return ''

        mn = min(tc)
        mx = max(tc)

        if not mn and not mx:
            return ''
        elif mn == mx:
            return mn
        else:
            return "{} to {}".format(mn, mx)
53520
def handle_time(msg):
    """"""
    return msg.copy(ack=0, payload=calendar.timegm(time.localtime()))
1208958
def label_for(self, name):
        ''''''
        method = getattr(self, name)
        if method.__doc__ and method.__doc__.strip():
            return method.__doc__.strip().splitlines()[0]
        return humanize(name.replace(self._prefix, ''))