MCPcopy Index your code
hub / github.com/couchbase/couchbase-python-client / decode_value

Method decode_value

couchbase/transcoder.py:132–151  ·  view source on GitHub ↗
(self,
                     value,  # type: bytes
                     flags  # type: int
                     )

Source from the content-addressed store, hash-verified

130 return self._serializer.serialize(value), FMT_JSON
131
132 def decode_value(self,
133 value, # type: bytes
134 flags # type: int
135 ) -> Any:
136
137 format = get_decode_format(flags)
138
139 # flags=[0 | None] special case, attempt JSON deserialize
140 if format in [FMT_JSON, 0, None]:
141 try:
142 return self._serializer.deserialize(value)
143 except Exception:
144 # if error encountered, assume return bytes
145 return value
146 elif format == FMT_BYTES:
147 raise ValueFormatException("The JSONTranscoder (default transcoder) does not support binary format")
148 elif format == FMT_UTF8:
149 raise ValueFormatException("The JSONTranscoder (default transcoder) does not support string format")
150 else:
151 raise ValueFormatException(f"Unrecognized format provided: {format}")
152
153
154class RawJSONTranscoder(Transcoder):

Callers 1

Calls 3

get_decode_formatFunction · 0.85
deserializeMethod · 0.45

Tested by 1