(name, value, dummy, opts)
return b"\x0F" + name + full_length + _PACK_INT(cstrlen) + cstring + scope
Encode bson.code.Code.
Encode bson.code.Code.
Encode bson . code . Code .
def _encode_code(name, value, dummy, opts):
    """Encode bson.code.Code."""
    cstring = _make_c_string(value)
    cstrlen = len(cstring)
    if value.scope is None:
        return b"\x0D" + name + _PACK_INT(cstrlen) + cstring
    scope = _dict_to_bson(value.scope, False, opts, False)
    full_length = _PACK_INT(8 + cstrlen + len(scope))
    return b"\x0F" + name + full_length + _PACK_INT(cstrlen) + cstring + scope
def _encode_code ( name , value , dummy , opts ) : cstring = _make_c_string ( value ) cstrlen = len ( cstring ) if value . scope is None : return b"\x0D" + name + _PACK_INT ( cstrlen ) + cstring scope = _dict_to_bson ( value . scope , False , opts , False ) full_length = _PACK_INT ( 8 + cstrlen + len ( scope ) ) return b"\x0F" + name + full_length + _PACK_INT ( cstrlen ) + cstring + scope