<commit_before>let s:KEYWORDS = [
      \ 'author-mail',
      \ 'author-time',
      \ 'author-tz',
      \ 'author',
      \ 'committer-mail',
      \ 'committer-time',
      \ 'committer-tz',
      \ 'committer',
      \ 'summary',
      \ 'previous',
      \ 'filename',
      \ 'boundary',
      \]
call map(
      \ s:KEYWORDS,
      \ '[v:val, len(v:val), substitute(v:val, ''-'', ''_'', ''g'')]',
      \)

function! gina#command#blame#pipe#incremental() abort
  let parser_pipe = deepcopy(s:parser_pipe)
  let parser_pipe.revisions = {}
  let parser_pipe.chunks = []
  let parser_pipe._stderr = []
  let parser_pipe._chunk = {}
  let parser_pipe._previous = ''
  return parser_pipe
endfunction


" Parser pipe ----------------------------------------------------------------
let s:parser_pipe = gina#util#inherit(gina#process#pipe#echo())

function! s:parser_pipe.on_stdout(job, msg, event) abort
  if len(a:msg) <= 1
    let self._previous .= get(a:msg, 0, '')
    return
  endif
  let content = [self._previous . a:msg[0]] + a:msg[1:-2]
  let self._previous = a:msg[-1]
  call map(content, 'self.parse(v:val)')
endfunction

function! s:parser_pipe.on_exit(job, msg, event) abort
  if a:msg == 0
    if !empty(self._previous)
      call self.parse(self._previous)
    endif
    call sort(self.chunks, function('s:compare_chunks'))<commit_msg>Fix wrong pipe in Blame<commit_after>let s:KEYWORDS = [
      \ 'author-mail',
      \ 'author-time',
      \ 'author-tz',
      \ 'author',
      \ 'committer-mail',
      \ 'committer-time',
      \ 'committer-tz',
      \ 'committer',
      \ 'summary',
      \ 'previous',
      \ 'filename',
      \ 'boundary',
      \]
call map(
      \ s:KEYWORDS,
      \ '[v:val, len(v:val), substitute(v:val, ''-'', ''_'', ''g'')]',
      \)

function! gina#command#blame#pipe#incremental() abort
  let parser_pipe = deepcopy(s:parser_pipe)
  let parser_pipe.revisions = {}
  let parser_pipe.chunks = []
  let parser_pipe._stderr = []
  let parser_pipe._chunk = {}
  let parser_pipe._previous = ''
  return parser_pipe
endfunction


" Parser pipe ----------------------------------------------------------------
let s:parser_pipe = gina#util#inherit(gina#process#pipe#store())

function! s:parser_pipe.on_stdout(job, msg, event) abort
  if len(a:msg) <= 1
    let self._previous .= get(a:msg, 0, '')
    return
  endif
  let content = [self._previous . a:msg[0]] + a:msg[1:-2]
  let self._previous = a:msg[-1]
  call map(content, 'self.parse(v:val)')
endfunction

function! s:parser_pipe.on_exit(job, msg, event) abort
  if a:msg == 0
    if !empty(self._previous)
      call self.parse(self._previous)
    endif
    call sort(self.chunks, function('s:compare_chunks'))
{'fraction_non_alphanumeric': 0.20920810313075505, 'fraction_numerical': 0.005156537753222836, 'mean_word_length': 2.4865211810012835, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5546619', 'n_tokens_mistral': 960, 'n_tokens_neox': 937, 'n_words': 177}