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

Method _split_scope_id

Lib/ipaddress.py:1891–1908  ·  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

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

Callers 1

__init__Method · 0.80

Calls 2

AddressValueErrorClass · 0.85
partitionMethod · 0.45

Tested by

no test coverage detected