@@ -754,8 +754,8 @@ def get_time(bytearray_: bytearray, byte_index: int) -> str:
754754 val = int (byte_str , 16 )
755755 if (val & (1 << (bits - 1 ))) != 0 :
756756 sign = - 1 # if sign bit is set e.g., 8bit: 128-255
757- val = val - (1 << bits ) # compute negative value
758- val = val * sign
757+ val -= (1 << bits ) # compute negative value
758+ val *= sign
759759
760760 milli_seconds = val % 1000
761761 seconds = val // 1000
@@ -1376,8 +1376,7 @@ def __getitem__(self, key: str, default: Optional[None] = None) -> Union[None, i
13761376 return self .index .get (key , default )
13771377
13781378 def __iter__ (self ):
1379- for key , row in self .index .items ():
1380- yield key , row
1379+ yield from self .index .items ()
13811380
13821381 def __len__ (self ):
13831382 return len (self .index )
@@ -1460,10 +1459,7 @@ def export(self) -> Dict[str, Union[str, int, float, bool, datetime]]:
14601459 Returns:
14611460 dictionary containing the values of each value of the row.
14621461 """
1463- data = {}
1464- for key in self ._specification :
1465- data [key ] = self [key ]
1466- return data
1462+ return {key : self [key ] for key in self ._specification }
14671463
14681464 def __getitem__ (self , key ):
14691465 """
@@ -1492,9 +1488,7 @@ def unchanged(self, bytearray_: bytearray) -> bool:
14921488 Returns:
14931489 True if the current `bytearray_` is equal to the new one. Otherwise is False.
14941490 """
1495- if self .get_bytearray () == bytearray_ :
1496- return True
1497- return False
1491+ return self .get_bytearray () == bytearray_
14981492
14991493 def get_offset (self , byte_index : Union [str , int ]) -> int :
15001494 """ Calculate correct beginning position for a row
0 commit comments