<commit_before>// @flow
import React from 'react';
import { List as ImmutableList, Map as ImmutableMap } from 'immutable';

import Inputs from './inputs';
import Display from './display-area';

import Editor from '../../providers/editor';
import LatexRenderer from '../latex';

import Pager from './pager';

type Props = {
  cell: ImmutableMap<string, any>,
  displayOrder: ImmutableList<any>,
  id: string,
  language: string,
  theme: string,
  transforms: ImmutableMap<string, any>,
  cellFocused: boolean,
  editorFocused: boolean,
  pagers: ImmutableList<any>,
  running: boolean,
  focusAbove: () => void,
  focusBelow: () => void,
  models: ImmutableMap<string, any>,
};

class CodeCell extends React.PureComponent {
  props: Props;

  static defaultProps = {
    pagers: new ImmutableList(),
    running: false,
    tabSize: 4,
  };

  isOutputHidden(): any {
    return this.props.cell.getIn(['metadata', 'outputHidden']);
  }

  isInputHidden(): any {
    return this.props.cell.getIn(['metadata', 'inputHidden']);
  }

  isOutputExpanded() {
    return this.props.cell.getIn(['metadata', 'outputExpanded']);
  }

  getCodeCellType(): any {
    return this.props.cell.getIn(['metadata', 'tellurium', 'te_cell_type']);
  }

  render(): ?React.Element<any> {
    return (<div className={this.props && this.props.running ? 'cell-running' : ''} >
      {
        !this.isInputHidden() ?
          <div className="input-container"> {
            <Inputs
              executionCount={this.props.cell.get('execution_count')}
              running={this.props.running}
              type={this.getCodeCellType()}
            />
            }
            <Editor
              completion
              id={this.props.id}
              input={this.props.cell.get('source')}
              language={this.getCodeCellType() === 'omex' || this.getCodeCellType() === 'antimony' ? 'omex' : this.props.language}
              cellFocused={this.props.cellFocused}
              editorFocused={this.props.editorFocused}
              theme={this.props.theme}
              focusAbove={this.props.focusAbove}<commit_msg>add editor ref<commit_after>// @flow
import React from 'react';
import { List as ImmutableList, Map as ImmutableMap } from 'immutable';

import Inputs from './inputs';
import Display from './display-area';

import Editor from '../../providers/editor';
import LatexRenderer from '../latex';

import Pager from './pager';

type Props = {
  cell: ImmutableMap<string, any>,
  displayOrder: ImmutableList<any>,
  id: string,
  language: string,
  theme: string,
  transforms: ImmutableMap<string, any>,
  cellFocused: boolean,
  editorFocused: boolean,
  pagers: ImmutableList<any>,
  running: boolean,
  focusAbove: () => void,
  focusBelow: () => void,
  models: ImmutableMap<string, any>,
};

class CodeCell extends React.PureComponent {
  props: Props;
  editor: Object;

  static defaultProps = {
    pagers: new ImmutableList(),
    running: false,
    tabSize: 4,
  };

  isOutputHidden(): any {
    return this.props.cell.getIn(['metadata', 'outputHidden']);
  }

  isInputHidden(): any {
    return this.props.cell.getIn(['metadata', 'inputHidden']);
  }

  isOutputExpanded() {
    return this.props.cell.getIn(['metadata', 'outputExpanded']);
  }

  getCodeCellType(): any {
    return this.props.cell.getIn(['metadata', 'tellurium', 'te_cell_type']);
  }

  render(): ?React.Element<any> {
    return (<div className={this.props && this.props.running ? 'cell-running' : ''} >
      {
        !this.isInputHidden() ?
          <div className="input-container"> {
            <Inputs
              executionCount={this.props.cell.get('execution_count')}
              running={this.props.running}
              type={this.getCodeCellType()}
            />
            }
            <Editor
              completion
              ref={(editor) => { this.editor = editor; }}
              id={this.props.id}
              input={this.props.cell.get('source')}
              language={this.getCodeCellType() === 'omex' || this.getCodeCellType() === 'antimony' ? 'omex' : this.props.language}
              cellFocused={this.props.cellFocused}
              editorFocused={this.props.editorFocused}
              theme={this.props.theme}
              focusAbove={this.props.focusAbove}
{'fraction_non_alphanumeric': 0.14980227959990697, 'fraction_numerical': 0.00046522447080716444, 'mean_word_length': 2.8290293855743545, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 26, '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': '4140837', 'n_tokens_mistral': 1305, 'n_tokens_neox': 1283, 'n_words': 264}