<commit_before>var util = require('util');

var DEFER_LABEL = 'NG_DEFER_BOOTSTRAP!';
/**
 * @param {webdriver.WebDriver} webdriver
 * @constructor
 */
var Protractor = function(webdriver) {
  this.driver = webdriver;

  this.moduleNames_ = [];

  this.moduleScripts_ = [];
};

Protractor.prototype.waitForAngular = function() {
  return this.driver.executeAsyncScript(function() {
    var callback = arguments[arguments.length - 1];
    angular.element(document.body).injector().get('$browser').
    notifyWhenNoOutstandingRequests(callback);
  });
};

Protractor.prototype.findElement = function(locator, varArgs) {
  this.waitForAngular();
  return this.driver.findElement(locator, varArgs);
};

Protractor.prototype.addMockModule = function(name, script) {
  this.moduleNames_.push(name);
  this.moduleScripts_.push(script);
};

Protractor.prototype.clearMockModules = function() {
  this.moduleNames_ = [];
  this.moduleScripts_ = [];
};

Protractor.prototype.get = function(destination) {
  this.driver.get('about:blank');
  this.driver.executeScript('window.name += "' + DEFER_LABEL + '";' + 
      'window.location.href = "' + destination + '"');
      // At this point, Angular will pause for us, until angular.resumeBootstrap is called.

  for (var i = 0; i < this.moduleScripts_.length; ++i) {
    this.driver.executeScript(this.moduleScripts_[i]);
  }

  this.driver.executeAsyncScript(function() {
    var callback = arguments[arguments.length - 1];
    // Continue to bootstrap Angular.
    angular.resumeBootstrap(arguments[0]);
    callback();
  }, this.moduleNames_);
};

exports.wrapDriver = function(webdriver) {
  return new Protractor(webdriver);
};


/**
 * Locators.
 */
var ProtractorBy = function() {}
var WebdriverBy = function() {};
WebdriverBy.prototype = require('selenium-webdriver').By;

util.inherits(ProtractorBy, WebdriverBy);

ProtractorBy.prototype.binding = function() {
  return {
    using: 'js',
    value: function() {
      var bindings = document.getElementsByClassName('ng-binding');
      var matches = [];
      var binding = arguments[0];
      for (var i = 0; i < bindings.length; ++i) {
        if (angular.element(bindings[i]).data().$binding[0].exp == binding) {
          matches.push(bindings[i]);
        }
      }
      
      return matches[0]; // We can only return one with webdriver.findElement.
    }
  };
};

ProtractorBy.prototype.select = function(model) {
  return {
    using: 'css selector',
    value: 'select[ng-model=' + model + ']'
  };
};

ProtractorBy.prototype.selectedOption = function(model) {
  return {
    using: 'css selector',
    value: 'select[ng-model=' + model + '] option[selected]'
  };
};

ProtractorBy.prototype.input = function(model) {
  return {
    using: 'css selector',
    value: 'input[ng-model=' + model + ']'
  };
};
ProtractorBy.prototype.repeater = null;

exports.By = new ProtractorBy();<commit_msg>Move imports to the top, 80 line fixup.<commit_after>var util = require('util');
var webdriver = require('selenium-webdriver');

var DEFER_LABEL = 'NG_DEFER_BOOTSTRAP!';
/**
 * @param {webdriver.WebDriver} webdriver
 * @constructor
 */
var Protractor = function(webdriver) {
  this.driver = webdriver;

  this.moduleNames_ = [];

  this.moduleScripts_ = [];
};

Protractor.prototype.waitForAngular = function() {
  return this.driver.executeAsyncScript(function() {
    var callback = arguments[arguments.length - 1];
    angular.element(document.body).injector().get('$browser').
    notifyWhenNoOutstandingRequests(callback);
  });
};

Protractor.prototype.findElement = function(locator, varArgs) {
  this.waitForAngular();
  return this.driver.findElement(locator, varArgs);
};

Protractor.prototype.addMockModule = function(name, script) {
  this.moduleNames_.push(name);
  this.moduleScripts_.push(script);
};

Protractor.prototype.clearMockModules = function() {
  this.moduleNames_ = [];
  this.moduleScripts_ = [];
};

Protractor.prototype.get = function(destination) {
  this.driver.get('about:blank');
  this.driver.executeScript('window.name += "' + DEFER_LABEL + '";' + 
      'window.location.href = "' + destination + '"');
      // At this point, Angular will pause for us, until angular.resumeBootstrap
      // is called.

  for (var i = 0; i < this.moduleScripts_.length; ++i) {
    this.driver.executeScript(this.moduleScripts_[i]);
  }

  this.driver.executeAsyncScript(function() {
    var callback = arguments[arguments.length - 1];
    // Continue to bootstrap Angular.
    angular.resumeBootstrap(arguments[0]);
    callback();
  }, this.moduleNames_);
};

exports.wrapDriver = function(webdriver) {
  return new Protractor(webdriver);
};


/**
 * Locators.
 */
var ProtractorBy = function() {}
var WebdriverBy = function() {};
WebdriverBy.prototype = webdriver.By;

util.inherits(ProtractorBy, WebdriverBy);

ProtractorBy.prototype.binding = function() {
  return {
    using: 'js',
    value: function() {
      var bindings = document.getElementsByClassName('ng-binding');
      var matches = [];
      var binding = arguments[0];
      for (var i = 0; i < bindings.length; ++i) {
        if (angular.element(bindings[i]).data().$binding[0].exp == binding) {
          matches.push(bindings[i]);
        }
      }
      
      return matches[0]; // We can only return one with webdriver.findElement.
    }
  };
};

ProtractorBy.prototype.select = function(model) {
  return {
    using: 'css selector',
    value: 'select[ng-model=' + model + ']'
  };
};

ProtractorBy.prototype.selectedOption = function(model) {
  return {
    using: 'css selector',
    value: 'select[ng-model=' + model + '] option[selected]'
  };
};

ProtractorBy.prototype.input = function(model) {
  return {
    using: 'css selector',
    value: 'input[ng-model=' + model + ']'
  };
};

ProtractorBy.prototype.repeater = null;

exports.By = new ProtractorBy();
{'fraction_non_alphanumeric': 0.1549223681965535, 'fraction_numerical': 0.0030711482682136155, 'mean_word_length': 3.8088597210828548, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1247497', 'n_tokens_mistral': 1890, 'n_tokens_neox': 1829, 'n_words': 341}