<commit_before>/* @flow */
import React from 'react'
import styles from './style.css'

type Props = {
  value: string,
  className: string,
  onChange: Function
}

type State = {
  value: string,
  hover: boolean,
  mode: 'normal' | 'edit'
}

export default class Editable extends React.Component<*, Props, *> {
  state: State
  shouldFocus: boolean
  input: HTMLElement

  constructor (props: Props) {
    super(props)
    this.state = {
      value: this.props.value,
      hover: false,
      mode: 'normal'
    }
    this.shouldFocus = false
  }

  componentWillReceiveProps(nextProps: Props) {
    if (this.state.value !== nextProps.value) {
      this.setState({
        value: nextProps.value
      })
    }
  }
  handleEdit (event: Object) {
    this.setState({ value: event.target.value })
  }

  handleSubmit () {
    this.setState({ mode: 'normal', hover: false })
    if (typeof this.props.onChange == 'function') {
      this.props.onChange(this.state.value)
    }
  }

  handleClick () {
    this.setState({ mode: 'edit' })<commit_msg>Fixed missing space before parens.<commit_after>/* @flow */
import React from 'react'
import styles from './style.css'

type Props = {
  value: string,
  className: string,
  onChange: Function
}

type State = {
  value: string,
  hover: boolean,
  mode: 'normal' | 'edit'
}

export default class Editable extends React.Component<*, Props, *> {
  state: State
  shouldFocus: boolean
  input: HTMLElement

  constructor (props: Props) {
    super(props)
    this.state = {
      value: this.props.value,
      hover: false,
      mode: 'normal'
    }
    this.shouldFocus = false
  }

  componentWillReceiveProps (nextProps: Props) {
    if (this.state.value !== nextProps.value) {
      this.setState({
        value: nextProps.value
      })
    }
  }
  handleEdit (event: Object) {
    this.setState({ value: event.target.value })
  }

  handleSubmit () {
    this.setState({ mode: 'normal', hover: false })
    if (typeof this.props.onChange == 'function') {
      this.props.onChange(this.state.value)
    }
  }

  handleClick () {
    this.setState({ mode: 'edit' })
{'fraction_non_alphanumeric': 0.13726415094339622, 'fraction_numerical': 0.0, 'mean_word_length': 2.8354430379746836, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2635747', 'n_tokens_mistral': 692, 'n_tokens_neox': 693, 'n_words': 169}