2727 GoDataFloat ,
2828 GoDataInteger ,
2929 GoDataMap ,
30+ GoDataNilInterface ,
3031 GoDataPointer ,
3132 GoDataSlice ,
3233 GoDataString ,
3334 GoDataStruct ,
3435 GoDataUnparsed ,
35- GoDataNilInterface
3636)
3737from common .golang .util_stateless import entropy , rate_candidate_length , read_varint
3838
@@ -455,7 +455,7 @@ class GoTypeArray(GoType):
455455 length : int
456456
457457 def populate (self , type_section : bytes , offset : int , info : PopulateInfo ) -> Union [list [int ], None ]:
458- ( sub_elem , sup_slice , this_len ) = struct .unpack_from ("<" + info .ptr_specifier * 3 , type_section , offset )
458+ sub_elem , sup_slice , this_len = struct .unpack_from ("<" + info .ptr_specifier * 3 , type_section , offset )
459459 self .child_addr = sub_elem
460460 self .length = this_len
461461 return [sub_elem , sup_slice ]
@@ -517,7 +517,7 @@ class GoTypeChan(GoType):
517517 direction : int
518518
519519 def populate (self , type_section : bytes , offset : int , info : PopulateInfo ) -> Union [list [int ], None ]:
520- ( sub_elem , direction ) = struct .unpack_from ("<" + info .ptr_specifier * 2 , type_section , offset )
520+ sub_elem , direction = struct .unpack_from ("<" + info .ptr_specifier * 2 , type_section , offset )
521521 self .child_addr = sub_elem
522522 self .direction = direction
523523 return [sub_elem ]
@@ -553,7 +553,7 @@ class GoTypeFunc(GoType):
553553
554554 def populate (self , type_section : bytes , offset : int , info : PopulateInfo ) -> Union [list [int ], None ]:
555555 # the size of param count fields and the uncommon offset addition is NOT pointer size dependent.
556- ( num_param_in , num_param_out ) = struct .unpack_from ("<HH" , type_section , offset )
556+ num_param_in , num_param_out = struct .unpack_from ("<HH" , type_section , offset )
557557
558558 # We consumed 32 bits. On 32-bit, read the next byte: on 64-bit, need 32 bits of padding.
559559 offset += info .ptr_size
@@ -626,16 +626,16 @@ class GoTypeInterface(GoType):
626626
627627 def populate (self , type_section : bytes , offset : int , info : PopulateInfo ) -> Union [list [pointer ], None ]:
628628 self .methods = []
629- ( go_min_version , _ ) = self .version
630- ( methods_base , methods_len ) = struct .unpack_from (
629+ go_min_version , _ = self .version
630+ methods_base , methods_len = struct .unpack_from (
631631 "<" + info .ptr_specifier * 2 , type_section , offset + info .ptr_size
632632 )
633633 # Each method structure in the methods table is a struct of two 32-bit integers.
634634 for i in range (methods_len ):
635635 imethod_ptr = methods_base + i * 8
636636 if info .types <= imethod_ptr < info .etypes :
637637 imethod_offset = imethod_ptr - info .types
638- ( name_off , type_off ) = struct .unpack_from ("<II" , type_section , imethod_offset )
638+ name_off , type_off = struct .unpack_from ("<II" , type_section , imethod_offset )
639639
640640 name_off += 1
641641 if go_min_version <= 16 :
@@ -701,7 +701,7 @@ def extract_at(self, info: ExtractInfo, addr: pointer, dereferenced_pointers: se
701701 data_pointer = safe_read_unsigned (info , addr + info .ptr_size , info .ptr_size )
702702 if data_pointer is not None :
703703 extracted = interface_type .extract_at (info , data_pointer , dereferenced_pointers , depth )
704- else :
704+ else :
705705 extracted = GoDataBad (heuristic = Confidence .JUNK .to_float ())
706706 else :
707707 extracted = GoDataBad (heuristic = Confidence .JUNK .to_float ())
@@ -725,7 +725,7 @@ class GoTypeMap(GoType):
725725 bucket_type : Union [GoType , None ]
726726
727727 def populate (self , type_section : bytes , offset : int , info : PopulateInfo ) -> Union [list [pointer ], None ]:
728- ( self .key_addr , self .child_addr , self .bucket_addr ) = struct .unpack_from (
728+ self .key_addr , self .child_addr , self .bucket_addr = struct .unpack_from (
729729 "<" + info .ptr_specifier * 3 , type_section , offset
730730 )
731731 self .key_type = None
@@ -750,7 +750,7 @@ def extract_at(self, info: ExtractInfo, addr: pointer, dereferenced_pointers: se
750750 extracted : Union [GoData , None ] = None
751751
752752 if self .bucket_type is not None :
753- ( go_min_version , _ ) = self .version
753+ go_min_version , _ = self .version
754754 # Minimum version is only lifted to 24 if we are sure the new map implementation is being used
755755 # (the programmer can choose to use the old version even in 1.24).
756756 parser : Union [SwissMapParser , NoSwissMapParser ]
@@ -965,16 +965,16 @@ class GoTypeStruct(GoType):
965965 fields : list [GoTypeStructField ]
966966
967967 def populate (self , type_section : bytes , offset : int , info : PopulateInfo ) -> Union [list [pointer ], None ]:
968- ( go_min_version , go_max_version ) = self .version
969- ( _ , fields_addr , fields_len ) = struct .unpack_from ("<" + info .ptr_specifier * 3 , type_section , offset )
968+ go_min_version , go_max_version = self .version
969+ _ , fields_addr , fields_len = struct .unpack_from ("<" + info .ptr_specifier * 3 , type_section , offset )
970970 self .fields = []
971971
972972 for i in range (fields_len ):
973973 # Each field struct is 3 pointers wide.
974974 addr = fields_addr + i * 3 * info .ptr_size
975975 if info .types <= addr < info .etypes :
976976 field_struct_offset = addr - info .types
977- ( field_name_ptr , field_type , field_offset ) = struct .unpack_from (
977+ field_name_ptr , field_type , field_offset = struct .unpack_from (
978978 "<" + info .ptr_specifier * 3 , type_section , field_struct_offset
979979 )
980980
@@ -1384,7 +1384,7 @@ def parse(self, addr: pointer, nest_depth: int) -> GoData:
13841384 entries = None
13851385 break
13861386 # The next line is well-typed because if entries is None, then we already broke.
1387- entries .extend (from_table ) # type:ignore[union-attr]
1387+ entries .extend (from_table ) # type: ignore[union-attr]
13881388
13891389 if entries is not None and len (entries ) > 0 :
13901390 # A valid map.
0 commit comments