Convert a string representation of a HostHostBusAdapter into an
    object reference.
9162
def _get_hba_type(hba_type):
    '''
    
    '''
    if hba_type == "parallel":
        return vim.host.ParallelScsiHba
    elif hba_type == "block":
        return vim.host.BlockHba
    elif hba_type == "iscsi":
        return vim.host.InternetScsiHba
    elif hba_type == "fibre":
        return vim.host.FibreChannelHba

    raise ValueError('Unknown Host Bus Adapter Type')
552929
def _get_binding_info(hostheader='', ipaddress='*', port=80):
    '''
    
    '''
    ret = r'{0}:{1}:{2}'.format(ipaddress, port, hostheader.replace(' ', ''))

    return ret
1114472
def hostloc(self):
        """"""
        hostloc = self.hostname
        if self.port:
            hostloc = '{hostloc}:{port}'.format(hostloc=hostloc, port=self.port)

        return hostloc
487758
def _parse_host(cls, host='localhost', port=0):
        
        if not port and (host.find(':') == host.rfind(':')):
            i = host.rfind(':')
            if i >= 0:
                host, port = host[:i], host[i + 1:]
                try:
                    port = int(port)
                except ValueError:
                    raise OSError('nonnumeric port')
        return host, port
880999
static String normalizeHostname(String hostname) {
        if (needsNormalization(hostname)) {
            hostname = IDN.toASCII(hostname, IDN.ALLOW_UNASSIGNED);
        }
        return hostname.toLowerCase(Locale.US);
    }
1151935
public static String toSocketAddressString(InetSocketAddress addr) {
        String port = String.valueOf(addr.getPort());
        final StringBuilder sb;

        if (addr.isUnresolved()) {
            String hostname = getHostname(addr);
            sb = newSocketAddressStringBuilder(hostname, port, !isValidIpV6Address(hostname));
        } else {
            InetAddress address = addr.getAddress();
            String hostString = toAddressString(address);
            sb = newSocketAddressStringBuilder(hostString, port, address instanceof Inet4Address);
        }
        return sb.append(':').append(port).toString();
    }
327646
def socketTextStream(self, hostname, port):
        
        deserializer = TCPDeserializer(self._context)
        tcp_text_stream = TCPTextStream()
        tcp_text_stream.listen(port, hostname)
        self._on_stop_cb.append(tcp_text_stream.stop)
        return DStream(tcp_text_stream, self, deserializer)
735808
def beanstalk_host_and_port(uri_string)
      uri = URI.parse(uri_string)
      raise(BadURL, uri_string) if uri.scheme != 'beanstalk'.freeze
      "#{uri.host}:#{uri.port || 11300}"
    end
849683
def ConvertFromWireFormat(self, value, container=None):
    """"""
    result = AnyValue()
    ReadIntoObject(value[2], 0, result)
    if self._type is not None:
      converted_value = self._type(container)
    else:
      converted_value = self._TypeFromAnyValue(result)

    # If one of the protobuf library wrapper classes is used, unwrap the value.
    if result.type_url.startswith("type.googleapis.com/google.protobuf."):
      wrapper_cls = self.__class__.WRAPPER_BY_TYPE[
          converted_value.data_store_type]
      wrapper_value = wrapper_cls()
      wrapper_value.ParseFromString(result.value)
      return converted_value.FromDatastoreValue(wrapper_value.value)
    else:
      # TODO(user): Type stored in type_url is currently ignored when value
      # is decoded. We should use it to deserialize the value and then check
      # that value type and dynamic type are compatible.
      return converted_value.FromSerializedString(result.value)
513583
public static Hosts parse(String hostString, Integer explicitGlobalPort, Integer defaultPort) {
		List<String> hosts = new ArrayList<>();
		List<Integer> ports = new ArrayList<>();
		if ( hostString == null || hostString.trim().isEmpty() ) {
			return Hosts.NO_HOST;
		}
		// for each element between commas
		String[] splits = hostString.split( "," );
		for ( String rawSplit : splits ) {
			// remove whitespaces
			String split = rawSplit.trim();
			//
			Matcher matcher = HOST_AND_PORT_PATTERN.matcher( split );
			if ( matcher.matches() ) {
				setCleanHost( matcher, hosts );
				setPort( ports, matcher, explicitGlobalPort, splits, defaultPort );
			}
			else {
				throw LOG.unableToParseHost( hostString );
			}
		}
		return new Hosts( hosts, ports );
	}
539016
private static String getHost(final String endpoint) {
        String host = URI.create(endpoint).getHost();
        if (host == null) {
            host = URI.create("http://" + endpoint).getHost();
        }
        return host;
    }
1258297
def from_string(self, string_representation, resource=None):
        
        stream = NativeIO(string_representation)
        return self.from_stream(stream, resource=resource)
594710
async def read(cls, *, hostnames: typing.Sequence[str] = None):
        
        params = {}
        if hostnames:
            params["hostname"] = [
                normalize_hostname(hostname)
                for hostname in hostnames
            ]
        data = await cls._handler.read(**params)
        return cls(map(cls._object, data))
960927
static String normalizeHostnamePattern(String hostnamePattern) {
        requireNonNull(hostnamePattern, "hostnamePattern");
        if (needsNormalization(hostnamePattern)) {
            hostnamePattern = IDN.toASCII(hostnamePattern, IDN.ALLOW_UNASSIGNED);
        }

        if (!"*".equals(hostnamePattern) &&
            !HOSTNAME_PATTERN.matcher(hostnamePattern.startsWith("*.") ? hostnamePattern.substring(2)
                                                                       : hostnamePattern).matches()) {
            throw new IllegalArgumentException("hostnamePattern: " + hostnamePattern);
        }

        return Ascii.toLowerCase(hostnamePattern);
    }
516825
def ResolveHostnameToIP(host, port):
  """"""
  ip_addrs = socket.getaddrinfo(host, port, socket.AF_UNSPEC, 0,
                                socket.IPPROTO_TCP)
  # getaddrinfo returns tuples (family, socktype, proto, canonname, sockaddr).
  # We are interested in sockaddr which is in turn a tuple
  # (address, port) for IPv4 or (address, port, flow info, scope id)
  # for IPv6. In both cases, we want the first element, the address.
  result = ip_addrs[0][4][0]
  # TODO: In Python 2, this value is a byte string instead of UTF-8
  # string. To ensure type correctness until support for Python 2 is dropped,
  # we always decode this value.
  if compatibility.PY2:
    result = result.decode("ascii")
  return result
1229998
def __chopStringDict(self, data):
        ''''''

        r = {}
        d = data.split('\t')

        for item in d:
            item_parts = item.split('::')
            if len(item_parts) == 2:
                (name, value) = item_parts
            else:
                name = item_parts[0]
                value = item_parts[1]

            name = self.__filter(name)
            r[name] = value

        if "hostperfdata" in r:
            r["type"] = "hostcheck"
            r["perfdata"] = r["hostperfdata"]
            r["checkcommand"] = re.search("(.*?)!\(?.*", r["hostcheckcommand"]).group(1)
            r["name"] = "hostcheck"
        else:
            r["type"] = "servicecheck"
            r["perfdata"] = r["serviceperfdata"]
            r["checkcommand"] = re.search("((.*)(?=\!)|(.*))", r["servicecheckcommand"]).group(1)
            r["name"] = self.__filter(r["servicedesc"])

        r["hostname"] = self.replacePeriod(self.__filter(r["hostname"]))

        return r
1367714
def map2hosts (hostmap):
    
    ret = hostmap[0].copy()
    for net, mask in hostmap[1]:
        ret.add("%s/%d" % (num2dq(net), mask2netmask(mask)))
    return ret