<commit_before>// @flow
import { combineReducers } from 'redux'

import {
  NAMESPACE_ADD, NAMESPACE_REMOVE,
  QUERY_COMPONENT_ADD, QUERY_COMPONENT_MODIFY, QUERY_COMPONENT_REMOVE,
  SEARCH_REQUEST, SEARCH_REQUEST_SUCCESS, SEARCH_REQUEST_FAILURE,
  QUERY_TRACKING_SET, QUERY_TRACKING_FLUSH,
} from '../actions/query'

import { REQUEST_IN_PROGRESS, REQUEST_SUCCEEDED, REQUEST_FAILED } from '../constants/RequestState'

function namespaces(state: Object = {}, action: Object): Object {
  switch (action.type) {
    case NAMESPACE_ADD: {
      return {
        ...state,
        [action.namespace]: {
          project: action.project,
          collection: action.collection,
        }
      }
    }
    case NAMESPACE_REMOVE: {
      // Break out namespace to be removed from state, return everything else
      const { [action.namespace]: _, ...rest } = state
      return rest
    }
    default: {
      return state
    }
  }
}

function queryComponent(state: Object = {}, action: Object): Object {
  switch (action.type) {
    case QUERY_COMPONENT_ADD:
    case QUERY_COMPONENT_MODIFY: {
      return {
        ...state,
        [action.namespace]: {
          ...state[action.namespace],
          [action.uuid]: {
            type: action.queryDataType,
            data: action.data,
          },
        }
      }
    }
    case QUERY_COMPONENT_REMOVE: {
      const { [action.uuid]: _, ...rest } = state[action.namespace]
      return {
        ...state,
        [action.namespace]: rest
      }
    }
    default: {
      return state
    }
  }
}

function queryStatus(state: Object = {}, action: Object): Object {
  switch (action.type) {
    case SEARCH_REQUEST: {
      return {
        ...state,
        [action.namespace]: {
          status: REQUEST_IN_PROGRESS,
        },
      }
    }
    case SEARCH_REQUEST_SUCCESS: {
      return {
        ...state,
        [action.namespace]: {
          status: REQUEST_SUCCEEDED,
          data: action.data
        },<commit_msg>Remove flow from query reducer<commit_after>import { combineReducers } from 'redux'

import {
  NAMESPACE_ADD, NAMESPACE_REMOVE,
  QUERY_COMPONENT_ADD, QUERY_COMPONENT_MODIFY, QUERY_COMPONENT_REMOVE,
  SEARCH_REQUEST, SEARCH_REQUEST_SUCCESS, SEARCH_REQUEST_FAILURE,
  QUERY_TRACKING_SET, QUERY_TRACKING_FLUSH,
} from '../actions/query'

import { REQUEST_IN_PROGRESS, REQUEST_SUCCEEDED, REQUEST_FAILED } from '../constants/RequestState'

function namespaces(state = {}, action) {
  switch (action.type) {
    case NAMESPACE_ADD: {
      return {
        ...state,
        [action.namespace]: {
          project: action.project,
          collection: action.collection,
        }
      }
    }
    case NAMESPACE_REMOVE: {
      // Break out namespace to be removed from state, return everything else
      const { [action.namespace]: _, ...rest } = state
      return rest
    }
    default: {
      return state
    }
  }
}

function queryComponent(state = {}, action) {
  switch (action.type) {
    case QUERY_COMPONENT_ADD:
    case QUERY_COMPONENT_MODIFY: {
      return {
        ...state,
        [action.namespace]: {
          ...state[action.namespace],
          [action.uuid]: {
            type: action.queryDataType,
            data: action.data,
          },
        }
      }
    }
    case QUERY_COMPONENT_REMOVE: {
      const { [action.uuid]: _, ...rest } = state[action.namespace]
      return {
        ...state,
        [action.namespace]: rest
      }
    }
    default: {
      return state
    }
  }
}

function queryStatus(state = {}, action) {
  switch (action.type) {
    case SEARCH_REQUEST: {
      return {
        ...state,
        [action.namespace]: {
          status: REQUEST_IN_PROGRESS,
        },
      }
    }
    case SEARCH_REQUEST_SUCCESS: {
      return {
        ...state,
        [action.namespace]: {
          status: REQUEST_SUCCEEDED,
          data: action.data
        },
{'fraction_non_alphanumeric': 0.11304347826086956, 'fraction_numerical': 0.0, 'mean_word_length': 2.1089030206677264, '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': '6473054', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1230, 'n_words': 237}