numArgs :: Integer -> String
194032
function numArgs(n) {
    return (n < numbers.length ? numbers[n] : show (n)) + ' ' +
           (n === 1 ? 'argument' : 'arguments');
  }
1012657
function parseStringNumbers (parser) {
  const length = parser.buffer.length - 1
  var offset = parser.offset
  var number = 0
  var res = ''

  if (parser.buffer[offset] === 45) {
    res += '-'
    offset++
  }

  while (offset < length) {
    var c1 = parser.buffer[offset++]
    if (c1 === 13) { // \r\n
      parser.offset = offset + 1
      if (number !== 0) {
        res += number
      }
      return res
    } else if (number > 429496728) {
      res += (number * 10) + (c1 - 48)
      number = 0
    } else if (c1 === 48 && number === 0) {
      res += 0
    } else {
      number = (number * 10) + (c1 - 48)
    }
  }
}
586413
function(args) {
    var lastArgWasNumber = false;
    var numArgs = args.length;
    var strs = [];
    for (var ii = 0; ii < numArgs; ++ii) {
      var arg = args[ii];
      if (arg === undefined) {
        strs.push('undefined');
      } else if (typeof arg === 'number') {
        if (lastArgWasNumber) {
          strs.push(", ");
        }
        if (arg === Math.floor(arg)) {
          strs.push(arg.toFixed(0));
        } else {
        strs.push(arg.toFixed(3));
        }
        lastArgWasNumber = true;
      } else if (window.Float32Array && arg instanceof Float32Array) {
        // TODO(gman): Make this handle other types of arrays.
        strs.push(tdl.string.argsToString(arg));
      } else {
        strs.push(arg.toString());
        lastArgWasNumber = false;
      }
    }
    return strs.join("");
  }
265708
def get_number(string_nums):
    
    match = re.match(r".*([\d]{1,})", string_nums)
    if match:
        return int(match.group(1))
    return None
472041
function _int(chunk, type) {
  var b, s = '', i;
  while(this._offset < chunk.length) {
    b = chunk[this._offset];
    if(b === CR && chunk[this._offset + 1] === LF) {
      this._offset += 2;
      i = parseInt(s);
      if(type === BST) {
        if(isNaN(i)) {
          return this._abort(new Error('bad string length'));
        }else if(i > this.maxlen) {
          return this._abort(new Error('string length exceeded'));
        }
      }
      return i;
    }
    s += String.fromCharCode(b);
    ++this._offset;
  }
}
701190
def fmt_num(value, places = 2)
      return nil if value.blank?

      value =
          if value.respond_to?(:to_f)
            value.to_f
          else
            nil
          end

      return nil unless value.is_a?(::Float)

      "%0.#{places}f" % value.round(places)
    end
1145767
def str_to_num(i, exact_match=True):
    
    # TODO: Cleanup -- this is really ugly
    if not isinstance(i, str):
        return i
    try:
        if not exact_match:
            return int(i)
        elif str(int(i)) == i:
            return int(i)
        elif str(float(i)) == i:
            return float(i)
        else:
            pass
    except ValueError:
        pass
    return i
396489
function numarray(x) {
    for (var j = 0, o = []; j < x.length; j++) o[j] = parseFloat(x[j]);
    return o;
}
340745
def argmin(attrs, inputs, proto_obj):
    """"""
    axis = attrs.get('axis', 0)
    keepdims = attrs.get('keepdims', 1)
    argmin_op = symbol.argmin(inputs[0], axis=axis, keepdims=keepdims)
    # onnx argmax operator always expects int64 as output type
    cast_attrs = {'dtype': 'int64'}
    return 'cast', cast_attrs, argmin_op
962727
function compileString($string) {
        /**
         * Examples:
         *  numeric[-10, 30)
         *  integer(0, inf)
         *  float[0,1]
         */
        $numeric = '/^(numeric|float|integer|int)((\(|\[).+,[^\]\)]+(\)|\]))$/';
        /**
         * Examples:
         *  string{pendent, payed, ready, cancelled}
         *  integer{10, 100, 1000}
         *  scalar{0, false}
         *  {0, false} //same as the previous one
         */
        $valueSetScalar = '/^(scalar|string|float|integer|int|str|boolean|bool|numeric)?(\{[^}]*\})$/';

        /**
         * Examples:
         *  string(5..10)
         *  string(5..)
         *  string(..10)
         *  string(5..5) // strict length
         *  string(..) // pointless, but valid
         */
        $lengthString = '/^string(\(\d*\.\.\d*\))$/';

        /**
         * Examples:
         *  (string|integer)[]
         *  (string|integer{0,1})[]
         *  (bool{true}|integer[1,inf))[]
         */
        $quickArray = "/^(\\(.+(\\|.+)+\\)|[^\\|]*)\\[(\\d+|\\d*\\+|\\*|\\d*\\.\\.\\d*)?\\]$/";

        $identityStructure = array(
            "check" => function($data, $null, &$failed) { return true; },
            "format" => function($data) { return $data; }
        );

        // allow "type1|type2|..."
        $types = explode("|", $string);

        if (preg_match($quickArray, $string)) {
            $structure = new ArrayS();
            $structure->setFormat($string);
            $structure->setCountStrict($this->countStrict);
            $arrayStructure = true;

            $objects = array($structure);
            $i = count($types) + 1;
        } else {
            /** @var Structure[] $objects */
            $objects = array();

            // Use a do-while to check always $type[0]
            $i = 0;
        }
        while (count($types) > $i) {
            $type = $types[$i];
            if (preg_match($numeric, $type, $matches)) {
                switch ($type[0]) {
                    case "n": $structure = new NumericS(); break;
                    case "f": $structure = new FloatS(); break;
                    case "i": $structure = new IntegerS(); break;
                }
                /** @var NumericS $structure */
                $structure->setRange($matches[2]);
            } else if (preg_match($valueSetScalar, $type, $matches)) {
                switch ($type[0] . $type[1]) {
                    default: //fall through to _scalar_
                    case "sc": $structure = new ScalarS(); break;
                    case "st": $structure = new StringS(); break;
                    case "nu": $structure = new NumericS(); break;
                    case "fl": $structure = new FloatS(); break;
                    case "in": $structure = new IntegerS(); break;
                    case "bo": $structure = new BooleanS(); break;
                }
                /** @var ScalarS $structure */
                $structure->setValueSet($matches[2]);
            } else if (preg_match($lengthString, $type, $matches)) {
                $structure = new StringS();
                $structure->setLength($matches[1]);
            } else if (preg_match($quickArray, $type, $matches)) {
                $structure = new ArrayS();
                $structure->setFormat($type);
                $structure->setCountStrict($this->countStrict);
                $arrayStructure = true;
            } else {
                switch ($type) {
                    case "scalar": $structure = new ScalarS(); break;
                    case "string":// fall through to _str_
                    case "str": $structure = new StringS(); break;
                    case "numeric": $structure = new NumericS(); break;
                    case "integer":// fall through to _int_
                    case "int": $structure = new IntegerS(); break;
                    case "float": $structure = new FloatS(); break;
                    case "boolean":// fall through to _bool_
                    case "bool": $structure = new BooleanS(); break;
                    case "array":
                        $structure = new ArrayS();
                        $structure->setFormat("array");
                        $structure->setCountStrict($this->countStrict);
                        break;
                    case "*":
                    case "any":
                        // set structure:identity
                        $structure = $identityStructure;
                        break;
                    case "null":
                    case null:
                        // set structure:null
                        $structure = array(
                            "check" => function($data, $null, &$failed) {
                                $valid = is_null($data);
                                if (!$valid) $failed = Structure::typeof($data);
                                return $valid;
                            },
                            "format" => function() { return null; }
                        );
                        break;
                    default:
                        if (class_exists($string)) {
                            // todo: create ObjectS class
                            $structure = array(
                                "check" => function($data, $null, &$failed) use ($string) {
                                    if (is_null($data)) $valid = $null;
                                    else $valid = $data instanceof $string;

                                    if (!$valid) $failed = Structure::typeof($data);
                                    return $valid;
                                },
                                "format" => $identityStructure["format"]
                            );
                        } else {
                            // maybe $format is a simple array (type[] or type[int])
                            $structure = new ArrayS();
                            $structure->setFormat($type);
                            $structure->setCountStrict($this->countStrict);
                            $arrayStructure = true;
                        }
                        break;
                }
                //prevent errors
                if (!isset($structure)) {
                    $structure = $identityStructure;
                }
            }

            // Add the Structure to use it after the loop
            $objects[] = $structure;
            $i++;
        }

        /**
         * Define return functions, depending on the number of $objects
         * (1 or more)
         */
        $ret = array();
        if ($i == 1) {
            if ($objects[0] instanceof Structure) {
                $check = function ($data, $null, &$failed) use ($objects) {
                    $objects[0]->setNull($null);
                    return $objects[0]->check($data, $failed);
                };
                $format = function ($data, $null) use ($objects) {
                    $objects[0]->setNull($null);
                    return $objects[0]->format($data);
                };
            } else {
                $check = $objects[0]["check"];
                $format = function ($data) use ($objects) {
                    return call_user_func($objects[0]["format"], $data);
                };
            }
        } else {
            $check = function($data, $null, &$failed) use ($objects) {
                foreach ($objects as $obj) {
                    if ($obj instanceof Structure) {
                        $obj->setNull($null);
                        if ($obj->check($data, $failed)) return true;
                    } else if (is_array($obj) && isset($obj["check"])) {
                        $check = $obj["check"];
                        if ($check($data, $null, $failed)) return true;
                    }
                }
                return false;
            };
            $format = function($data, $null) use ($objects) {
                foreach ($objects as $obj) {
                    try {
                        if ($obj instanceof Structure) {
                            $obj->setNull($null);
                            return $obj->format($data);
                        } else {
                            return call_user_func($obj["format"], $data);
                        }
                    } catch (\Exception $e) {}
                }
                throw new \Exception("Unable to format \$data");
            };
        }
        $ret["check"] = $check;
        $ret["format"] = $format;

        if (isset($arrayStructure) && $arrayStructure) {
            $ret["meta"] = "array";
        }

        return $ret;
    }
1095713
def numberize(string):
    ''''''
    if not isinstance(string,basestring):
        return string
    just_int = r'^\s*[-+]?\d+\s*$'
    just_float = r'^\s*[-+]?\d+\.(\d+)?\s*$'
    if re.match(just_int,string):
        return int(string)
    if re.match(just_float,string):
        return float(string)
    return string
520258
private void parseNth() {
        // Remove all '+' and spaces.
        String str = argument.replaceAll("\\+|\\s+", "");
        if ("odd".equals(str)) {
            a = 2;
            b = 1;
        } else if ("even".equals(str)) {
            a = 2;
        } else {
            int n = str.indexOf('n');
            if (n != -1) {
                if (n == 0) {
                    a = 1;
                } else if (n == 1 && str.charAt(0) == '-') {
                    a = -1;
                } else {
                    a = Integer.parseInt(str.substring(0, n));
                }

                if ((n + 1) != str.length()) {
                    b = Integer.parseInt(str.substring(n + 1, str.length()));
                }
            } else {
                b = Integer.parseInt(str);
            }
        }
    }
385725
def str2int(num, radix=10, alphabet=BASE85):
    """"""
    return NumConv(radix, alphabet).str2int(num)
1343119
def conv_str_to_int(x)
      if x.instance_of? String
        (x.to_i.zero? && x != "0") ? x : x.to_i
      else
        x
      end
    end
228940
def InsertInt16Arg(self, string="", **_):
    """"""
    try:
      int_value = int(string, 16)
      return self.InsertArg(int_value)
    except (TypeError, ValueError):
      raise ParseError("%s is not a valid base16 integer." % string)
612152
def strings_to_integers(strings: Iterable[str]) -> Iterable[int]:
    
    return strings_to_(strings, lambda x: int(float(x)))
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;
}