<commit_before>import React, { Component, PropTypes } from 'react';
import cx from 'classnames';

import css from './Tabs.css';

export default class Tab extends Component {
  static propTypes = {
    value: PropTypes.number,
    selected: PropTypes.bool,
    className: PropTypes.string,
    children: PropTypes.node,
    onClick: PropTypes.func,
    onFocus: PropTypes.func,
    onBlur: PropTypes.func
  }

  handleClick = (e) => {
    const { onClick, value } = this.props;
    onClick(e, parseInt(value, 10));
  };

  handleFocus = (e) => {
    const { onFocus, value } = this.props;
    onFocus(e, parseInt(value, 10));
  };

  handleBlur = (e) => {
    const { onBlur, value } = this.props;
    onBlur(e, parseInt(value, 10));
  };

  focus = () => {
    this.component.focus();
  };

  blur = () => {
    this.component.blur();
  };

  render() {
    const {
      value,
      selected,
      className,
      children,
      ...rest,
    } = this.props;

    const classes = cx(
      css.tab,
      selected ? css.tabActive : null,
      className
    );

    return (
      <button
        { ...rest }
        ref={ (c) => {
          this.component = c;
        } }
        onFocus={ this.handleFocus }
        onBlur={ this.handleBlur }
        onClick={ this.handleClick }
        className={ classes }
        aria-selected= { selected }
        value={ value }
        tabIndex={ selected ? 0 : -1 }
      >
        { children }
      </button><commit_msg>Prevent changing tabs from submitting forms<commit_after>import React, { Component, PropTypes } from 'react';
import cx from 'classnames';

import css from './Tabs.css';

export default class Tab extends Component {
  static propTypes = {
    value: PropTypes.number,
    selected: PropTypes.bool,
    className: PropTypes.string,
    children: PropTypes.node,
    onClick: PropTypes.func,
    onFocus: PropTypes.func,
    onBlur: PropTypes.func
  }

  handleClick = (e) => {
    const { onClick, value } = this.props;
    onClick(e, parseInt(value, 10));
  };

  handleFocus = (e) => {
    const { onFocus, value } = this.props;
    onFocus(e, parseInt(value, 10));
  };

  handleBlur = (e) => {
    const { onBlur, value } = this.props;
    onBlur(e, parseInt(value, 10));
  };

  focus = () => {
    this.component.focus();
  };

  blur = () => {
    this.component.blur();
  };

  render() {
    const {
      value,
      selected,
      className,
      children,
      ...rest,
    } = this.props;

    const classes = cx(
      css.tab,
      selected ? css.tabActive : null,
      className
    );

    return (
      <button
        { ...rest }
        ref={ (c) => {
          this.component = c;
        } }
        type="button"
        onFocus={ this.handleFocus }
        onBlur={ this.handleBlur }
        onClick={ this.handleClick }
        className={ classes }
        aria-selected= { selected }
        value={ value }
        tabIndex={ selected ? 0 : -1 }
      >
        { children }
      </button>
{'fraction_non_alphanumeric': 0.14185580774365822, 'fraction_numerical': 0.0053404539385847796, 'mean_word_length': 2.0364741641337387, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '5965476', 'n_tokens_mistral': 952, 'n_tokens_neox': 945, 'n_words': 221}