<commit_before>exports = module.exports = function(IoC, logger) {
  // Load modules.
  var passport = require('passport');
  
  
  var authenticator = new passport.Authenticator();
  
  authenticator.serializeUser(function(user, cb) {
    console.log('SERIALIZE!!!!');
    
    cb(null, user);
  });

  authenticator.deserializeUser(function(obj, cb) {
    console.log('DESERIALIZE!!!!');
    
    cb(null, obj);
  });
  
  return Promise.resolve(authenticator)
    .then(function(authenticator) {
      
      // Register HTTP authentication schemes.
      var components = IoC.components('http://i.bixbyjs.org/http/auth/Scheme');
      
      return Promise.all(components.map(function(comp) { return comp.create(); } ))
        .then(function(schemes) {
          schemes.forEach(function(scheme, i) {
            authenticator.use(components[i].a['@scheme'] || scheme.name, scheme);
            logger.info('Loaded HTTP authentication scheme: ' + (components[i].a['@scheme'] || scheme.name));
          });
        })
        .then(function() {
          return authenticator;
        });
    })
    .then(function(authenticator) {<commit_msg>More resiliant plugin loading.<commit_after>exports = module.exports = function(IoC, logger) {
  // Load modules.
  var passport = require('passport');
  
  
  var authenticator = new passport.Authenticator();
  
  authenticator.serializeUser(function(user, cb) {
    console.log('SERIALIZE!!!!');
    
    cb(null, user);
  });

  authenticator.deserializeUser(function(obj, cb) {
    console.log('DESERIALIZE!!!!');
    
    cb(null, obj);
  });
  
  return Promise.resolve(authenticator)
    .then(function(authenticator) {
      // Register HTTP authentication schemes.
      return new Promise(function(resolve, reject) {
        var components = IoC.components('http://i.bixbyjs.org/http/auth/Scheme');
        
        (function iter(i) {
          var component = components[i];
          if (!component) {
            return resolve(authenticator);
          }
          
          component.create()
            .then(function(scheme) {
              logger.info('Loaded HTTP authentication scheme: ' + (component.a['@scheme'] || scheme.name));
              
              authenticator.use(component.a['@scheme'] || scheme.name, scheme);
              iter(i + 1);
            }, function(err) {
              // TODO: Make this IMPLEMENTATION_NOT_FOUND
              // TODO: Make the error have the stack of dependencies.
              if (err.code == 'INTERFACE_NOT_FOUND') {
                logger.notice(err.message + ' while loading component ' + component.id);
                return iter(i + 1);
              }
              
              reject(err);
            })
        })(0);
      });
    })
    .then(function(authenticator) {
{'fraction_non_alphanumeric': 0.1416339636104174, 'fraction_numerical': 0.0010702818408847663, 'mean_word_length': 2.2529002320185616, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5416283', 'n_tokens_mistral': 801, 'n_tokens_neox': 780, 'n_words': 143}