parameters: (nmea=sys.stdin,
             errorcb=ErrorPrinter,
             keep_nmea=False,
             stats=None,
             **kw)
docstring: Decodes a stream of AIS messages. Takes the same arguments as normalize.
docstring_summary: Decodes a stream of AIS messages. Takes the same arguments as normalize.
docstring_tokens: Decodes a stream of AIS messages . Takes the same arguments as normalize .
function: def decode(nmea=sys.stdin,
             errorcb=ErrorPrinter,
             keep_nmea=False,
             stats=None,
             **kw):
    """Decodes a stream of AIS messages. Takes the same arguments as normalize."""
  
    if stats is None: stats={}
  
    def report_error(e):
      add_error_to_stats(e, stats)
      errorcb(e, stats, **kw)
  
    for tagblock, line, origline in normalize(nmea=nmea, errorcb=errorcb, stats=stats, **kw):
      try:
        body = ''.join(line.split(',')[5])
        pad = int(line.split('*')[0][-1])
        res = ais.decode(body, pad)
        res.update(tagblock)
        if keep_nmea:
          res['nmea'] = origline
        yield res
      except TooManyErrorsError:
        raise
      except Exception as e:
        report_error(e)
function_tokens: def decode ( nmea = sys . stdin , errorcb = ErrorPrinter , keep_nmea = False , stats = None , * * kw ) : if stats is None : stats = { } def report_error ( e ) : add_error_to_stats ( e , stats ) errorcb ( e , stats , * * kw ) for tagblock , line , origline in normalize ( nmea = nmea , errorcb = errorcb , stats = stats , * * kw ) : try : body = '' . join ( line . split ( ',' ) [ 5 ] ) pad = int ( line . split ( '*' ) [ 0 ] [ - 1 ] ) res = ais . decode ( body , pad ) res . update ( tagblock ) if keep_nmea : res [ 'nmea' ] = origline yield res except TooManyErrorsError : raise except Exception as e : report_error ( e )