<commit_before># -*- coding: utf-8 -*-

"""
    Configuration of system status items and groups.
"""

import flask_babel

from orchard.system_status import StatusGroup, StatusItem
from orchard.system_status.formatters import data
from orchard.system_status.system import cpu, memory, network, os, storage

# Create the status groups.
group_cpu = StatusGroup(flask_babel.gettext('CPU'))
group_memory = StatusGroup(flask_babel.gettext('Memory'))
group_network = StatusGroup(flask_babel.gettext('Network'))
group_os = StatusGroup(flask_babel.gettext('Operating System'))
group_storage = StatusGroup(flask_babel.gettext('Storage'))
group_users = StatusGroup(flask_babel.gettext('Users'))

# Operating System.
status_kernel = StatusItem(flask_babel.gettext('Kernel'), os.kernel_version)
status_runtime = StatusItem(flask_babel.gettext('Runtime'), os.run_time,
                            formatter = flask_babel.format_timedelta)
status_current_time = StatusItem(flask_babel.gettext('Current Time'), os.current_time,
                                 formatter = flask_babel.format_datetime)
group_os.append(status_kernel)
group_os.append(status_gpu)
group_os.append(status_runtime)
group_os.append(status_current_time)

# Users.
status_current_logins = StatusItem(flask_babel.gettext('Current Logins'), os.current_logins,
                                   formatter = flask_babel.gettext('Currently, {value} users are '
                                                                   'logged in.'))
status_last_login = StatusItem(flask_babel.gettext('Last Login'), os.last_login)
group_users.append(status_current_logins)
group_users.append(status_last_login)

# CPU.
status_processes = StatusItem(flask_babel.gettext('Running Processes'), os.running_processes)
status_load_one = StatusItem(flask_babel.gettext('Load (1-minute average)'), cpu.load,
                             [cpu.LoadPeriods.one])
status_load_five = StatusItem(flask_babel.gettext('Load (5-minute average)'), cpu.load,
                              [cpu.LoadPeriods.five])
status_load_fifteen = StatusItem(flask_babel.gettext('Load (15-minute average)'), cpu.load,
                                 [cpu.LoadPeriods.fifteen])
group_cpu.append(status_temperature)
group_cpu.append(status_processes)
group_cpu.append(status_load_one)
group_cpu.append(status_load_five)
group_cpu.append(status_load_fifteen)

# Storage.
status_storage_total = StatusItem(flask_babel.gettext('Total'), storage.total,
                                  formatter = data.bytes_to_human_readable)
status_storage_used = StatusItem(flask_babel.gettext('Used'), storage.used,
                                 formatter = data.bytes_to_human_readable)
status_storage_available = StatusItem(flask_babel.gettext('Available'), storage.available,
                                      formatter = data.bytes_to_human_readable)
group_storage.append(status_storage_total)
group_storage.append(status_storage_used)
group_storage.append(status_storage_available)

# Memory.<commit_msg>Fix undeclared variables.<commit_after># -*- coding: utf-8 -*-

"""
    Configuration of system status items and groups.
"""

import flask_babel

from orchard.system_status import StatusGroup, StatusItem
from orchard.system_status.formatters import data
from orchard.system_status.system import cpu, memory, network, os, storage

# Create the status groups.
group_cpu = StatusGroup(flask_babel.gettext('CPU'))
group_memory = StatusGroup(flask_babel.gettext('Memory'))
group_network = StatusGroup(flask_babel.gettext('Network'))
group_os = StatusGroup(flask_babel.gettext('Operating System'))
group_storage = StatusGroup(flask_babel.gettext('Storage'))
group_users = StatusGroup(flask_babel.gettext('Users'))

# Operating System.
status_kernel = StatusItem(flask_babel.gettext('Kernel'), os.kernel_version)
status_runtime = StatusItem(flask_babel.gettext('Runtime'), os.run_time,
                            formatter = flask_babel.format_timedelta)
status_current_time = StatusItem(flask_babel.gettext('Current Time'), os.current_time,
                                 formatter = flask_babel.format_datetime)
group_os.append(status_kernel)
group_os.append(status_runtime)
group_os.append(status_current_time)

# Users.
status_current_logins = StatusItem(flask_babel.gettext('Current Logins'), os.current_logins,
                                   formatter = flask_babel.gettext('Currently, {value} users are '
                                                                   'logged in.'))
status_last_login = StatusItem(flask_babel.gettext('Last Login'), os.last_login)
group_users.append(status_current_logins)
group_users.append(status_last_login)

# CPU.
status_processes = StatusItem(flask_babel.gettext('Running Processes'), os.running_processes)
status_load_one = StatusItem(flask_babel.gettext('Load (1-minute average)'), cpu.load,
                             [cpu.LoadPeriods.one])
status_load_five = StatusItem(flask_babel.gettext('Load (5-minute average)'), cpu.load,
                              [cpu.LoadPeriods.five])
status_load_fifteen = StatusItem(flask_babel.gettext('Load (15-minute average)'), cpu.load,
                                 [cpu.LoadPeriods.fifteen])
group_cpu.append(status_processes)
group_cpu.append(status_load_one)
group_cpu.append(status_load_five)
group_cpu.append(status_load_fifteen)

# Storage.
status_storage_total = StatusItem(flask_babel.gettext('Total'), storage.total,
                                  formatter = data.bytes_to_human_readable)
status_storage_used = StatusItem(flask_babel.gettext('Used'), storage.used,
                                 formatter = data.bytes_to_human_readable)
status_storage_available = StatusItem(flask_babel.gettext('Available'), storage.available,
                                      formatter = data.bytes_to_human_readable)
group_storage.append(status_storage_total)
group_storage.append(status_storage_used)
group_storage.append(status_storage_available)

# Memory.
{'fraction_non_alphanumeric': 0.10051848135139656, 'fraction_numerical': 0.0016725204883759827, 'mean_word_length': 3.853896103896104, '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': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4256157', 'n_tokens_mistral': 1800, 'n_tokens_neox': 1709, 'n_words': 263}