From 6437b7545859ce14552345b7ca5f35841de6824c Mon Sep 17 00:00:00 2001 From: AdrianSosic Date: Thu, 18 Apr 2024 16:25:28 +0200 Subject: [PATCH] Make objective classes slotted --- CHANGELOG.md | 2 +- baybe/objectives/base.py | 5 +---- baybe/objectives/desirability.py | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17b19caaf3..131c6b9f89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed -- Parameter classes are now slotted due to `cached_property` attrs support +- Parameter and objective classes are now slotted due to `cached_property` attrs support ## [0.10.0] - 2024-08-02 ### Breaking Changes diff --git a/baybe/objectives/base.py b/baybe/objectives/base.py index 785b075576..18c84e358a 100644 --- a/baybe/objectives/base.py +++ b/baybe/objectives/base.py @@ -14,11 +14,8 @@ from baybe.serialization.mixin import SerialMixin from baybe.targets.base import Target -# TODO: Reactive slots in all classes once cached_property is supported: -# https://github.com/python-attrs/attrs/issues/164 - -@define(frozen=True, slots=False) +@define(frozen=True) class Objective(ABC, SerialMixin): """Abstract base class for all objectives.""" diff --git a/baybe/objectives/desirability.py b/baybe/objectives/desirability.py index a96326903a..6b3fd20dab 100644 --- a/baybe/objectives/desirability.py +++ b/baybe/objectives/desirability.py @@ -61,7 +61,7 @@ def scalarize( return func(values, weights=weights) -@define(frozen=True, slots=False) +@define(frozen=True) class DesirabilityObjective(Objective): """An objective scalarizing multiple targets using desirability values."""