<commit_before>﻿from ..libs.view_helpers import *
from ..libs.text_helpers import *
from ..libs import get_panel_manager, log
from .event_hub import EventHub


class ProjectErrorListener:

    def __init__(self):
        self.just_changed_focus = False
        self.modified = False
        self.pending_timeout = 0
        self.pending_update_error_list_panel = 0
        self.errors = dict()
        self.event_handler_added = False

    def is_error_list_panel_active(self):
        return get_panel_manager().is_panel_active("errorlist")

    def on_activated_with_info(self, view, info):
        # Only starts the timer when the error list panel is active
        if self.is_error_list_panel_active():
            self.set_request_error_timer(50)
            self.just_changed_focus = True

    def post_on_modified(self, view):
        if not is_special_view(view) and self.is_error_list_panel_active():
            self.modified = True
            self.set_request_error_timer(50)

    def set_request_error_timer(self, ms):
        """Set timer to go off when file not being modified"""
        self.pending_timeout += 1
        sublime.set_timeout(self.handle_time_out, ms)

    def handle_time_out(self):
        self.pending_timeout -= 1<commit_msg>Fix reload issue<commit_after>﻿from ..libs.view_helpers import *
from ..libs.text_helpers import *
from ..libs import get_panel_manager, log
from .event_hub import EventHub


class ProjectErrorListener:

    def __init__(self):
        self.just_changed_focus = False
        self.modified = False
        self.pending_timeout = 0
        self.pending_update_error_list_panel = 0
        self.errors = dict()
        self.event_handler_added = False

    def is_error_list_panel_active(self):
        return get_panel_manager().is_panel_active("errorlist")

    def on_activated_with_info(self, view, info):
        # Only starts the timer when the error list panel is active
        if self.is_error_list_panel_active():
            self.set_request_error_timer(50)
            self.just_changed_focus = True

    def post_on_modified(self, view):
        if not is_special_view(view) and self.is_error_list_panel_active():
            self.modified = True
            self.set_request_error_timer(150)
            log.debug("error list timer started")

    def set_request_error_timer(self, ms):
        """Set timer to go off when file not being modified"""
        self.pending_timeout += 1
        sublime.set_timeout(self.handle_time_out, ms)

    def handle_time_out(self):
        self.pending_timeout -= 1
{'fraction_non_alphanumeric': 0.0780885780885781, 'fraction_numerical': 0.006604506604506605, 'mean_word_length': 2.9253048780487805, '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': '4209668', 'n_tokens_mistral': 782, 'n_tokens_neox': 749, 'n_words': 179}