parse a string to HSB
508202
function (strVal) {
      strVal = strVal.toLowerCase().trim();
      if (strVal) {
        if (this.isTransparent(strVal)) {
          this.value = {
            h: 0,
            s: 0,
            b: 0,
            a: 0
          };
        } else {
          this.value = this.stringToHSB(strVal) || {
            h: 0,
            s: 0,
            b: 0,
            a: 1
          }; // if parser fails, defaults to black
        }
      }
    }
1050668
public void parse(String s) {
        Preconditions.checkNotNull(s, "s");
        if (s.length() == 0) {
            // Nothing to do.
            return;
        }

        val pairs = s.split(pairDelimiter);
        for (String pair : pairs) {
            int delimiterPos = pair.indexOf(keyValueDelimiter);
            if (delimiterPos < 0) {
                throw new IllegalArgumentException(String.format("Invalid pair '%s' (missing key-value delimiter).", pair));
            }

            String key = pair.substring(0, delimiterPos);
            String value;
            if (delimiterPos == pair.length() - 1) {
                value = "";
            } else {
                value = pair.substring(delimiterPos + 1);
            }

            Extractor<?> e = this.extractors.get(key);
            Preconditions.checkArgument(e != null, String.format("No extractor provided for key '%s'.", key));
            e.process(value);
        }
    }
617676
def loads(cls, s: str) -> 'Money':
        """"""
        try:
            currency, amount = s.strip().split()
            return cls(amount, currency)
        except ValueError as err:
            raise ValueError("failed to parse string "
                             " '{}': {}".format(s, err))
491716
private static String[] parsePair (String pair) {
        String[] tmp = new String[2];
        int indexOfA = pair.indexOf('{')+1;
        int indexOfB = pair.indexOf(',');
        tmp[0] = pair.substring(indexOfA,indexOfB);
        tmp[1] = pair.substring(indexOfB+2,pair.length()-1);

        return tmp;
    }
1234702
def from_string(cls, s, space):
        """"""

        import hashlib

        hs = hashlib.sha1(s).hexdigest()

        return cls.from_hex(hs, space)
698787
def parse_string(self, string=''):
        '''
        
        '''
        self.strings = string.splitlines(1)
        self.strings = [self.__parse(line) for line in self.strings]
        return ''.join(self.strings)
583552
function parse(raw, opts) {
  opts = opts || {}

  var preserveNumbers = opts.preserveNumbers;
  var trim = function (s) { return s.trim(); };
  var obj = {};

  getKeyValueChunks(raw)
    .map(trim)
    .filter(Boolean)
    .forEach(function (item) {
      // split with `.indexOf` rather than `.split` because the value may also contain colons.
      var pos = item.indexOf(':');
      var key = item.substr(0, pos).trim();
      var val = item.substr(pos + 1).trim();
      if (preserveNumbers && isNumeric(val)) {
        val = Number(val);
      }

      obj[key] = val;
    });

  return obj;
}
1228534
def parse(cls, detail_string):
        """"""
        split = detail_string.split(':')
        if len(split) != 4:
            raise Exception('invalid credentials')  # TODO: other exception

        ltpk = binascii.unhexlify(split[0])
        ltsk = binascii.unhexlify(split[1])
        atv_id = binascii.unhexlify(split[2])
        client_id = binascii.unhexlify(split[3])
        return Credentials(ltpk, ltsk, atv_id, client_id)
473620
private void parseValue(StringBuffer res, HashMap<String, String> predefs, char preDelim,
                            HashMap<String, String> valids) {
        int len = res.length();

        if (preDelim != (char) 0 && res.charAt(0) != preDelim) {
            if (len == 0) {
                throw new ParseErrorException(HBCIUtils.getLocMsg("EXCMSG_ENDOFSTRG", getPath()));
            }

            // log.("error string: "+res.toString(),log._ERR);
            // log.("current: "+getPath()+":"+type+"("+minsize+","+maxsize+")="+value,log._ERR);
            // log.("predelimiter mismatch (required:"+getPreDelim()+" found:"+temp.charAt(0)+")",log._ERR);
            throw new PredelimErrorException(getPath(), Character.toString(preDelim),
                Character.toString(res.charAt(0)));
        }

        this.value = SyntaxDEFactory.createSyntaxDE(getType(), getPath(), res, minsize, maxsize);

        String valueString = value.toString(0);
        String predefined = predefs.get(getPath());
        if (predefined != null) {
            if (!valueString.equals(predefined)) {
                throw new ParseErrorException(HBCIUtils.getLocMsg("EXCMSG_PREDEFERR",
                    new Object[]{getPath(), predefined, value}));
            }
        }

        boolean atLeastOne = false;
        boolean ok = false;
        if (valids != null) {
            String header = getPath() + ".value";
            for (String key : valids.keySet()) {
                if (key.startsWith(header) &&
                    key.indexOf(".", header.length()) == -1) {

                    atLeastOne = true;
                    String validValue = valids.get(key);
                    if (valueString.equals(validValue)) {
                        ok = true;
                        break;
                    }
                }
            }
        }

        if (atLeastOne && !ok) {
            throw new NoValidValueException(getPath(), valueString);
        }
    }
1177594
function parseNumber( str ) {
	var v = parseFloat( str );
	if ( isnan( v ) ) {
		return new TypeError( 'invalid value. Unable to parse string as a number. Value: `' + str + '`.' );
	}
	return v;
}
84677
function parse(str, options) {
  if (typeof str !== 'string') {
    throw new TypeError('argument str must be a string');
  }

  var obj = {}
  var opt = options || {};
  var pairs = str.split(pairSplitRegExp);
  var dec = opt.decode || decode;

  for (var i = 0; i < pairs.length; i++) {
    var pair = pairs[i];
    var eq_idx = pair.indexOf('=');

    // skip things that don't look like key=value
    if (eq_idx < 0) {
      continue;
    }

    var key = pair.substr(0, eq_idx).trim()
    var val = pair.substr(++eq_idx, pair.length).trim();

    // quoted values
    if ('"' == val[0]) {
      val = val.slice(1, -1);
    }

    // only assign once
    if (undefined == obj[key]) {
      obj[key] = tryDecode(val, dec);
    }
  }

  return obj;
}
966525
function decode(str) {
  const [hrp, data] = deserialize(str);

  if (data.length === 0 || data.length > 65)
    throw new Error('Invalid bech32 data length.');

  if (data[0] > 16)
    throw new Error('Invalid bech32 version.');

  const version = data[0];
  const output = data;
  const hash = convert(data, output, 5, 8, -1, 1);

  if (hash.length < 2 || hash.length > 40)
    throw new Error('Invalid bech32 data length.');

  return new AddrResult(hrp, version, hash);
}
255467
function parseCover(str) {
    str = str.split(EOL);
    var obj = {};
    var reg = /(\w+)\s?:\s?(.+)/;
    str.forEach(function(val) {
        if (val = reg.exec(val)) {
            obj[val[1]] = val[2];
        }
    });
    return obj;
}
869814
def from_str(string):
        
        match = re.match(r'^READ (\w+) FOR (\d+) \w+S$', string)
        if match:
            return ReadEvent(match.group(1), int(match.group(2)))
        else:
            raise EventParseError
290782
def parse(self, string, evaluate_result=True):
        '''
        '''
        m = self._match_re.match(string)
        if m is None:
            return None

        if evaluate_result:
            return self.evaluate_result(m)
        else:
            return Match(self, m)
1240575
def from_string(cls, string):
        
        items = shlex.split(string, **cls.split_args)
        return cls(items)
490103
private <E> Object parse( String s, Class fclz ) {
    if( fclz.equals(String.class) ) return s; // Strings already the right primitive type
    if( fclz.isArray() ) {      // An array?
      read(s,    0       ,'[',fclz);
      read(s,s.length()-1,']',fclz);
      String[] splits = s.substring(1,s.length()-1).split(",");
      Class<E> afclz = (Class<E>)fclz.getComponentType();
      E[] a= (E[])Array.newInstance(afclz,splits.length);
      for( int i=0; i<splits.length; i++ )
        a[i] = (E)parse(splits[i],afclz);
      return a;
    }
    if( fclz.equals(Key.class) ) return Key.make(s);

    throw new RuntimeException("Unimplemented schema fill from "+fclz.getSimpleName());
  }  
  private int read( String s, int x, char c, Class fclz ) {
    if( peek(s,x,c) ) return x+1;
    throw new IllegalArgumentException("Expected '"+c+"' while reading a "+fclz.getSimpleName()+", but found "+s);
  }
  private boolean peek( String s, int x, char c ) { return x < s.length() && s.charAt(x) == c; }
}