<commit_before>let s:t_number = type(0)
let s:RETRY_DELAY = 100
let s:RETRY_NUMBER = 15
let s:READ_THRESHOLD = 0.01

function! s:_vital_loaded(V) abort
  let s:Guard = a:V.import('Vim.Guard')
  let s:String = a:V.import('Data.String')
  let s:Window = a:V.import('Vim.Window')
  let s:exiting = 0
  augroup vital_vim_buffer_writer_{s:_SID()}
    autocmd! *
    autocmd VimLeave * let s:exiting = 1
  augroup END
endfunction

function! s:_vital_depends() abort
  return ['Vim.Guard', 'Data.String', 'Vim.Window']
endfunction

function! s:_vital_created(module) abort
  let a:module.updatetime = 100
endfunction

function! s:_iconv(bufnr, text) abort
  let fileencoding = getbufvar(a:bufnr, '&fileencoding')
  if fileencoding ==# ''
    return a:text
  endif
  let expr = join(a:text, "\n")
  let result = s:String.iconv(expr, fileencoding, &encoding)
  return split(result, '\n', 1)
endfunction

" s:setbufline(expr, lnum, text)
if exists('*nvim_buf_set_lines')
  function! s:setbufline(expr, lnum, text) abort
    let bufnr = type(a:expr) == s:t_number ? a:expr : bufnr(a:expr)
    let start = a:lnum ==# '$' ? -2 : a:lnum
    return nvim_buf_set_lines(bufnr, start, -1, v:false, a:text)
  endfunction
else
  function! s:setbufline(expr, lnum, text) abort
    let focus = s:Window.focus_buffer(a:expr)
    try
      return setline(a:lnum, a:text)
    finally
      silent! call focus.restore()
    endtry
  endfunction
endif

" subbufline(expr, text)
if exists('*nvim_buf_set_lines')
  function! s:subbufline(expr, text) abort
    let bufnr = type(a:expr) == s:t_number ? a:expr : bufnr(a:expr)
    return nvim_buf_set_lines(bufnr, 0, -1, v:true, a:text)
  endfunction
else
  function! s:subbufline(expr, text) abort
    let focus = s:Window.focus_buffer(a:expr)<commit_msg>Do not use strict_indexing<commit_after>let s:t_number = type(0)
let s:RETRY_DELAY = 100
let s:RETRY_NUMBER = 15
let s:READ_THRESHOLD = 0.01

function! s:_vital_loaded(V) abort
  let s:Guard = a:V.import('Vim.Guard')
  let s:String = a:V.import('Data.String')
  let s:Window = a:V.import('Vim.Window')
  let s:exiting = 0
  augroup vital_vim_buffer_writer_{s:_SID()}
    autocmd! *
    autocmd VimLeave * let s:exiting = 1
  augroup END
endfunction

function! s:_vital_depends() abort
  return ['Vim.Guard', 'Data.String', 'Vim.Window']
endfunction

function! s:_vital_created(module) abort
  let a:module.updatetime = 100
endfunction

function! s:_iconv(bufnr, text) abort
  let fileencoding = getbufvar(a:bufnr, '&fileencoding')
  if fileencoding ==# ''
    return a:text
  endif
  let expr = join(a:text, "\n")
  let result = s:String.iconv(expr, fileencoding, &encoding)
  return split(result, '\n', 1)
endfunction

" s:setbufline(expr, lnum, text)
if exists('*nvim_buf_set_lines')
  function! s:setbufline(expr, lnum, text) abort
    let bufnr = type(a:expr) == s:t_number ? a:expr : bufnr(a:expr)
    let start = a:lnum ==# '$' ? -2 : a:lnum
    return nvim_buf_set_lines(bufnr, start, -1, v:false, a:text)
  endfunction
else
  function! s:setbufline(expr, lnum, text) abort
    let focus = s:Window.focus_buffer(a:expr)
    try
      return setline(a:lnum, a:text)
    finally
      silent! call focus.restore()
    endtry
  endfunction
endif

" subbufline(expr, text)
if exists('*nvim_buf_set_lines')
  function! s:subbufline(expr, text) abort
    let bufnr = type(a:expr) == s:t_number ? a:expr : bufnr(a:expr)
    return nvim_buf_set_lines(bufnr, 0, -1, v:false, a:text)
  endfunction
else
  function! s:subbufline(expr, text) abort
    let focus = s:Window.focus_buffer(a:expr)
{'fraction_non_alphanumeric': 0.13587871982032565, 'fraction_numerical': 0.010668163952835485, 'mean_word_length': 4.4984567901234565, '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': '3945104', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1403, 'n_words': 316}