bpack.codecs module
Base classes and utility functions for codecs.
- bpack.codecs.has_codec(descriptor, codec_type: type[Decoder | Encoder | Codec] | None = None) bool [source]
Return True if the input descriptor has a codec attached.
A descriptor decorated with a codec decorator has an attached codec instance and “frombytes”/”tobytes” methods (depending on the kind of codec).
The codec_type parameter can be used to query for specific codec features:
codec_type = None: return True for any kind of codec
codec_type =
Decoder
: return True if the attached coded has decoding capabilitiescodec_type =
Encoder
: return True if the attached coded has encoding capabilitiescodec_type =
Codec
: return True if the attached coded has both encoding and decoding capabilities