luminoso_api/v4_json_stream.py
def _normalize_data(stream, date_format=None):
    """
    This function is meant to normalize data for upload to the Luminoso
    Analytics system. Currently it only normalizes dates.

    If date_format is not specified, or if there's no date in a particular doc,
    the the doc is yielded unchanged.
    """
    for doc in stream:
        if 'date' in doc and date_format is not None:
            try:
                doc['date'] = _convert_date(doc['date'], date_format)
            except ValueError:
                # ValueErrors cover the cases when date_format does not match
                # the actual format of the date, both for epoch and non-epoch
                # times.
                logger.exception('%s does not match the date format %s;'
                                 % (doc['date'], date_format))
        yield doc
def _normalize_data(stream, date_format=None):
    """
    This function is meant to normalize data for upload to the Luminoso
    Analytics system. Currently it only normalizes dates.

    If date_format is not specified, or if there's no date in a particular doc,
    the the doc is yielded unchanged.
    """
    for doc in stream:
        if 'date' in doc and date_format is not None:
            try:
                doc['date'] = _convert_date(doc['date'], date_format)
            except ValueError:
                # ValueErrors cover the cases when date_format does not match
                # the actual format of the date, both for epoch and non-epoch
                # times.
                logger.exception('%s does not match the date format %s;'
                                 % (doc['date'], date_format))
        yield doc
This function is meant to normalize data for upload to the Luminoso
    Analytics system. Currently it only normalizes dates.

    If date_format is not specified, or if there's no date in a particular doc,
    the the doc is yielded unchanged.