<commit_before>"""
    nemreader.nem_objects
    ~~~~~
    Define named tuple data classes
"""

from collections import namedtuple

Reading = namedtuple('Reading', [
    't_start', 't_end', 'read_value', 'uom', 'quality_method', 'event_code',
    'event_desc', 'read_start', 'read_end'
])

NmiDetails = namedtuple('NmiDetails', [
    'nmi', 'nmi_configuration', 'register_id', 'nmi_suffix',
    'mdm_datastream_identifier', 'meter_serial_number', 'uom',
    'interval_length', 'next_scheduled_read_date'
])

HeaderRecord = namedtuple('HeaderRecord', [
    'version_header',
    'datetime',
    'from_participant',
    'to_participant',
    'file_name',
])

IntervalRecord = namedtuple('IntervalRecord', [
    'interval_data', 'interval_values', 'quality_method', 'reason_code',
    'reason_description', 'update_datetime', 'msats_load_datatime'
])

EventRecord = namedtuple('IntervalRecord', [
    'start_interval', 'end_interval', 'quality_method', 'reason_code',
    'reason_description'
])

BasicMeterData = namedtuple('BasicMeterData', [
    'nmi', 'nmi_configuration', 'register_id', 'nmi_suffix',
    'mdm_data_stream_identifier', 'meter_serial_number', 'direction_indicator',
    'previous_register_read', 'previous_register_read_datetime',
    'previous_quality_method', 'previous_reason_code',
    'previous_reason_description', 'current_register_read',
    'current_register_read_datetime', 'current_quality_method',
    'current_reason_code', 'current_reason_description', 'quantity', 'uom',
    'next_scheduled_read_date', 'update_datetime', 'msats_load_datetime'
])

B2BDetails12 = namedtuple(
    'B2BDetails12',
    ['trans_code', 'ret_service_order', 'read_datetime', 'index_read'])

B2BDetails13 = namedtuple('B2BDetails13', [
    'previous_trans_code', 'previous_ret_service_order', 'current_trans_code',
    'current_ret_service_order'
])

NEMFile = namedtuple('NEMFile', ['header', 'readings', 'transactions'])<commit_msg>Changed to typed named tuple<commit_after>"""
    nemreader.nem_objects
    ~~~~~
    Define named tuple data classes
"""

from collections import namedtuple
from datetime import datetime
from typing import NamedTuple, Optional, Any


class NEMFile(NamedTuple):
    """ Represents a meter reading """
    header: Any
    readings: Any
    transactions: Any


class Reading(NamedTuple):
    """ Represents a meter reading """
    t_start: datetime
    t_end: datetime
    read_value: float
    uom: str
    quality_method: Optional[str]
    event_code: Optional[str]
    event_desc: Optional[str]
    read_start: Optional[datetime]
    read_end: Optional[datetime]


class NmiDetails(NamedTuple):
    """ Represents meter metadata """
    nmi: str
    nmi_configuration: str
    register_id: str
    nmi_suffix: str
    mdm_datastream_identifier: str
    meter_serial_number: str
    uom: str
    interval_length: int
    next_scheduled_read_date: datetime


HeaderRecord = namedtuple('HeaderRecord', [
    'version_header',
    'datetime',
    'from_participant',
    'to_participant',
    'file_name',
])

IntervalRecord = namedtuple('IntervalRecord', [
    'interval_data', 'interval_values', 'quality_method', 'reason_code',
    'reason_description', 'update_datetime', 'msats_load_datatime'
])

EventRecord = namedtuple('IntervalRecord', [
    'start_interval', 'end_interval', 'quality_method', 'reason_code',
    'reason_description'
])

BasicMeterData = namedtuple('BasicMeterData', [
    'nmi', 'nmi_configuration', 'register_id', 'nmi_suffix',
    'mdm_data_stream_identifier', 'meter_serial_number', 'direction_indicator',
    'previous_register_read', 'previous_register_read_datetime',
    'previous_quality_method', 'previous_reason_code',
    'previous_reason_description', 'current_register_read',
    'current_register_read_datetime', 'current_quality_method',
    'current_reason_code', 'current_reason_description', 'quantity', 'uom',
    'next_scheduled_read_date', 'update_datetime', 'msats_load_datetime'
])

B2BDetails12 = namedtuple(
    'B2BDetails12',
    ['trans_code', 'ret_service_order', 'read_datetime', 'index_read'])

B2BDetails13 = namedtuple('B2BDetails13', [
    'previous_trans_code', 'previous_ret_service_order', 'current_trans_code',
    'current_ret_service_order'
])
{'fraction_non_alphanumeric': 0.12755942574723464, 'fraction_numerical': 0.00564838785596611, 'mean_word_length': 5.810897435897436, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4705454', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1346, 'n_words': 241}