<commit_before>angular.module('multiselect', ['ams-templates'])
.directive('multiselect', ->
  restrict: 'EA'
  scope:
    model: '='
    options: '='
  templateUrl: (element, attr) ->
    attr.templateUrl or 'multiselect.html'
  controller: [
    '$scope'
    'Choice'
  (
      $scope
      Choice
  ) ->
    model = $scope.model or []

    options = $scope.options or []
    options.forEach (option, index) ->
      options[index] = new Choice(option)

    $scope.options = options

    $scope.model = model

    $scope.showSelections = ->
      $scope.model.length

    $scope.updateModel = ->
      replaceContents model, options.filter (option) ->
        option.selected
  ]
  link: ($scope, element) ->
    element.addClass('multiselect')
)

replaceContents = (array, newContents) ->
  array.splice(0, array.length, newContents...)
<commit_msg>Always access model and options from $scope<commit_after>angular.module('multiselect', ['ams-templates'])
.directive('multiselect', ->
  restrict: 'EA'
  scope:
    model: '='
    options: '='
  templateUrl: (element, attr) ->
    attr.templateUrl or 'multiselect.html'
  controller: [
    '$scope'
    'Choice'
  (
      $scope
      Choice
  ) ->
    $scope.model ?= []
    $scope.options ?= []

    $scope.options.forEach (option, index) ->
      $scope.options[index] = new Choice(option)

    $scope.showSelections = ->
      $scope.model.length

    $scope.updateModel = ->
      $scope.model = $scope.options.filter (option) ->
        option.selected
      .map (option) ->
        option.value
  ]
  link: ($scope, element) ->
    element.addClass('multiselect')
)

{'fraction_non_alphanumeric': 0.15867158671586715, 'fraction_numerical': 0.0006150061500615006, 'mean_word_length': 2.689342403628118, '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': '4098012', 'n_tokens_mistral': 528, 'n_tokens_neox': 518, 'n_words': 100}