Merge IP address with addresses from the given address.
196128
public function mergeWith(Address $address): self
    {
        return new static(...\array_merge($this->ipv4, $address->ipv4), ...\array_merge($this->ipv6, $address->ipv6));
    }
267537
def add_ip(self,oid,value,label=None):
		""""""
		self.add_oid_entry(oid,'IPADDRESS',value,label=label)
539604
def expand_ip (ip):
    
    if _ipv4_re.match(ip) or \
       _ipv6_re.match(ip) or \
       _ipv6_ipv4_re.match(ip):
        return (ip, 1)
    if _ipv6_abbr_re.match(ip):
        return (expand_ipv6(ip, 8), 1)
    if _ipv6_ipv4_abbr_re.match(ip):
        i = ip.rfind(":") + 1
        return (expand_ipv6(ip[:i], 6) + ip[i:], 1)
    return (ip, 0)
112005
def add_ipv4addr(self, ipv4addr):
        
        for addr in self.ipv4addrs:
            if ((isinstance(addr, dict) and addr['ipv4addr'] == ipv4addr) or
                (isinstance(addr, HostIPv4) and addr.ipv4addr == ipv4addr)):
                raise ValueError('Already exists')
        self.ipv4addrs.append({'ipv4addr': ipv4addr})
482951
def reset(self, addresses):
        
        request = self._call(SetEnqueueResetReverseDns.SetEnqueueResetReverseDns, IPs=addresses)
        response = request.commit()
        return response['Success']
1333840
def _merge_params(url, params):
    """"""
    if isinstance(params, dict):
        params = list(params.items())

    scheme, netloc, path, query, fragment = urllib.parse.urlsplit(url)
    url_params = urllib.parse.parse_qsl(query, keep_blank_values=True)
    url_params.extend(params)

    query = _encode_data(url_params)

    return urllib.parse.urlunsplit((scheme, netloc, path, query, fragment))
320308
def _split_optional_netmask(address):
    """"""
    addr = _compat_str(address).split('/')
    if len(addr) > 2:
        raise AddressValueError("Only one '/' permitted in %r" % address)
    return addr
1193506
def merge_from(self, other):
        """"""
        if other.country_code is not None:
            self.country_code = other.country_code
        if other.national_number is not None:
            self.national_number = other.national_number
        if other.extension is not None:
            self.extension = other.extension
        if other.italian_leading_zero is not None:
            self.italian_leading_zero = other.italian_leading_zero
        if other.number_of_leading_zeros is not None:
            self.number_of_leading_zeros = other.number_of_leading_zeros
        if other.raw_input is not None:
            self.raw_input = other.raw_input
        if other.country_code_source is not CountryCodeSource.UNSPECIFIED:
            self.country_code_source = other.country_code_source
        if other.preferred_domestic_carrier_code is not None:
            self.preferred_domestic_carrier_code = other.preferred_domestic_carrier_code
152680
def deallocate_ip(self, hostipaddress):
        
        delete_host_from_segment(hostipaddress, self.netaddr, self.auth, self.url)
578493
def AddForwardedIp(self, address, interface):
    
    for ip in list(netaddr.IPNetwork(address)):
      self._RunIfconfig(args=[interface, 'alias', '%s/32' % str(ip)])
1091238
def cli(env, volume_id, hardware_id, virtual_id, ip_address_id, ip_address):
    """"""
    block_manager = SoftLayer.BlockStorageManager(env.client)
    ip_address_id_list = list(ip_address_id)

    # Convert actual IP Addresses to their SoftLayer ids
    if ip_address is not None:
        network_manager = SoftLayer.NetworkManager(env.client)
        for ip_address_value in ip_address:
            ip_address_object = network_manager.ip_lookup(ip_address_value)
            ip_address_id_list.append(ip_address_object['id'])

    block_manager.deauthorize_host_to_volume(volume_id,
                                             hardware_id,
                                             virtual_id,
                                             ip_address_id_list)

    # If no exception was raised, the command succeeded
    click.echo('Access to %s was revoked for the specified hosts' % volume_id)
467703
public static long ipToLong(String ip) {
        if (!isValidIp(ip)) {
            throw new IllegalArgumentException("Invalid IP address: " + ip);
        }

        long result = 0;
        String[] ipArr = ip.split("\\.");
        for (int i = 3; i >= 0; i--) {
            long part = Long.parseLong(ipArr[3 - i]);
            result |= part << (i * 8);
        }
        return result;
    }
1047237
def _split_optional_netmask(address):
    """"""
    addr = str(address).split('/')
    if len(addr) > 2:
        raise AddressValueError("Only one '/' permitted in %r" % address)
    return addr
845726
def convert_to_ip(self):
        """"""
        self._values, self._header._unit = self._header.data_type.to_ip(
                self._values, self._header.unit)
1318297
def to_ip(self, values, from_unit):
        """"""
        if from_unit in self._ip_units:
            return values, from_unit
        elif from_unit == 'degC-hours':
            return self.to_unit(values, 'degF-hours', from_unit), 'degF-hours'
        else:
            return self.to_unit(values, 'degF-days', from_unit), 'degF-days'
60738
def inet_ntop(af, addr):
    """"""
    if af == socket.AF_INET:
        return inet_ntoa(addr)
    elif af == socket.AF_INET6:
        # IPv6 addresses have 128bits (16 bytes)
        if len(addr) != 16:
            raise Exception("Illegal syntax for IP address")
        parts = []
        for left in [0, 2, 4, 6, 8, 10, 12, 14]:
            try: 
                value = struct.unpack("!H", addr[left:left+2])[0]
                hexstr = hex(value)[2:]
            except TypeError:
                raise Exception("Illegal syntax for IP address")
            parts.append(hexstr.lstrip("0").lower())
        result = b":".join(parts)
        while b":::" in result:
            result = result.replace(b":::", b"::")
        # Leaving out leading and trailing zeros is only allowed with ::
        if result.endswith(b":") and not result.endswith(b"::"):
            result = result + b"0"
        if result.startswith(b":") and not result.startswith(b"::"):
            result = b"0" + result
        return result
    else:
        raise Exception("Address family not supported yet")
381778
function(x, y) {
  var ip,
    bits,
    arr,
    ip4,
    ip6;
  if (y === undefined) { // handed a string
    arr = x.split('/');
    this.subnet = arr[1];
    ip = arr[0];
  } else {
    this.subnet = y;
    ip = x;
  }


  ip4 = (ip instanceof Address4 ? ip : new Address4(ip));
  ip6 = (ip instanceof Address6 ? ip : new Address6(ip));

  this.v = (ip4.valid ? 4 : (ip6.valid ? 6 : 0));

  if (this.v === 6) {
    bits = 128;
  } else {
    bits = 32;
  }
  ip = makeAddr(ip, this.v);

  this.mask = generateCidrMask(bits, bits - this.subnet - 1);
  this.prefix = generatePrefix(ip, this.mask);
}