parameters: (self, offset, size_or_format)
return_statement: return ret
docstring: Read data at `offset', or raise an exception.  `size_or_format'
             may either be a byte count, in which case we return raw data,
             or a format string for `struct.unpack', in which case we
             work out the size and unpack the data before returning it.
docstring_summary: Read data at `offset', or raise an exception.  `size_or_format'
             may either be a byte count, in which case we return raw data,
             or a format string for `struct.unpack', in which case we
             work out the size and unpack the data before returning it.
docstring_tokens: Read data at offset or raise an exception . size_or_format may either be a byte count in which case we return raw data or a format string for struct . unpack in which case we work out the size and unpack the data before returning it .
function: def read(self, offset, size_or_format):
          """Read data at `offset', or raise an exception.  `size_or_format'
             may either be a byte count, in which case we return raw data,
             or a format string for `struct.unpack', in which case we
             work out the size and unpack the data before returning it."""
          # N.B. There is a fixed offset of four bytes(!)
          self._file.seek(offset + 4, os.SEEK_SET)
  
          if isinstance(size_or_format, (str, unicode)):
              size = struct.calcsize(size_or_format)
              fmt = size_or_format
          else:
              size = size_or_format
              fmt = None
          
          ret = self._file.read(size)
          if len(ret) < size:
              ret += b'\0' * (size - len(ret))
  
          if fmt is not None:
              if isinstance(ret, bytearray):
                  ret = struct.unpack_from(fmt, bytes(ret))
              else:
                  ret = struct.unpack(fmt, ret)
              
          return ret
function_tokens: def read ( self , offset , size_or_format ) : # N.B. There is a fixed offset of four bytes(!) self . _file . seek ( offset + 4 , os . SEEK_SET ) if isinstance ( size_or_format , ( str , unicode ) ) : size = struct . calcsize ( size_or_format ) fmt = size_or_format else : size = size_or_format fmt = None ret = self . _file . read ( size ) if len ( ret ) < size : ret += b'\0' * ( size - len ( ret ) ) if fmt is not None : if isinstance ( ret , bytearray ) : ret = struct . unpack_from ( fmt , bytes ( ret ) ) else : ret = struct . unpack ( fmt , ret ) return ret