How to use the scalecodec.base.RuntimeConfiguration.get_decoder_class function in scalecodec

To help you get started, we’ve selected a few scalecodec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github polkascan / py-scale-codec / scalecodec / base.py View on Github external
def get_decoder_class(cls, type_string, data=None, **kwargs):
        """
        :param type_string:
        :param data:
        :param kwargs:
        :return: ScaleType
        """

        type_string = cls.convert_type(type_string)

        decoder_class = RuntimeConfiguration().get_decoder_class(
            type_string.lower(),
            spec_version_id=kwargs.get('spec_version_id', 'default')
        )
        if decoder_class:
            return decoder_class(data, **kwargs)

        raise NotImplementedError('Decoder class for "{}" not found'.format(type_string))