<commit_before>{ combineReducers } = require 'redux'

{ getInstanceNumberFromTaskId } = require '../utils'

moment = require 'moment'

buildTaskGroup = (taskIds, search) ->
  {
    taskIds
    search
    logLines: []
    taskBuffer: {}
    prependedLineCount: 0
    linesRemovedFromTop: 0
    updatedAt: +new Date()
    top: false
    bottom: false
    tailing: false
    ready: false
    pendingRequests: false
    detectedTimestamp: false
  }

resetTaskGroup = (tailing=false) -> {
  logLines: []
  taskBuffer: {}
  top: false
  bottom: false
  tailing
}

updateTaskGroup = (state, taskGroupId, update) ->
  newState = Object.assign([], state)
  newState[taskGroupId] = Object.assign({}, state[taskGroupId], update)
  return newState

filterLogLines = (lines, search) ->
  _.filter lines, ({data}) -> new RegExp(search).test(data)

TIMESTAMP_REGEX = [
  [/^(\d{2}:\d{2}:\d{2}\.\d{3})/, 'HH:mm:ss.SSS']
  [/^[A-Z \[]+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})/, 'YYYY-MM-DD HH:mm:ss,SSS']
  [/^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})/, 'YYYY-MM-DD HH:mm:ss,SSS']
]
<commit_msg>update updatedAt when task group is reset<commit_after>{ combineReducers } = require 'redux'

{ getInstanceNumberFromTaskId } = require '../utils'

moment = require 'moment'

buildTaskGroup = (taskIds, search) ->
  {
    taskIds
    search
    logLines: []
    taskBuffer: {}
    prependedLineCount: 0
    linesRemovedFromTop: 0
    updatedAt: +new Date()
    top: false
    bottom: false
    tailing: false
    ready: false
    pendingRequests: false
    detectedTimestamp: false
  }

resetTaskGroup = (tailing=false) -> {
  logLines: []
  taskBuffer: {}
  top: false
  bottom: false
  updatedAt: +new Date()
  tailing
}

updateTaskGroup = (state, taskGroupId, update) ->
  newState = Object.assign([], state)
  newState[taskGroupId] = Object.assign({}, state[taskGroupId], update)
  return newState

filterLogLines = (lines, search) ->
  _.filter lines, ({data}) -> new RegExp(search).test(data)

TIMESTAMP_REGEX = [
  [/^(\d{2}:\d{2}:\d{2}\.\d{3})/, 'HH:mm:ss.SSS']
  [/^[A-Z \[]+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})/, 'YYYY-MM-DD HH:mm:ss,SSS']
  [/^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3})/, 'YYYY-MM-DD HH:mm:ss,SSS']
]

{'fraction_non_alphanumeric': 0.206927575348628, 'fraction_numerical': 0.01799370220422852, 'mean_word_length': 3.465863453815261, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5516291', 'n_tokens_mistral': 895, 'n_tokens_neox': 884, 'n_words': 165}