This parses a single crontab field and returns the data necessary for
        this matcher to accept the proper values.

        See the README for information about what is accepted.
4635
def _parse_crontab(self, which, entry):
        '''
        
        '''

        # this handles day of week/month abbreviations
        def _fix(it):
            if which in _alternate and not it.isdigit():
                if it in _alternate[which]:
                    return _alternate[which][it]
            _assert(it.isdigit(),
                "invalid range specifier: %r (%r)", it, entry)
            it = int(it, 10)
            _assert(_start <= it <= _end_limit,
                "item value %r out of range [%r, %r]",
                it, _start, _end_limit)
            return it

        # this handles individual items/ranges
        def _parse_piece(it):
            if '-' in it:
                start, end = map(_fix, it.split('-'))
                # Allow "sat-sun"
                if which in (DAY_OFFSET, WEEK_OFFSET) and end == 0:
                    end = 7
            elif it == '*':
                start = _start
                end = _end
            else:
                start = _fix(it)
                end = _end
                if increment is None:
                    return set([start])

            _assert(_start <= start <= _end_limit,
                "%s range start value %r out of range [%r, %r]",
                _attribute[which], start, _start, _end_limit)
            _assert(_start <= end <= _end_limit,
                "%s range end value %r out of range [%r, %r]",
                _attribute[which], end, _start, _end_limit)
            _assert(start <= end,
                "%s range start value %r > end value %r",
                _attribute[which], start, end)

            if increment:
                next_value = start + increment
                _assert(next_value <= _end_limit,
                        "first next value %r is out of range [%r, %r]",
                        next_value, start, _end_limit)
            return set(range(start, end+1, increment or 1))

        _start, _end = _ranges[which]
        _end_limit = _end
        # wildcards
        if entry in ('*', '?'):
            if entry == '?':
                _assert(which in (DAY_OFFSET, WEEK_OFFSET),
                    "cannot use '?' in the %r field", _attribute[which])
            return None, _end

        # last day of the month
        if entry == 'l':
            _assert(which == DAY_OFFSET,
                "you can only specify a bare 'L' in the 'day' field")
            return None, _end

        # for the last 'friday' of the month, for example
        elif entry.startswith('l'):
            _assert(which == WEEK_OFFSET,
                "you can only specify a leading 'L' in the 'weekday' field")
            es, _, ee = entry[1:].partition('-')
            _assert((entry[1:].isdigit() and 0 <= int(es) <= 7) or
                    (_ and es.isdigit() and ee.isdigit() and 0 <= int(es) <= 7 and 0 <= int(ee) <= 7),
                "last <day> specifier must include a day number or range in the 'weekday' field, you entered %r", entry)
            return None, _end

        # allow Sunday to be specified as weekday 7
        if which == WEEK_OFFSET:
            _end_limit = 7

        increment = None
        # increments
        if '/' in entry:
            entry, increment = entry.split('/')
            increment = int(increment, 10)
            _assert(increment > 0,
                "you can only use positive increment values, you provided %r",
                increment)
            _assert(increment <= _end_limit,
                    "increment value must be less than %r, you provided %r",
                    _end_limit, increment)

        # handle singles and ranges
        good = _parse_piece(entry)

        # change Sunday to weekday 0
        if which == WEEK_OFFSET and 7 in good:
            good.discard(7)
            good.add(0)

        return good, _end
603947
public String checkSanity() {
        for (CronTab tab : tabs) {
            String s = tab.checkSanity();
            if(s!=null)     return s;
        }
        return null;
    }
33402
def parse_tstamp(ev, field_name):
    
    try:
        return datetime.strptime(ev[field_name], '%Y-%m-%d %H:%M')
    except Exception as e:
        log.error("Unable to parse the '%s' field in the event named '%s': %s" \
            % (field_name, ev['title'], e))
        raise
1310859
private static CronField parseField(String field, int minValue, int maxValue) {

		// asterisk: *
		if ("*".equals(field)) {

			return new CronField(minValue, maxValue, 1, true);

		}

		// asterisk with step: */3
		if (field.startsWith("*/")) {

			int step = Integer.parseInt(field.substring(2));
			if(step > 0 & step <= maxValue) {

			      return new CronField(minValue, maxValue, step);

			} else {

			      throw new IllegalArgumentException("Illegal step: '" + step + "'");
			}
		}

		// simple number: 2
		if (field.matches("[0-9]{1,2}")) {

			int value = Integer.parseInt(field);

			if ((value >= minValue) && (value <= maxValue)) {

				return new CronField(value, value, 1);

			} else {

				throw new IllegalArgumentException("Parameter not within range: '" + field + "'");

			}

		}

		// range: 4-6
		if (field.matches("[0-9]{1,2}-[0-9]{1,2}")) {

			String[] rangeValues = field.split("[-]+");

			if (rangeValues.length == 2) {

				int start = Integer.parseInt(rangeValues[0]);
				int end   = Integer.parseInt(rangeValues[1]);

				if ((start >= minValue) && (start <= maxValue) && (end >= minValue) && (end <= maxValue)) {

					return new CronField(start, end, 1);

				} else {

					throw new IllegalArgumentException("Parameters not within range: '" + field + "'");

				}

			} else {

				throw new IllegalArgumentException("Invalid range: '" + field + "'");

			}

		}

		// list: 4,6
		if (field.contains(",")) {

			final String[] listValues  = field.split("[,]+");
			final List<Integer> values = new LinkedList<>();

			for (final String value : listValues) {

				try {
					values.add(Integer.parseInt(value));

				} catch (Throwable t) {
					throw new IllegalArgumentException("Invalid list value: '" + value + "'");
				}
			}

			return new CronField(values);

		}

		// range with step: 4-6/3
		if (field.matches("[0-9]{1,2}-[0-9]{1,2}/[0-9]{1,2}")) {

			throw new UnsupportedOperationException("Steps are not supported yet.");
		}

		throw new IllegalArgumentException("Invalid field: '" + field + "'");
	}
1313385
function timeMatch(value, cronTime){
  if(typeof(cronTime) == 'number'){
    if(cronTime == -1)
      return true;
    if(value == cronTime)
      return true;
    return false;
  }else if(typeof(cronTime) == 'object' && cronTime instanceof Array){
    if(value < cronTime[0] || value > cronTime[cronTime.length -1])
      return false;

    for(let i = 0; i < cronTime.length; i++)
      if(value == cronTime[i])
        return true;

    return false;
  }

  return null;
}
959301
def parse(self, data=b''):
        
        self.buf.extend(data)
        while self.buf:
            if self.state == AWAITING_CONTROL_LINE:
                msg = MSG_RE.match(self.buf)
                if msg:
                    try:
                        subject, sid, _, reply, needed_bytes = msg.groups()
                        self.msg_arg["subject"] = subject
                        self.msg_arg["sid"] = int(sid)
                        if reply:
                            self.msg_arg["reply"] = reply
                        else:
                            self.msg_arg["reply"] = b''
                        self.needed = int(needed_bytes)
                        del self.buf[:msg.end()]
                        self.state = AWAITING_MSG_PAYLOAD
                        continue
                    except:
                        raise ErrProtocol("nats: malformed MSG")

                ok = OK_RE.match(self.buf)
                if ok:
                    # Do nothing and just skip.
                    del self.buf[:ok.end()]
                    continue

                err = ERR_RE.match(self.buf)
                if err:
                    err_msg = err.groups()
                    yield self.nc._process_err(err_msg)
                    del self.buf[:err.end()]
                    continue

                ping = PING_RE.match(self.buf)
                if ping:
                    del self.buf[:ping.end()]
                    yield self.nc._process_ping()
                    continue

                pong = PONG_RE.match(self.buf)
                if pong:
                    del self.buf[:pong.end()]
                    yield self.nc._process_pong()
                    continue

                info = INFO_RE.match(self.buf)
                if info:
                    info_line = info.groups()[0]
                    self.nc._process_info(info_line)
                    del self.buf[:info.end()]
                    continue

                # If nothing matched at this point, then probably
                # a split buffer and need to gather more bytes,
                # otherwise it would mean that there is an issue
                # and we're getting malformed control lines.
                if len(self.buf
                       ) < MAX_CONTROL_LINE_SIZE and _CRLF_ not in self.buf:
                    break
                else:
                    raise ErrProtocol("nats: unknown protocol")

            elif self.state == AWAITING_MSG_PAYLOAD:
                if len(self.buf) >= self.needed + CRLF_SIZE:
                    subject = self.msg_arg["subject"]
                    sid = self.msg_arg["sid"]
                    reply = self.msg_arg["reply"]

                    # Consume msg payload from buffer and set next parser state.
                    payload = bytes(self.buf[:self.needed])
                    del self.buf[:self.needed + CRLF_SIZE]
                    self.state = AWAITING_CONTROL_LINE
                    yield self.nc._process_msg(sid, subject, reply, payload)
                else:
                    # Wait until we have enough bytes in buffer.
                    break
163721
def _parse_schedule(self, schedule):
        
        result = {}

        for param in shlex.split(str(schedule)): # do not feed unicode to shlex
            try:
                key, val = param.split('=', 1)
            except (TypeError, ValueError):
                self.fatal("Bad param '%s' in job schedule '%s'" % (param, schedule))
            else:
                result[key] = val

        return result
567362
def parse(self, callback_data: str) -> typing.Dict[str, str]:
        
        prefix, *parts = callback_data.split(self.sep)
        if prefix != self.prefix:
            raise ValueError("Passed callback data can't be parsed with that prefix.")
        elif len(parts) != len(self._part_names):
            raise ValueError('Invalid parts count!')

        result = {'@': prefix}
        result.update(zip(self._part_names, parts))
        return result
373769
function parse(string) {
            var match = isoDateExpression.exec(string);
            if (match) {
                // parse months, days, hours, minutes, seconds, and milliseconds
                // provide default values if necessary
                // parse the UTC offset component
                var year = $Number(match[1]),
                    month = $Number(match[2] || 1) - 1,
                    day = $Number(match[3] || 1) - 1,
                    hour = $Number(match[4] || 0),
                    minute = $Number(match[5] || 0),
                    second = $Number(match[6] || 0),
                    millisecond = Math.floor($Number(match[7] || 0) * 1000),
                    // When time zone is missed, local offset should be used
                    // (ES 5.1 bug)
                    // see https://bugs.ecmascript.org/show_bug.cgi?id=112
                    isLocalTime = Boolean(match[4] && !match[8]),
                    signOffset = match[9] === '-' ? 1 : -1,
                    hourOffset = $Number(match[10] || 0),
                    minuteOffset = $Number(match[11] || 0),
                    result;
                var hasMinutesOrSecondsOrMilliseconds = minute > 0 || second > 0 || millisecond > 0;
                if (
                    hour < (hasMinutesOrSecondsOrMilliseconds ? 24 : 25) &&
                    minute < 60 && second < 60 && millisecond < 1000 &&
                    month > -1 && month < 12 && hourOffset < 24 &&
                    minuteOffset < 60 && // detect invalid offsets
                    day > -1 &&
                    day < (dayFromMonth(year, month + 1) - dayFromMonth(year, month))
                ) {
                    result = (
                        (dayFromMonth(year, month) + day) * 24 +
                        hour +
                        hourOffset * signOffset
                    ) * 60;
                    result = (
                        (result + minute + minuteOffset * signOffset) * 60 +
                        second
                    ) * 1000 + millisecond;
                    if (isLocalTime) {
                        result = toUTC(result);
                    }
                    if (-8.64e15 <= result && result <= 8.64e15) {
                        return result;
                    }
                }
                return NaN;
            }
            return NativeDate.parse.apply(this, arguments);
        }
208183
def parse(line)
      fields = [:name, :value, :unit, :status, :type, :state, :lower_nonrec,
                :lower_crit, :lower_noncrit, :upper_crit, :upper_nonrec, :asserts_enabled, :deasserts_enabled]
      # skip the header
      data = line.split(/\|/)
      # should we ever encounter a field not in the fields list, just use a counter based fieldname
      i = 0
      data.each do |value|
        field ||= fields.shift || "field#{i}"
        self[field] = value.strip
        i = i.next
      end
    end
611876
function parseData(data)
{
    var tmp_data = {};
    if (nlib.isString(data)) {
        if (data.match(/\.json/i) && grunt.file.exists(data)) {
          tmp_data = grunt.file.readJSON(data);
        } else if (data.match(/\.ya?ml/i) && grunt.file.exists(data)) {
          tmp_data = grunt.file.readYAML(data);
        } else {
            tmp_data = data;
        }
    } else if (nlib.isObject(data) || nlib.isArray(data)) {
        for (var i in data) {
            if (nlib.isString(data[i])) {
                var parsed = parseData(data[i]);
                if (nlib.isString(parsed)) {
                    tmp_data[i] = parsed;
                } else {
                    tmp_data = merge(tmp_data, parsed);
                }
            } else {
                tmp_data = merge(tmp_data, data[i]);
            }
        }
    }
    return tmp_data;
}
674728
def parse_items(self, field: Field) -> Mapping[str, Any]:
        
        return self.build_parameter(field.container)
317520
private void parseFilename() {

    // Add additional filtering to discard empty files, or files ending in .crc
    if ((filename != null) && (filename.length() > 0)
        && (!filename.endsWith(".crc"))) {

      Matcher matcher = PATTERN.matcher(filename);

      if (matcher.matches()) {
    	//  jobTracker = "";
    	  jobid = matcher.group(1);
    	  Matcher confMatcher = CONF_PATTERN.matcher(filename);
    	  if (confMatcher.matches()) {
        	isJobConfFile = true;
        	LOG.debug("Job Conf file  " + filename + " with job id: " + jobid);
        	} else {
        		isJobHistoryFile = true;
        		LOG.debug("Job History file " + filename + " with job id: " + jobid);
        		}
    	  }
      else {
          LOG.info(" file does not match any format: " + filename);
      }
    }
  }
591094
def parse_line(self, line, lineno):
        """"""
        match = self.RE_TINDERBOXPRINT.match(line) if line else None
        if match:
            line = match.group('line')

            for regexp_item in self.TINDERBOX_REGEXP_TUPLE:
                match = regexp_item['re'].match(line)
                if match:
                    artifact = match.groupdict()
                    # handle duplicate fields
                    for to_field, from_field in regexp_item['duplicates_fields'].items():
                        # if to_field not present or None copy form from_field
                        if to_field not in artifact or artifact[to_field] is None:
                            artifact[to_field] = artifact[from_field]
                    artifact.update(regexp_item['base_dict'])
                    self.artifact.append(artifact)
                    return

            # default case: consider it html content
            # try to detect title/value splitting on <br/>
            artifact = {"content_type": "raw_html", }
            if "<br/>" in line:
                title, value = line.split("<br/>", 1)
                artifact["title"] = title
                artifact["value"] = value
            # or similar long lines if they contain a url
            elif "href" in line and "title" in line:
                def parse_url_line(line_data):
                    class TpLineParser(HTMLParser):

                        def handle_starttag(self, tag, attrs):
                            d = dict(attrs)
                            artifact["url"] = d['href']
                            artifact["title"] = d['title']

                        def handle_data(self, data):
                            artifact["value"] = data

                    p = TpLineParser()
                    p.feed(line_data)
                    p.close()

                # strip ^M returns on windows lines otherwise
                # handle_data will yield no data 'value'
                parse_url_line(line.replace('\r', ''))
            else:
                artifact["value"] = line
            self.artifact.append(artifact)
2639
public function parseExistingCrontab(Crontab $crontab)
    {
        // parsing cron file
        $process = new Process($this->crontabCommand($crontab).' -l');
        $process->run();

        foreach ($this->parseString($process->getOutput()) as $item) {
            $crontab->addItem($item);
        }

        $this->error = $process->getErrorOutput();

        return $this;
    }
942633
def parse_form_data(io, boundary)
      boundary_regexp = /\A--#{Regexp.quote(boundary)}(--)?#{CRLF}\z/
      form_data = Hash.new
      return form_data unless io
      data = nil
      io.each_line{|line|
        if boundary_regexp =~ line
          if data
            data.chop!
            key = data.name
            if form_data.has_key?(key)
              form_data[key].append_data(data)
            else
              form_data[key] = data
            end
          end
          data = FormData.new
          next
        else
          if data
            data << line
          end
        end
      }
      return form_data
    end
1229858
def parse_match_info(self, req: Request, name: str, field: Field) -> typing.Any:
        """"""
        return core.get_value(req.match_info, name, field)