Return a list of parsed hosts info, with the limit applied if required.
429218
def get_hosts(self):
        
        limited_hosts = {}
        if self.limit is not None:
            # Find hosts and groups of hosts to include
            for include in self.limit['include']:
                # Include whole group
                for hostname in self.hosts_in_group(include):
                    limited_hosts[hostname] = self.hosts[hostname]
                # Include individual host
                if include in self.hosts:
                    limited_hosts[include] = self.hosts[include]
            # Find hosts and groups of hosts to exclude
            for exclude in self.limit["exclude"]:
                # Exclude whole group
                for hostname in self.hosts_in_group(exclude):
                    if hostname in limited_hosts:
                        limited_hosts.pop(hostname)
                # Exclude individual host
                if exclude in limited_hosts:
                    limited_hosts.pop(exclude)

            return limited_hosts
        else:
            # Return all hosts
            return self.hosts
791480
def _get_ids_from_hostname(self, hostname):
        """"""
        results = self.list_instances(hostname=hostname, mask="id")
        return [result['id'] for result in results]
401159
def gethosts(self):
        
        self.hosts = get_ip_scope_hosts(self.auth, self.url, self.id)
375012
def _getaddrinfo(self, host: str, family: int=socket.AF_UNSPEC) \
            -> List[tuple]:
        '''
        '''
        event_loop = asyncio.get_event_loop()
        query = event_loop.getaddrinfo(host, 0, family=family,
                                       proto=socket.IPPROTO_TCP)

        if self._timeout:
            query = asyncio.wait_for(query, self._timeout)

        try:
            results = yield from query
        except socket.error as error:
            if error.errno in (
                    socket.EAI_FAIL,
                    socket.EAI_NODATA,
                    socket.EAI_NONAME):
                raise DNSNotFound(
                    'DNS resolution failed: {error}'.format(error=error)
                ) from error
            else:
                raise NetworkError(
                    'DNS resolution error: {error}'.format(error=error)
                ) from error
        except asyncio.TimeoutError as error:
            raise NetworkError('DNS resolve timed out.') from error
        else:
            return results
944622
def failed_hosts(self):
        """"""
        return {h: r for h, r in self.items() if r.failed}
322897
def get_all_names(offset=None, count=None, include_expired=False, proxy=None, hostport=None):
    
    assert proxy or hostport, 'Need proxy or hostport'
    if proxy is None:
        proxy = connect_hostport(hostport)

    offset = 0 if offset is None else offset

    if count is None:
        # get all names after this offset
        count = get_num_names(proxy=proxy, hostport=hostport)
        if json_is_error(count):
            # error
            return count

        count -= offset

    page_size = 100
    all_names = []
    while len(all_names) < count:
        request_size = page_size
        if count - len(all_names) < request_size:
            request_size = count - len(all_names)

        page = get_all_names_page(offset + len(all_names), request_size, include_expired=include_expired, proxy=proxy, hostport=hostport)
        if json_is_error(page):
            # error
            return page

        if len(page) > request_size:
            # error
            error_str = 'server replied too much data'
            return {'error': error_str, 'http_status': 503}
        elif len(page) == 0:
            # end-of-table
            break

        all_names += page

    return all_names
486048
def getservers(self, vhost = None):
        '''
        
        '''
        if vhost is not None:
            return [s for s in self.connections if s.protocol.vhost == vhost]
        else:
            return list(self.connections)
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
1045976
def failed_hosts(self) -> Dict[str, "MultiResult"]:
        
        return {k: v for k, v in self.result.items() if v.failed}
1161342
def GetNumCoresOnHosts(hosts, private_key):
  
  results = runner.Runner(host_list=hosts, private_key=private_key,
                          module_name='setup').run()
  num_cores_list = []
  for _, props in results['contacted'].iteritems():
    cores = props['ansible_facts']['ansible_processor_cores']
    val = 0
    try:
      val = int(cores)
    except ValueError:
      pass
    num_cores_list.append(val)
  return num_cores_list
809649
def get_host_sets
      begin
        @host_set.get_host_sets
      rescue => ex
        Util.log_exception(ex, caller_locations(1, 1)[0].label)
        raise ex
      end
    end
1227273
def host_domains(self, ip=None, limit=None, **kwargs):
        """"""
        return self._results('reverse-ip', '/v1/{0}/host-domains'.format(ip), limit=limit, **kwargs)
844046
def list_hosts(kwargs=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_hosts function must be called with '
            '-f or --function.'
        )

    return {'Hosts': salt.utils.vmware.list_hosts(_get_si())}
461429
def get_hostnames(self):
        
        hosts = set()
        for entry in self._config:
            hosts.update(entry["host"])
        return hosts
923285
def get_plugins_info(self, limit=10, offset=10):
        
        params = {}
        if offset:
            params['offset'] = offset
        if limit:
            params['limit'] = limit
        url = 'rest/1.0/plugins'
        return (self.get(url, params=params) or {}).get('plugins')
1080989
def valid_hosts(hosts):
    
    if _empty.match(hosts):
        return False

    for host in hosts.split(","):
        if not valid_host_with_port(host):
            return False

    return True
1353246
def hosts_to_endpoints(hosts, port=2181):
    
    endpoints = []
    for host in hosts.split(","):
        endpoints.append(tuple(host.rsplit(":", 1)) if ":" in host else (host, port))
    return endpoints