Skip to content

Commit

Permalink
correct hash function
Browse files Browse the repository at this point in the history
  • Loading branch information
Nomos11 committed Nov 7, 2024
1 parent b1c55b4 commit 4922d71
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions qupulse/program/linspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()])+")"
Expand All @@ -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()])+")"
Expand All @@ -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:
Expand All @@ -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())))


Expand Down

0 comments on commit 4922d71

Please sign in to comment.