Helper for type name generation, like: bytes1 .. bytes32
486471
def type_names(prefix, sizerange):
        
        namelist = []
        for i in sizerange: namelist.append(prefix + str(i))
        return tuple(namelist)
1162994
private static String getSimpleTypeName(TypeReference typ) {
    final Map<String, String> mapFullTypeName =
        ImmutableMap.<String, String>builder()
            .put("B", "byte")
            .put("C", "char")
            .put("D", "double")
            .put("F", "float")
            .put("I", "int")
            .put("J", "long")
            .put("S", "short")
            .put("Z", "boolean")
            .build();
    if (typ.isArrayType()) return "Array";
    String typName = typ.getName().toString();
    if (typName.startsWith("L")) {
      typName = typName.split("<")[0].substring(1); // handle generics
      typName = typName.substring(typName.lastIndexOf('/') + 1); // get unqualified name
      typName = typName.substring(typName.lastIndexOf('$') + 1); // handle inner classes
    } else {
      typName = mapFullTypeName.get(typName);
    }
    return typName;
  }
714312
def _encode_long(name, value, dummy0, dummy1):
    """"""
    try:
        return b"\x12" + name + _PACK_LONG(value)
    except struct.error:
        raise OverflowError("BSON can only handle up to 8-byte ints")
166979
def fmt_type_name(data_type, inside_namespace=None):
    
    if is_user_defined_type(data_type) or is_alias(data_type):
        if data_type.namespace == inside_namespace:
            return data_type.name
        else:
            return '%s.%s' % (data_type.namespace.name, data_type.name)
    else:
        fmted_type = _base_type_table.get(data_type.__class__, 'Object')
        if is_list_type(data_type):
            fmted_type += '<' + fmt_type(data_type.data_type, inside_namespace) + '>'
        return fmted_type
1327287
private PTypeList convertGeneric(String name)
	{
		String nameNoLessOrGreater = name.substring(name.indexOf("<") + 1, name.length() - 1);

		String[] typeStrings = nameNoLessOrGreater.split(",");

		// decide if the split is valid or if the type is a single generic type
		boolean notSingleGenericType = true;
		for (String part : typeStrings)
		{
			if (part.replaceAll("[^<]", "").length() != part.replaceAll("[^>]", "").length())
			{
				notSingleGenericType = false;
			}
		}

		PTypeList types = new PTypeList();
		if (notSingleGenericType)
		{
			for (String t : typeStrings)
			{
				types.add(convert(t, null));
			}
		} else
		{
			types.add(convert(nameNoLessOrGreater, null));
		}
		return types;
	}
117928
def get_full_typename(o):
    
    instance_name = o.__class__.__module__ + "." + o.__class__.__name__
    if instance_name in ["builtins.module", "__builtin__.module"]:
        return o.__name__
    else:
        return instance_name
1101631
def _format_type(cls):
    """"""
    if cls.__module__ == _BUILTIN_MODULE:
        return cls.__name__
    else:
        return '%s.%s' % (cls.__module__, cls.__name__)
842912
def std_byte(self):
        """"""
        try:
            return self.std_name[self.pos]
        except IndexError:
            self.failed = 1
            return ord('?')
1118075
def _name_value_to_bson(name, value, check_keys, opts):
    """"""

    # First see if the type is already cached. KeyError will only ever
    # happen once per subtype.
    try:
        return _ENCODERS[type(value)](name, value, check_keys, opts)
    except KeyError:
        pass

    # Second, fall back to trying _type_marker. This has to be done
    # before the loop below since users could subclass one of our
    # custom types that subclasses a python built-in (e.g. Binary)
    marker = getattr(value, "_type_marker", None)
    if isinstance(marker, int) and marker in _MARKERS:
        func = _MARKERS[marker]
        # Cache this type for faster subsequent lookup.
        _ENCODERS[type(value)] = func
        return func(name, value, check_keys, opts)

    # If all else fails test each base type. This will only happen once for
    # a subtype of a supported base type.
    for base in _ENCODERS:
        if isinstance(value, base):
            func = _ENCODERS[base]
            # Cache this type for faster subsequent lookup.
            _ENCODERS[type(value)] = func
            return func(name, value, check_keys, opts)

    raise InvalidDocument("cannot convert value of type %s to bson" %
                          type(value))
214459
function toTypeRefNames() {
    for (var _len2 = arguments.length, types = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
      types[_key2] = arguments[_key2];
    }

    return types.map(toTypeRefName);
  }
146459
def _encode_int(name, value, dummy0, dummy1):
    """"""
    if -2147483648 <= value <= 2147483647:
        return b"\x10" + name + _PACK_INT(value)
    else:
        try:
            return b"\x12" + name + _PACK_LONG(value)
        except struct.error:
            raise OverflowError("BSON can only handle up to 8-byte ints")
1292499
function buildNamedExport({ id, types: t }) {
  return t.exportNamedDeclaration(t.variableDeclaration('const', [
    t.variableDeclarator(t.identifier(id), t.objectExpression([])),
  ]), []);
}
375780
def uint32(self, name):
        """"""
        self._assert_is_string(name)
        frame = self._next_frame()
        if len(frame) != 4:
            raise MessageParserError("Expected exacty 4 byte for uint32 value")
        (val,) = unpack("!I", frame)
        self.results.__dict__[name] = val
        return self
1004386
def register_type_name(t, name):
    
    assert isinstance(t, type)
    assert isinstance(name, unicode)
    __type_names[t] = name
733099
def __type2str(type_, buf, _, tbl):
    
    del buf[:]
    if type_ in tbl:
        buf.extend(tbl[type_].encode('ascii'))
    else:
        buf.extend('0x{0:x}'.format(type_).encode('ascii'))
    return buf
638016
def _names_to_bytes(names):
    
    names = sorted(names)
    names_bytes = json.dumps(names).encode('utf8')
    return names_bytes
1139145
def extern_type_to_str(self, context_handle, type_id):
    """"""
    c = self._ffi.from_handle(context_handle)
    return c.utf8_buf(text_type(c.from_id(type_id.tup_0).__name__))