<commit_before># Copyright (c) 2016, <NAME>
# Licensed under MIT
from datetime import datetime
import time
from kervi.utility.thread import KerviThread
from kervi.spine import Spine
from kervi.utility.component import KerviComponent

class Sensor(KerviComponent):
    def __init__(self, sensor_id, name):
        KerviComponent.__init__(self, sensor_id, "sensor", name)
        self.type = None
        self.max = None
        self.min = None
        self.unit = None
        self.reading_interval = .5
        self.upper_fatal_limit = None
        self.upper_warning_limit = None
        self.lower_warning_limit = None
        self.lower_fatal_limit = None
        self.store_settings = {"delta":1, "interval":60, "active":True}
        self.old_val = None
        self.last_reading = None
        self.sparkline = []
        self.ui_parameters = {
            "size": 1,
            "type": "value",
            "chart_points": 60,
            "show_sparkline": True,
            "add_to_header": False,
            "icon": None,
            "flat": False
        }

    def add_to_dashboard(self, dashboard_id, section_id, **kwargs):
        return KerviComponent.add_to_dashboard(
            self,
            dashboard_id,
            section_id,
            {
                "size": kwargs.get("ui_size", self.ui_parameters["size"]),
                "type": kwargs.get("ui_type", self.ui_parameters["type"]),
                "chartPoints": kwargs.get("ui_chart_points", self.ui_parameters["chart_points"]),
                "showSparkline": kwargs.get("ui_show_sparkline", self.ui_parameters["show_sparkline"]),
                "addToHeader":kwargs.get("ui_add_to_header", self.ui_parameters["add_to_header"]),
                "icon":kwargs.get("ui_icon", self.ui_parameters["icon"]),
                "flat":kwargs.get("ui_flat", self.ui_parameters["flat"])
            })

    def _get_info(self):
        return {
            "type":self.type,
            "max":self.max,
            "min":self.min,
            "unit":self.unit,
            "readingInterval":self.reading_interval,
            "value":self.old_val,<commit_msg>Added ui options<commit_after># Copyright (c) 2016, <NAME>
# Licensed under MIT
from datetime import datetime
import time
from kervi.utility.thread import KerviThread
from kervi.spine import Spine
from kervi.utility.component import KerviComponent

class Sensor(KerviComponent):
    def __init__(self, sensor_id, name):
        KerviComponent.__init__(self, sensor_id, "sensor", name)
        self.type = None
        self.max = None
        self.min = None
        self.unit = None
        self.reading_interval = .5
        self.upper_fatal_limit = None
        self.upper_warning_limit = None
        self.lower_warning_limit = None
        self.lower_fatal_limit = None
        self.store_settings = {"delta":1, "interval":60, "active":True}
        self.old_val = None
        self.last_reading = None
        self.sparkline = []
        self.ui_parameters = {
            "size": 1,
            "type": "value",
            "chart_points": 60,
            "show_sparkline": True,
            "add_to_header": False,
            "icon": None,
            "flat": False,
            "show_value": True,
        }

    def add_to_dashboard(self, dashboard_id, section_id, **kwargs):
        return KerviComponent.add_to_dashboard(
            self,
            dashboard_id,
            section_id,
            {
                "size": kwargs.get("ui_size", self.ui_parameters["size"]),
                "type": kwargs.get("ui_type", self.ui_parameters["type"]),
                "chartPoints": kwargs.get("ui_chart_points", self.ui_parameters["chart_points"]),
                "showSparkline": kwargs.get("ui_show_sparkline", self.ui_parameters["show_sparkline"]),
                "addToHeader":kwargs.get("ui_add_to_header", self.ui_parameters["add_to_header"]),
                "icon":kwargs.get("ui_icon", self.ui_parameters["icon"]),
                "flat":kwargs.get("ui_flat", self.ui_parameters["flat"]),
                "showValue":kwargs.get("ui_show_value", self.ui_parameters["show_value"]),
            })

    def _get_info(self):
        return {
            "type":self.type,
            "max":self.max,
            "min":self.min,
            "unit":self.unit,
            "readingInterval":self.reading_interval,
            "value":self.old_val,
{'fraction_non_alphanumeric': 0.12284287011807447, 'fraction_numerical': 0.004995458673932788, 'mean_word_length': 2.227106227106227, 'pattern_counts': {'":': 48, '<': 5, '<?xml version=': 0, '>': 5, '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': '3986703', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1306, 'n_words': 235}