<commit_before>import CorePlugin from 'base/core_plugin'

import Events from 'base/events'
import find from 'lodash.find'

export default class SourcesPlugin extends CorePlugin {
  get name() { return 'sources' }

  bindEvents() {
    this.listenToOnce(this.core, Events.CORE_CONTAINERS_CREATED, this.onContainersCreated)
  }

  onContainersCreated() {
    var firstValidSource = find(this.core.containers, (container) => container.playback.name !== 'no_op')  || this.core.containers[0]
    if (firstValidSource) {
      this.core.containers.forEach((container) => {
        if (container !== firstValidSource) {
          container.destroy()
        }
      })
    }
  }
}
<commit_msg>Fix 'sources' plugin so it still handles future sources<commit_after>import CorePlugin from 'base/core_plugin'

import Events from 'base/events'
import find from 'lodash.find'

export default class SourcesPlugin extends CorePlugin {
  get name() { return 'sources' }

  bindEvents() {
    this.listenTo(this.core, Events.CORE_CONTAINERS_CREATED, this.onContainersCreated)
  }

  onContainersCreated() {
    var firstValidSource = find(this.core.containers, (container) => container.playback.name !== 'no_op')  || this.core.containers[0]
    if (firstValidSource) {
      this.core.containers.forEach((container) => {
        if (container !== firstValidSource) {
          container.destroy()
        }
      })
    }
  }
}

{'fraction_non_alphanumeric': 0.12056737588652482, 'fraction_numerical': 0.0014184397163120568, 'mean_word_length': 3.6567656765676566, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4083705', 'n_tokens_mistral': 434, 'n_tokens_neox': 423, 'n_words': 90}