File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
src/bloqade/geometry/dialects/grid Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -202,7 +202,16 @@ def __getitem__(self, indices):
202202 return self .get_view (x_indices = x_indices , y_indices = y_indices )
203203
204204 def __hash__ (self ) -> int :
205- return id (self )
205+ return hash ((self .x_spacing , self .y_spacing , self .x_init , self .y_init ))
206+
207+ def __eq__ (self , other : Any ) -> bool :
208+ return (
209+ isinstance (other , Grid )
210+ and self .x_spacing == other .x_spacing
211+ and self .y_spacing == other .y_spacing
212+ and self .x_init == other .x_init
213+ and self .y_init == other .y_init
214+ )
206215
207216 def print_impl (self , printer : Printer ) -> None :
208217 printer .plain_print ("Grid(" )
@@ -309,7 +318,10 @@ def get_view(
309318 )
310319
311320 def __hash__ (self ):
312- return id (self )
321+ return super ().__hash__ ()
322+
323+ def __eq__ (self , other : Any ) -> bool :
324+ return super ().__eq__ (other )
313325
314326 def __repr__ (self ):
315327 return super ().__repr__ ()
You can’t perform that action at this time.
0 commit comments