Create a new DiscoverProvider using a host-file.
@param {string} hostsFile The path to a json file containing an array of strings.
@returns {DiscoverProvider}
766050
function createJsonFileDiscoverProvider(hostsFile) {
    var fs = require('fs');

    return function jsonFileProvider(callback) {
        fs.readFile(hostsFile, function onFileRead(err, data) {
            if (err) {
                callback(err);
                return;
            }

            var hosts;
            try {
                hosts = JSON.parse(data.toString());
            } catch (e) {
                callback(e);
                return;
            }
            callback(null, hosts);
            return;
        });
    };
}
605603
function loadFromConfig(router, providers, sessionStore) {
  const sitesMap = siteService.sites(),
    siteHosts = _.uniq(_.map(sitesMap, 'host'));

  // iterate through the hosts
  _.each(siteHosts, hostname => {
    const sites = _.filter(sitesMap, {host: hostname}).sort(sortByDepthOfPath);

    addHost({
      router,
      hostname,
      sites,
      providers,
      sessionStore
    });
  });

  return router;
}
342017
protected GitHubClient createClient(String hostname)
			throws MojoExecutionException {
		if (!hostname.contains("://"))
			return new RateLimitedGitHubClient(hostname);
		try {
			URL hostUrl = new URL(hostname);
			return new RateLimitedGitHubClient(hostUrl.getHost(), hostUrl.getPort(),
					hostUrl.getProtocol());
		} catch (MalformedURLException e) {
			throw new MojoExecutionException("Could not parse host URL "
					+ hostname, e);
		}
	}
1366387
function constructHostsList(xmlPreferences) {
  var hostsList = [];

  // look for defined hosts
  var xmlHostList = xmlPreferences['host'];
  if (xmlHostList == null || xmlHostList.length == 0) {
    return [];
  }

  xmlHostList.forEach(function(xmlElement) {
    var host = constructHostEntry(xmlElement);
    if (host) {
      hostsList.push(host);
    }
  });

  return hostsList;
}
1072615
def _get_or_create_hostfile():
    '''
    
    '''
    hfn = __get_hosts_filename()
    if hfn is None:
        hfn = ''
    if not os.path.exists(hfn):
        with salt.utils.files.fopen(hfn, 'w'):
            pass
    return hfn
422788
function createConf(sourceFile, loaders) {

    var allLoaders = [];
    var testFilesPattern = 'src/**/*.test.js';

    if (loaders) {
        allLoaders.concat(loaders);
    }

    // Return a new instance each time.
    var conf = {

        browsers: ['PhantomJS'],

        files: [
            // https://github.com/webpack/style-loader/issues/31
            'node_modules/phantomjs-polyfill/bind-polyfill.js',

            testFilesPattern
        ],

        frameworks: ['jasmine'],

        plugins: [
            karmaWebpackPlugin,
            'karma-jasmine',
            'karma-phantomjs-launcher'
        ],

        preprocessors: {},

        reporters: [
            'dots'
        ],

        webpack: {
            module: {
                loaders: allLoaders
            },
            resolve: {
                alias: {}
            }
        },

        webpackMiddleware: {
            noInfo: true
        }

    };

    // Resolve to the correct file for testing.
    conf.webpack.resolve.alias[webpackConfig.library.projectName] =
        path.join(__dirname, sourceFile);

    conf.preprocessors[testFilesPattern] = ['webpack'];

    return conf;
}
602478
def create(cls, propertyfile, allow_unknown):
        
        with open(propertyfile) as f:
            content = f.read().strip()

        # parse content for known properties
        is_svcomp = False
        known_properties = []
        only_known_svcomp_property = True

        if content == 'OBSERVER AUTOMATON' or content == 'SATISFIABLE':
            known_properties = [_PROPERTY_NAMES[content]]

        elif content.startswith('CHECK'):
            is_svcomp = True
            for line in filter(None, content.splitlines()):
                if content.startswith('CHECK'):
                    # SV-COMP property, either a well-known one or a new one
                    props_in_line = [
                        prop for (substring, prop) in _PROPERTY_NAMES.items() if substring in line]
                    if len(props_in_line) == 1:
                        known_properties.append(props_in_line[0])
                    else:
                        only_known_svcomp_property = False
                else:
                    # not actually an SV-COMP property file
                    is_svcomp = False
                    known_properties = []
                    break

        # check if some known property content was found
        subproperties = None
        if only_known_svcomp_property and len(known_properties) == 1:
            is_well_known = True
            name = known_properties[0]

        elif only_known_svcomp_property and set(known_properties) == _MEMSAFETY_SUBPROPERTIES:
            is_well_known = True
            name = _PROP_MEMSAFETY
            subproperties = list(known_properties)

        else:
            if not allow_unknown:
                raise BenchExecException(
                    'File "{0}" does not contain a known property.'.format(propertyfile))
            is_well_known = False
            name = os.path.splitext(os.path.basename(propertyfile))[0]

        return cls(propertyfile, is_well_known, is_svcomp, name, subproperties)
615966
def hosts_append(hostsfile='/etc/hosts', ip_addr=None, entries=None):
    '''
    
    '''
    host_list = entries.split(',')
    hosts = parse_hosts(hostsfile=hostsfile)
    if ip_addr in hosts:
        for host in host_list:
            if host in hosts[ip_addr]:
                host_list.remove(host)

    if not host_list:
        return 'No additional hosts were added to {0}'.format(hostsfile)

    append_line = '\n{0} {1}'.format(ip_addr, ' '.join(host_list))
    with salt.utils.files.fopen(hostsfile, 'a') as fp_:
        fp_.write(salt.utils.stringutils.to_str(append_line))

    return 'The following line was added to {0}:{1}'.format(hostsfile,
                                                            append_line)
92611
public static JedisCluster newJedisCluster(JedisPoolConfig poolConfig, String hostsAndPorts) {
        return newJedisCluster(poolConfig, hostsAndPorts, null, Protocol.DEFAULT_TIMEOUT, 3);
    }
255951
public static FrameworkProjectConfig create(
            final String name,
            final File propertyFile,
            final IFilesystemFramework filesystemFramework
    )
    {
        return new FrameworkProjectConfig(name, propertyFile, filesystemFramework);
    }
328503
function HttpProvider(host, timeout) {
  if (!(this instanceof HttpProvider)) { throw new Error('[ethjs-provider-http] the HttpProvider instance requires the "new" flag in order to function normally (e.g. `const eth = new Eth(new HttpProvider());`).'); }
  if (typeof host !== 'string') { throw new Error('[ethjs-provider-http] the HttpProvider instance requires that the host be specified (e.g. `new HttpProvider("http://localhost:8545")` or via service like infura `new HttpProvider("http://ropsten.infura.io")`)'); }

  const self = this;
  self.host = host;
  self.timeout = timeout || 0;
}
5009
function HostMapping(settings) {
        settings.init("hostConfig", {});
        settings.init("hostMapping", {});
        settings.init("xdmConfig", {});
        this.settings = settings;
      }
1004585
async function host(filename, options) {
    let files = [path.join(__dirname, "html")];
    if (options.assets) {
        files = [options.assets, ...files];
    }
    const server = new WebSocketHost({assets: files, port: options.port});
    let file;
    if (filename) {
        file = fs.readFileSync(filename).toString();
    } else {
        file = await read_stdin();
    }
    server.host_table("data_source_one", table(file));
    if (options.open) {
        open_browser(options.port);
    }
}
1285943
function discover(callback) {
      if (!callback) return discover.bind(this);
      if (!connection) {
        return connect(function (err) {
          if (err) return callback(err);
          return discover(callback);
        });
      }
      connection.write("git-upload-pack " + opts.pathname + "\0host=" + opts.hostname + "\0");
      sharedDiscover(connection, callback);
    }
70120
def get_hosts_files(option):
    
    if option is not None:
        return option.split(',')

    # Use hosts file from the current dir if it exists
    if os.path.isfile('hosts'):
        return ['hosts']

    # Perhaps it's configured in a configuration file. Try to find a
    # configuration file and see if it contains a `hostsfile` entry.
    config_locations = [
        '.',
        '/etc/ansible/'
    ]
    config_dir = util.find_path(config_locations, 'ansible.cfg')
    log.debug('config_dir = {0}'.format(config_dir))
    if config_dir:
        with open(os.path.join(config_dir, 'ansible.cfg'), 'r') as cf:
            for line in cf:
                if line.startswith('hostfile'):
                    return [line.split('=', 1)[1].strip()]
948187
public static RiakClient newClient(Collection<HostAndPort> hosts, RiakNode.Builder nodeBuilder) throws UnknownHostException
    {
        final RiakCluster cluster = new RiakCluster.Builder(hosts, nodeBuilder).build();
        cluster.start();

        return new RiakClient(cluster);
    }
1206475
function createHostComponentMeta(typeReference, compMeta) {
    var /** @type {?} */ template = __WEBPACK_IMPORTED_MODULE_5__selector__["a" /* CssSelector */].parse(compMeta.selector)[0].getMatchingElementTemplate();
    return CompileDirectiveMetadata.create({
        isHost: true,
        type: { reference: typeReference, diDeps: [], lifecycleHooks: [] },
        template: new CompileTemplateMetadata({
            encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewEncapsulation"].None,
            template: template,
            templateUrl: '',
            styles: [],
            styleUrls: [],
            ngContentSelectors: [],
            animations: []
        }),
        changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectionStrategy"].Default,
        inputs: [],
        outputs: [],
        host: {},
        isComponent: true,
        selector: '*',
        providers: [],
        viewProviders: [],
        queries: [],
        viewQueries: []
    });
}