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

Method _explode_shorthand_ip_string

Lib/ipaddress.py:1860–1879  ·  view source on GitHub ↗

Expand a shortened IPv6 address. Returns: A string, the expanded IPv6 address.

(self)

Source from the content-addressed store, hash-verified

1858 return ':'.join(hextets)
1859
1860 def _explode_shorthand_ip_string(self):
1861 """Expand a shortened IPv6 address.
1862
1863 Returns:
1864 A string, the expanded IPv6 address.
1865
1866 """
1867 if isinstance(self, IPv6Network):
1868 ip_str = str(self.network_address)
1869 elif isinstance(self, IPv6Interface):
1870 ip_str = str(self.ip)
1871 else:
1872 ip_str = str(self)
1873
1874 ip_int = self._ip_int_from_string(ip_str)
1875 hex_str = '%032x' % ip_int
1876 parts = [hex_str[x:x+4] for x in range(0, 32, 4)]
1877 if isinstance(self, (_BaseNetwork, IPv6Interface)):
1878 return '%s/%d' % (':'.join(parts), self._prefixlen)
1879 return ':'.join(parts)
1880
1881 def _reverse_pointer(self):
1882 """Return the reverse DNS pointer name for the IPv6 address.

Callers

nothing calls this directly

Calls 4

_ip_int_from_stringMethod · 0.95
isinstanceFunction · 0.85
strFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected