<commit_before>angular
  .module('cluster.filter.collapse', [])
  .directive('filterSection', function ($timeout) {
    return {
      restrict: 'E',
      transclude: true,
      scope: {
        heading: '@',
        expanded: '@?'
      },
      require: '^filterToggleAll',
      templateUrl: 'scripts/modules/clusterFilter/collapsibleFilterSection.html',
      link:  function (scope, elem, attrs, toggleController) {
        var expanded = (scope.expanded === 'true');
        scope.state = {expanded: expanded};
        scope.getIcon = function () {
          return scope.state.expanded ? 'down' : 'up';
        };

        scope.toggle = function () {
          scope.state.expanded = !scope.state.expanded;
        };

        scope.$on('parent::clearAll', function() {
          $timeout(function() {  // This is needed b/c we don't want to trigger another digest cycle while one is currently in flight.
            $(elem).find(':checked').trigger('click');
            $(elem).find('input').val('').trigger('change');
          }, 0, false);
        });
      },

      controller: function($scope){
        $scope.$on('parent::toggle', function(event, isShow) {
          $scope.state = {expanded: isShow };
          console.log($scope.state);
        });

      }
    }
  })
  .directive('filterToggleAll', function () {
    return {
      restrict: 'E',
      transclude: true,
      template: [
        '<div>',
          '<div class="btn-group btn-group-xs">',
            '<button class="btn btn-default" ng-click="toggle()">{{buttonName}}</button>',
            '<button class="btn btn-default" ng-click="clearAll()">Clear All</button>',
          '</div>',
          '<div ng-transclude ></div>',
        '</div>'
      ].join(''),
      controller: function ($scope) {
        $scope.show = false;
        $scope.buttonName = ($scope.show ? 'Hide All' : 'Show All');
        $scope.toggle = toggle;
        $scope.clearAll = clearAll;

        function toggle() {
          $scope.show = !$scope.show;
          $scope.$broadcast('parent::toggle', $scope.show);
          $scope.buttonName = ($scope.show ? 'Hide All' : 'Show All');
        }

        function clearAll() {<commit_msg>removing console.log that was causing a memory leak<commit_after>angular
  .module('cluster.filter.collapse', [])
  .directive('filterSection', function ($timeout) {
    return {
      restrict: 'E',
      transclude: true,
      scope: {
        heading: '@',
        expanded: '@?'
      },
      require: '^filterToggleAll',
      templateUrl: 'scripts/modules/clusterFilter/collapsibleFilterSection.html',
      link:  function (scope, elem, attrs, toggleController) {
        var expanded = (scope.expanded === 'true');
        scope.state = {expanded: expanded};
        scope.getIcon = function () {
          return scope.state.expanded ? 'down' : 'up';
        };

        scope.toggle = function () {
          scope.state.expanded = !scope.state.expanded;
        };

        scope.$on('parent::clearAll', function() {
          $timeout(function() {  // This is needed b/c we don't want to trigger another digest cycle while one is currently in flight.
            $(elem).find(':checked').trigger('click');
            $(elem).find('input').val('').trigger('change');
          }, 0, false);
        });
      },

      controller: function($scope){
        $scope.$on('parent::toggle', function(event, isShow) {
          $scope.state = {expanded: isShow };
        });

      }
    }
  })
  .directive('filterToggleAll', function () {
    return {
      restrict: 'E',
      transclude: true,
      template: [
        '<div>',
          '<div class="btn-group btn-group-xs">',
            '<button class="btn btn-default" ng-click="toggle()">{{buttonName}}</button>',
            '<button class="btn btn-default" ng-click="clearAll()">Clear All</button>',
          '</div>',
          '<div ng-transclude ></div>',
        '</div>'
      ].join(''),
      controller: function ($scope) {
        $scope.show = false;
        $scope.buttonName = ($scope.show ? 'Hide All' : 'Show All');
        $scope.toggle = toggle;
        $scope.clearAll = clearAll;

        function toggle() {
          $scope.show = !$scope.show;
          $scope.$broadcast('parent::toggle', $scope.show);
          $scope.buttonName = ($scope.show ? 'Hide All' : 'Show All');
        }

        function clearAll() {
{'fraction_non_alphanumeric': 0.17274167987321712, 'fraction_numerical': 0.0004527960153950645, 'mean_word_length': 2.1921965317919074, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '3836562', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1268, 'n_words': 266}