<commit_before>/* global twttr */

import React, { Component } from 'react';
import PropTypes from 'prop-types';

export default class TwitterTimeline extends Component {
  static propTypes = {
    widgetId: PropTypes.string,
    user: PropTypes.string,
    chrome: PropTypes.string,
    limit: PropTypes.number,
    width: PropTypes.number,
    height: PropTypes.number
    loading: PropTypes.node,
  };

  static defaultProps = {
    widgetId: '',
    user: '',
    chrome: '',
    limit: null,
    width: null,
    height: null,
    loading: null
  };

  constructor(props) {
    super(props);
    this.state = ({ initialized: false });
  }

  componentDidMount() {
    if (this.state.initialized) {
      return;
    }

    if (typeof twttr === 'undefined') {
      const twittertimeline = this.node;
      const twitterscript = document.createElement('script');
      twitterscript.src = '//platform.twitter.com/widgets.js';
      twitterscript.async = true;
      twitterscript.id = 'twitter-wjs';
      twittertimeline.parentNode.appendChild(twitterscript);
    } else {
      twttr.widgets.load();
    }

    this.initialized();
  }

  initialized() {
    this.setState({ initialized: true });
  }

  render() {
    const {
      user, widgetId, chrome, limit, width, height, loading
    } = this.props;
    return (
      <a
        ref={node => this.node = node}
        className="twitter-timeline"
        href={`https://twitter.com/${user}`}
        data-widget-id={widgetId}
        data-chrome={chrome}
        data-tweet-limit={limit}
        data-width={width}
        data-height={height}
      >
        {loading || ('Tweets by @' + user)}
      </a>
    );
  }
}

exports.modules = TwitterTimeline;
<commit_msg>Fix fatal error<commit_after>/* global twttr */

import React, { Component } from 'react';
import PropTypes from 'prop-types';

export default class TwitterTimeline extends Component {
  static propTypes = {
    widgetId: PropTypes.string,
    user: PropTypes.string,
    chrome: PropTypes.string,
    limit: PropTypes.number,
    width: PropTypes.number,
    height: PropTypes.number,
    loading: PropTypes.node,
  };

  static defaultProps = {
    widgetId: '',
    user: '',
    chrome: '',
    limit: null,
    width: null,
    height: null,
    loading: null
  };

  constructor(props) {
    super(props);
    this.state = ({ initialized: false });
  }

  componentDidMount() {
    if (this.state.initialized) {
      return;
    }

    if (typeof twttr === 'undefined') {
      const twittertimeline = this.node;
      const twitterscript = document.createElement('script');
      twitterscript.src = '//platform.twitter.com/widgets.js';
      twitterscript.async = true;
      twitterscript.id = 'twitter-wjs';
      twittertimeline.parentNode.appendChild(twitterscript);
    } else {
      twttr.widgets.load();
    }

    this.initialized();
  }

  initialized() {
    this.setState({ initialized: true });
  }

  render() {
    const {
      user, widgetId, chrome, limit, width, height, loading
    } = this.props;
    console.log(loading);
    return (
      <a
        ref={node => this.node = node}
        className="twitter-timeline"
        href={`https://twitter.com/${user}`}
        data-widget-id={widgetId}
        data-chrome={chrome}
        data-tweet-limit={limit}
        data-width={width}
        data-height={height}
      >
        {loading || (`Tweets by @${user}`)}
      </a>
    );
  }
}

exports.modules = TwitterTimeline;

{'fraction_non_alphanumeric': 0.1395015754798052, 'fraction_numerical': 0.0, 'mean_word_length': 2.5237134207870837, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '3272349', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1066, 'n_words': 221}