@@ -50,7 +50,7 @@ def children(self):
50
50
pass
51
51
52
52
53
- @attr .frozen (cache_hash = True )
53
+ @attr .frozen (auto_detect = True )
54
54
class AndGate (Node ):
55
55
left : Node
56
56
right : Node
@@ -59,15 +59,27 @@ class AndGate(Node):
59
59
def children (self ):
60
60
return (self .left , self .right )
61
61
62
+ def __eq__ (self , other ) -> bool :
63
+ return id (self ) == id (other ) # Allow for duplication.
62
64
63
- @attr .frozen
65
+ def __hash__ (self ) -> int :
66
+ return hash (id (self ))
67
+
68
+
69
+ @attr .frozen (auto_detect = True )
64
70
class Inverter (Node ):
65
71
input : Node
66
72
67
73
@property
68
74
def children (self ):
69
75
return (self .input , )
70
76
77
+ def __eq__ (self , other ) -> bool :
78
+ return id (self ) == id (other ) # Allow for duplication.
79
+
80
+ def __hash__ (self ) -> int :
81
+ return hash (id (self ))
82
+
71
83
72
84
@attr .frozen
73
85
class Input (Node ):
@@ -77,6 +89,12 @@ class Input(Node):
77
89
def children (self ):
78
90
return ()
79
91
92
+ def __eq__ (self , other ) -> bool :
93
+ return isinstance (other , Input ) and (self .name == other .name )
94
+
95
+ def __hash__ (self ) -> int :
96
+ return hash (("input" , self .name ))
97
+
80
98
81
99
@attr .frozen
82
100
class LatchIn (Node ):
@@ -86,6 +104,12 @@ class LatchIn(Node):
86
104
def children (self ):
87
105
return ()
88
106
107
+ def __eq__ (self , other ) -> bool :
108
+ return isinstance (other , LatchIn ) and (self .name == other .name )
109
+
110
+ def __hash__ (self ) -> int :
111
+ return hash (("latch" , self .name ))
112
+
89
113
90
114
@attr .frozen
91
115
class ConstFalse (Node ):
0 commit comments