<commit_before>import React from 'react';
import PropTypes from 'prop-types';

class InfoPair extends React.Component {
  render() {
    const { spacingClass } = this.props;

    const gridRowClasses = spacingClass ?
        `usa-grid-full ${this.props.spacingClass}`
        : 'usa-grid-full';

    const row = (
      <div className={gridRowClasses}>
        <div className="usa-width-one-third">
          <span><strong>{this.props.label}: </strong></span>
        </div>
        <div className="usa-width-two-thirds">
          {this.props.value}
        </div>
      </div>
    );

    let rowToDisplay;
    // Some rows should display the value even if the value is 0,
    // while other rows shouldn't display anything if the value is 0.
    // If this prop is passed, the value should be displayed regardless
    // of if it is 0 or not.
    // If the prop is not passed, check first if the value exists before
    // determining whether or not to display it.
    if (this.props.displayIfZero) {
      rowToDisplay = row;
    } else {
      rowToDisplay = this.props.value && row;
    }

    return (
      rowToDisplay || null
    );
  }
}

InfoPair.propTypes = {
  label: PropTypes.string.isRequired,
  value: PropTypes.any,
  spacingClass: PropTypes.string,
  displayIfZero: PropTypes.bool
};

export default InfoPair;
<commit_msg>Update comment<commit_after>import React from 'react';
import PropTypes from 'prop-types';

class InfoPair extends React.Component {
  render() {
    const { spacingClass } = this.props;

    const gridRowClasses = spacingClass ?
        `usa-grid-full ${this.props.spacingClass}`
        : 'usa-grid-full';

    const row = (
      <div className={gridRowClasses}>
        <div className="usa-width-one-third">
          <span><strong>{this.props.label}: </strong></span>
        </div>
        <div className="usa-width-two-thirds">
          {this.props.value}
        </div>
      </div>
    );

    let rowToDisplay;
    // The displayIfZero prop may be passed in because some rows should
    // display 0 values, while other rows should not display any 0 values.
    // If displayIfZero is false or is not passed in, only display the
    // row if the value is defined and nonzero.
    if (this.props.displayIfZero) {
      rowToDisplay = row;
    } else {
      rowToDisplay = this.props.value && row;
    }

    return (
      rowToDisplay || null
    );
  }
}

InfoPair.propTypes = {
  label: PropTypes.string.isRequired,
  value: PropTypes.any,
  spacingClass: PropTypes.string,
  displayIfZero: PropTypes.bool
};

export default InfoPair;

{'fraction_non_alphanumeric': 0.11381172839506173, 'fraction_numerical': 0.0019290123456790122, 'mean_word_length': 2.5183175033921303, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '2645803', 'n_tokens_mistral': 776, 'n_tokens_neox': 762, 'n_words': 227}