Source code for mlprodict.grammar_sklearn.g_sklearn_type_helpers
# -*- coding: utf-8 -*-
"""
Tiny helpers for scikit-learn exporters.
:githublink:`%|py|6`
"""
[docs]def check_type(model, model_type):
"""
Raises an exception if the model is not of the expected type.
:param model: *scikit-learn* model
:param model_type: expected type
:githublink:`%|py|14`
"""
if not isinstance(model, model_type):
raise TypeError( # pragma: no cover
"Model type {0} is not of type {1}.".format(
type(model), model_type))