<commit_before>var React = require('react');

var ImageTag = React.createClass({
  calculateDensity: function () {
    var
        ratio;

    if (typeof window !== 'undefined' && window.devicePixelRatio > 1.5) {
      ratio = 2;
    } else {
      ratio = 1;
    }

    return ratio;
  },

  getInitialState: function () {
    return {
      pixelDensity: this.calculateDensity()
    };
  },

  handleMediaChange: function () {
    this.setState({
      pixelDensity: this.calculateDensity()
    });
  },

  componentDidMount: function () {
    window.addEventListener('resize', this.handleMediaChange);
  },

  componentWillUnmount: function () {
    window.removeEventListener('resize', this.handleMediaChange);
  },

  propTypes: {
    alt: React.PropTypes.string.isRequired,
    src1x: React.PropTypes.string.isRequired,
    src2x: React.PropTypes.string,
    width: React.PropTypes.number,
    height: React.PropTypes.number,
    className: React.PropTypes.string
  },

  render: function () {
    return (
        <img src={this.props['src' + this.state.pixelDensity + 'x'] || this.props.src1x} alt={this.props.alt}
            width={this.props.width} height={this.props.height} className={this.props.className}/>
    );
  }
});

module.exports = ImageTag;<commit_msg>no, that won't work<commit_after>var React = require('react');

var ImageTag = React.createClass({
  calculateDensity: function () {
    var
        ratio;

    if (typeof window !== 'undefined' && window.devicePixelRatio > 1.5) {
      ratio = 2;
    } else {
      ratio = 1;
    }

    return ratio;
  },

  getInitialState: function () {
    return {
      pixelDensity: this.calculateDensity()
    };
  },

  handleMediaChange: function () {
    this.setState({
      pixelDensity: this.calculateDensity()
    });
  },

  componentDidMount: function () {
    window.addEventListener('resize', this.handleMediaChange);
  },

  componentWillUnmount: function () {
    window.removeEventListener('resize', this.handleMediaChange);
  },

  propTypes: {
    alt: React.PropTypes.string.isRequired,
    src1x: React.PropTypes.string.isRequired,
    src2x: React.PropTypes.string,
    width: React.PropTypes.number,
    height: React.PropTypes.number,
    className: React.PropTypes.string
  },

  render: function () {
    return (
        <img src={this.props['src' + this.state.pixelDensity + 'x'] || this.props.src1x} alt={this.props.alt}
            width={this.props.width} height={this.props.height} className={this.props.className}
            srcSet={this.props.src2x ? [this.props.src1x + ' 1x', this.props.src2x + ' 2x'].join(', ') : null} />
    );
  }
});

module.exports = ImageTag;
{'fraction_non_alphanumeric': 0.14681647940074907, 'fraction_numerical': 0.007116104868913857, 'mean_word_length': 3.028657616892911, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '7355340', 'n_tokens_mistral': 860, 'n_tokens_neox': 837, 'n_words': 144}