<commit_before>"use strict";

const React = require("react");
const { connect } = require("react-redux");
const { bindActionCreators } = require("redux");
const actions = require("../actions");
const { getSource, isCurrentlyPausedAtBreakpoint, getBreakpoints, makeLocationId } = require("../selectors");
const ImPropTypes = require("react-immutable-proptypes");
const { DOM: dom, PropTypes } = React;

require("./Breakpoints.css");

const Breakpoints = React.createClass({
  propTypes: {
    breakpoints: ImPropTypes.map.isRequired,
    enableBreakpoint: PropTypes.func.isRequired,
    disableBreakpoint: PropTypes.func.isRequired,
  },

  displayName: "Breakpoints",

  handleCheckbox(breakpoint) {
    const loc = breakpoint.get("location").toJS();

    if (breakpoint.get("disabled")) {
      this.props.enableBreakpoint(loc);
    } else {
      this.props.disableBreakpoint(loc);
    }
  },

  renderBreakpoint(breakpoint) {
    const filename = breakpoint.getIn(["location", "source", "filename"]);
    const locationId = breakpoint.get("locationId");
    const line = breakpoint.getIn(["location", "line"]);

    return dom.div(
      { className: "breakpoint",
        key: locationId },
      dom.input({ type: "checkbox",
                  checked: !breakpoint.get("disabled"),
                  onChange: () => this.handleCheckbox(breakpoint) }),
      `${filename}, line ${line}`
    );
  },

  render() {
    const { breakpoints } = this.props;

    return dom.div(
      { className: "breakpoints" },
      (breakpoints.size === 0 ?
       dom.div({ className: "pane-info" }, "No Breakpoints") :
       breakpoints.valueSeq().map(bp => {
         return this.renderBreakpoint(bp);
       }))
    );
  }
});

function _getBreakpoints(state) {
  return getBreakpoints(state).map(breakpoint => {
    const source = getSource(state, breakpoint.getIn(["location", "actor"]));
    const isCurrentlyPaused = isCurrentlyPausedAtBreakpoint(state, breakpoint);
    const locationId = makeLocationId(breakpoint.get("location").toJS());
    return breakpoint.setIn(["location", "source"], source)
                     .set("locationId", locationId)
                     .set("isCurrentlyPaused", isCurrentlyPaused);
  });
}


module.exports = connect(
  (state, props) => ({
    breakpoints: _getBreakpoints(state)
  }),
  dispatch => bindActionCreators(actions, dispatch)
)(Breakpoints);
<commit_msg>Fix lint js<commit_after>"use strict";

const React = require("react");
const { connect } = require("react-redux");
const { bindActionCreators } = require("redux");
const actions = require("../actions");
const { getSource, isCurrentlyPausedAtBreakpoint, getBreakpoints, makeLocationId } = require("../selectors");
const ImPropTypes = require("react-immutable-proptypes");
const { DOM: dom, PropTypes } = React;

require("./Breakpoints.css");

const Breakpoints = React.createClass({
  propTypes: {
    breakpoints: ImPropTypes.map.isRequired,
    enableBreakpoint: PropTypes.func.isRequired,
    disableBreakpoint: PropTypes.func.isRequired,
  },

  displayName: "Breakpoints",

  handleCheckbox(breakpoint) {
    const loc = breakpoint.get("location").toJS();

    if (breakpoint.get("disabled")) {
      this.props.enableBreakpoint(loc);
    } else {
      this.props.disableBreakpoint(loc);
    }
  },

  renderBreakpoint(breakpoint) {
    const filename = breakpoint.getIn(["location", "source", "filename"]);
    const locationId = breakpoint.get("locationId");
    const line = breakpoint.getIn(["location", "line"]);

    return dom.div(
      { className: "breakpoint",
        key: locationId },
      dom.input({ type: "checkbox",
                  checked: !breakpoint.get("disabled"),
                  onChange: () => this.handleCheckbox(breakpoint) }),
      `${filename}, line ${line}`
    );
  },

  render() {
    const { breakpoints } = this.props;

    return dom.div(
      { className: "breakpoints" },
      (breakpoints.size === 0 ?
       dom.div({ className: "pane-info" }, "No Breakpoints") :
       breakpoints.valueSeq().map(bp => {
         return this.renderBreakpoint(bp);
       }))
    );
  }
});

function _getBreakpoints(state) {
  return getBreakpoints(state).map(breakpoint => {
    const source = getSource(state, breakpoint.getIn(["location", "actor"]));
    const isCurrentlyPaused = isCurrentlyPausedAtBreakpoint(state, breakpoint);
    const locationId = makeLocationId(breakpoint.get("location").toJS());
    return breakpoint.setIn(["location", "source"], source)
                     .set("locationId", locationId)
                     .set("isCurrentlyPaused", isCurrentlyPaused);
  });
}

module.exports = connect(
  (state, props) => ({
    breakpoints: _getBreakpoints(state)
  }),
  dispatch => bindActionCreators(actions, dispatch)
)(Breakpoints);

{'fraction_non_alphanumeric': 0.1545511351801708, 'fraction_numerical': 0.00041657987919183504, 'mean_word_length': 3.5733333333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '3813213', 'n_tokens_mistral': 1439, 'n_tokens_neox': 1409, 'n_words': 264}