Convert ``name`` to int if it looks like an int.

        Otherwise, return it as is.
547013
def _convert_name(self, name):
        
        if re.search('^\d+$', name):
            if len(name) > 1 and name[0] == '0':
                # Don't treat strings beginning with "0" as ints
                return name
            return int(name)
        return name
90160
public int getInt(String name) {

		Object value = super.get(name);

		if (value instanceof Integer) {
			return (Integer) value;
		}

		if (value == null) {
			throw new IllegalArgumentException("Setting: '" + name + "', not found!");
		}

		try {
			return Integer.parseInt(value.toString());
		}
		catch (NumberFormatException e) {
			throw new IllegalArgumentException("Setting: '" + name + "', can't be converted to integer: '" + value + "'!");
		}
	}
544520
def int_id(self):
        ""
        id_or_name = self.id_or_name
        if id_or_name is not None and isinstance(id_or_name, int):
            return id_or_name
        return None
479863
def try_int(o:Any)->Any:
    ""
    # NB: single-item rank-1 array/tensor can be converted to int, but we don't want to do this
    if isinstance(o, (np.ndarray,Tensor)): return o if o.ndim else int(o)
    if isinstance(o, collections.Sized) or getattr(o,'__array_interface__',False): return o
    try: return int(o)
    except: return o
188519
def to_int(value: str, default: T = None) -> Union[int, Optional[T]]:
    
    try:
        return int(value)
    except (TypeError, ValueError):
        return default
169841
def str2int(self, str_value):
    """"""
    str_value = tf.compat.as_text(str_value)
    if self._str2int:
      return self._str2int[str_value]

    # No names provided, try to integerize
    failed_parse = False
    try:
      int_value = int(str_value)
    except ValueError:
      failed_parse = True
    if failed_parse or not 0 <= int_value < self._num_classes:
      raise ValueError("Invalid string class label %s" % str_value)
    return int_value
43450
def clean_int(x) -> int:
    
    try:
        return int(x)
    except ValueError:
        raise forms.ValidationError(
            "Cannot convert to integer: {}".format(repr(x)))
1086622
def _cast_int(self, value):
        """"""
        try:
            return int(value)
        except ValueError:
            msg.err("Cannot convert {} to int for line {}.".format(value, self.identifier))
            exit(1)
965890
def to_int(b:Any)->Union[int,List[int]]:
    ""
    if is_listy(b): return [to_int(x) for x in b]
    else:          return int(b)
522784
public int getInt(String name)
    {
        int val = 0;
        try {
            val = Integer.valueOf(request.getParameter(name));
        } catch (NumberFormatException e) {}
        
        return val;
    }
501784
def get_int(self, key, default=None):
        
        """
        return self.get_converted(
            key, ConversionTypeEnum.INTEGER, default=default)
543764
public int getInt(String name) throws JSONException {
		Object object = get(name);
		Integer result = JSON.toInteger(object);
		if (result == null) {
			throw JSON.typeMismatch(name, object, "int");
		}
		return result;
	}
115277
def _convert_number(self, number):
        """"""

        number = float(number)
        return int(number) if number.is_integer() else float(number)
263690
def to_int(d, key, default_to_zero=False, default=None, required=True):
    
    value = d.get(key) or default
    if (value in ["", None]) and default_to_zero:
        return 0
    if value is None:
        if required:
            raise ParseError("Unable to read %s from %s" % (key, d))
    else:
        return int(value)
1175929
def coerce_to_int(val, default=0xDEADBEEF):
    """"""
    try:
        return int(val)
    except (TypeError, ValueError):
        if default != 0xDEADBEEF:
            return default
        return val
51543
def check_int(integer):
    
    if not isinstance(integer, str):
        return False
    if integer[0] in ('-', '+'):
        return integer[1:].isdigit()
    return integer.isdigit()
723888
def _canonical_int(self, interface):
        """"""
        if self.use_canonical_interface is True:
            return napalm.base.helpers.canonical_interface_name(
                interface, addl_name_map=None
            )
        else:
            return interface