From 8209022ee8eca7d856121f9c38f009df542610a1 Mon Sep 17 00:00:00 2001 From: Diadochokinetic Date: Sun, 12 Jun 2022 14:40:28 +0200 Subject: [PATCH] change self.type to self.param_type to allow 'sepcial' types tobe validated --- sklearn/utils/_param_validation.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sklearn/utils/_param_validation.py b/sklearn/utils/_param_validation.py index 9aa51492c579d..38cf821a1939c 100644 --- a/sklearn/utils/_param_validation.py +++ b/sklearn/utils/_param_validation.py @@ -173,12 +173,12 @@ class _InstancesOf(_Constraint): Parameters ---------- - type : type - The valid type. + param_type : param_type + The valid paramater type. """ - def __init__(self, type): - self.type = type + def __init__(self, param_type): + self.param_type = param_type def _type_name(self, t): """Convert type into human readable string.""" @@ -193,10 +193,10 @@ def _type_name(self, t): return f"{module}.{qualname}" def is_satisfied_by(self, val): - return isinstance(val, self.type) + return isinstance(val, self.param_type) def __str__(self): - return f"an instance of {self._type_name(self.type)!r}" + return f"an instance of {self._type_name(self.param_type)!r}" class _NoneConstraint(_Constraint):