Return the input integer, or the default.
551007
def filter_int(string, default=None, start=None, stop=None):
    """"""
    try:
        i = int(string)
        if start is not None and i < start:
            raise InvalidInputError("value too small")
        if stop is not None and i >= stop:
            raise InvalidInputError("value too large")
        return i
    except ValueError:
        if not string and default is not None:
            # empty string, default was given
            return default
        else:
            raise InvalidInputError
1157521
public static Integer toInt(Object value, Integer defaultValue) {
		return convert(Integer.class, value, defaultValue);
	}
347956
def get_option_int(self, name, section=None, vars=None, expect=None):
        """"""
        val = self.get_option(name, section, vars, expect)
        if val:
            return int(val)
1292864
def _parse_int(value, default=None):
    
    if value is None:
        return default
    try:
        return int(value)
    except ValueError:
        print "Couldn't cast value to `int`."
        return default
1082904
private int convertToInt(Object o, int defaultValue) {
		if (o.getClass() == Integer.class) {
			return (Integer) o;
		}
		else if (o.getClass() == Long.class) {
			long value = (Long) o;
			if (value <= Integer.MAX_VALUE && value >= Integer.MIN_VALUE) {
				return (int) value;
			} else {
				LOG.warn("Configuration value {} overflows/underflows the integer type.", value);
				return defaultValue;
			}
		}
		else {
			try {
				return Integer.parseInt(o.toString());
			}
			catch (NumberFormatException e) {
				LOG.warn("Configuration cannot evaluate value {} as an integer number", o);
				return defaultValue;
			}
		}
	}
121197
public Integer getIntegerProperty(String key, Integer defaultValue) {
        String val = getProperty(key, defaultValue.toString());
        try {
            Integer intVal = Integer.parseInt(val);
            return intVal;
        } catch (NumberFormatException e) {
            return defaultValue;
        }
    }
1015964
public int getInt(int key, int defaultValue) {
        if (key < 0) Kit.codeBug();
        int index = findIndex(key);
        if (0 <= index) {
            if (ivaluesShift != 0) {
                return keys[ivaluesShift + index];
            }
            return 0;
        }
        return defaultValue;
    }
613210
def get_int(self, key, default=None):
        
        value = self.get(key, default)
        return None if value is None else int(value)
346753
def _get_int(data, position, dummy0, dummy1, dummy2):
    """"""
    end = position + 4
    return _UNPACK_INT(data[position:end])[0], end
1373358
public Integer getInt(String key, Integer defaultValue) throws SyntaxException
    {
        String value = getSimple(key);
        return toInt(key, value, defaultValue);
    }
457856
public static int getInt(String name, int defaultVal){
        if(getConfiguration().containsKey(name)){
            return getConfiguration().getInt(name);
        } else {
            return defaultVal;
        }
    }
620342
def arg_int(name, default=None):
    
    try:
        v = request.args.get(name)
        return int(v)
    except (ValueError, TypeError):
        return default
32639
def _int(int_or_str: Any) -> int:
    ""
    if isinstance(int_or_str, str):
        return ord(int_or_str)
    if isinstance(int_or_str, bytes):
        return int_or_str[0]
    return int(int_or_str)
361721
def _get_value(self, value, default):
        """"""
        vtype = type(default)

        if vtype is bool:
            return value.get_bool()
        elif vtype is str:
            return value.get_string()
        elif vtype is int:
            return value.get_int()
        elif vtype in (list, tuple):
            l = []
            for i in value.get_list():
                l.append(i.get_string())
            return l

        return None
1325553
def make_int(value, missing=-1):
    """"""
    if isinstance(value, six.string_types):
        if not value.strip():
            return missing
    elif value is None:
        return missing
    return int(value)
39824
def parse_int_arg(name, default):
    """"""
    return default if request.args.get(name) is None \
        else int(request.args.get(name))
272703
def standard_input():
    """"""
    with click.get_text_stream("stdin") as stdin:
        while stdin.readable():
            line = stdin.readline()
            if line:
                yield line.strip().encode("utf-8")