<commit_before>from __future__ import print_function
from __future__ import division

import os
import sys
import time

from collections import deque
from json import dumps
from platform import python_version
from pprint import pformat
from signal import signal, SIGTERM, SIGUSR1, SIGTSTP, SIGCONT
from subprocess import Popen
from threading import Event, Thread
from syslog import syslog, LOG_ERR, LOG_INFO, LOG_WARNING
from traceback import extract_tb, format_tb, format_stack

import py3status.docstrings as docstrings
from py3status.command import CommandServer
from py3status.constants import COLOR_NAMES
from py3status.events import Events
from py3status.helpers import print_stderr
from py3status.i3status import I3status
from py3status.parse_config import process_config
from py3status.module import Module
from py3status.profiling import profile
from py3status.version import version

LOG_LEVELS = {'error': LOG_ERR, 'warning': LOG_WARNING, 'info': LOG_INFO, }

DBUS_LEVELS = {'error': 'critical', 'warning': 'normal', 'info': 'low', }

CONFIG_SPECIAL_SECTIONS = [
    '.group_extras',
    '.module_groups',
    'general',
    'i3s_modules',
    'on_click',
    'order',
    'py3_modules',
    'py3status',
]


class Runner(Thread):
    """
    A Simple helper to run a module in a Thread so it is non-locking.
    """
    def __init__(self, module, py3_wrapper, module_name):
        Thread.__init__(self)
        self.daemon = True
        self.module = module
        self.module_name = module_name
        self.py3_wrapper = py3_wrapper
        self.start()

    def run(self):
        try:
            self.module.run()
        except:
            self.py3_wrapper.report_exception('Runner')
        # the module is no longer running so notify the timeout logic
        if self.module_name:
            self.py3_wrapper.timeout_finished.append(self.module_name)


class NoneSetting:
    """
    This class represents no setting in the config.
    """
    # this attribute is used to identify that this is a none setting
    none_setting = True

    def __len__(self):
        return 0

    def __repr__(self):
        # this is for output via module_test
        return 'None'


class Task:
    """
    A simple task that can be run by the scheduler.
    """

    def run(self):
        raise NotImplemented()

<commit_msg>flake8 + core: ignore F901 warning<commit_after>from __future__ import print_function
from __future__ import division

import os
import sys
import time

from collections import deque
from json import dumps
from platform import python_version
from pprint import pformat
from signal import signal, SIGTERM, SIGUSR1, SIGTSTP, SIGCONT
from subprocess import Popen
from threading import Event, Thread
from syslog import syslog, LOG_ERR, LOG_INFO, LOG_WARNING
from traceback import extract_tb, format_tb, format_stack

import py3status.docstrings as docstrings
from py3status.command import CommandServer
from py3status.constants import COLOR_NAMES
from py3status.events import Events
from py3status.helpers import print_stderr
from py3status.i3status import I3status
from py3status.parse_config import process_config
from py3status.module import Module
from py3status.profiling import profile
from py3status.version import version

LOG_LEVELS = {'error': LOG_ERR, 'warning': LOG_WARNING, 'info': LOG_INFO, }

DBUS_LEVELS = {'error': 'critical', 'warning': 'normal', 'info': 'low', }

CONFIG_SPECIAL_SECTIONS = [
    '.group_extras',
    '.module_groups',
    'general',
    'i3s_modules',
    'on_click',
    'order',
    'py3_modules',
    'py3status',
]


class Runner(Thread):
    """
    A Simple helper to run a module in a Thread so it is non-locking.
    """
    def __init__(self, module, py3_wrapper, module_name):
        Thread.__init__(self)
        self.daemon = True
        self.module = module
        self.module_name = module_name
        self.py3_wrapper = py3_wrapper
        self.start()

    def run(self):
        try:
            self.module.run()
        except:
            self.py3_wrapper.report_exception('Runner')
        # the module is no longer running so notify the timeout logic
        if self.module_name:
            self.py3_wrapper.timeout_finished.append(self.module_name)


class NoneSetting:
    """
    This class represents no setting in the config.
    """
    # this attribute is used to identify that this is a none setting
    none_setting = True

    def __len__(self):
        return 0

    def __repr__(self):
        # this is for output via module_test
        return 'None'


class Task:
    """
    A simple task that can be run by the scheduler.
    """

    def run(self):
        # F901 'raise NotImplemented' should be 'raise NotImplementedError'
        raise NotImplemented()  # noqa f901


{'fraction_non_alphanumeric': 0.07483277591973245, 'fraction_numerical': 0.0112876254180602, 'mean_word_length': 3.318592057761733, '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': '1630749', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1392, 'n_words': 469}