Skip to content

Commit 79f3604

Browse files
committed
Drop unnecessary isinstance check
Criterion is a BayBEGPComponent (check is already included)
1 parent f213893 commit 79f3604

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

  • baybe/surrogates/gaussian_process/components

baybe/surrogates/gaussian_process/components/generic.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,7 @@ def _is_gpytorch_component_class(obj: Any, /) -> bool:
9696

9797
def _validate_component(instance: Any, attribute: Attribute, value: Any) -> None:
9898
"""Validate that an object is a BayBE or a GPyTorch GP component."""
99-
from baybe.surrogates.gaussian_process.components.criterion import Criterion
100-
101-
if (
102-
isinstance(value, Kernel)
103-
or isinstance(value, Criterion)
104-
or _is_gpytorch_component_class(type(value))
105-
):
99+
if isinstance(value, BayBEGPComponent) or _is_gpytorch_component_class(type(value)):
106100
return
107101

108102
raise TypeError(
@@ -153,13 +147,7 @@ def to_component_factory(
153147
Raises:
154148
TypeError: If the given component does not match the allowed types.
155149
"""
156-
from baybe.surrogates.gaussian_process.components.criterion import Criterion
157-
158-
if (
159-
isinstance(obj, BayBEGPComponent)
160-
or isinstance(obj, Criterion)
161-
or _is_gpytorch_component_class(type(obj))
162-
):
150+
if isinstance(obj, BayBEGPComponent) or _is_gpytorch_component_class(type(obj)):
163151
if component_type is not None:
164152
allowed_types = component_type.get_types()
165153
if not isinstance(obj, allowed_types):

0 commit comments

Comments
 (0)