<commit_before>function authSetup() {
  var authArea = document.getElementById('auth');
  $.ajax({ 
    type: 'GET',
    url: '/auth', 
    success: function(res, status, xhr) { 
      var html='';
      if(Array.isArray(res)) {
        for(var i=0;i<res.length;i++) {
          var apiId = res[i].id;
          var apiName = res[i].name;
          var method = res[i].enabled ? 'delete' : 'post';
          var toggle = res[i].enabled ? 'disable' : 'enable';
          var disabled = res[i].authRequired ? '' : 'disabled ';
          html += '<span class="auth-switch">'
          html += '<form name="'+apiId+'" method="'+method+'" action="/auth/'+apiId+'">';
          var classList= toggle+'-auth';
          html += '<input type="button" class="'+classList+'" alt="'+apiName+'" value="'+apiId+'" onclick="'+toggle+'Auth(this.form)" '+disabled+'/>';
          html += '</form></span>';
        }
      }
      authArea.innerHTML = html; 
    },
    error: function(xhr, status, err) {
      authArea.innerHTML = ''; 
    }
  });
}

function authTeardown() {
  var authArea = document.getElementById('auth');
  authArea.innerHTML = ''; 
}

function enableAuth(form) {
  form.submit();
}

function disableAuth(form) {
  $.ajax({ 
    type: 'DELETE',
    url: form.action, 
    success: function(res, status, xhr) { 
      authSetup();  
    },
    error: function(xhr, status, err) {
    }
  });
}
<commit_msg>changed alt to title to enable tooltip<commit_after>function authSetup() {
  var authArea = document.getElementById('auth');
  $.ajax({ 
    type: 'GET',
    url: '/auth', 
    success: function(res, status, xhr) { 
      var html='';
      if(Array.isArray(res)) {
        for(var i=0;i<res.length;i++) {
          var apiId = res[i].id;
          var apiName = res[i].name;
          var method = res[i].enabled ? 'delete' : 'post';
          var toggle = res[i].enabled ? 'disable' : 'enable';
          var disabled = res[i].authRequired ? '' : 'disabled ';
          html += '<span class="auth-switch">'
          html += '<form name="'+apiId+'" method="'+method+'" action="/auth/'+apiId+'">';
          var classList= toggle+'-auth';
          html += '<input type="button" class="'+classList+'" title="'+apiName+'" value="'+apiId+'" onclick="'+toggle+'Auth(this.form)" '+disabled+'/>';
          html += '</form></span>';
        }
      }
      authArea.innerHTML = html; 
    },
    error: function(xhr, status, err) {
      authArea.innerHTML = ''; 
    }
  });
}

function authTeardown() {
  var authArea = document.getElementById('auth');
  authArea.innerHTML = ''; 
}

function enableAuth(form) {
  form.submit();
}

function disableAuth(form) {
  $.ajax({ 
    type: 'DELETE',
    url: form.action, 
    success: function(res, status, xhr) { 
      authSetup();  
    },
    error: function(xhr, status, err) {
    }
  });
}

{'fraction_non_alphanumeric': 0.1971238162048404, 'fraction_numerical': 0.0007015082427218519, 'mean_word_length': 2.596469104665826, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '883864', 'n_tokens_mistral': 928, 'n_tokens_neox': 917, 'n_words': 190}