<commit_before>var _ = require('lodash'),
  React = require('react'),
  qs = require('query-string');


var DEFAULT_PROPS = {
  usePlaceholder: false,
  placeholder: {
    /* See https://github.com/imsky/holder#placeholder-options for info on more props and themes */
    theme: 'vine',
    auto: true,
  },
};


var Img = React.createClass({
  propTypes: {
    src: React.PropTypes.string.isRequired,
    usePlaceholder: React.PropTypes.bool,
    placeholder: React.PropTypes.object,
  },

  getDefaultProps: function() {
    return DEFAULT_PROPS;
  },

  render: function() {
    let props = this.props;

    var attrs = _.omit(props, 'src', 'usePlaceholder', 'placeholder');

    // placeholder
    if (props.usePlaceholder) {
      let query = qs.stringify(props.placeholder);

      let src = `holder.js/${attrs.width}x${attrs.height}?${query}`;

      attrs = _.omit(attrs, 'width', 'height');
      
      return (
        <img {...attrs} ref="placeholder" data-src={src} />
      );
    } 
    // real
    else {
      return (
        attrs = _.omit(attrs, 'width', 'height');
        
        <img {...attrs} src={props.src} />
      );
    }
  },

  componentDidMount: function() {
    this._initPlaceholderImage();
  },
<commit_msg>fix bugs<commit_after>var _ = require('lodash'),
  React = require('react'),
  qs = require('query-string');


var DEFAULT_PROPS = {
  usePlaceholder: false,
  placeholder: {
    /* See https://github.com/imsky/holder#placeholder-options for info on more props and themes */
    theme: 'vine',
    auto: true,
  },
};


var Img = React.createClass({
  propTypes: {
    src: React.PropTypes.string.isRequired,
    usePlaceholder: React.PropTypes.bool,
    placeholder: React.PropTypes.object,
  },

  getDefaultProps: function() {
    return DEFAULT_PROPS;
  },

  render: function() {
    let props = this.props;

    let { width, height } = this.props;

    var attrs = _.omit(props, 'src', 'usePlaceholder', 'placeholder', 
      'width', 'height');

    // placeholder
    if (props.usePlaceholder) {
      let query = qs.stringify(props.placeholder);

      let src = `holder.js/${width}x${height}?${query}`;

      return (
        <img {...attrs} ref="placeholder" data-src={src} />
      );
    } 
    // real
    else {
      return (
        <img {...attrs} src={props.src} />
      );
    }
  },

  componentDidMount: function() {
    this._initPlaceholderImage();
  },

{'fraction_non_alphanumeric': 0.1608910891089109, 'fraction_numerical': 0.0, 'mean_word_length': 2.6194029850746268, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '1297648', 'n_tokens_mistral': 797, 'n_tokens_neox': 770, 'n_words': 159}