<commit_before>" Author: <NAME> <<EMAIL>>
" Description: Support for black, a python style linter

call ale#Set('python_black_executable', 'black')
call ale#Set('python_black_options', '"--quiet".(&textwidth ? " --line-length ".&textwidth : "")')

function! ale_linters#python#black#GetExecutable(buffer) abort
    return ale#Var(a:buffer, 'python_black_executable')
endfunction

function! ale_linters#python#black#GetCommand(buffer) abort
    let l:options = eval(ale#Var(a:buffer, 'python_black_options'))
    return ale#Escape(ale_linters#python#black#GetExecutable(a:buffer))
    \   . ' ' . l:options
    \   . ' - < %t | diff --old-group-format="%df: warning: black style: " --unchanged-line-format="" %t -'
endfunction

function! ale_linters#python#black#Handle(buffer, lines) abort
    " matches: '2: warning: ...
    let l:pattern = '\v(\d+): warning: (.+)$'
    let l:output = []

    for l:match in ale#util#GetMatches(a:lines, l:pattern)
        call add(l:output, {
        \   'lnum': l:match[1] + 0,
        \   'text': l:match[2],
        \   'type': 'W',
        \   'sub_type': 'style',
        \})
    endfor

    return l:output
endfunction<commit_msg>Use fast checking mode for black<commit_after>" Author: <NAME> <<EMAIL>>
" Description: Support for black, a python style linter

call ale#Set('python_black_executable', 'black')
call ale#Set('python_black_options', '"--quiet".(&textwidth ? " --line-length ".&textwidth : "")')

function! ale_linters#python#black#GetExecutable(buffer) abort
    return ale#Var(a:buffer, 'python_black_executable')
endfunction

function! ale_linters#python#black#GetCommand(buffer) abort
    let l:options = eval(ale#Var(a:buffer, 'python_black_options'))
    return ale#Escape(ale_linters#python#black#GetExecutable(a:buffer))
    \   . ' --fast ' . l:options
    \   . ' - < %t | diff --old-group-format="%df: warning: black style: " --unchanged-line-format="" %t -'
endfunction

function! ale_linters#python#black#Handle(buffer, lines) abort
    " matches: '2: warning: ...
    let l:pattern = '\v(\d+): warning: (.+)$'
    let l:output = []

    for l:match in ale#util#GetMatches(a:lines, l:pattern)
        call add(l:output, {
        \   'lnum': l:match[1] + 0,
        \   'text': l:match[2],
        \   'type': 'W',
        \   'sub_type': 'style',
        \})
    endfor

    return l:output
endfunction
{'fraction_non_alphanumeric': 0.1729957805907173, 'fraction_numerical': 0.0033755274261603376, 'mean_word_length': 3.603883495145631, 'pattern_counts': {'":': 0, '<': 11, '<?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': '3488438', 'n_tokens_mistral': 820, 'n_tokens_neox': 809, 'n_words': 163}