parameters: (f)
docstring: r"""
      >>> import StringIO
      >>> read_int4(StringIO.StringIO('\xff\x00\x00\x00'))
      255
      >>> read_int4(StringIO.StringIO('\x00\x00\x00\x80')) == -(2**31)
      True
docstring_summary: r"""
      >>> import StringIO
      >>> read_int4(StringIO.StringIO('\xff\x00\x00\x00'))
      255
      >>> read_int4(StringIO.StringIO('\x00\x00\x00\x80')) == -(2**31)
      True
docstring_tokens: r >>> import StringIO >>> read_int4 ( StringIO . StringIO ( \ xff \ x00 \ x00 \ x00 )) 255 >>> read_int4 ( StringIO . StringIO ( \ x00 \ x00 \ x00 \ x80 )) == - ( 2 ** 31 ) True
function: def read_int4(f):
      r"""
      >>> import StringIO
      >>> read_int4(StringIO.StringIO('\xff\x00\x00\x00'))
      255
      >>> read_int4(StringIO.StringIO('\x00\x00\x00\x80')) == -(2**31)
      True
      """
  
      data = f.read(4)
      if len(data) == 4:
          return _unpack("<i", data)[0]
      raise ValueError("not enough data in stream to read int4")
function_tokens: def read_int4 ( f ) : data = f . read ( 4 ) if len ( data ) == 4 : return _unpack ( "<i" , data ) [ 0 ] raise ValueError ( "not enough data in stream to read int4" )