Package private to enable testing
770714
SXSSFWorkbook dataSetToWorkbook(DataSet dataSet) {
        // TODO?: Excel 2010 limits: 1,048,576 rows by 16,384 columns; row width 255 characters
        if (dataSet == null) {
            throw new IllegalArgumentException("Null dataSet specified!");
        }
        int columnCount = dataSet.getColumns().size();
        int rowCount = dataSet.getRowCount() + 1; //Include header row;
        int row = 0;

        SXSSFWorkbook wb = new SXSSFWorkbook(100); // keep 100 rows in memory, exceeding rows will be flushed to disk
        Map<String, CellStyle> styles = createStyles(wb);
        SXSSFSheet sh = wb.createSheet("Sheet 1");

        // General setup
        sh.setDisplayGridlines(true);
        sh.setPrintGridlines(false);
        sh.setFitToPage(true);
        sh.setHorizontallyCenter(true);
        sh.trackAllColumnsForAutoSizing();
        PrintSetup printSetup = sh.getPrintSetup();
        printSetup.setLandscape(true);

        // Create header
        Row header = sh.createRow(row++);
        header.setHeightInPoints(20f);
        for (int i = 0; i < columnCount; i++) {
            Cell cell = header.createCell(i);
            cell.setCellStyle(styles.get("header"));
            cell.setCellValue(dataSet.getColumnByIndex(i).getId());
        }

        // Create data rows
        for (; row < rowCount; row++) {
            Row _row = sh.createRow(row);
            for (int cellnum = 0; cellnum < columnCount; cellnum++) {
                Cell cell = _row.createCell(cellnum);
                Object value = dataSet.getValueAt(row - 1,
                                                  cellnum);
                if (value instanceof Short || value instanceof Long || value instanceof Integer || value instanceof BigInteger) {
                    cell.setCellType(CellType.NUMERIC);
                    cell.setCellStyle(styles.get("integer_number_cell"));
                    cell.setCellValue(((Number) value).doubleValue());
                } else if (value instanceof Float || value instanceof Double || value instanceof BigDecimal) {
                    cell.setCellType(CellType.NUMERIC);
                    cell.setCellStyle(styles.get("decimal_number_cell"));
                    cell.setCellValue(((Number) value).doubleValue());
                } else if (value instanceof Date) {
                    cell.setCellType(CellType.STRING);
                    cell.setCellStyle(styles.get("date_cell"));
                    cell.setCellValue((Date) value);
                } else if (value instanceof Interval) {
                    cell.setCellType(CellType.STRING);
                    cell.setCellStyle(styles.get(TEXT_CELL));
                    cell.setCellValue(((Interval) value).getName());
                } else {
                    cell.setCellType(CellType.STRING);
                    cell.setCellStyle(styles.get(TEXT_CELL));
                    String val = value == null ? "" : value.toString();
                    cell.setCellValue(val);
                }
            }
        }

        // Adjust column size
        for (int i = 0; i < columnCount; i++) {
            sh.autoSizeColumn(i);
        }
        return wb;
    }
1757
def system(session):
    """"""

    # Sanity check: Only run system tests if the environment variable is set.
    if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
        session.skip('Credentials must be set via environment variable.')

    # Install all test dependencies, then install this package into the
    # virtualenv's dist-packages.
    session.install('pytest')
    session.install('-e', os.path.join('..', 'test_utils'))
    for local_dep in LOCAL_DEPS:
        session.install('-e', local_dep)
    session.install('-e', '.[pandas,fastavro]')

    # Run py.test against the system tests.
    session.run('py.test', '--quiet', 'tests/system/')
604782
def system(session):
    """"""
    system_test_path = os.path.join("tests", "system.py")
    system_test_folder_path = os.path.join("tests", "system")
    # Sanity check: Only run tests if the environment variable is set.
    if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""):
        session.skip("Credentials must be set via environment variable")

    system_test_exists = os.path.exists(system_test_path)
    system_test_folder_exists = os.path.exists(system_test_folder_path)
    # Sanity check: only run tests if found.
    if not system_test_exists and not system_test_folder_exists:
        session.skip("System tests were not found")

    # Use pre-release gRPC for system tests.
    session.install("--pre", "grpcio")

    # Install all test dependencies, then install this package into the
    # virtualenv's dist-packages.
    session.install("mock", "pytest")
    for local_dep in LOCAL_DEPS:
        session.install("-e", local_dep)
    session.install("-e", "../test_utils/")
    session.install("-e", ".")

    # Run py.test against the system tests.
    if system_test_exists:
        session.run("py.test", "--quiet", system_test_path, *session.posargs)
    if system_test_folder_exists:
        session.run("py.test", "--quiet", system_test_folder_path, *session.posargs)
581752
def main(args=sys.argv):
    
    try:
        opts, args = getopt.gnu_getopt(args[1:], 'p:o:jdt', [
            'jspath=', 'output=', 'private', 'json', 'dependencies', 
            'test', 'help'])
        opts = dict(opts)
    except getopt.GetoptError:
        usage()
        sys.exit(2)

    run_and_exit_if(opts, run_doctests, '--test')
    run_and_exit_if(opts, usage, '--help')

    js_paths = get_path_list(opts)
    docs = CodeBaseDoc(js_paths, '--private' in opts)
    if args:
        selected_files = set(docs.keys()) & set(args)
    else:
        selected_files = list(docs.keys())

    def print_json():
        print(docs.to_json(selected_files))
    run_and_exit_if(opts, print_json, '--json', '-j')

    def print_dependencies():
        for dependency in find_dependencies(selected_files, docs):
            print(dependency)
    run_and_exit_if(opts, print_dependencies, '--dependencies', '-d')

    output = opts.get('--output') or opts.get('-o')
    if output is None and len(args) != 1:
        output = 'apidocs'
    docs.save_docs(selected_files, output)
1332365
private static void getClassPackageNames(Class<?> clazz, Map<String, Class<?>> packageNames) {
    if (isPrivate(clazz)) {
      throw new IllegalArgumentException(PrettyPrinter.format(
          "Unable to inject an instance of %s because it is a private class.", clazz));
    } else if (!isPublic(clazz)) {
      packageNames.put(clazz.getPackage().getName(), clazz);
    }

    Class<?> enclosingClass = clazz.getEnclosingClass();
    if (enclosingClass != null) {
      getClassPackageNames(enclosingClass, packageNames);
    }
  }
997989
def prepare(ctx, new_version=None, version_part=None, hide=True,
            dry_run=False):
    """"""
    if new_version is not None:
        bump_version(ctx, new_version, version_part=version_part,
                     dry_run=dry_run)
    build_packages(ctx, hide=hide)
    packages = ensure_packages_exist(ctx, check_only=True)
    print_packages(packages)
208859
private void init(Symtab syms, boolean definitive) {
        if (classes != null) return;

        if (definitive) {
            Assert.check(packages == null || packages == syms.packages);
            packages = syms.packages;
            Assert.check(classes == null || classes == syms.classes);
            classes = syms.classes;
        } else {
            packages = new HashMap<Name, PackageSymbol>();
            classes = new HashMap<Name, ClassSymbol>();
        }

        packages.put(names.empty, syms.rootPackage);
        syms.rootPackage.completer = thisCompleter;
        syms.unnamedPackage.completer = thisCompleter;
    }
348791
boolean isPackagePrivate(Element element) {
        Set<Modifier> modifiers = element.getModifiers();
        return !(modifiers.contains(PUBLIC)
            || modifiers.contains(PROTECTED)
            || modifiers.contains(PRIVATE));
    }
226787
function plugin(suite) {
	// Instance
	var instance = {
		devices: [],
		// Register the plugin's name
		name: pkg.name
	};
	// Options
	var options = util.extend({}, defaultConfig, suite.options);

	// // Dependencies
	// // Add the plugin's `root`
	// suite.addRoot(path.join(__dirname, 'defaults'));
	// // API
	// suite.api.browser = {};

	// Listen for a new Session creation
	suite.on('create session', function (session) {
		session.on('pre run', function () {
			instance.devices.each = util.forEachSeries(instance.devices);
			// var devices = [];
			// before(function () {
			//   this.plugins.browser = {};
			//   this.plugins.browser.devices = devices;
			//   devices.each = util.forEachSeries(devices);
			// });

			before(function (done) {
				this.timeout(options.timeout);

				// this.plugins[name] = ctx;

				if (!instance.devices.length) {
					// throw new Error(name + ': A device must be in use to run tests.');
					throw new Error('A device must be in use to run tests.');
				}

				// Load the choosen devices
				instance.devices.each(function (device, next) {
					device.start(next);
				}, done);
			});

			after(function (done) {
				instance.devices.each(function (device, next) {
					device.stop(next);
				}, done);
			});
		});
	});

	return instance;
}
455793
ScopeState visibilityIn(String pkg, QualifiedName type) {
    if (pkg == null) {
      return visibilityIn(UNIVERSALLY_VISIBLE_PACKAGE, type);
    } else if (isTopLevelType(pkg, type.getSimpleName())) {
      if (type.isTopLevel() && type.getPackage().equals(pkg)) {
        return ScopeState.IN_SCOPE;
      } else {
        return ScopeState.HIDDEN;
      }
    } else if (!pkg.equals(UNIVERSALLY_VISIBLE_PACKAGE)) {
      return visibilityIn(UNIVERSALLY_VISIBLE_PACKAGE, type);
    } else {
      return ScopeState.IMPORTABLE;
    }
  }
160756
def main():
  
  parser = argparse.ArgumentParser(description='A distributed test framework')
  parser.add_argument('testfile',
      help='The file that is used to determine the test suite run')
  parser.add_argument('--test-only',
      nargs='*',
      dest='test_list',
      help='run only the named tests to help debug broken tests')
  parser.add_argument('--machine-list',
      nargs='*',
      dest='machine_list',
      help='''mapping of logical host names to physical names allowing the same
              test suite to run on different hardware, each argument is a pair
              of logical name and physical name separated by a =''')
  parser.add_argument('--config-overrides',
      nargs='*',
      dest='config_overrides',
      help='''config overrides at execution time, each argument is a config with
              its value separated by a =. This has the highest priority of all
              configs''')
  parser.add_argument('-d', '--output-dir',
      dest='output_dir',
      help='''Directory to write output files and logs. Defaults to the current
              directory.''')
  parser.add_argument("--log-level", dest="log_level", help="Log level (default INFO)", default="INFO")
  parser.add_argument("--console-log-level", dest="console_level", help="Console Log level (default ERROR)",
                      default="ERROR")
  parser.add_argument("--nopassword", action='store_true', dest="nopassword", help="Disable password prompt")
  parser.add_argument("--user", dest="user", help="user to run the test as (defaults to current user)")
  args = parser.parse_args()
  try:
    call_main(args)
  except ValueError:
    #We only sys.exit here, as call_main is used as part of a unit test
    #and should not exit the system
    sys.exit(1)
111569
function(args, done) {
  function run(cmd) {
    return function(cb) {
      debug('testing `%s`', cmd);
      var parts = cmd.split(' ');
      var bin = parts.shift();
      var args = parts;
      var completed = false;

      var child = spawn(bin, args, {
        cwd: args['<directory>']
      })
        .on('error', function(err) {
          completed = true;
          done(new Error(cmd + ' failed: ' + err.message));
        });

      child.stderr.pipe(process.stderr);

      if (cmd === 'npm start') {
        setTimeout(function() {
          if (completed) {
            return;
          }

          completed = true;
          child.kill('SIGKILL');
          done();
        }, 5000);
      }

      child.on('close', function(code) {
        if (completed) {
          return;
        }

        completed = true;

        if (code === 0) {
          done();
          return;
        }

        cb(new Error(cmd + ' failed'));
      });
    };
  }
  debug('checking first run');


  var dir = path.resolve(args['<directory>']);

  var pkg = require(path.join(dir, 'package.json'));

  debug('clearing local node_modules to make sure install works');

  rimraf(dir + '/node_modules/**/*', function(err) {
    if (err) {
      return done(err);
    }
    var tasks = [
      run('npm install'),
      run('npm test')
    ];

    if (pkg.scripts.start) {
      tasks.push(run('npm start'));
    }

    async.series(tasks, function(err, results) {
      if (err) {
        return done(err);
      }
      done(null, results);
    });
  });
}
370242
function tryBindPath(serverless, bindPath, testFile) {
  const options = [
    'run',
    '--rm',
    '-v',
    `${bindPath}:/test`,
    'alpine',
    'ls',
    `/test/${testFile}`
  ];
  try {
    const ps = dockerCommand(options);
    if (process.env.SLS_DEBUG) {
      serverless.cli.log(`Trying bindPath ${bindPath} (${options})`);
      serverless.cli.log(ps.stdout.trim());
    }
    return ps.stdout.trim() === `/test/${testFile}`;
  } catch (err) {
    return false;
  }
}
1170453
function checkPkg(pkgDir, scopes) {
  var errors;
  try {
    var config = {packageDir: pkgDir};
    if (scopes) {
      config.scopeList = scopes;
    }
    var checked = checkDeps.sync(config);
    if (checked.error.length) {
      errors = checked.error;
    }
  } finally {
    // eslint-disable-next-line no-unsafe-finally
    return errors;
  }
}
892820
def enable(cls, args):
        """"""
        mgr = NAppsManager()

        if args['all']:
            napps = mgr.get_disabled()
        else:
            napps = args['<napp>']

        cls.enable_napps(napps)
1093815
def perform_release(context):
    """"""
    try:
        run_tests()

        if not context.skip_changelog:
            generate_changelog(context)

        increment_version(context)

        build_distributions(context)

        install_package(context)

        upload_package(context)

        install_from_pypi(context)

        publish(context)
    except Exception:
        log.exception('Error releasing')
946505
function _defaultEnabled(env, addonConfig) {
  let usingInDev = env === 'development' && !addonConfig.usingProxy;
  let usingInTest = env === 'test';

  return usingInDev || usingInTest;
}