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

Method is_private

Lib/ipaddress.py:1071–1085  ·  view source on GitHub ↗

Test if this network belongs to a private range. Returns: A boolean, True if the network is reserved per iana-ipv4-special-registry or iana-ipv6-special-registry.

(self)

Source from the content-addressed store, hash-verified

1069
1070 @property
1071 def is_private(self):
1072 """Test if this network belongs to a private range.
1073
1074 Returns:
1075 A boolean, True if the network is reserved per
1076 iana-ipv4-special-registry or iana-ipv6-special-registry.
1077
1078 """
1079 return any(self.network_address in priv_network and
1080 self.broadcast_address in priv_network
1081 for priv_network in self._constants._private_networks) and all(
1082 self.network_address not in network and
1083 self.broadcast_address not in network
1084 for network in self._constants._private_networks_exceptions
1085 )
1086
1087 @property
1088 def is_global(self):

Callers

nothing calls this directly

Calls 1

anyFunction · 0.70

Tested by

no test coverage detected