MCPcopy Index your code
hub / github.com/python/cpython / _split_scope_id

Method _split_scope_id

Lib/ipaddress.py:1892–1909  ·  view source on GitHub ↗

Helper function to parse IPv6 string address with scope id. See RFC 4007 for details. Args: ip_str: A string, the IPv6 address. Returns: (addr, scope_id) tuple.

(ip_str)

Source from the content-addressed store, hash-verified

1890
1891 @staticmethod
1892 def _split_scope_id(ip_str):
1893 """Helper function to parse IPv6 string address with scope id.
1894
1895 See RFC 4007 for details.
1896
1897 Args:
1898 ip_str: A string, the IPv6 address.
1899
1900 Returns:
1901 (addr, scope_id) tuple.
1902
1903 """
1904 addr, sep, scope_id = ip_str.partition('%')
1905 if not sep:
1906 scope_id = None
1907 elif not scope_id or '%' in scope_id:
1908 raise AddressValueError('Invalid IPv6 address: "%r"' % ip_str)
1909 return addr, scope_id
1910
1911class IPv6Address(_BaseV6, _BaseAddress):
1912

Callers 1

__init__Method · 0.80

Calls 2

AddressValueErrorClass · 0.85
partitionMethod · 0.45

Tested by

no test coverage detected