<commit_before>import React, { Component, PropTypes } from 'react'
import TimeAgo from 'react-timeago'
import { Link } from 'react-router'

import Item from './Item'
import { pluralize, isNumber, decode } from '../utils'

export default class Post extends Component {
  static propTypes = {
    post: PropTypes.object,
    onPlay: PropTypes.func,
    playing: PropTypes.bool,
    showSubreddit: PropTypes.bool
  };
  shouldComponentUpdate (nextProps) {
    return (
      this.props.post.id !== nextProps.post.id ||
      this.props.playing !== nextProps.playing
    )
  }
  onPlay = () => this.props.onPlay(this.props.post);
  onLinkClick (e) {
    // Prevent playing media on link click
    e.stopPropagation()
  }
  renderTime ({ created }) {
    return (
      <TimeAgo
        key='time'
        date={created}
        component='time'
        dateTime={created.toISOString()}
        title={created.toString()}
      />
    )
  }
  renderComments ({ permalink, num_comments, author }) {
    return (
      <a key='comments' onClick={this.onLinkClick} href={permalink} target='_blank'>
        { isNumber(num_comments) ? pluralize(num_comments, 'comment') : author }
      </a>
    )
  }
  renderSubreddit ({ subreddit }) {
    return (
      <Link key='subreddit' onClick={this.onLinkClick} to={'/r/' + subreddit}>
        { subreddit }
      </Link>
    )
  }
  renderMeta (post) {
    let nodes = [ this.renderTime(post), ' · ', this.renderComments(post) ]
    if (this.props.showSubreddit) {
      nodes = nodes.concat(' · ', this.renderSubreddit(post))
    }
    return nodes
  }
  render () {
    const { post, playing } = this.props
    return (
      <Item
        onClick={this.onPlay}
        thumbnail={post.thumbnail}<commit_msg>Add title to post source links<commit_after>import React, { Component, PropTypes } from 'react'
import TimeAgo from 'react-timeago'
import { Link } from 'react-router'

import Item from './Item'
import { pluralize, isNumber, decode } from '../utils'

export default class Post extends Component {
  static propTypes = {
    post: PropTypes.object,
    onPlay: PropTypes.func,
    playing: PropTypes.bool,
    showSubreddit: PropTypes.bool
  };
  shouldComponentUpdate (nextProps) {
    return (
      this.props.post.id !== nextProps.post.id ||
      this.props.playing !== nextProps.playing
    )
  }
  onPlay = () => this.props.onPlay(this.props.post);
  onLinkClick (e) {
    // Prevent playing media on link click
    e.stopPropagation()
  }
  renderTime ({ created }) {
    return (
      <TimeAgo
        key='time'
        date={created}
        component='time'
        dateTime={created.toISOString()}
        title={created.toString()}
      />
    )
  }
  renderComments ({ permalink, num_comments, author }) {
    return (
      <a key='comments' onClick={this.onLinkClick} href={permalink} target='_blank' title='View source on Reddit'>
        { isNumber(num_comments) ? pluralize(num_comments, 'comment') : author }
      </a>
    )
  }
  renderSubreddit ({ subreddit }) {
    return (
      <Link key='subreddit' onClick={this.onLinkClick} to={'/r/' + subreddit} title='View source on Reddit'>
        { subreddit }
      </Link>
    )
  }
  renderMeta (post) {
    let nodes = [ this.renderTime(post), ' · ', this.renderComments(post) ]
    if (this.props.showSubreddit) {
      nodes = nodes.concat(' · ', this.renderSubreddit(post))
    }
    return nodes
  }
  render () {
    const { post, playing } = this.props
    return (
      <Item
        onClick={this.onPlay}
        thumbnail={post.thumbnail}
{'fraction_non_alphanumeric': 0.13785374054356964, 'fraction_numerical': 0.0, 'mean_word_length': 2.7343096234309625, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '4403219', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1126, 'n_words': 244}