MCPcopy Index your code
hub / github.com/RustPython/RustPython / _ipv4_mapped_ipv6_to_str

Method _ipv4_mapped_ipv6_to_str

Lib/ipaddress.py:1975–1991  ·  view source on GitHub ↗

Return convenient text representation of IPv4-mapped IPv6 address See RFC 4291 2.5.5.2, 2.2 p.3 for details. Returns: A string, 'x:x:x:x:x:x:d.d.d.d', where the 'x's are the hexadecimal values of the six high-order 16-bit pieces of the address, and the 'd's

(self)

Source from the content-addressed store, hash-verified

1973 return '.'.join(reverse_chars) + '.ip6.arpa'
1974
1975 def _ipv4_mapped_ipv6_to_str(self):
1976 """Return convenient text representation of IPv4-mapped IPv6 address
1977
1978 See RFC 4291 2.5.5.2, 2.2 p.3 for details.
1979
1980 Returns:
1981 A string, 'x:x:x:x:x:x:d.d.d.d', where the 'x's are the hexadecimal values of
1982 the six high-order 16-bit pieces of the address, and the 'd's are
1983 the decimal values of the four low-order 8-bit pieces of the
1984 address (standard IPv4 representation) as defined in RFC 4291 2.2 p.3.
1985
1986 """
1987 ipv4_mapped = self.ipv4_mapped
1988 if ipv4_mapped is None:
1989 raise AddressValueError("Can not apply to non-IPv4-mapped IPv6 address %s" % str(self))
1990 high_order_bits = self._ip >> 32
1991 return "%s:%s" % (self._string_from_ip_int(high_order_bits), str(ipv4_mapped))
1992
1993 def __str__(self):
1994 ipv4_mapped = self.ipv4_mapped

Callers 1

__str__Method · 0.95

Calls 3

AddressValueErrorClass · 0.85
strFunction · 0.85
_string_from_ip_intMethod · 0.45

Tested by

no test coverage detected