If t is of type long, return it, otherwise raise InvalidTypeError.
541444
def getLong(t):
    
    i = c_long()
    if PL_get_long(t, byref(i)):
        return i.value
    else:
        raise InvalidTypeError("long")
1185496
def _normalize(value):
        
        if hasattr(value, 'value'):
            value = value.value
        if value is not None:
            value = long(value)
        return value
110591
def MetricValueTypeFromPythonType(python_type):
  """"""
  if python_type in (int, long):
    return rdf_stats.MetricMetadata.ValueType.INT
  elif python_type == float:
    return rdf_stats.MetricMetadata.ValueType.FLOAT
  else:
    raise ValueError("Invalid value type: %s" % python_type)
998476
def validate_rtype(self, value):
        

        if not value or value != self.rtype:
            msg = self.messages['rtype'].format(self.rtype, value)
            raise ValidationError(msg)
        return value
1063792
def inflate_long(s, always_positive=False):
    """"""
    out = long(0)
    negative = 0
    if not always_positive and (len(s) > 0) and (byte_ord(s[0]) >= 0x80):
        negative = 1
    if len(s) % 4:
        filler = zero_byte
        if negative:
            filler = max_byte
        # never convert this to ``s +=`` because this is a string, not a number
        # noinspection PyAugmentAssignment
        s = filler * (4 - len(s) % 4) + s
    for i in range(0, len(s), 4):
        out = (out << 32) + struct.unpack('>I', s[i:i+4])[0]
    if negative:
        out -= (long(1) << (8 * len(s)))
    return out
54892
def type_name(self) -> T.Optional[str]:
        """"""
        return self.args[1] if len(self.args) > 1 else None
551359
def str2long(s):
    """"""
    if type(s) not in (types.StringType, types.UnicodeType):
        raise ValueError('the input must be a string')

    l = 0
    for i in s:
        l <<= 8
        l |= ord(i)

    return l
1219263
public static long getLongParameter (
        HttpServletRequest req, String name, long defval, String invalidDataMessage)
        throws DataValidationException
    {
        String value = getParameter(req, name, false);
        if (StringUtil.isBlank(value)) {
            return defval;
        }
        return parseLongParameter(value, invalidDataMessage);
    }
204522
public static boolean isLong(String s) {
        if (s == null) {
            return false;
        }
        try {
            Long.parseLong(s.trim());
        } catch (NumberFormatException e) {
            return false;
        }
        return true;
    }
466484
def t_ID(t):
    '
    if t.value in keywords:
        t.type = t.value.upper()
    return t
978519
private long toLong() {
        assert (intLen <= 2) : "this MutableBigInteger exceeds the range of long";
        if (intLen == 0)
            return 0;
        long d = value[offset] & LONG_MASK;
        return (intLen == 2) ? d << 32 | (value[offset + 1] & LONG_MASK) : d;
    }
138572
def _send_long(self,value):
        

        # Coerce to int. This will throw a ValueError if the value can't 
        # actually be converted.
        if type(value) != int:
            new_value = int(value)
            
            if self.give_warnings:
                w = "Coercing {} into int ({})".format(value,new_value)
                warnings.warn(w,Warning)
                value = new_value

        # Range check
        if value > self.board.long_max or value < self.board.long_min:
            err = "Value {} exceeds the size of the board's long.".format(value)
            raise OverflowError(err)
           
        return struct.pack(self.board.long_type,value)
699032
private final Long getLong(NamedList<Object> response, String... args) {
    Object objectItem = response.findRecursive(args);
    if (objectItem != null && objectItem instanceof Long) {
      return (Long) objectItem;
    } else {
      return null;
    }
  }
582827
public int getType(int pathLength) {
        if (type == TYPE_INVALID || dataPath == null || pathLength >= dataPath.length)
            return TYPE_INVALID;

        if (pathLength == 1)
            return TYPE_MODULE;
        else
            return TYPE_COLLECTION;
    }
465390
def parse_long(tokens, options):
    """"""
    long, eq, value = tokens.move().partition('=')
    assert long.startswith('--')
    value = None if eq == value == '' else value
    similar = [o for o in options if o.long == long]
    if tokens.error is DocoptExit and similar == []:  # if no exact match
        similar = [o for o in options if o.long and o.long.startswith(long)]
    if len(similar) > 1:  # might be simply specified ambiguously 2+ times?
        raise tokens.error('%s is not a unique prefix: %s?' %
                           (long, ', '.join(o.long for o in similar)))
    elif len(similar) < 1:
        argcount = 1 if eq == '=' else 0
        o = Option(None, long, argcount)
        options.append(o)
        if tokens.error is DocoptExit:
            o = Option(None, long, argcount, value if argcount else True)
    else:
        o = Option(similar[0].short, similar[0].long,
                   similar[0].argcount, similar[0].value)
        if o.argcount == 0:
            if value is not None:
                raise tokens.error('%s must not have an argument' % o.long)
        else:
            if value is None:
                if tokens.current() in [None, '--']:
                    raise tokens.error('%s requires argument' % o.long)
                value = tokens.move()
        if tokens.error is DocoptExit:
            o.value = value if value is not None else True
    return [o]
734798
public static Long readLong(String value, Long defaultValue) {
		if (!StringUtils.hasText(value)) return defaultValue;
		
		return Long.valueOf(value);
	}
1002760
def to_long(x):
    
    if isinstance(x, long):
        return x
    elif isinstance(x, int):
        return long(x)
    else:
        return bytes_to_long(to_bytes(x))