<commit_before>class Backbone.Factlink.DetachedViewPort extends Backbone.View
  constructor: (options) ->
    super(options)
    @_view = null
    @_transition = options?.transition

  currentView: ->
    @_view

  switchView: (new_view) ->
    return if new_view == @_view

    @$el.append(new_view.$el)

    if @_view?
      @transitionView(new_view, @_view)

    @_view = new_view

  transitionView: (new_view, old_view) ->
    if @_transition?
      @_transition.run old_view.$el, new_view.$el, ->
        old_view.$el.detach()
    else
      old_view.$el.detach()

  removeView: ->
      @_view.$el.detach()
      @_view = null

  close: ->
    @$el.detach()

  cleanup: ->
    @remove()

class Backbone.Factlink.DetachedViewCache extends Backbone.Factlink.DetachedViewPort
  initialize: ->
    @cache = {}
    @current = null

  switchCacheView: (key) ->
    view = @cache[key] || null
    @switchView(view) if view?
    view

  renderCacheView: (key, view) ->
    @current = @cache[key] = view
    @current.render()
    @switchView(@current)

  closeCacheView: (key) ->
    @views[key].close()
    @views[key] = undefined

  clear: ->
    for key, view of @views
      @closeView(key)
      view.remove()<commit_msg>Use less lines :-)<commit_after>class Backbone.Factlink.DetachedViewPort extends Backbone.View
  constructor: (options) ->
    super(options)
    @_view = null
    @_transition = options?.transition

  currentView: -> @_view
  cleanup: -> @remove()
  close: -> @$el.detach()

  switchView: (new_view) ->
    return if new_view == @_view

    @$el.append(new_view.$el)

    if @_view?
      @transitionView(new_view, @_view)

    @_view = new_view

  transitionView: (new_view, old_view) ->
    if @_transition?
      @_transition.run old_view.$el, new_view.$el, ->
        old_view.$el.detach()
    else
      old_view.$el.detach()

  removeView: ->
      @_view.$el.detach()
      @_view = null



class Backbone.Factlink.DetachedViewCache extends Backbone.Factlink.DetachedViewPort
  initialize: ->
    @cache = {}
    @current = null

  switchCacheView: (key) ->
    view = @cache[key] || null
    @switchView(view) if view?
    view

  renderCacheView: (key, view) ->
    @current = @cache[key] = view
    @current.render()
    @switchView(@current)

  closeCacheView: (key) ->
    @views[key].close()
    @views[key] = undefined

  clear: ->
    for key, view of @views
      @closeView(key)
      view.remove()
{'fraction_non_alphanumeric': 0.14391143911439114, 'fraction_numerical': 0.0, 'mean_word_length': 2.8065522620904835, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '1687698', 'n_tokens_mistral': 859, 'n_tokens_neox': 831, 'n_words': 168}