Called by the initialiser of Hosts. This reads the entries from the local hosts file,
        converts them into instances of HostsEntry and adds them to the Hosts list of entries.
        :return: None
778167
def populate_entries(self):
        
        try:
            with open(self.hosts_path, 'r') as hosts_file:
                hosts_entries = [line for line in hosts_file]
                for hosts_entry in hosts_entries:
                    entry_type = HostsEntry.get_entry_type(hosts_entry)
                    if entry_type == "comment":
                        hosts_entry = hosts_entry.replace("\r", "")
                        hosts_entry = hosts_entry.replace("\n", "")
                        self.entries.append(HostsEntry(entry_type="comment",
                                                       comment=hosts_entry))
                    elif entry_type == "blank":
                        self.entries.append(HostsEntry(entry_type="blank"))
                    elif entry_type in ("ipv4", "ipv6"):
                        chunked_entry = hosts_entry.split()
                        stripped_name_list = [name.strip() for name in chunked_entry[1:]]

                        self.entries.append(
                            HostsEntry(
                                entry_type=entry_type,
                                address=chunked_entry[0].strip(),
                                names=stripped_name_list))
        except IOError:
            return {'result': 'failed',
                    'message': 'Cannot read: {0}.'.format(self.hosts_path)}
186243
public static void addEntries(File zip, ZipEntrySource[] entries, File destZip) {
    if (log.isDebugEnabled()) {
      log.debug("Copying '" + zip + "' to '" + destZip + "' and adding " + Arrays.asList(entries) + ".");
    }

    OutputStream destOut = null;
    try {
      destOut = new BufferedOutputStream(new FileOutputStream(destZip));
      addEntries(zip, entries, destOut);
    }
    catch (IOException e) {
      ZipExceptionUtil.rethrow(e);
    }
    finally {
      IOUtils.closeQuietly(destOut);
    }
  }
1233711
def initialize(self, name=None, dbname=None, base=None, generator=None,
                   case=None, namespaces=None):

        self.name = none_or(name, str)
        

        self.dbname = none_or(dbname, str)
        """
        The dbname of the site. : str | `None`
        """

        self.base = none_or(base, str)
        """
        TODO: ??? : str | `None`
        """

        self.generator = none_or(generator, str)
        """
        TODO: ??? : str | `None`
        """

        self.case = none_or(case, str)
        """
        TODO: ??? : str | `None`
        """

        self.namespaces = none_or(namespaces, list)
        """
        A list of :class:`mwtypes.Namespace` | `None`
        """
1194614
function (lines, ip, host) {
    // Try to update entry, if host already exists in file
    var didUpdate = false;
    lines = lines.map(function (line) {
      if (Array.isArray(line) && line[1] === host) {
        line[0] = ip;
        didUpdate = true;
      }
      return line;
    });

    // If entry did not exist, let's add it
    if (!didUpdate) {
      lines.push([ip, host]);
    }
    return lines;
  }
433739
def from_file (filename):
    
    entries = []
    with open(filename) as fd:
        lines = []
        for line in fd.readlines():
            line = line.rstrip()
            if not line:
                if lines:
                    entries.append(from_headers("\r\n".join(lines)))
                lines = []
            else:
                lines.append(line)
        if lines:
            entries.append(from_headers("\r\n".join(lines)))
        return entries
1057210
function readEntries (directoryReader, oldEntries, callback) {
  directoryReader.readEntries(
    (entries) => {
      const newEntries = [...oldEntries, ...entries]
      // According to the FileSystem API spec, readEntries() must be called until it calls the callback with an empty array.
      if (entries.length) {
        setTimeout(() => {
          readEntries(directoryReader, newEntries, callback)
        }, 0)
      // Done iterating this particular directory
      } else {
        callback(newEntries)
      }
    },
    // Make sure we resolve on error anyway
    () =>
      callback(oldEntries)
  )
}
532543
def parse_hosts(hostsfile='/etc/hosts', hosts=None):
    '''
    
    '''
    if not hosts:
        try:
            with salt.utils.files.fopen(hostsfile, 'r') as fp_:
                hosts = salt.utils.stringutils.to_unicode(fp_.read())
        except Exception:
            return 'Error: hosts data was not found'

    hostsdict = {}
    for line in hosts.splitlines():
        if not line:
            continue
        if line.startswith('#'):
            continue
        comps = line.split()
        ip = comps[0]
        aliases = comps[1:]
        hostsdict.setdefault(ip, []).extend(aliases)

    return hostsdict
320543
def linkify_hostgroups_hosts(self, hosts):
        
        for hostgroup in self:
            members = hostgroup.get_hosts()
            # The new members identifiers list
            new_members = []
            for member in members:
                # member is an host name
                member = member.strip()
                if not member:  # void entry, skip this
                    continue

                if member == '*':
                    # All the hosts identifiers list
                    new_members.extend(list(hosts.items.keys()))
                else:
                    host = hosts.find_by_name(member)
                    if host is not None:
                        new_members.append(host.uuid)
                        if hostgroup.uuid not in host.hostgroups:
                            host.hostgroups.append(hostgroup.uuid)
                    else:
                        hostgroup.add_unknown_members(member)

            # Make members unique
            new_members = list(set(new_members))

            # We find the id, we replace the names
            hostgroup.replace_members(new_members)
1200
def load_known_hosts(self, filename=None):

        

        if filename is None:
            filename = os.path.expanduser('~/.ssh/known_hosts')
            try:
                self._host_keys.load(filename)
            except IOError:
                # for windows
                filename = os.path.expanduser('~/ssh/known_hosts')
                try:
                    self._host_keys.load(filename)
                except IOError:
                    pass
        else:
            self._host_keys.load(filename)
702963
def thread_local_hosts(read)
      thread_hosts_key = read ? "algolia_search_hosts_#{application_id}" : "algolia_hosts_#{application_id}"
      Thread.current[thread_hosts_key] ||= (read ? search_hosts : hosts).each_with_index.map do |host, i|
        client = HTTPClient.new
        client.ssl_config.ssl_version = @ssl_version if @ssl && @ssl_version
        client.transparent_gzip_decompression = @gzip
        client.ssl_config.add_trust_ca File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'resources', 'ca-bundle.crt'))
        {
          :index => i,
          :base_url => "http#{@ssl ? 's' : ''}://#{host}",
          :session => client,
          :last_call => nil
        }
      end
      hosts = Thread.current[thread_hosts_key]
      thread_index_key = read ? "algolia_search_host_index_#{application_id}" : "algolia_host_index_#{application_id}"
      current_host = Thread.current[thread_index_key].to_i # `to_i` to ensure first call is 0
      # we want to always target host 0 first
      # if the current host is not 0, then we want to use it first only if (we never used it OR we're using it since less than 1 minute)
      if current_host != 0 && (hosts[current_host][:last_call].nil? || hosts[current_host][:last_call] > Time.now.to_i - 60)
        # first host will be `current_host`
        first = hosts[current_host]
        [first] + hosts.reject { |h| h[:index] == 0 || h == first } + hosts.select { |h| h[:index] == 0 }
      else
        # first host will be `0`
        hosts
      end
    end
719277
def get_entry_type(hosts_entry=None):
        
        if hosts_entry and isinstance(hosts_entry, str):
            entry = hosts_entry.strip()
            if not entry or not entry[0] or entry[0] == "\n":
                return 'blank'
            if entry[0] == "#":
                return 'comment'
            entry_chunks = entry.split()
            if is_ipv6(entry_chunks[0]):
                return 'ipv6'
            if is_ipv4(entry_chunks[0]):
                return 'ipv4'
1094466
void readDirectives()
  {
    KeyUpdSSD keyUpdDir = ssdManager.getKeyUpdateSSD();
    HostSpecSSD hostSpecDir = ssdManager.getHostSpecBypassSSD();

    if (keyUpdDir != null)
    {
      processKeyUpdateDirective(keyUpdDir.getIssuer(), keyUpdDir.getKeyUpdDirective());
    }

    if (hostSpecDir != null)
    {
      ssdManager.addToSSDCache(hostSpecDir.getHostSpecDirective());
    }
  }
648769
def update_hosts(self, host_names):

        

        if self.host_access:
            curr_hosts = [access.host.name for access in self.host_access]
        else:
            curr_hosts = []

        if set(curr_hosts) == set(host_names):
            log.info('Hosts for updating is equal to current hosts, '
                     'skip modification.')
            return None

        new_hosts = [UnityHostList.get(cli=self._cli, name=host_name)[0]
                     for host_name in host_names]
        new_access = [{'host': item,
                       'accessMask': HostLUNAccessEnum.PRODUCTION}
                      for item in new_hosts]
        resp = self.modify(host_access=new_access)
        resp.raise_if_err()
        return resp
886830
def _get_hosts(self, host):
        
        try:
            return shlex.split(host)
        except ValueError:
            raise Exception("Unparsable host {}".format(host))
277384
def init(cnf):
    '''
    
    '''
    CONFIG['host'] = cnf.get('proxy', {}).get('host')
    if not CONFIG['host']:
        raise MinionError(message="Cannot find 'host' parameter in the proxy configuration")

    CONFIG['user'] = cnf.get('proxy', {}).get('user')
    if not CONFIG['user']:
        raise MinionError(message="Cannot find 'user' parameter in the proxy configuration")

    CONFIG['uri'] = "/api/{0}".format(CONFIG['user'])
1226005
def _load_entries(self):
        """"""

        rel_path = os.path.join('~','cltk_data',
                                'french',
                                'text','french_data_cltk'
                                ,'entries.py')
        path = os.path.expanduser(rel_path)
        #logger.info('Loading entries. This may take a minute.')
        loader = importlib.machinery.SourceFileLoader('entries', path)
        module = loader.load_module()
        entries = module.entries
        return entries
409753
def initialize(self, host):
        
        self.host = host
        self.storage_client = BlockBlobService(account_name=self.storage_account_name,
                                               account_key=self.storage_account_key,
                                               sas_token=self.storage_sas_token,
                                               endpoint_suffix=self.endpoint_suffix,
                                               connection_string=self.connection_string,
                                               request_session=self.request_session)
        self.consumer_group_directory = self.storage_blob_prefix + self.host.eh_config.consumer_group