parses input, adds contents
774911
public void parse(String xmlInput, boolean strict) throws ParseException {
		if (xmlInput == null) {
			throw new IllegalArgumentException("input can not be null");
		}
		ArrayList splitContents = split(xmlInput, interpreteAsXHTML, true);
		build(splitContents, interpreteAsXHTML);
	}
954870
def _get_input_data(self, request):
        
        # only PUT and POST should provide data
        if not self._is_data_method(request):
            return None

        content = [row for row in request.read()]
        content = ''.join(content) if content else None
        return self._parse_input_data(content, request) if content else None
247182
public void load(BufferedReader input) throws IOException {
    String line;
    while( (line=input.readLine()) != null ) {
      if( StringUtils.matches(line, "\\s*(%.*)?") ) {
        // comment or blank line
        System.err.println("Skipping: " + line);
        continue;
      }
      char [] linechars = line.toCharArray();
      int [] pattern = new int[linechars.length];
      char [] chars  = new char[linechars.length];
      int c = 0;
      for( int i = 0; i < linechars.length; ++i) {
        if( Character.isDigit(linechars[i]) ) {
          pattern[c] = Character.digit(linechars[i], 10);
        } else {
          chars[c++] = linechars[i];
        }
      }
      char[] shortchars = new char[c];
      int [] shortpattern = new int[c+1];
      System.arraycopy(chars, 0, shortchars, 0, c);
      System.arraycopy(pattern, 0, shortpattern, 0, c+1);
      insertHyphPattern(shortchars, shortpattern);
    }
  }
1286307
def parse_input(args, kwargs=None, condition=True, no_parse=None):
    '''
    
    '''
    if no_parse is None:
        no_parse = ()
    if kwargs is None:
        kwargs = {}
    _args = []
    _kwargs = {}
    for arg in args:
        if isinstance(arg, six.string_types):
            arg_name, arg_value = parse_kwarg(arg)
            if arg_name:
                _kwargs[arg_name] = yamlify_arg(arg_value) \
                    if arg_name not in no_parse \
                    else arg_value
            else:
                _args.append(yamlify_arg(arg))
        elif isinstance(arg, dict):
            # Yes, we're popping this key off and adding it back if
            # condition_input is called below, but this is the only way to
            # gracefully handle both CLI and API input.
            if arg.pop('__kwarg__', False) is True:
                _kwargs.update(arg)
            else:
                _args.append(arg)
        else:
            _args.append(arg)
    _kwargs.update(kwargs)
    if condition:
        return condition_input(_args, _kwargs)
    return _args, _kwargs
307247
def parse(input_: Union[str, FileStream], default_base: Optional[str]=None) -> Optional[Schema]:
    

    # Step 1: Tokenize the input stream
    error_listener = ParseErrorListener()
    if not isinstance(input_, FileStream):
        input_ = InputStream(input_)
    lexer = ShExDocLexer(input_)
    lexer.addErrorListener(error_listener)
    tokens = CommonTokenStream(lexer)
    tokens.fill()
    if error_listener.n_errors:         # Lexer prints errors directly
        return None

    # Step 2: Generate the parse tree
    parser = ShExDocParser(tokens)
    parser.addErrorListener(error_listener)
    parse_tree = parser.shExDoc()
    if error_listener.n_errors:
        print('\n'.join(error_listener.errors), file=sys.stderr)
        return None

    # Step 3: Transform the results the results
    parser = ShexDocParser(default_base=default_base)
    parser.visit(parse_tree)

    return parser.context.schema
406768
@Override
	public ImmutableList<TargetAtom> parse(String input) throws TargetQueryParserException {
		StringBuffer bf = new StringBuffer(input.trim());
		if (!bf.substring(bf.length() - 2, bf.length()).equals(" .")) {
			bf.insert(bf.length() - 1, ' ');
		}
		if (!prefixes.isEmpty()) {
			// Update the input by appending the directives
			appendDirectives(bf);
		}		
		try {
			CharStream inputStream = CharStreams.fromString(bf.toString());
			TurtleOBDALexer lexer = new TurtleOBDALexer(inputStream);

			//substitute the standard ConsoleErrorListener (simply print out the error) with ThrowingErrorListener
            lexer.removeErrorListeners();
			lexer.addErrorListener(ThrowingErrorListener.INSTANCE);

			CommonTokenStream tokenStream = new CommonTokenStream(lexer);
			TurtleOBDAParser parser = new TurtleOBDAParser(tokenStream);
            //substitute the standard ConsoleErrorListener (simply print out the error) with ThrowingErrorListener
			parser.removeErrorListeners();
			parser.addErrorListener(ThrowingErrorListener.INSTANCE);

			return (ImmutableList<TargetAtom>)visitor.visitParse(parser.parse());
		} catch (RuntimeException e) {
			throw new TargetQueryParserException(e.getMessage(), e);
		}
	}
667613
def parse(input_: Union[str, FileStream], source: str) -> Optional[str]:
    

    # Step 1: Tokenize the input stream
    error_listener = ParseErrorListener()
    if not isinstance(input_, FileStream):
        input_ = InputStream(input_)
    lexer = jsgLexer(input_)
    lexer.addErrorListener(error_listener)
    tokens = CommonTokenStream(lexer)
    tokens.fill()
    if error_listener.n_errors:
        return None

    # Step 2: Generate the parse tree
    parser = jsgParser(tokens)
    parser.addErrorListener(error_listener)
    parse_tree = parser.doc()
    if error_listener.n_errors:
        return None

    # Step 3: Transform the results the results
    parser = JSGDocParser()
    parser.visit(parse_tree)

    if parser.undefined_tokens():
        for tkn in parser.undefined_tokens():
            print("Undefined token: " + tkn)
        return None

    return parser.as_python(source)
191373
protected function parseInput(string $input)
	{
		$category = explode('|', $input);

		if (isset($category[0]) && trim($category[0]) != '') {
			$this->category_id = urldecode($category[0]);
		}

		if (isset($category[1]) && trim($category[1]) != '') {
			$this->category_name = urldecode($category[1]);
		}
	}
881881
function normalizeInput(input) {
    var ret;
    if (input instanceof Uint8Array) {
        ret = input;
    }
    else if (input instanceof Buffer) {
        ret = new Uint8Array(input);
    }
    else if (typeof (input) === 'string') {
        ret = new Uint8Array(Buffer.from(input, 'utf8'));
    }
    else {
        throw new Error(ERROR_MSG_INPUT);
    }
    return ret;
}
603913
function decode(input) {
    var decoder = new Decoder()
    var output = decoder.update(input, true)
    return output
}
155529
function object(input, level, options) {
  var spaces = options.spaces;
  var inner = indent(level, spaces);
  var outer = indent(level - 1, spaces);

  var keys = Object.keys(input);
  if (options.sortKeys) keys.sort(naturalSort());
  var str = keys.map(function (key) {
    return inner
      + stringify(key) + ': '
      + format(input[key], level + 1, options);
  }).join(',\n');

  return [ '{', str, outer + '}' ].join('\n');
}
1101116
def parse(input):
    '''
    
    '''
    if isinstance(input, datetime):
        return input
    if isinstance(input, date):
        return date_to_datetime(input)
    if isinstance(input, time):
        return time_to_datetime(input)
    if isinstance(input, (int, float)):
        return timestamp_to_datetime(input)
    if isinstance(input, (str)):
        return string_to_data_time(input)
    return None
1102719
def process_input(self, paragraph):
        """"""
        try:
            lang, body = paragraph.split(None, 1)
        except ValueError:
            lang, body = paragraph, None

        if not lang.strip().startswith('%'):
            lang = 'scala'
            body = paragraph.strip()

        else:
            lang = lang.strip()[1:]

        if lang == 'md':
            self.build_markdown(lang, body)
        else:
            self.build_code(lang, body)
434095
function parse(contents, retained, parser) {
    var errors = [], data = [], lines = 0;

    // optional parser
    if (!parser) parser = JSON;

    // process each line of the file
    contents.toString().split('\n').forEach(function(line) {
        if (!line) return;
        lines++;
        try {
            data.push(parser.parse(line));
        } catch (e) {
            e.line = line;
            errors.push(e);
        }
    });

    // if no errors/data, don't return an empty array
    var ret = {};
    if (errors.length) ret.errors = errors;
    if (data.length) ret.data = data;

    // if every line failed, probably not line-delimited
    if (errors.length == lines) ret.errors = retained;

    return ret;
}
228842
def split_input(args):
    """"""
    args['files'] = []
    args['urls'] = []
    for arg in args['query']:
        if os.path.isfile(arg):
            args['files'].append(arg)
        else:
            args['urls'].append(arg.strip('/'))
971173
function parse_contents($contents)
	{
		if($this->fix_newlines) {
			// fix mac/dos formatted newlines
			$contents = preg_replace('!\r\n?!', "\n", $contents);
		}

		$config_data = array();
		$config_data['sections'] = array();
		$config_data['vars'] = array();

		/* reference to fill with data */
		$vars =& $config_data['vars'];

		/* parse file line by line */
		preg_match_all('!^.*\r?\n?!m', $contents, $match);
		$lines = $match[0];
		for ($i=0, $count=count($lines); $i<$count; $i++) {
			$line = $lines[$i];
			if (empty($line)) continue;

			if ( substr($line, 0, 1) == '[' && preg_match('!^\[(.*?)\]!', $line, $match) ) {
				/* section found */
				if (substr($match[1], 0, 1) == '.') {
					/* hidden section */
					if ($this->read_hidden) {
						$section_name = substr($match[1], 1);
					} else {
						/* break reference to $vars to ignore hidden section */
						unset($vars);
						$vars = array();
						continue;
					}
				} else {
					$section_name = $match[1];
				}
				if (!isset($config_data['sections'][$section_name]))
				$config_data['sections'][$section_name] = array('vars' => array());
				$vars =& $config_data['sections'][$section_name]['vars'];
				continue;
			}

			if (preg_match('/^\s*(\.?\w+)\s*=\s*(.*)/s', $line, $match)) {
				/* variable found */
				$var_name = rtrim($match[1]);
				if (strpos($match[2], '"""') === 0) {
					/* handle multiline-value */
					$lines[$i] = substr($match[2], 3);
					$var_value = '';
					while ($i<$count) {
						if (($pos = strpos($lines[$i], '"""')) === false) {
							$var_value .= $lines[$i++];
						} else {
							/* end of multiline-value */
							$var_value .= substr($lines[$i], 0, $pos);
							break;
						}
					}
					$booleanize = false;

				} else {
					/* handle simple value */
					$var_value = preg_replace('/^([\'"])(.*)\1$/', '\2', rtrim($match[2]));
					$booleanize = $this->booleanize;

				}
				$this->_set_config_var($vars, $var_name, $var_value, $booleanize);
			}
			/* else unparsable line / means it is a comment / means ignore it */
		}
		return $config_data;
	}
543076
function parse(input, isindex) {
				var sequences = input.split('&');
				if (isindex && sequences[0].indexOf('=') === -1)
					sequences[0] = '=' + sequences[0];
				var pairs = [];
				sequences.forEach(function (bytes) {
					if (bytes.length === 0) return;
					var index = bytes.indexOf('=');
					if (index !== -1) {
						var name = bytes.substring(0, index);
						var value = bytes.substring(index + 1);
					} else {
						name = bytes;
						value = '';
					}
					name = name.replace(/\+/g, ' ');
					value = value.replace(/\+/g, ' ');
					pairs.push({ name: name, value: value });
				});
				var output = [];
				pairs.forEach(function (pair) {
					output.push({
						name: decodeURIComponent(pair.name),
						value: decodeURIComponent(pair.value)
					});
				});
				return output;
			}