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

Method is_private

Lib/ipaddress.py:2089–2110  ·  view source on GitHub ↗

``True`` if the address is defined as not globally reachable by iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_ (for IPv6) with the following exceptions: * ``is_private`` is ``False`` for ``100.64.0.0/10`` * For IPv4-mapped IPv6-addresses the ``

(self)

Source from the content-addressed store, hash-verified

2087 @property
2088 @functools.lru_cache()
2089 def is_private(self):
2090 """``True`` if the address is defined as not globally reachable by
2091 iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
2092 (for IPv6) with the following exceptions:
2093
2094 * ``is_private`` is ``False`` for ``100.64.0.0/10``
2095 * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
2096 semantics of the underlying IPv4 addresses and the following condition holds
2097 (see :attr:`IPv6Address.ipv4_mapped`)::
2098
2099 address.is_private == address.ipv4_mapped.is_private
2100
2101 ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
2102 IPv4 range where they are both ``False``.
2103 """
2104 ipv4_mapped = self.ipv4_mapped
2105 if ipv4_mapped is not None:
2106 return ipv4_mapped.is_private
2107 return (
2108 any(self in net for net in self._constants._private_networks)
2109 and all(self not in net for net in self._constants._private_networks_exceptions)
2110 )
2111
2112 @property
2113 def is_global(self):

Callers

nothing calls this directly

Calls 2

allFunction · 0.85
anyFunction · 0.70

Tested by

no test coverage detected