@@ -199,9 +199,9 @@ def _merge_batch_to_components(
199199 assert isinstance (flat_adj , HyperAdjacency )
200200
201201 def flatten_indices (node_tag_key , index : Field ) -> Field :
202- node_set_name = self .spec ._metadata [node_tag_key ] # pylint: disable=protected-access
203- return utils .flatten_indices (index , num_edges_per_example ,
204- num_nodes_per_example [node_set_name ])
202+ node_set_name = self .spec ._metadata [node_tag_key ] # pylint: disable=protected-access # pyrefly: ignore[unsupported-operation]
203+ return utils .flatten_indices (index , num_edges_per_example , # pyrefly: ignore[bad-argument-type]
204+ num_nodes_per_example [node_set_name ]) # pyrefly: ignore[bad-argument-type, bad-index]
205205
206206 new_data = {
207207 node_tag_key : flatten_indices (node_tag_key , index )
@@ -324,7 +324,7 @@ def get_index_specs_dict(
324324
325325 def node_set_name (self , node_set_tag : IncidentNodeTag ) -> NodeSetName :
326326 """Returns a node set name for the given node set tag."""
327- return self ._metadata [_node_tag_to_index_key (node_set_tag )]
327+ return self ._metadata [_node_tag_to_index_key (node_set_tag )] # pyrefly: ignore[bad-return, unsupported-operation]
328328
329329 @property
330330 def total_size (self ) -> Optional [int ]:
@@ -477,7 +477,7 @@ class AdjacencySpec(HyperAdjacencySpec):
477477 """A type spec for `tfgnn.Adjacency`."""
478478
479479 @classmethod
480- def from_incident_node_sets (
480+ def from_incident_node_sets ( # pyrefly: ignore[bad-override]
481481 cls ,
482482 source_node_set : NodeSetName ,
483483 target_node_set : NodeSetName ,
@@ -602,25 +602,25 @@ def check_compatibility(tag_0, name_0, index_0, tag_i, name_i, index_i):
602602
603603 raise ValueError (err_message )
604604
605- indices = sorted (list (indices .items ()), key = lambda i : i [0 ])
605+ indices = sorted (list (indices .items ()), key = lambda i : i [0 ]) # pyrefly: ignore[bad-assignment]
606606 tag_0 , (name_0 , index_0 ) = indices [0 ]
607607 check_index (tag_0 , name_0 , index_0 )
608- for tag_i , (name_i , index_i ) in indices [1 :]:
608+ for tag_i , (name_i , index_i ) in indices [1 :]: # pyrefly: ignore[bad-index]
609609 check_index (tag_i , name_i , index_i )
610610 check_compatibility (tag_0 , name_0 , index_0 , tag_i , name_i , index_i )
611611
612612 # Apply identity operations to all index tensors to ensure that assertions are
613613 # executed in the graph mode.
614614 if not assert_ops :
615615 result = {
616- node_tag : (node_set , index ) for node_tag , (node_set , index ) in indices
616+ node_tag : (node_set , index ) for node_tag , (node_set , index ) in indices # pyrefly: ignore[not-iterable]
617617 }
618618 else :
619619 assert allow_tf_assertions
620620 with tf .control_dependencies (assert_ops ):
621621 result = {
622622 node_tag : (node_set , tf .identity (index ))
623- for node_tag , (node_set , index ) in indices
623+ for node_tag , (node_set , index ) in indices # pyrefly: ignore[not-iterable]
624624 }
625625
626626 return result
0 commit comments