@@ -338,22 +338,17 @@ def tobinarray(self, start=None, end=None, pad=_DEPRECATED, size=None):
338338 return self ._tobinarray_really (start , end , pad , size )
339339
340340 def _tobinarray_really (self , start , end , pad , size ):
341+ """Return binary array."""
341342 if pad is None :
342343 pad = self .padding
343-
344344 bin = array ('B' )
345-
346345 if self ._buf == {} and None in (start , end ):
347346 return bin
348-
349347 if size is not None and size <= 0 :
350348 raise ValueError ("tobinarray: wrong value for size" )
351-
352349 start , end = self ._get_start_end (start , end , size )
353-
354350 for i in range_g (start , end + 1 ):
355351 bin .append (self ._buf .get (i , pad ))
356-
357352 return bin
358353
359354 def tobinstr (self , start = None , end = None , pad = _DEPRECATED , size = None ):
@@ -364,7 +359,7 @@ def tobinstr(self, start=None, end=None, pad=_DEPRECATED, size=None):
364359 fill empty spaces with this value
365360 (if pad is None then this method uses self.padding).
366361 @param size size of the block, used with start or end parameter.
367- @return string of binary data.
362+ @return bytes string of binary data.
368363 '''
369364 if not isinstance (pad , _DeprecatedParam ):
370365 print ("IntelHex.tobinstr: 'pad' parameter is deprecated." )
@@ -711,7 +706,8 @@ def tofile(self, fobj, format):
711706 def gets (self , addr , length ):
712707 """Get string of bytes from given address. If any entries are blank
713708 from addr through addr+length, a NotEnoughDataError exception will
714- be raised. Padding is not used."""
709+ be raised. Padding is not used.
710+ """
715711 a = array ('B' , asbytes ('\0 ' * length ))
716712 try :
717713 for i in range_g (length ):
@@ -729,7 +725,7 @@ def puts(self, addr, s):
729725 self ._buf [addr + i ] = a [i ]
730726
731727 def getsz (self , addr ):
732- """Get zero-terminated string from given address. Will raise
728+ """Get zero-terminated bytes string from given address. Will raise
733729 NotEnoughDataError exception if a hole is encountered before a 0.
734730 """
735731 i = 0
@@ -744,7 +740,7 @@ def getsz(self, addr):
744740 return self .gets (addr , i )
745741
746742 def putsz (self , addr , s ):
747- """Put string in object at addr and append terminating zero at end."""
743+ """Put bytes string in object at addr and append terminating zero at end."""
748744 self .puts (addr , s )
749745 self ._buf [addr + len (s )] = 0
750746
0 commit comments