<commit_before>var auth2;
// client ID is generated from my google APIs credentials page.
const CLIENT_ID = '1034390229233-u07o0iaas2oql8l4jhe7fevpfsbrtv7n.apps.googleusercontent.com'

// googleUser is generated with auth2.currentUser.get().
// Further Google Sign in documentation is available at:
// https://developers.google.com/identity/sign-in/web/reference

/**
 * This ID token is an encrypted token containing user information,
 * including user unique ID and profile data.
 * ID token must be sent to backend for processing for any user-related datastore operation.
 */
function getIdToken() {
  return auth2.currentUser.get().getAuthResponse().id_token;
}

/**
 * Loads the auth2 library for the g-signin API, and then initializes
 * the googleAuth object.
 * Passed as jquery parameter, executed by API script.
 */
function onStart() {
  gapi.load('auth2', initSigninV2);
}

/**
 * Initializes google authentication API and sets event listeners.
 */
function initSigninV2() {
  auth2 = gapi.auth2.init({
    client_id : CLIENT_ID
  });

  gapi.signin2.render('g-signin-container');

  auth2.currentUser.listen(function(newGoogleUser) {
    if (auth2.isSignedIn.get()) {
      insertUserInfo(newGoogleUser);
    }
  });

  auth2.isSignedIn.listen(function(signedIn) {
    if (signedIn) {
      enableUserDropdown();
    } else {
      disableUserDropdown();
    }
  });
}

/**
 * Signs out current user from g-signin API.
 */
function signOut() {
  auth2.signOut();
}

/**
 * To be run in currentUser listener, activates whenever current user changes.
 *
 * @param {GoogleUser} current user to provide profile info.
 */<commit_msg>user-auth initSignin now checks for sign-in box container before trying to insert html<commit_after>var auth2;
// client ID is generated from my google APIs credentials page.
const CLIENT_ID = '1034390229233-u07o0iaas2oql8l4jhe7fevpfsbrtv7n.apps.googleusercontent.com'

// googleUser is generated with auth2.currentUser.get().
// Further Google Sign in documentation is available at:
// https://developers.google.com/identity/sign-in/web/reference

/**
 * This ID token is an encrypted token containing user information,
 * including user unique ID and profile data.
 * ID token must be sent to backend for processing for any user-related datastore operation.
 */
function getIdToken() {
  return auth2.currentUser.get().getAuthResponse().id_token;
}

/**
 * Loads the auth2 library for the g-signin API, and then initializes
 * the googleAuth object.
 * Passed as jquery parameter, executed by API script.
 */
function onStart() {
  gapi.load('auth2', initSigninV2);
}

/**
 * Initializes google authentication API and preforms onload functions.
 */
function initSigninV2() {
  auth2 = gapi.auth2.init({
    client_id : CLIENT_ID
  });

  if (document.getElementById('g-signin-container') != null) {
    fillSigninContainer('g-signin-container');
  }
}

// Creates sign in box and sets event listeners.
function fillSigninContainer(signInContainer) {

  gapi.signin2.render(signInContainer);

  auth2.currentUser.listen(function(newGoogleUser) {
    if (auth2.isSignedIn.get()) {
      insertUserInfo(newGoogleUser);
    }
  });

  auth2.isSignedIn.listen(function(signedIn) {
    if (signedIn) {
      enableUserDropdown();
    } else {
      disableUserDropdown();
    }
  });
}

/**
 * Signs out current user from g-signin API.
 */
function signOut() {
  auth2.signOut();
}

/**
 * To be run in currentUser listener, activates whenever current user changes.
 *
 * @param {GoogleUser} current user to provide profile info.
 */
{'fraction_non_alphanumeric': 0.11064425770308123, 'fraction_numerical': 0.0196078431372549, 'mean_word_length': 3.8717598908594817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2386995', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1095, 'n_words': 314}