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

Method is_private

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

1323 @property
1324 @functools.lru_cache()
1325 def is_private(self):
1326 """``True`` if the address is defined as not globally reachable by
1327 iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
1328 (for IPv6) with the following exceptions:
1329
1330 * ``is_private`` is ``False`` for ``100.64.0.0/10``
1331 * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
1332 semantics of the underlying IPv4 addresses and the following condition holds
1333 (see :attr:`IPv6Address.ipv4_mapped`)::
1334
1335 address.is_private == address.ipv4_mapped.is_private
1336
1337 ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
1338 IPv4 range where they are both ``False``.
1339 """
1340 return (
1341 any(self in net for net in self._constants._private_networks)
1342 and all(self not in net for net in self._constants._private_networks_exceptions)
1343 )
1344
1345 @property
1346 @functools.lru_cache()

Callers

nothing calls this directly

Calls 2

allFunction · 0.85
anyFunction · 0.70

Tested by

no test coverage detected