Coerce inputs into compatible format
193844
def _preprocess_inputs(x, weights):
    
    if weights is None:
        w_arr = np.ones(len(x))
    else:
        w_arr = np.array(weights)
    x_arr = np.array(x)
    if x_arr.ndim == 2:
        if w_arr.ndim == 1:
            w_arr = w_arr[:, np.newaxis]
    return x_arr, w_arr
609496
def _put_input(self, input_source: str) -> None:
        """"""
        input_cmd = shlex.split(str(input_source))
        if len(input_cmd) > 1:
            self._argv.extend(input_cmd)
        else:
            self._argv.extend(["-i", input_source])
247204
function( input, charset ) {

    if( /iso-?2022-?jp/i.test( charset ) ) {
      charset = 'shift_jis'
    }

    if( charset ) {
      return MIME.Iconv.decode( Buffer.from( input, 'base64' ), charset )
    } else {
      return Buffer.from( input, 'base64' ).toString()
    }

  }
695281
def convert(cgi_input, twobit_ref, twobit_name, var_only=False):
    """"""

    # Set up CGI input. Default is to assume a str generator.
    if isinstance(cgi_input, str) or isinstance(cgi_input, unicode):
        cgi_input = auto_zip_open(cgi_input, 'rb')

    # Set up TwoBitFile for retrieving reference sequences.
    reference = twobitreader.TwoBitFile(twobit_ref)

    # Output header.
    header = make_header(twobit_name).split('\n')
    for line in header:
        yield line

    while True:
        line = cgi_input.readline()
        if not line:
            break
        line = line.decode('utf-8')

        # Skip header lines.
        if re.search(r'^\W*$', line) or line.startswith('#'):
            continue

        # Store header row labels.
        if line.startswith('>'):
            header_data = line.lstrip('>').rstrip('\n').split('\t')
            header = {header_data[i]: i for i in range(len(header_data))}
            continue

        # If we reach this point, this is a line that contains data.
        data = line.rstrip('\n').split("\t")

        out = process_next_position(
            data=data, cgi_input=cgi_input, header=header, reference=reference,
            var_only=var_only)

        # process_next_position returns an array of one or more lines
        if out:
            for line in out:
                yield line
96786
def input_format(self, content_type):
        """"""
        return getattr(self, '_input_format', {}).get(content_type, hug.defaults.input_format.get(content_type, None))
413053
function(input, shallow, output) {
    if (shallow && _.every(input, _.isArray)) {
      return concat.apply(output, input);
    }
    each(input, function(value) {
      if (_.isArray(value) || _.isArguments(value)) {
        shallow ? push.apply(output, value) : flatten(value, shallow, output);
      } else {
        output.push(value);
      }
    });
    return output;
  }
679007
def _construct_output_to_match(output_block):
    """"""
    output_block.validate()

    selections = (
        u'%s AS `%s`' % (output_block.fields[key].to_match(), key)
        for key in sorted(output_block.fields.keys())  # Sort keys for deterministic output order.
    )

    return u'SELECT %s FROM' % (u', '.join(selections),)
276152
def combine_inputs(self, args, kw, ignore_args):
        ""
        inputs= args + tuple(c[1] for c in sorted(kw.items(), key=lambda x: x[0]))
        # REMOVE the ignored arguments from input and PREVENT it from being checked!!!
        return [a for i,a in enumerate(inputs) if i not in ignore_args]
23522
def format_string(m, l, capture, is_bytes):
    """"""

    for fmt_type, value in capture[1:]:
        if fmt_type == FMT_ATTR:
            # Attribute
            l = getattr(l, value)
        elif fmt_type == FMT_INDEX:
            # Index
            l = l[value]
        elif fmt_type == FMT_CONV:
            if is_bytes:
                # Conversion
                if value in ('r', 'a'):
                    l = repr(l).encode('ascii', 'backslashreplace')
                elif value == 's':
                    # If the object is not string or byte string already
                    l = _to_bstr(l)
            else:
                # Conversion
                if value == 'a':
                    l = ascii(l)
                elif value == 'r':
                    l = repr(l)
                elif value == 's':
                    # If the object is not string or byte string already
                    l = str(l)
        elif fmt_type == FMT_SPEC:
            # Integers and floats don't have an explicit 's' format type.
            if value[3] and value[3] == 's':
                if isinstance(l, int):  # pragma: no cover
                    raise ValueError("Unknown format code 's' for object of type 'int'")
                if isinstance(l, float):  # pragma: no cover
                    raise ValueError("Unknown format code 's' for object of type 'float'")

            # Ensure object is a byte string
            l = _to_bstr(l) if is_bytes else str(l)

            spec_type = value[1]
            if spec_type == '^':
                l = l.center(value[2], value[0])
            elif spec_type == ">":
                l = l.rjust(value[2], value[0])
            else:
                l = l.ljust(value[2], value[0])

    # Make sure the final object is a byte string
    return _to_bstr(l) if is_bytes else str(l)
1327684
def formatreturn(arg, input_is_array=False):
    """"""
    if not input_is_array and arg.size == 1:
        arg = arg.item()
    return arg
107936
def coerce_quotes(quotes):
        """"""
        orig, quotes = quotes, str(quotes) if quotes else None
        if quotes not in [None, '"', "'"]:
            raise ValueError("{!r} is not a valid quote type".format(orig))
        return quotes
642890
function(input, shallow, strict, output) {
    if (shallow && _.every(input, _.isArray)) {
      return concat.apply(output, input);
    }
    for (var i = 0, length = input.length; i < length; i++) {
      var value = input[i];
      if (!_.isArray(value) && !_.isArguments(value)) {
        if (!strict) output.push(value);
      } else if (shallow) {
        push.apply(output, value);
      } else {
        flatten(value, shallow, strict, output);
      }
    }
    return output;
  }
1371416
def prepare_input_data(self, X):
        
        X = check_array(X, force_all_finite=False)
        if X.dtype != "f" and X.dtype != "d":
            X = X.astype(float)

        self._check_input(X)
        missing_mask = np.isnan(X)
        self._check_missing_value_mask(missing_mask)
        return X, missing_mask
1183603
function normalizeFields(input) {
  if (!input) return;
  if (!Array.isArray(input)) input = [ input ];

  return flatten(input).filter(Boolean).map(normalizeField);
}
970608
def union(input, **params):
    
    res = []
    for col in input:
        res.extend(input[col])
    return res
345737
function(input) {
      if (typeof input != 'string') return
      input = hookImmutable('preprocessing', input)
      return input.
        replace(/\t/g, '  ').
        replace(/\r\n|\n|\r/g, '\n').
        split('__END__')[0].
        replace(/([\w\.]+)\.(stub|destub)\((.*?)\)$/gm, '$2($1, $3)').
        replace(/describe\s+(.*?)$/gm, 'describe($1, function(){').
        replace(/^\s+it\s+(.*?)$/gm, ' it($1, function(){').
        replace(/^ *(before_each|after_each|before|after)(?= |\n|$)/gm, 'JSpec.currentSuite.addHook("$1", function(){').
        replace(/^\s*end(?=\s|$)/gm, '});').
        replace(/-\{/g, 'function(){').
        replace(/(\d+)\.\.(\d+)/g, function(_, a, b){ return range(a, b) }).
        replace(/\.should([_\.]not)?[_\.](\w+)(?: |;|$)(.*)$/gm, '.should$1_$2($3)').
        replace(/([\/\s]*)(.+?)\.(should(?:[_\.]not)?)[_\.](\w+)\((.*)\)\s*;?$/gm, '$1 expect($2).$3($4, $5)').
        replace(/, \)/g, ')').
        replace(/should\.not/g, 'should_not')
    }
684507
function canConvert(input) {
    return input != null && (typeof input === 'string' || input.nodeType && (input.nodeType === 1 || input.nodeType === 9 || input.nodeType === 11));
}