<commit_before># -*- coding: utf-8 -*-
import os
import sys
import time
import threading

import sublime
import sublime_plugin

from sublimelinter.loader import Loader
from sublimelinter.modules.base_linter import INPUT_METHOD_FILE

LINTERS = {}     # mapping of language name to linter module
QUEUE = {}       # views waiting to be processed by linter
ERRORS = {}      # error messages on given line obtained from linter; they are
                 # displayed in the status bar when cursor is on line with error
VIOLATIONS = {}  # violation messages, they are displayed in the status bar
WARNINGS = {}    # warning messages, they are displayed in the status bar
TIMES = {}       # collects how long it took the linting to complete
MOD_LOAD = Loader(os.getcwd(), LINTERS)  # utility to load (and reload
                 # if necessary) linter modules [useful when working on plugin]

# For snappier linting, different delays are used for different linting times:
# (linting time, delays)
DELAYS = (
    (800, (800, 2000)),
    (400, (400, 1000)),
    (200, (200, 500)),
    (100, (100, 300)),
    (50, (50, 100)),
)


def get_delay(t, view):
    delay = 0

    for _t, d in DELAYS:
        if t >= _t:
            delay = d
    delay = DELAYS[-1][1]
    minDelay = int(view.settings().get('sublimelinter_delay', 0) * 1000)

    # If the user specifies a delay greater than the built in delay,
    # figure they only want to see marks when idle.
    if minDelay > delay[1]:
        erase_lint_marks(view)

    return (minDelay, minDelay) if minDelay > delay[1] else delay

<commit_msg>Fixed bug in get_delay() that prevented it to detect an effective delay properly<commit_after># -*- coding: utf-8 -*-
import os
import sys
import time
import threading

import sublime
import sublime_plugin

from sublimelinter.loader import Loader
from sublimelinter.modules.base_linter import INPUT_METHOD_FILE

LINTERS = {}     # mapping of language name to linter module
QUEUE = {}       # views waiting to be processed by linter
ERRORS = {}      # error messages on given line obtained from linter; they are
                 # displayed in the status bar when cursor is on line with error
VIOLATIONS = {}  # violation messages, they are displayed in the status bar
WARNINGS = {}    # warning messages, they are displayed in the status bar
TIMES = {}       # collects how long it took the linting to complete
MOD_LOAD = Loader(os.getcwd(), LINTERS)  # utility to load (and reload
                 # if necessary) linter modules [useful when working on plugin]

# For snappier linting, different delays are used for different linting times:
# (linting time, delays)
DELAYS = (
    (800, (800, 2000)),
    (400, (400, 1000)),
    (200, (200, 500)),
    (100, (100, 300)),
    (50, (50, 100)),
)


def get_delay(t, view):
    delay = 0
    for _t, d in DELAYS:
        if _t >= t:
            delay = d
    delay = delay or DELAYS[-1][1]

    # If the user specifies a delay greater than the built in delay,
    # figure they only want to see marks when idle.
    minDelay = int(view.settings().get('sublimelinter_delay', 0) * 1000)
    if minDelay > delay[1]:
        erase_lint_marks(view)

    return (minDelay, minDelay) if minDelay > delay[1] else delay


{'fraction_non_alphanumeric': 0.09127351218008017, 'fraction_numerical': 0.034535923527597906, 'mean_word_length': 3.0348258706467663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2306945', 'n_tokens_mistral': 1073, 'n_tokens_neox': 964, 'n_words': 400}