<commit_before>"""
Created on 16 Sep 2020

@author: <NAME> (<EMAIL>)

An OPCube controller
"""

from scs_core.gas.afe_baseline import AFEBaseline
from scs_core.gas.afe_calib import AFECalib

from scs_dfe.gas.isi.isi import ISI

from scs_dfe.interface.interface import Interface
from scs_dfe.interface.interface_status import InterfaceStatus


# --------------------------------------------------------------------------------------------------------------------

class OPCube(Interface):
    """
    classdocs
    """

    # ----------------------------------------------------------------------------------------------------------------

    def __init__(self, mcu):
        """
        Constructor
        """
        self.__mcu = mcu                            # OPCubeMCU


    # ----------------------------------------------------------------------------------------------------------------

    def status(self):
        return InterfaceStatus(self.__mcu.read_temperature())


    def null_datum(self):
        return InterfaceStatus(None)


    # ----------------------------------------------------------------------------------------------------------------

    def gas_sensors(self, host):
        # sensors...
        afe_calib = AFECalib.load(host)
        afe_baseline = AFEBaseline.load(host, skeleton=True)

        sensors = [] if afe_calib is None else afe_calib.sensors(afe_baseline)

        return ISI(sensors)


    def pt1000(self, host):<commit_msg>Fixed a bug in OPCube<commit_after>"""
Created on 16 Sep 2020

@author: <NAME> (<EMAIL>)

An OPCube controller
"""

from scs_core.gas.afe_baseline import AFEBaseline
from scs_core.gas.afe_calib import AFECalib

from scs_dfe.gas.isi.isi import ISI

from scs_dfe.interface.interface import Interface
from scs_dfe.interface.interface_status import InterfaceStatus


# --------------------------------------------------------------------------------------------------------------------

class OPCube(Interface):
    """
    classdocs
    """

    # ----------------------------------------------------------------------------------------------------------------

    def __init__(self, mcu):
        """
        Constructor
        """
        self.__mcu = mcu                            # OPCubeMCU


    # ----------------------------------------------------------------------------------------------------------------

    def status(self):
        return InterfaceStatus(self.__mcu.read_temperature())


    def null_datum(self):
        return InterfaceStatus(None)


    # ----------------------------------------------------------------------------------------------------------------

    def gas_sensors(self, host):
        # sensors...
        afe_calib = AFECalib.load(host)
        afe_baseline = AFEBaseline.load(host, skeleton=True)

        if afe_calib is None:
            return None

        sensors = afe_calib.sensors(afe_baseline)

        return ISI(sensors)


    def pt1000(self, host):
{'fraction_non_alphanumeric': 0.3685446009389671, 'fraction_numerical': 0.00670690811535882, 'mean_word_length': 0.9728835978835979, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4924268', 'n_tokens_mistral': 751, 'n_tokens_neox': 659, 'n_words': 146}