<commit_before>{Disposable, CompositeDisposable} = require 'atom'

ViewURI = 'atom://deprecation-cop'
DeprecationCopView = null

module.exports =
  disposables: null

  activate: ->
    @disposables = new CompositeDisposable

    @disposables.add atom.workspace.addOpener (uri) =>
      @deserializeDeprecationCopView({uri}) if uri is ViewURI

    @disposables.add atom.commands.add 'atom-workspace', 'deprecation-cop:view', ->
      atom.workspace.open(ViewURI)

  deactivate: ->
    @disposables.dispose()
    if pane = atom.workspace.paneForURI(ViewURI)
      pane.destroyItem(pane.itemForURI(ViewURI))

  deserializeDeprecationCopView: (state) ->
    DeprecationCopView ?= require './deprecation-cop-view'
    new DeprecationCopView(state)

  consumeStatusBar: (statusBar) ->
    if atom.inDevMode()
      DeprecationCopStatusBarView = require './deprecation-cop-status-bar-view'
      statusBarView = new DeprecationCopStatusBarView()
      statusBarTile = statusBar.addRightTile(item: statusBarView, priority: 150)
      @disposables.add(new Disposable => statusBarView.destroy())
      @disposables.add(new Disposable => statusBarTile.destroy())<commit_msg>Add deserializers.add call for backwards compatibility<commit_after>{Disposable, CompositeDisposable} = require 'atom'

ViewURI = 'atom://deprecation-cop'
DeprecationCopView = null

module.exports =
  disposables: null

  activate: ->
    @disposables = new CompositeDisposable

    @disposables.add atom.workspace.addOpener (uri) =>
      @deserializeDeprecationCopView({uri}) if uri is ViewURI

    @disposables.add atom.commands.add 'atom-workspace', 'deprecation-cop:view', ->
      atom.workspace.open(ViewURI)

  deactivate: ->
    @disposables.dispose()
    if pane = atom.workspace.paneForURI(ViewURI)
      pane.destroyItem(pane.itemForURI(ViewURI))

  deserializeDeprecationCopView: (state) ->
    DeprecationCopView ?= require './deprecation-cop-view'
    new DeprecationCopView(state)

  consumeStatusBar: (statusBar) ->
    if atom.inDevMode()
      DeprecationCopStatusBarView = require './deprecation-cop-status-bar-view'
      statusBarView = new DeprecationCopStatusBarView()
      statusBarTile = statusBar.addRightTile(item: statusBarView, priority: 150)
      @disposables.add(new Disposable => statusBarView.destroy())
      @disposables.add(new Disposable => statusBarTile.destroy())

unless parseFloat(atom.getVersion()) >= 1.7
  atom.deserializers.add
    name: 'DeprecationCopView',
    deserialize: (state) -> module.exports.deserializeDeprecationCopView.bind(module.exports)
{'fraction_non_alphanumeric': 0.11539961013645224, 'fraction_numerical': 0.0031189083820662767, 'mean_word_length': 4.436440677966102, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '1724925', 'n_tokens_mistral': 835, 'n_tokens_neox': 809, 'n_words': 137}