MCPcopy Index your code
hub / github.com/python/cpython / is_private

Method is_private

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

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

Callers

nothing calls this directly

Calls 1

anyFunction · 0.70

Tested by

no test coverage detected