From 4922d713c23d14bbdee8a0dd6224cfe2fe0194e9 Mon Sep 17 00:00:00 2001 From: Selene Lab Date: Thu, 7 Nov 2024 21:55:53 +0100 Subject: [PATCH] correct hash function --- qupulse/program/linspace.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qupulse/program/linspace.py b/qupulse/program/linspace.py index e623e446..e23a9f5f 100644 --- a/qupulse/program/linspace.py +++ b/qupulse/program/linspace.py @@ -911,7 +911,7 @@ class Increment: key: DepKey def __hash__(self): - return hash((self.channel,self.value,self.key)) + return hash((type(self),self.channel,self.value,self.key)) def __str__(self): return "Increment("+",".join([f"{k}="+v.__str__() for k,v in vars(self).items()])+")" @@ -923,7 +923,7 @@ class Set: key: DepKey = dataclasses.field(default_factory=lambda: DepKey((),DepDomain.NODEP)) def __hash__(self): - return hash((self.channel,self.value,self.key)) + return hash((type(self),self.channel,self.value,self.key)) def __str__(self): return "Set("+",".join([f"{k}="+v.__str__() for k,v in vars(self).items()])+")" @@ -934,7 +934,7 @@ class Wait: key_by_domain: Dict[DepDomain,DepKey] = dataclasses.field(default_factory=lambda: {}) def __hash__(self): - return hash((self.duration,frozenset(self.key_by_domain.items()))) + return hash((type(self),self.duration,frozenset(self.key_by_domain.items()))) @dataclass class LoopJmp: @@ -954,7 +954,7 @@ def __post_init__(self): self.keys_by_domain_by_ch = {ch: {} for ch in self.play_channels+self.step_channels} def __hash__(self): - return hash((self.waveform,self.play_channels,self.step_channels, + return hash((type(self),self.waveform,self.play_channels,self.step_channels, frozenset((k,frozenset(d.items())) for k,d in self.keys_by_domain_by_ch.items())))