Lines Matching refs:ip_str
500 def _prefix_from_ip_string(cls, ip_str):
504 ip_str: The netmask/hostmask to be converted
514 ip_int = cls._ip_int_from_string(ip_str)
516 cls._report_invalid_netmask(ip_str)
531 cls._report_invalid_netmask(ip_str)
1184 def _ip_int_from_string(cls, ip_str):
1188 ip_str: A string, the IP ip_str.
1191 The IP ip_str as an integer.
1194 AddressValueError: if ip_str isn't a valid IPv4 Address.
1197 if not ip_str:
1200 octets = ip_str.split('.')
1202 raise AddressValueError("Expected 4 octets in %r" % ip_str)
1207 raise AddressValueError("%s in %r" % (exc, ip_str)) from None
1618 def _ip_int_from_string(cls, ip_str):
1619 """Turn an IPv6 ip_str into an integer.
1622 ip_str: A string, the IPv6 ip_str.
1628 AddressValueError: if ip_str isn't a valid IPv6 Address.
1631 if not ip_str:
1634 parts = ip_str.split(':')
1639 msg = "At least %d parts expected in %r" % (_min_parts, ip_str)
1647 raise AddressValueError("%s in %r" % (exc, ip_str)) from None
1656 msg = "At most %d colons permitted in %r" % (_max_parts-1, ip_str)
1666 msg = "At most one '::' permitted in %r" % ip_str
1680 raise AddressValueError(msg % ip_str) # ^: requires ^::
1685 raise AddressValueError(msg % ip_str) # :$ requires ::$
1689 raise AddressValueError(msg % (cls._HEXTET_COUNT-1, ip_str))
1696 raise AddressValueError(msg % (cls._HEXTET_COUNT, ip_str))
1699 raise AddressValueError(msg % ip_str) # ^: requires ^::
1702 raise AddressValueError(msg % ip_str) # :$ requires ::$
1719 raise AddressValueError("%s in %r" % (exc, ip_str)) from None
1825 ip_str: A string, the IPv6 address.
1832 ip_str = str(self.network_address)
1834 ip_str = str(self.ip)
1836 ip_str = str(self)
1838 ip_int = self._ip_int_from_string(ip_str)
1855 def _split_scope_id(ip_str):
1861 ip_str: A string, the IPv6 address.
1867 addr, sep, scope_id = ip_str.partition('%')
1871 raise AddressValueError('Invalid IPv6 address: "%r"' % ip_str)
1930 ip_str = super().__str__()
1931 return ip_str + '%' + self._scope_id if self._scope_id else ip_str