From b80a53662b8aed327079f341675c23c9a70b7c2b Mon Sep 17 00:00:00 2001 From: Shervin Nourbakhsh <4571685+shervin86@users.noreply.github.com> Date: Wed, 3 Apr 2024 18:02:59 +0200 Subject: [PATCH] fixup --- libpyvinyl/BaseCalculator.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libpyvinyl/BaseCalculator.py b/libpyvinyl/BaseCalculator.py index 76f3785..78670c4 100644 --- a/libpyvinyl/BaseCalculator.py +++ b/libpyvinyl/BaseCalculator.py @@ -384,6 +384,11 @@ def __call__(self, parameters=None, **kwargs): return new def __hash__(self): + """Hashing capability for a Calculator + Parameters are removed when calculating the hash. + The hash of the parameters can be accessed by hash(calc.parameters). + This logic allows to decouple the changes in the calculator from changes in the values of the parameters + """ a = dill.copy(self) a.init_parameters() return int.from_bytes(hashlib.sha256(dill.dumps(a)).digest(), "big")