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

Function get_decode_format

couchbase/transcoder.py:51–74  ·  view source on GitHub ↗

Decode the flags value for transcoding. Args: flags (int, optional): The flags to decode. Returns: Optional[int]: The common flags or legacy flags format. If None is returned the format is UNKNOWN.

(flags,  # type: Optional[int]
                      )

Source from the content-addressed store, hash-verified

49
50
51def get_decode_format(flags, # type: Optional[int]
52 ) -> Optional[int]:
53 """ Decode the flags value for transcoding.
54
55 Args:
56 flags (int, optional): The flags to decode.
57
58 Returns:
59 Optional[int]: The common flags or legacy flags format. If None
60 is returned the format is UNKNOWN.
61 """
62 # return None for unknown format
63 if flags is None:
64 return flags
65
66 c_flags = flags & FMT_COMMON_MASK
67 l_flags = flags & FMT_LEGACY_MASK
68
69 if c_flags:
70 # if unknown format, default to None
71 return COMMON2UNIFIED.get(c_flags, None)
72 else:
73 # if unknown format, default to None
74 return LEGACY2UNIFIED.get(l_flags, None)
75
76
77class Transcoder(ABC):

Callers 5

decode_valueMethod · 0.85
decode_valueMethod · 0.85
decode_valueMethod · 0.85
decode_valueMethod · 0.85
decode_valueMethod · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected