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)
| 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 | |
| 1911 | class IPv6Address(_BaseV6, _BaseAddress): |
| 1912 |
no test coverage detected