MCPcopy Create free account
hub / github.com/couchbase/couchbase-python-client / decode_value

Method decode_value

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

Source from the content-addressed store, hash-verified

199 raise ValueFormatException("Only string data supported by RawStringTranscoder")
200
201 def decode_value(self,
202 value, # type: bytes
203 flags # type: int
204 ) -> Union[str, bytes]:
205
206 format = get_decode_format(flags)
207
208 if format == FMT_BYTES:
209 raise ValueFormatException("Binary format type not supported by RawStringTranscoder")
210 elif format == FMT_UTF8:
211 return value.decode('utf-8')
212 elif format == FMT_JSON:
213 raise ValueFormatException("JSON format type not supported by RawStringTranscoder")
214 else:
215 raise ValueFormatException(f"Unrecognized format provided: {format}")
216
217
218class RawBinaryTranscoder(Transcoder):

Callers

nothing calls this directly

Calls 2

get_decode_formatFunction · 0.85

Tested by

no test coverage detected