(self,
value, # type: bytes
flags # type: int
)
| 167 | raise ValueFormatException("Only binary and string data supported by RawJSONTranscoder") |
| 168 | |
| 169 | def decode_value(self, |
| 170 | value, # type: bytes |
| 171 | flags # type: int |
| 172 | ) -> Union[str, bytes]: |
| 173 | |
| 174 | format = get_decode_format(flags) |
| 175 | |
| 176 | if format == FMT_BYTES: |
| 177 | raise ValueFormatException("Binary format type not supported by RawJSONTranscoder") |
| 178 | elif format == FMT_UTF8: |
| 179 | raise ValueFormatException("String format type not supported by RawJSONTranscoder") |
| 180 | elif format == FMT_JSON: |
| 181 | if isinstance(value, str): |
| 182 | value = value.decode('utf-8') |
| 183 | elif isinstance(value, bytearray): |
| 184 | value = bytes(value) |
| 185 | return value |
| 186 | else: |
| 187 | raise ValueFormatException(f"Unrecognized format provided: {format}") |
| 188 | |
| 189 | |
| 190 | class RawStringTranscoder(Transcoder): |
nothing calls this directly
no test coverage detected