<commit_before>import React from 'react';
import NodeGroup from 'react-move/NodeGroup';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { scaleLinear } from 'd3';
import {
  bindAll,
  findIndex,
  isEqual,
  isFinite,
  has,
  keyBy,
  partial,
  pick,
  sortBy,
} from 'lodash';

import {
  animationProcessorFactory,
  AnimateEvents,
  AnimateProp,
  AnimateTiming,
  combineStyles,
  CommonDefaultProps,
  CommonPropTypes,
  memoizeByLastCall,
  propResolver,
  propsChanged,
  stateFromPropUpdates,
} from '../../../utils';

import Shape from './shape';

/**
 * `import { Scatter } from 'ihme-ui'`
 */
export default class Scatter extends React.PureComponent {
  static getCoordinate(value, scale) {
    return scale && isFinite(value) ? scale(value) : 0;
  }

  constructor(props) {
    super(props);

    this.combineStyles = memoizeByLastCall(combineStyles);
    this.state = stateFromPropUpdates(Scatter.propUpdates, {}, props, {});
    bindAll(this, [
      'renderScatter',
      'renderShape',
    ]);
  }

  componentWillReceiveProps(nextProps) {
    this.state = stateFromPropUpdates(Scatter.propUpdates, this.props, nextProps, this.state);
  }

  static computeFill(props, datum) {
    const {
      colorAccessor,
      colorScale,
      dataAccessors,
      fill,
    } = props;
    const fillValue = propResolver(datum, dataAccessors.fill || dataAccessors.x);
    if (colorScale && isFinite(fillValue)) {
      return colorAccessor && colorScale(fillValue) !== '#ccc'
        ? propResolver(datum, colorAccessor)
        : colorScale(fillValue);
    }
    return fill;
  }

  static processDatum(props, datum) {
    const {
      dataAccessors,
      scales,
      shapeScale,<commit_msg>Assigning directly to this.state is deprecated (except inside a component's constructor) updated deprecated use in scatter.jsx to setState instead<commit_after>import React from 'react';
import NodeGroup from 'react-move/NodeGroup';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { scaleLinear } from 'd3';
import {
  bindAll,
  findIndex,
  isEqual,
  isFinite,
  has,
  keyBy,
  partial,
  pick,
  sortBy,
} from 'lodash';

import {
  animationProcessorFactory,
  AnimateEvents,
  AnimateProp,
  AnimateTiming,
  combineStyles,
  CommonDefaultProps,
  CommonPropTypes,
  memoizeByLastCall,
  propResolver,
  propsChanged,
  stateFromPropUpdates,
} from '../../../utils';

import Shape from './shape';

/**
 * `import { Scatter } from 'ihme-ui'`
 */
export default class Scatter extends React.PureComponent {
  static getCoordinate(value, scale) {
    return scale && isFinite(value) ? scale(value) : 0;
  }

  constructor(props) {
    super(props);

    this.combineStyles = memoizeByLastCall(combineStyles);
    this.state = stateFromPropUpdates(Scatter.propUpdates, {}, props, {});
    bindAll(this, [
      'renderScatter',
      'renderShape',
    ]);
  }

  componentWillReceiveProps(nextProps) {
    this.setState(stateFromPropUpdates(Scatter.propUpdates, this.props, nextProps, this.state));
  }

  static computeFill(props, datum) {
    const {
      colorAccessor,
      colorScale,
      dataAccessors,
      fill,
    } = props;
    const fillValue = propResolver(datum, dataAccessors.fill || dataAccessors.x);
    if (colorScale && isFinite(fillValue)) {
      return colorAccessor && colorScale(fillValue) !== '#ccc'
        ? propResolver(datum, colorAccessor)
        : colorScale(fillValue);
    }
    return fill;
  }

  static processDatum(props, datum) {
    const {
      dataAccessors,
      scales,
      shapeScale,
{'fraction_non_alphanumeric': 0.11520354472445306, 'fraction_numerical': 0.0011077263915812794, 'mean_word_length': 3.5548549810844894, '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': '3369601', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1149, 'n_words': 250}