<commit_before>import { merge, cloneDeep } from 'lodash';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Immutable, { fromJS } from 'immutable';
import { FormattedMessage, intlShape } from 'react-intl';
import { connect } from 'react-redux';

import SelectMenu from '../../common/SelectMenu';
import ToggleInput from '../../common/ToggleInput';
import SidebarHeader from './SidebarHeader';
import SidebarControls from './SidebarControls';
import * as API from '../../../utilities/api';
import { showNotification } from '../../../actions/notification';
import { ensureImmutable } from '../../../utilities/utils';
import { columnSelectOptions, columnSelectSelectedOption } from '../../../utilities/column';

require('./ExtractMultiple.scss');

const multipleTypes = new Set(['caddisfly', 'geo-shape-features']);

function multipleTypeCondition(column) {
  return multipleTypes.has(column.get('multipleType'));
}

function textColumnOptions(columns) {
  return columns
    .filter(column => column.get('type') === 'multiple' && multipleTypeCondition(column))
    .map(column => (fromJS({
      label: column.get('title'),
      groupName: column.get('groupName'),
      value: column.get('columnName'),
    })));
}

function filterByMultipleAndColumnName(columns, columnName) {
  return columns
    .filter(column => column.get('type') === 'multiple' && multipleTypeCondition(column) && column.get('columnName') === columnName)
    .toJS()[0];
}

function SelectColumn({ columns, onChange, value, intl }) {
  const columnsSelect = ensureImmutable(textColumnOptions(columns));

  return (
    <div className="inputGroup"><commit_msg>[#2451] Refactor<commit_after>import { merge, cloneDeep } from 'lodash';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Immutable, { fromJS } from 'immutable';
import { FormattedMessage, intlShape } from 'react-intl';
import { connect } from 'react-redux';

import SelectMenu from '../../common/SelectMenu';
import ToggleInput from '../../common/ToggleInput';
import SidebarHeader from './SidebarHeader';
import SidebarControls from './SidebarControls';
import * as API from '../../../utilities/api';
import { showNotification } from '../../../actions/notification';
import { ensureImmutable } from '../../../utilities/utils';
import { columnSelectOptions, columnSelectSelectedOption } from '../../../utilities/column';

require('./ExtractMultiple.scss');

const multipleTypes = new Set(['caddisfly', 'geo-shape-features']);

function multipleTypeCondition(column) {
  return multipleTypes.has(column.get('multipleType'));
}

function textColumnOptions(columns) {
  return columns
    .filter(column => column.get('type') === 'multiple' && multipleTypeCondition(column))
    .map(column => (fromJS({
      label: column.get('title'),
      groupName: column.get('groupName'),
      value: column.get('columnName'),
    })));
}

function filterByMultipleAndColumnName(columns, columnName) {
  return columns
    .filter(column => column.get('type') === 'multiple' && multipleTypeCondition(column) && column.get('columnName') === columnName)
    .toJS()[0];
}

function SelectColumn({ columns, onChange, value, intl }) {
  const columnsSelect = textColumnOptions(columns);

  return (
    <div className="inputGroup">
{'fraction_non_alphanumeric': 0.16777108433734939, 'fraction_numerical': 0.0018072289156626507, 'mean_word_length': 4.765625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '12109', 'n_tokens_mistral': 904, 'n_tokens_neox': 916, 'n_words': 224}